Changeset a1b67e3 for build.gradle


Ignore:
Timestamp:
Feb 17, 2019 1:56:24 AM (14 months ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
9731c20
Parents:
56c1739d
Message:

Gradle: Parse router version from Java source

File:
1 edited

Legend:

Unmodified
Added
Removed
  • build.gradle

    r56c1739d ra1b67e3  
    22    id 'idea'
    33}
     4
     5String getReleaseVersion() {
     6    def releaseVersion
     7    file("core/java/src/net/i2p/CoreVersion.java").readLines().findAll({ line ->
     8        line.contains("public final static String VERSION")
     9    }).first().eachMatch('.*"([^"]+)";', {
     10        releaseVersion = it[1]
     11    })
     12    releaseVersion
     13}
     14
     15String getBuildVersion() {
     16    def buildVersion
     17    file("router/java/src/net/i2p/router/RouterVersion.java").readLines().findAll({ line ->
     18        line.contains("public final static long BUILD")
     19    }).first().eachMatch('.*=\\s+([0-9]+);', {
     20        buildVersion = it[1]
     21    })
     22    buildVersion
     23}
     24
     25String getBuildExtra() {
     26    def buildExtra
     27    file("router/java/src/net/i2p/router/RouterVersion.java").readLines().findAll({ line ->
     28        line.contains("public final static String EXTRA")
     29    }).first().eachMatch('.*"(.*)";', {
     30        buildExtra = it[1]
     31    })
     32    buildExtra
     33}
     34
     35def releaseVersion = getReleaseVersion()
     36def buildVersion = getBuildVersion()
     37def buildExtra = getBuildExtra()
     38def fullVersion = "$releaseVersion-$buildVersion$buildExtra"
    439
    540// Exclude apps/ dir itself, but include its subdirs
     
    2459    jar {
    2560        manifest {
    26             attributes 'Implementation-Version': '0.9.31-7'
     61            attributes 'Implementation-Version': "$fullVersion"
    2762        }
    2863    }
Note: See TracChangeset for help on using the changeset viewer.