mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 09:52:09 +01:00
30226219e6
* 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
49 lines
1.3 KiB
Scala
49 lines
1.3 KiB
Scala
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
|
|
}
|
|
}
|