Skip to content

Commit

Permalink
[#74] Add OSGi entries to JAR manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
phxql committed Jul 22, 2020
1 parent c5e3749 commit 1f07175
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ task libsJar(type: Jar, dependsOn: classes) {
from sourceSets.main.output

manifest {
attributes('Automatic-Module-Name': 'de.mkammerer.argon2')
attributes(manifestAttributes())
}
}

Expand All @@ -53,7 +53,7 @@ task noLibsJar(type: Jar, dependsOn: classes) {
from sourceSets.main.output.classesDirs

manifest {
attributes('Automatic-Module-Name': 'de.mkammerer.argon2')
attributes(manifestAttributes())
}
}

Expand All @@ -69,6 +69,9 @@ task noLibsJavadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}

// When running build, create all the JARs
build.dependsOn(libsJar, libsSourcesJar, libsJavadocJar, noLibsJar, noLibsSourcesJar, noLibsJavadocJar)

publishing {
publications {
libs(MavenPublication) {
Expand Down Expand Up @@ -145,3 +148,18 @@ private def configurePom(org.gradle.api.publish.maven.MavenPom pom) {
}
}
}

/**
* Creates the JAR attributes for the MANIFEST.MD
*/
private Map<String, Object> manifestAttributes() {
return [
'Automatic-Module-Name' : 'de.mkammerer.argon2',
// OSGI stuff
'Bundle-ManifestVersion': '2',
'Bundle-SymbolicName' : 'de.mkammerer.argon2',
'Bundle-Version' : project.version,
'Export-Package' : 'de.mkammerer.argon2, de.mkammerer.argon2.jna',
'Import-Package' : 'com.sun.jna'
]
}

0 comments on commit 1f07175

Please sign in to comment.