Skip to content

Commit

Permalink
working on changes for gradle build tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
davydotcom committed Apr 20, 2016
1 parent d92a266 commit 1863243
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 148 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,6 +3,7 @@ build/
.DS_Store
.gradle
*.iml
*.ipr
.idea/
gradle.properties
.jruby-container
Expand Down
1 change: 1 addition & 0 deletions asset-pipeline-core/build.gradle
Expand Up @@ -14,6 +14,7 @@ plugins {
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'idea'

group = 'com.bertramlabs.plugins'
sourceCompatibility = '1.7'
Expand Down
Expand Up @@ -16,6 +16,8 @@

package asset.pipeline

import asset.pipeline.processors.JsRequireProcessor

import java.util.regex.Pattern
import groovy.transform.CompileStatic
/**
Expand All @@ -29,7 +31,7 @@ class JsAssetFile extends AbstractAssetFile {
static final List<String> contentType = ['application/javascript', 'application/x-javascript','text/javascript']
static List<String> extensions = ['js']
static String compiledExtension = 'js'
static processors = []
static processors = [JsRequireProcessor]
Pattern directivePattern = ~/(?m)^\/\/=(.*)/

}
@@ -0,0 +1,19 @@
package asset.pipeline.processors

import asset.pipeline.AbstractProcessor
import asset.pipeline.AssetCompiler
import asset.pipeline.AssetFile
import groovy.transform.CompileStatic

@CompileStatic
public class JsRequireProcessor extends AbstractProcessor {
JsRequireProcessor(final AssetCompiler precompiler) {
super(precompiler)
}


String process(final String inputText, final AssetFile assetFile) {

return inputText
}
}
1 change: 1 addition & 0 deletions asset-pipeline-gradle/build.gradle
Expand Up @@ -19,6 +19,7 @@ apply plugin: 'com.gradle.plugin-publish'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'idea'

group = 'com.bertramlabs.plugins'
sourceCompatibility = '1.7'
Expand Down
Expand Up @@ -67,10 +67,21 @@ class AssetCompile extends DefaultTask {
pipelineExtension.enableDigests
}


void setEnableDigests(boolean enableDigests) {
pipelineExtension.enableDigests = enableDigests
}

@Input
@Optional
String getJarTaskName() {
pipelineExtension.jarTaskName
}

void setJarTaskName(String jarTaskName) {
pipelineExtension.jarTaskName = jarTaskName
}

@Input
@Optional
boolean getEnableGzip() {
Expand Down
Expand Up @@ -31,6 +31,7 @@ class AssetPipelineExtension {
boolean enableGzip = true
String compileDir = 'build/assets'
String assetsPath = 'src/assets'
String jarTaskName
Map minifyOptions
Map configOptions

Expand Down
Expand Up @@ -83,57 +83,42 @@ class AssetPipelinePlugin implements Plugin<Project> {
enableGzip = assetPipeline.enableGzip
}

project.tasks.withType(Jar) { Jar bundleTask ->
bundleTask.dependsOn assetPrecompileTask
bundleTask.from assetPipeline.compileDir, {
into "assets"
}
}
// project.tasks.withType(Jar) { Jar bundleTask ->
// bundleTask.dependsOn assetPrecompileTask
// bundleTask.from assetPipeline.compileDir, {
// into "assets"
// }
// }

if(assetPipeline.jarTaskName) {
Jar jarTask = project.tasks.findByName('jarTaskName')
if(jarTask) {
jarTask.dependsOn assetPrecompileTask
jarTask.from assetPipeline.compileDir, {
into "assets"
}
}
} else { //no jar task name specified we need to try and infer
def assetTasks = ['war','shadowJar','jar']

assetTasks?.each { taskName ->
Jar jarTask = project.tasks.findByName(taskName)
if(jarTask) {
jarTask.dependsOn assetPrecompileTask
jarTask.from assetPipeline.compileDir, {
into "assets"
}
}
}


}


}

// def assembleTask = project.tasks.findByName('assemble')
// if(assembleTask) {
// assembleTask.dependsOn( assetPrecompileTask )
// }

// def cleanTask = project.tasks.findByName('clean')
// if(cleanTask) {
// cleanTask.dependsOn( assetCleanTask )
// }

// def jarTask = project.tasks.findByName('jar')
// if(jarTask) {
// jarTask.dependsOn(assetPrecompileTask)
// }

// def shadowJarTask = project.tasks.findByName('shadowJar')
// if(shadowJarTask) {
// shadowJarTask.dependsOn(assetPrecompileTask)
// }

// def warTask = project.tasks.findByName('war')
// if(warTask) {
// warTask.dependsOn(assetPrecompileTask)
// }

// def installAppTask = project.tasks.findByName('installApp')
// if(installAppTask) {
// installAppTask.dependsOn(assetPrecompileTask)
// }

// def installDistTask = project.tasks.findByName('installDist')
// if(installDistTask) {
// installDistTask.dependsOn(assetPrecompileTask)
// }


// def resourcesTask = project.tasks.findByName('classes')


// project.task('asset-watch') << {
// //TODO: Implement live watcher to auto recompile assets as they change
// }
}

private void createGradleConfiguration(Project project) {
Expand Down
1 change: 1 addition & 0 deletions asset-pipeline-servlet/build.gradle
Expand Up @@ -16,6 +16,7 @@ apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'idea'

group = 'com.bertramlabs.plugins'
sourceCompatibility = '1.7'
Expand Down
101 changes: 0 additions & 101 deletions asset-pipeline.ipr

This file was deleted.

1 change: 1 addition & 0 deletions coffee-asset-pipeline/build.gradle
Expand Up @@ -15,6 +15,7 @@ apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'idea'

group = 'com.bertramlabs.plugins'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
Expand Down
1 change: 1 addition & 0 deletions ember-asset-pipeline/build.gradle
Expand Up @@ -17,6 +17,7 @@ apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'idea'

group = 'com.bertramlabs.plugins'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
Expand Down
1 change: 1 addition & 0 deletions handlebars-asset-pipeline/build.gradle
Expand Up @@ -14,6 +14,7 @@ apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'idea'

group = 'com.bertramlabs.plugins'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
Expand Down
1 change: 1 addition & 0 deletions less-asset-pipeline/build.gradle
Expand Up @@ -15,6 +15,7 @@ apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'idea'

group = 'com.bertramlabs.plugins'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
Expand Down
1 change: 1 addition & 0 deletions ratpack-asset-pipeline/build.gradle
Expand Up @@ -14,6 +14,7 @@ apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'idea'

group = 'com.bertramlabs.plugins'

Expand Down
1 change: 1 addition & 0 deletions sass-asset-pipeline/build.gradle
Expand Up @@ -15,6 +15,7 @@ apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'idea'
group = 'com.bertramlabs.plugins'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

Expand Down

0 comments on commit 1863243

Please sign in to comment.