2019-06-25 11:42:17 +00:00
|
|
|
package build
|
|
|
|
|
2021-04-29 18:01:23 +00:00
|
|
|
import "os"
|
|
|
|
|
2019-12-11 22:00:39 +00:00
|
|
|
var CurrentCommit string
|
2020-06-01 18:43:51 +00:00
|
|
|
var BuildType int
|
|
|
|
|
|
|
|
const (
|
2021-04-21 22:52:18 +00:00
|
|
|
BuildDefault = 0
|
|
|
|
BuildMainnet = 0x1
|
|
|
|
Build2k = 0x2
|
|
|
|
BuildDebug = 0x3
|
|
|
|
BuildCalibnet = 0x4
|
|
|
|
BuildInteropnet = 0x5
|
|
|
|
BuildNerpanet = 0x6
|
|
|
|
BuildButterflynet = 0x7
|
2020-06-01 18:43:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func buildType() string {
|
|
|
|
switch BuildType {
|
|
|
|
case BuildDefault:
|
2020-06-01 19:11:37 +00:00
|
|
|
return ""
|
2021-01-20 06:47:27 +00:00
|
|
|
case BuildMainnet:
|
|
|
|
return "+mainnet"
|
2020-06-01 18:43:51 +00:00
|
|
|
case Build2k:
|
|
|
|
return "+2k"
|
2021-01-20 06:47:27 +00:00
|
|
|
case BuildDebug:
|
|
|
|
return "+debug"
|
|
|
|
case BuildCalibnet:
|
|
|
|
return "+calibnet"
|
2021-06-02 18:49:10 +00:00
|
|
|
case BuildInteropnet:
|
|
|
|
return "+interopnet"
|
2021-04-21 22:52:18 +00:00
|
|
|
case BuildNerpanet:
|
|
|
|
return "+nerpanet"
|
|
|
|
case BuildButterflynet:
|
|
|
|
return "+butterflynet"
|
2020-06-01 18:43:51 +00:00
|
|
|
default:
|
|
|
|
return "+huh?"
|
|
|
|
}
|
|
|
|
}
|
2019-12-11 22:00:39 +00:00
|
|
|
|
2021-08-14 03:16:03 +00:00
|
|
|
// BuildVersion is the local build version
|
2021-10-01 23:45:49 +00:00
|
|
|
const BuildVersion = "1.12.0-rc1"
|
2019-07-19 10:15:22 +00:00
|
|
|
|
2020-06-01 18:43:51 +00:00
|
|
|
func UserVersion() string {
|
2021-04-30 09:18:15 +00:00
|
|
|
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
|
|
|
return BuildVersion
|
|
|
|
}
|
|
|
|
|
2020-06-01 18:43:51 +00:00
|
|
|
return BuildVersion + buildType() + CurrentCommit
|
|
|
|
}
|