diff --git a/common/logging/build.gradle b/common/logging/build.gradle index b2bcd61e01..91770cbabe 100644 --- a/common/logging/build.gradle +++ b/common/logging/build.gradle @@ -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' } diff --git a/common/logging/src/main/kotlin/net/corda/common/logging/Constants.kt b/common/logging/src/main/kotlin/net/corda/common/logging/Constants.kt new file mode 100644 index 0000000000..d53dfcfaa0 --- /dev/null +++ b/common/logging/src/main/kotlin/net/corda/common/logging/Constants.kt @@ -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" \ No newline at end of file diff --git a/common/logging/src/main/kotlin/net/corda/common/logging/CordaVersion.kt b/common/logging/src/main/kotlin/net/corda/common/logging/CordaVersion.kt index caac7faf72..083f0a078a 100644 --- a/common/logging/src/main/kotlin/net/corda/common/logging/CordaVersion.kt +++ b/common/logging/src/main/kotlin/net/corda/common/logging/CordaVersion.kt @@ -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 { diff --git a/common/logging/src/main/template/kotlin/net/corda/common/logging/Constants.kt b/common/logging/src/main/template/kotlin/net/corda/common/logging/Constants.kt new file mode 100644 index 0000000000..19f2cb8651 --- /dev/null +++ b/common/logging/src/main/template/kotlin/net/corda/common/logging/Constants.kt @@ -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@" \ No newline at end of file