forked from I2P_Developers/i2p.i2p
Gradle: Generate attributes for JAR manifests
This commit is contained in:
@ -21,6 +21,13 @@ dependencies {
|
||||
api project(':core')
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Specification-Title': 'I2P Streaming API'
|
||||
attributes 'Implementation-Title': 'I2P Java Streaming API'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
tests
|
||||
}
|
||||
|
@ -23,3 +23,10 @@ dependencies {
|
||||
api project(':apps:ministreaming')
|
||||
testImplementation project(path: ':apps:ministreaming', configuration: 'tests')
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Specification-Title': 'I2P Streaming Implementation'
|
||||
attributes 'Implementation-Title': 'I2P Java Streaming Implementation'
|
||||
}
|
||||
}
|
||||
|
56
build.gradle
56
build.gradle
@ -32,6 +32,34 @@ String getBuildExtra() {
|
||||
buildExtra
|
||||
}
|
||||
|
||||
String getBuiltBy() {
|
||||
def builtBy
|
||||
file("override.properties").readLines().findAll({ line ->
|
||||
line.contains("build.built-by")
|
||||
}).first().eachMatch('.*=(.*)', {
|
||||
builtBy = it[1]
|
||||
})
|
||||
builtBy
|
||||
}
|
||||
|
||||
boolean haveMonotone() {
|
||||
file("_MTN").exists()
|
||||
}
|
||||
|
||||
String getWorkspaceVersion() {
|
||||
if (haveMonotone()) {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
executable 'mtn'
|
||||
args 'automate', 'get_base_revision_id'
|
||||
standardOutput = stdout
|
||||
}
|
||||
stdout.toString().trim()
|
||||
} else {
|
||||
'unknown'
|
||||
}
|
||||
}
|
||||
|
||||
String compat(String src) {
|
||||
if (src.contains('.')) {
|
||||
src.substring(src.lastIndexOf('.') + 1)
|
||||
@ -54,6 +82,9 @@ def buildVersion = getBuildVersion()
|
||||
def buildExtra = getBuildExtra()
|
||||
def fullVersion = "$releaseVersion-$buildVersion$buildExtra"
|
||||
|
||||
def builtBy = getBuiltBy()
|
||||
def workspaceVersion = getWorkspaceVersion()
|
||||
|
||||
// Exclude apps/ dir itself, but include its subdirs
|
||||
def javaProjects = subprojects - project(':apps')
|
||||
|
||||
@ -73,15 +104,28 @@ configure(javaProjects) {
|
||||
testCompile 'org.mockito:mockito-core:2.11.0'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Implementation-Version': "$fullVersion"
|
||||
}
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
||||
jar {
|
||||
// Empty attributes are set by each project. They are initialized
|
||||
// here in order to create a defined ordering of the attributes.
|
||||
manifest {
|
||||
attributes 'Specification-Title': ''
|
||||
attributes 'Specification-Version': "$releaseVersion"
|
||||
attributes 'Specification-Vendor': 'The I2P Project https://geti2p.net/'
|
||||
attributes 'Implementation-Title': ''
|
||||
attributes 'Implementation-Version': "$fullVersion"
|
||||
attributes 'Implementation-Vendor': 'The I2P Project https://geti2p.net/'
|
||||
attributes 'Built-By': "$builtBy"
|
||||
attributes 'Build-Date': 'reproducible'
|
||||
attributes 'Base-Revision': "$workspaceVersion"
|
||||
attributes 'Workspace-Changes': ''
|
||||
attributes 'X-Compile-Source-JDK': "$sourceCompatibility"
|
||||
attributes 'X-Compile-Target-JDK': "$targetCompatibility"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(AbstractArchiveTask) {
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
|
@ -71,6 +71,14 @@ if (System.getenv("TARGET_JAVA_HOME") == null && JavaVersion.current() != JavaVe
|
||||
test.dependsOn scalaTest
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Specification-Title': 'I2P Core API'
|
||||
attributes 'Implementation-Title': 'I2P Java Core API'
|
||||
attributes 'Main-Class': 'net.i2p.util.CommandLine'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
tests
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Gradle:
|
||||
- Adjust dependencies to match Tomcat and Jetty updates
|
||||
- Generate reproducible archives
|
||||
- Generate attributes for JAR manifests
|
||||
|
||||
2019-04-17 zzz
|
||||
* Transport: More fixes for NTCP when SSU disabled (ticket #1417)
|
||||
|
@ -28,6 +28,9 @@ dependencies {
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Specification-Title': 'I2P Router'
|
||||
attributes 'Implementation-Title': 'I2P Java Router'
|
||||
attributes 'Main-Class': 'net.i2p.router.CommandLine'
|
||||
// so people with very old wrapper.config files will still work with Jetty 6
|
||||
attributes 'Class-Path': 'jetty-i2p.jar jetty-java5-threadpool.jar jetty-rewrite-handler.jar jetty-sslengine.jar jetty-start.jar jetty-util.jar'
|
||||
}
|
||||
|
Reference in New Issue
Block a user