Revert "version: don't have a third version number form for xcode"
This reverts commit 5280d039c4.
Turns out to not be possible. The semver form and the human readable
form both must of form x.y.z.
This commit is contained in:
+2
-10
@@ -61,14 +61,6 @@ xcode() {
|
|||||||
patch=$(echo "$ver" | cut -f3 -d.)
|
patch=$(echo "$ver" | cut -f3 -d.)
|
||||||
changecount=$(echo "$ver" | cut -f4 -d.)
|
changecount=$(echo "$ver" | cut -f4 -d.)
|
||||||
|
|
||||||
# name should be like git-describe, but without the git suffix or
|
|
||||||
# the leading v. For example, for git-describe of
|
|
||||||
# "v0.100.0-15-gce1b52bb7" we want:
|
|
||||||
#
|
|
||||||
# VERSION_NAME = 0.100.0-15
|
|
||||||
# VERSION_ID = 100.100.15
|
|
||||||
name=$(echo "$describe" | sed -e 's/^v//' | sed -e 's/-g.*//' | sed -e 's/-0$//')
|
|
||||||
|
|
||||||
# Apple version numbers must be major.minor.patch. We have 4 fields
|
# Apple version numbers must be major.minor.patch. We have 4 fields
|
||||||
# because we need major.minor.patch for go module compatibility, and
|
# because we need major.minor.patch for go module compatibility, and
|
||||||
# changecount for automatic version numbering of unstable builds. To
|
# changecount for automatic version numbering of unstable builds. To
|
||||||
@@ -76,8 +68,8 @@ xcode() {
|
|||||||
patch=$((patch*10000 + changecount))
|
patch=$((patch*10000 + changecount))
|
||||||
|
|
||||||
# CFBundleShortVersionString: the "short name" used in the App Store.
|
# CFBundleShortVersionString: the "short name" used in the App Store.
|
||||||
# e.g. 0.92.98
|
# eg. 0.92.98
|
||||||
echo "VERSION_NAME = $name"
|
echo "VERSION_NAME = $major.$minor.$patch"
|
||||||
# CFBundleVersion: the build number. Needs to be 3 numeric sections
|
# CFBundleVersion: the build number. Needs to be 3 numeric sections
|
||||||
# that increment for each release according to SemVer rules.
|
# that increment for each release according to SemVer rules.
|
||||||
#
|
#
|
||||||
|
|||||||
+10
-13
@@ -11,15 +11,15 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func xcode(name, semver string) string {
|
func xcode(short, long string) string {
|
||||||
return fmt.Sprintf("VERSION_NAME = %s\nVERSION_ID = %s", name, semver)
|
return fmt.Sprintf("VERSION_NAME = %s\nVERSION_ID = %s", short, long)
|
||||||
}
|
}
|
||||||
|
|
||||||
func mkversion(t *testing.T, mode, in string) string {
|
func mkversion(t *testing.T, mode, in string) string {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
bs, err := exec.Command("./mkversion.sh", mode, in).CombinedOutput()
|
bs, err := exec.Command("./mkversion.sh", mode, in).CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf("mkversion.sh output: %s", bs)
|
t.Logf("mkversion.sh output: %s", string(bs))
|
||||||
t.Fatalf("mkversion.sh %s %s: %v", mode, in, err)
|
t.Fatalf("mkversion.sh %s %s: %v", mode, in, err)
|
||||||
}
|
}
|
||||||
return strings.TrimSpace(string(bs))
|
return strings.TrimSpace(string(bs))
|
||||||
@@ -32,15 +32,12 @@ func TestMkversion(t *testing.T) {
|
|||||||
short string
|
short string
|
||||||
xcode string
|
xcode string
|
||||||
}{
|
}{
|
||||||
{"v0.98-gabcdef", "0.98.0-0-gabcdef", "0.98.0-0", xcode("0.98", "100.98.0")},
|
{"v0.98-abcdef", "0.98.0-0-abcdef", "0.98.0-0", xcode("0.98.0", "100.98.0")},
|
||||||
{"v0.98-123-gabcdef", "0.98.0-123-gabcdef", "0.98.0-123", xcode("0.98-123", "100.98.123")},
|
{"v0.98-123-abcdef", "0.98.0-123-abcdef", "0.98.0-123", xcode("0.98.123", "100.98.123")},
|
||||||
{"v0.99.5-123-gabcdef", "0.99.5-123-gabcdef", "0.99.5-123", xcode("0.99.5-123", "100.99.50123")},
|
{"v0.99.5-123-abcdef", "0.99.5-123-abcdef", "0.99.5-123", xcode("0.99.50123", "100.99.50123")},
|
||||||
{"v0.99.5-123-gabcdef", "0.99.5-123-gabcdef", "0.99.5-123", xcode("0.99.5-123", "100.99.50123")},
|
{"v0.99.5-123-abcdef", "0.99.5-123-abcdef", "0.99.5-123", xcode("0.99.50123", "100.99.50123")},
|
||||||
{"v0.100.0-gabcdef", "0.100.0-0-gabcdef", "0.100.0-0", xcode("0.100.0", "100.100.0")},
|
{"v2.3-0-abcdef", "2.3.0-0-abcdef", "2.3.0-0", xcode("2.3.0", "102.3.0")},
|
||||||
{"v0.100.0-1-gabcdef", "0.100.0-1-gabcdef", "0.100.0-1", xcode("0.100.0-1", "100.100.1")},
|
{"1.2.3-4-abcdef", "1.2.3-4-abcdef", "1.2.3-4", xcode("1.2.30004", "101.2.30004")},
|
||||||
{"v0.100.1-2-gabcdef", "0.100.1-2-gabcdef", "0.100.1-2", xcode("0.100.1-2", "100.100.10002")},
|
|
||||||
{"v2.3-0-gabcdef", "2.3.0-0-gabcdef", "2.3.0-0", xcode("2.3", "102.3.0")},
|
|
||||||
{"1.2.3-4-gabcdef", "1.2.3-4-gabcdef", "1.2.3-4", xcode("1.2.3-4", "101.2.30004")},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
@@ -54,7 +51,7 @@ func TestMkversion(t *testing.T) {
|
|||||||
t.Errorf("mkversion.sh short %q: got %q, want %q", test.in, gotshort, test.short)
|
t.Errorf("mkversion.sh short %q: got %q, want %q", test.in, gotshort, test.short)
|
||||||
}
|
}
|
||||||
if gotxcode != test.xcode {
|
if gotxcode != test.xcode {
|
||||||
t.Errorf("mkversion.sh xcode %q:\ngot:\n%q\nwant:\n%q", test.in, gotxcode, test.xcode)
|
t.Errorf("mkversion.sh xcode %q: got %q, want %q", test.in, gotxcode, test.xcode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user