org.dm.gradle.plugins.bundle.BundleGenerator.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.Action
import org.gradle.api.tasks.bundling.Jar
import static org.dm.gradle.plugins.bundle.Objects.requireNonNull
import static org.dm.gradle.plugins.bundle.BundleUtils.*
/**
* An action to be used for generating bundles.
*/
class BundleGenerator implements Action {
private final org.gradle.internal.Factory jarBuilderFactory
BundleGenerator(org.gradle.internal.Factory jarBuilderFactory) {
this.jarBuilderFactory = requireNonNull(jarBuilderFactory)
}
/**
* Creates and initializes a new {@link JarBuilder} using
* {@link BundleExtension} parameters and uses it to produce
* a new bundle.
* @param jarTask the task within which this action is
* performed
*/
@Override
void execute(Jar jarTask) {
jarBuilderFactory.create().writeJarTo(getOutput(jarTask))
}
}