|
13 | 13 |
|
14 | 14 | # Version detection: |
15 | 15 | # - When building from a git tag (e.g., nix build github:onflow/flow-cli/v2.14.2), |
16 | | - # the version is automatically extracted from the tag: "2.14.2" |
17 | | - # - For local development builds, version is "dev" |
18 | | - # This eliminates the need for a separate VERSION file and keeps version |
19 | | - # management in sync with git tags used for releases. |
| 16 | + # the version is extracted from the tag. |
| 17 | + # - For local development builds, version is "dev" (for nix metadata) and semver |
| 18 | + # is empty so build.go sets it to "undefined", matching Makefile behavior and |
| 19 | + # enabling isDevelopment() checks (skips version warnings and crash reporting). |
| 20 | + isRelease = (self ? ref) && (builtins.match "v[0-9]+\..+" self.ref != null); |
20 | 21 | version = |
21 | | - if (self ? ref) && (builtins.match "v[0-9]+\..+" self.ref != null) |
22 | | - then builtins.substring 1 (-1) self.ref # Remove 'v' prefix from version tags |
| 22 | + if isRelease |
| 23 | + then builtins.substring 1 (-1) self.ref # Remove 'v' prefix for nix version |
23 | 24 | else "dev"; |
| 25 | + # semver is what gets injected into the Go binary via ldflags. |
| 26 | + # Empty string → build.go init() sets it to "undefined" → isDevelopment() == true |
| 27 | + semver = |
| 28 | + if isRelease |
| 29 | + then self.ref # Full tag with 'v' prefix (e.g., "v2.14.2") |
| 30 | + else ""; |
24 | 31 |
|
25 | 32 | shortRev = self.shortRev or "dev"; |
26 | 33 | in |
|
43 | 50 |
|
44 | 51 | ldflags = [ |
45 | 52 | "-s" "-w" |
46 | | - "-X github.com/onflow/flow-cli/build.semver=v${version}" |
| 53 | + "-X github.com/onflow/flow-cli/build.semver=${semver}" |
47 | 54 | "-X github.com/onflow/flow-cli/build.commit=${shortRev}" |
48 | 55 | "-X github.com/onflow/flow-cli/internal/accounts.accountToken=lilico:sF60s3wughJBmNh2" |
49 | 56 | "-X github.com/onflow/flow-cli/internal/command.MixpanelToken=3fae49de272be1ceb8cf34119f747073" |
|
0 commit comments