Hi,
Where can I find the Groovy plugin for Bundlor?
I tried writing a Bundlor plugin but it did not work.
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.tasks.bundling.Jar;
import org.gradle.api.tasks.compile.Compile;
import org.gradle.api.logging.LogLevel
class BundlorPlugin implements Plugin<Project> {
void apply(Project project) {
project.getPlugins().apply(JavaPlugin.class)
Task bundlor = project.tasks.add('bundlor', Bundlor.class)
bundlor.dependsOn project.tasks.withType(Compile.class)
project.jar.dependsOn bundlor
}
}
import org.gradle.api.DefaultTask
class Bundlor extends DefaultTask
{
Bundlor() {
def templateDir = new File(project.projectDir, File.separator + 'config' + File.separator + 'bundlor');
def template = new File(templateDir, project.projectDir.getName() + ".mf");
if(!template.exists()) {
return;
}
def propertyFile = new File(templateDir, project.projectDir.getName() + '.properties')
def bundlorDir = new File("${project.buildDir}/bundlor")
def manifest = project.file("${bundlorDir}/META-INF/MANIFEST.MF")
outputs.dir bundlorDir
outputs.files manifest
inputs.files template, project.sourceSets.main.runtimeClasspath
project.jar.manifest.from manifest
project.jar.inputs.files manifest
project.configurations { bundlorconf }
project.dependencies {
bundlorconf 'com.springsource.bundlor:com.springsource.bundlor.ant:1.0.0.RELEASE',
'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RELEASE',
'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RELEASE'
}
doFirst {
ant.taskdef(resource: 'com/springsource/bundlor/ant/antlib.xml', classpath: project.configurations.bundlorconf.asPath)
if (!bundlorDir.isDirectory()) {
bundlorDir.mkdir()
}
if(propertyFile.exists()) {
ant.bundlor(inputPath: project.sourceSets.main.classesDir,
outputPath: bundlorDir,
manifestTemplatePath: template,
propertiesPath: propertyFile)
} else {
ant.bundlor(inputPath: project.sourceSets.main.classesDir,
outputPath: bundlorDir,
manifestTemplatePath: template)
}
}
}
}
Regards, Pranav