use of org.gradle.api.java.archives.Attributes 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);
}
use of org.gradle.api.java.archives.Attributes in project spring-boot by spring-projects.
the class BootArchiveSupport method configureManifest.
void configureManifest(Manifest manifest, String mainClass, String classes, String lib, String classPathIndex, String layersIndex) {
Attributes attributes = manifest.getAttributes();
attributes.putIfAbsent("Main-Class", this.loaderMainClass);
attributes.putIfAbsent("Start-Class", mainClass);
attributes.computeIfAbsent("Spring-Boot-Version", (name) -> determineSpringBootVersion());
attributes.putIfAbsent("Spring-Boot-Classes", classes);
attributes.putIfAbsent("Spring-Boot-Lib", lib);
if (classPathIndex != null) {
attributes.putIfAbsent("Spring-Boot-Classpath-Index", classPathIndex);
}
if (layersIndex != null) {
attributes.putIfAbsent("Spring-Boot-Layers-Index", layersIndex);
}
}
Aggregations