Search in sources :

Example 1 with OsgiManifest

use of org.gradle.api.plugins.osgi.OsgiManifest in project gradle by gradle.

the class DefaultOsgiManifest method getEffectiveManifest.

@Override
public DefaultManifest getEffectiveManifest() {
    ContainedVersionAnalyzer analyzer = analyzerFactory.create();
    DefaultManifest effectiveManifest = new DefaultManifest(null);
    try {
        setAnalyzerProperties(analyzer);
        Manifest osgiManifest = analyzer.calcManifest();
        java.util.jar.Attributes attributes = osgiManifest.getMainAttributes();
        for (Map.Entry<Object, Object> entry : attributes.entrySet()) {
            effectiveManifest.attributes(WrapUtil.toMap(entry.getKey().toString(), (String) entry.getValue()));
        }
        effectiveManifest.attributes(this.getAttributes());
        for (Map.Entry<String, Attributes> ent : getSections().entrySet()) {
            effectiveManifest.attributes(ent.getValue(), ent.getKey());
        }
        if (classesDir != null) {
            long mod = classesDir.lastModified();
            if (mod > 0) {
                effectiveManifest.getAttributes().put(Analyzer.BND_LASTMODIFIED, mod);
            }
        }
    } catch (Exception e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
    return getEffectiveManifestInternal(effectiveManifest);
}
Also used : DefaultManifest(org.gradle.api.java.archives.internal.DefaultManifest) Attributes(org.gradle.api.java.archives.Attributes) Manifest(java.util.jar.Manifest) DefaultManifest(org.gradle.api.java.archives.internal.DefaultManifest) OsgiManifest(org.gradle.api.plugins.osgi.OsgiManifest) IOException(java.io.IOException) UncheckedException(org.gradle.internal.UncheckedException)

Aggregations

IOException (java.io.IOException)1 Manifest (java.util.jar.Manifest)1 Attributes (org.gradle.api.java.archives.Attributes)1 DefaultManifest (org.gradle.api.java.archives.internal.DefaultManifest)1 OsgiManifest (org.gradle.api.plugins.osgi.OsgiManifest)1 UncheckedException (org.gradle.internal.UncheckedException)1