mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 01:40:55 +01:00
2022 03 01 static wix upgrade product code (#4149)
* Try fixing a stic wix productId so the windows OS can understand installations of bitcoin-s are the same product * Add this branch to release.yml * Use 1.9.0 windows product id * Add EnvUtil.parseCommitsSinceLastTag, make last number on windows version be the number of commits since last tag * Add ability to parse the version from a string * use upgradeId rather than productId * Remove feature branch from release.yml * Remove test
This commit is contained in:
parent
6e87eb1480
commit
30226219e6
@ -18,7 +18,14 @@ assembly / assemblyJarName := s"${name.value}.jar"
|
||||
|
||||
//need compatibility with windows versioning scheme which is
|
||||
//w.x.y.z
|
||||
Windows / version := CommonSettings.previousStableVersion
|
||||
Windows / version := {
|
||||
val commitNumberOpt = EnvUtil.parseCommitsSinceLastTag(version.value)
|
||||
val versionStr = EnvUtil.parseVersion(version.value)
|
||||
commitNumberOpt match {
|
||||
case Some(commitNumber) => versionStr + s".${commitNumber}"
|
||||
case None => versionStr
|
||||
}
|
||||
}
|
||||
|
||||
assembly / assemblyMergeStrategy := {
|
||||
case PathList("META-INF", _ @_*) => MergeStrategy.discard
|
||||
@ -35,7 +42,7 @@ packageDescription := "Bitcoin-S"
|
||||
|
||||
// wix build information
|
||||
wixProductId := java.util.UUID.randomUUID().toString
|
||||
wixProductUpgradeId := java.util.UUID.randomUUID().toString
|
||||
wixProductUpgradeId := "40055D9F-9172-4ED0-AF51-E4869D0AD689"
|
||||
|
||||
// Adding the wanted wixFeature:
|
||||
wixFeatures += WindowsFeature(
|
||||
|
@ -0,0 +1,32 @@
|
||||
package org.bitcoins.core.util
|
||||
|
||||
import org.bitcoins.testkitcore.util.BitcoinSUnitTest
|
||||
|
||||
class EnvUtilTest extends BitcoinSUnitTest {
|
||||
|
||||
behavior of "EnvUtil"
|
||||
|
||||
it must "calculate the number of commits since last tag" in {
|
||||
val versionString = "1.9.0-10-eddcc94b-SNAPSHOT"
|
||||
val numCommitsOpt = EnvUtil.parseCommitsSinceLastTag(versionString)
|
||||
assert(numCommitsOpt.get == 10)
|
||||
}
|
||||
|
||||
it must "calculate no commits for an official release" in {
|
||||
val versionString = "1.9.0"
|
||||
val numCommitsOpt = EnvUtil.parseCommitsSinceLastTag(versionString)
|
||||
assert(numCommitsOpt.isEmpty)
|
||||
}
|
||||
|
||||
it must "parse the version number of a snapshot commit" in {
|
||||
val versionString = "1.9.0-10-eddcc94b-SNAPSHOT"
|
||||
val version = EnvUtil.parseVersion(versionString)
|
||||
assert(version == "1.9.0")
|
||||
}
|
||||
|
||||
it must "parse the version number of a release" in {
|
||||
val versionString = "1.9.0"
|
||||
val version = EnvUtil.parseVersion(versionString)
|
||||
assert(version == "1.9.0")
|
||||
}
|
||||
}
|
@ -21,4 +21,30 @@ object EnvUtil {
|
||||
val secpDisabled = System.getenv("DISABLE_SECP256K1")
|
||||
secpDisabled != null && (secpDisabled.toLowerCase == "true" || secpDisabled == "1")
|
||||
}
|
||||
|
||||
/** Parses the number of commits since last tag
|
||||
* Expects a string of format
|
||||
* 1.9.0-9-eddcc94b-SNAPSHOT or 1.9.0
|
||||
*
|
||||
* If it's a release like 1.9.0, this will return None
|
||||
*/
|
||||
def parseCommitsSinceLastTag(version: String): Option[Int] = {
|
||||
val split = version.split("-")
|
||||
if (split.length == 1) {
|
||||
//means this is a release
|
||||
None
|
||||
} else {
|
||||
Some(split(1).toInt)
|
||||
}
|
||||
}
|
||||
|
||||
/** Parses the version number from a string of format
|
||||
* 1.9.0-9-eddcc94b-SNAPSHOT
|
||||
*
|
||||
* This method will return "1.9.0"
|
||||
*/
|
||||
def parseVersion(version: String): String = {
|
||||
val split = version.split("-")
|
||||
split.head
|
||||
}
|
||||
}
|
||||
|
48
project/EnvUtil.scala
Normal file
48
project/EnvUtil.scala
Normal file
@ -0,0 +1,48 @@
|
||||
import scala.util.Properties
|
||||
|
||||
object EnvUtil {
|
||||
private val osName = System.getProperty("os.name")
|
||||
|
||||
lazy val isLinux: Boolean = osName.startsWith("Linux")
|
||||
|
||||
lazy val isMac: Boolean = osName.startsWith("Mac")
|
||||
|
||||
lazy val isWindows: Boolean = osName.startsWith("Windows")
|
||||
|
||||
lazy val isCI: Boolean = Properties.envOrNone("CI").contains("true")
|
||||
|
||||
def getVersion: String = getClass.getPackage.getImplementationVersion
|
||||
|
||||
def getJdkVersion: String = System.getProperty("java.version")
|
||||
|
||||
def isNativeSecp256k1Disabled: Boolean = {
|
||||
val secpDisabled = System.getenv("DISABLE_SECP256K1")
|
||||
secpDisabled != null && (secpDisabled.toLowerCase == "true" || secpDisabled == "1")
|
||||
}
|
||||
|
||||
/** Parses the number of commits since last tag
|
||||
* Expects a string of format
|
||||
* 1.9.0-9-eddcc94b-SNAPSHOT or 1.9.0
|
||||
*
|
||||
* If it's a release like 1.9.0, this will return None
|
||||
*/
|
||||
def parseCommitsSinceLastTag(version: String): Option[Int] = {
|
||||
val split = version.split("-")
|
||||
if (split.length == 1) {
|
||||
//means this is a release
|
||||
None
|
||||
} else {
|
||||
Some(split(1).toInt)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Parses the version number from a string of format
|
||||
* 1.9.0-9-eddcc94b-SNAPSHOT
|
||||
*
|
||||
* This method will return "1.9.0"
|
||||
* */
|
||||
def parseVersion(version: String): String = {
|
||||
val split = version.split("-")
|
||||
split.head
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user