Changeset 1cc330b


Ignore:
Timestamp:
Apr 21, 2019 9:01:28 PM (15 months ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
9e0934f
Parents:
967dde4
Message:

Gradle: Generate attributes for JAR manifests

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • apps/ministreaming/build.gradle

    r967dde4 r1cc330b  
    2222}
    2323
     24jar {
     25    manifest {
     26        attributes 'Specification-Title': 'I2P Streaming API'
     27        attributes 'Implementation-Title': 'I2P Java Streaming API'
     28    }
     29}
     30
    2431configurations {
    2532    tests
  • apps/streaming/build.gradle

    r967dde4 r1cc330b  
    2424    testImplementation project(path: ':apps:ministreaming', configuration: 'tests')
    2525}
     26
     27jar {
     28    manifest {
     29        attributes 'Specification-Title': 'I2P Streaming Implementation'
     30        attributes 'Implementation-Title': 'I2P Java Streaming Implementation'
     31    }
     32}
  • build.gradle

    r967dde4 r1cc330b  
    3333}
    3434
     35String getBuiltBy() {
     36    def builtBy
     37    file("override.properties").readLines().findAll({ line ->
     38        line.contains("build.built-by")
     39    }).first().eachMatch('.*=(.*)', {
     40        builtBy = it[1]
     41    })
     42    builtBy
     43}
     44
     45boolean haveMonotone() {
     46    file("_MTN").exists()
     47}
     48
     49String getWorkspaceVersion() {
     50    if (haveMonotone()) {
     51        def stdout = new ByteArrayOutputStream()
     52        exec {
     53            executable 'mtn'
     54            args 'automate', 'get_base_revision_id'
     55            standardOutput = stdout
     56        }
     57        stdout.toString().trim()
     58    } else {
     59        'unknown'
     60    }
     61}
     62
    3563String compat(String src) {
    3664    if (src.contains('.')) {
     
    5583def fullVersion = "$releaseVersion-$buildVersion$buildExtra"
    5684
     85def builtBy = getBuiltBy()
     86def workspaceVersion = getWorkspaceVersion()
     87
    5788// Exclude apps/ dir itself, but include its subdirs
    5889def javaProjects = subprojects - project(':apps')
     
    74105    }
    75106
    76     jar {
    77         manifest {
    78             attributes 'Implementation-Version': "$fullVersion"
    79         }
    80     }
    81 
    82107    sourceCompatibility = 1.7
    83108    targetCompatibility = 1.7
     109
     110    jar {
     111        // Empty attributes are set by each project. They are initialized
     112        // here in order to create a defined ordering of the attributes.
     113        manifest {
     114            attributes 'Specification-Title': ''
     115            attributes 'Specification-Version': "$releaseVersion"
     116            attributes 'Specification-Vendor': 'The I2P Project https://geti2p.net/'
     117            attributes 'Implementation-Title': ''
     118            attributes 'Implementation-Version': "$fullVersion"
     119            attributes 'Implementation-Vendor': 'The I2P Project https://geti2p.net/'
     120            attributes 'Built-By': "$builtBy"
     121            attributes 'Build-Date': 'reproducible'
     122            attributes 'Base-Revision': "$workspaceVersion"
     123            attributes 'Workspace-Changes': ''
     124            attributes 'X-Compile-Source-JDK': "$sourceCompatibility"
     125            attributes 'X-Compile-Target-JDK': "$targetCompatibility"
     126        }
     127    }
    84128
    85129    tasks.withType(AbstractArchiveTask) {
  • core/build.gradle

    r967dde4 r1cc330b  
    7272}
    7373
     74jar {
     75    manifest {
     76        attributes 'Specification-Title': 'I2P Core API'
     77        attributes 'Implementation-Title': 'I2P Java Core API'
     78        attributes 'Main-Class': 'net.i2p.util.CommandLine'
     79    }
     80}
     81
    7482configurations {
    7583    tests
  • history.txt

    r967dde4 r1cc330b  
    33   - Adjust dependencies to match Tomcat and Jetty updates
    44   - Generate reproducible archives
     5   - Generate attributes for JAR manifests
    56
    672019-04-17 zzz
  • router/build.gradle

    r967dde4 r1cc330b  
    2929jar {
    3030    manifest {
     31        attributes 'Specification-Title': 'I2P Router'
     32        attributes 'Implementation-Title': 'I2P Java Router'
     33        attributes 'Main-Class': 'net.i2p.router.CommandLine'
    3134        // so people with very old wrapper.config files will still work with Jetty 6
    3235        attributes 'Class-Path': 'jetty-i2p.jar jetty-java5-threadpool.jar jetty-rewrite-handler.jar jetty-sslengine.jar jetty-start.jar jetty-util.jar'
Note: See TracChangeset for help on using the changeset viewer.