mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
CORDA-2909 Build CURRENT_MAJOR_RELEASE
from build.gradle
in commons-logging (#5150)
A template directory and file, `Constants`, has been added to allow gradle to replace the string `"@corda_release_version@"` with the current corda version provided by gradle. This output will be copied into the src directory and used for all builds. The generated `Constants` file has also been checked in to remove reliance for developers to first run a gradle build to get their environment fully working. This file does not need to be updated in the future since gradle will handle building the modules.
This commit is contained in:
parent
9c9f007f55
commit
d611a41ec8
@ -1,5 +1,6 @@
|
||||
apply plugin: 'kotlin'
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'com.jfrog.artifactory'
|
||||
|
||||
@ -17,6 +18,14 @@ dependencies {
|
||||
testCompile project(":test-utils")
|
||||
}
|
||||
|
||||
|
||||
task generateSource(type: Copy) {
|
||||
from 'src/main/template'
|
||||
filter(ReplaceTokens, tokens: [corda_release_version: corda_release_version])
|
||||
into 'src/main'
|
||||
}
|
||||
compileKotlin.dependsOn generateSource
|
||||
|
||||
jar {
|
||||
baseName 'corda-common-logging'
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
@file:JvmName("Constants")
|
||||
|
||||
package net.corda.common.logging
|
||||
|
||||
/**
|
||||
* constants in this file are generated by gradle
|
||||
* to change this file, edit src/main/template/kotlin/net/corda/common/logging/Constants.kt
|
||||
* the generated file does not need to be committed to source control (originally added to source control for ease of use)
|
||||
*/
|
||||
|
||||
internal const val CURRENT_MAJOR_RELEASE = "5.0-SNAPSHOT"
|
@ -5,7 +5,6 @@ import com.jcabi.manifests.Manifests
|
||||
class CordaVersion {
|
||||
companion object {
|
||||
private const val UNKNOWN = "Unknown"
|
||||
const val current_major_release = "4.0-SNAPSHOT"
|
||||
const val platformEditionCode = "OS"
|
||||
|
||||
private fun manifestValue(name: String): String? = if (Manifests.exists(name)) Manifests.read(name) else null
|
||||
@ -15,7 +14,7 @@ class CordaVersion {
|
||||
val vendor: String by lazy { manifestValue("Corda-Vendor") ?: UNKNOWN }
|
||||
val platformVersion: Int by lazy { manifestValue("Corda-Platform-Version")?.toInt() ?: 1 }
|
||||
|
||||
internal val semanticVersion: String by lazy { if(releaseVersion == UNKNOWN) current_major_release else releaseVersion }
|
||||
internal val semanticVersion: String by lazy { if(releaseVersion == UNKNOWN) CURRENT_MAJOR_RELEASE else releaseVersion }
|
||||
}
|
||||
|
||||
fun getVersion(): Array<String> {
|
||||
|
@ -0,0 +1,11 @@
|
||||
@file:JvmName("Constants")
|
||||
|
||||
package net.corda.common.logging
|
||||
|
||||
/**
|
||||
* constants in this file are generated by gradle
|
||||
* to change this file, edit src/main/template/kotlin/net/corda/common/logging/Constants.kt
|
||||
* the generated file does not need to be committed to source control (originally added to source control for ease of use)
|
||||
*/
|
||||
|
||||
internal const val CURRENT_MAJOR_RELEASE = "@corda_release_version@"
|
Loading…
Reference in New Issue
Block a user