Search in sources :

Example 1 with OsgiHelper

use of org.gradle.api.internal.plugins.osgi.OsgiHelper in project gradle by gradle.

the class OsgiPluginConvention method createDefaultOsgiManifest.

private OsgiManifest createDefaultOsgiManifest() {
    OsgiManifest osgiManifest = project.getServices().get(Instantiator.class).newInstance(DefaultOsgiManifest.class, project.getFileResolver());
    ConventionMapping mapping = ((IConventionAware) osgiManifest).getConventionMapping();
    final OsgiHelper osgiHelper = new OsgiHelper();
    mapping.map("version", new Callable<Object>() {

        public Object call() throws Exception {
            return osgiHelper.getVersion(project.getVersion().toString());
        }
    });
    mapping.map("name", new Callable<Object>() {

        public Object call() throws Exception {
            return project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName();
        }
    });
    mapping.map("symbolicName", new Callable<Object>() {

        public Object call() throws Exception {
            return osgiHelper.getBundleSymbolicName(project);
        }
    });
    return osgiManifest;
}
Also used : DefaultOsgiManifest(org.gradle.api.internal.plugins.osgi.DefaultOsgiManifest) Instantiator(org.gradle.internal.reflect.Instantiator) OsgiHelper(org.gradle.api.internal.plugins.osgi.OsgiHelper) ConventionMapping(org.gradle.api.internal.ConventionMapping) IConventionAware(org.gradle.api.internal.IConventionAware)

Aggregations

ConventionMapping (org.gradle.api.internal.ConventionMapping)1 IConventionAware (org.gradle.api.internal.IConventionAware)1 DefaultOsgiManifest (org.gradle.api.internal.plugins.osgi.DefaultOsgiManifest)1 OsgiHelper (org.gradle.api.internal.plugins.osgi.OsgiHelper)1 Instantiator (org.gradle.internal.reflect.Instantiator)1