org.dm.gradle.plugins.bundle.BundlePlugin.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-bundle-plugin Show documentation
Show all versions of gradle-bundle-plugin Show documentation
Gradle plugin to generate OSGI bundles.
package org.dm.gradle.plugins.bundle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.plugins.JavaPlugin
/**
* A bundle plugin which internally uses
* the bnd tool
* for generating bundles.
*/
class BundlePlugin implements Plugin {
/**
* {@inheritDoc}
*/
@Override
public void apply(Project project) {
project.extensions.create("bundle", BundleExtension)
project.plugins.apply(JavaBasePlugin)
project.plugins.withType(JavaPlugin) {
project.jar { jarTask ->
def jarBuilderFactory = new JarBuilderFactoryDecorator(
jarTask, project.bundle.jarBuilderFactory)
deleteAllActions()
doLast(new BundleGenerator(jarBuilderFactory))
manifest = new ManifestSubstitute(jarBuilderFactory, manifest)
}
}
}
}