Skip to content

Commit 97a826d

Browse files
committed
Makefile: extract version information from build.gradle
The tag_release target already writes the version into build.gradle. Ensure the exact same version information is used for the Go build. As a bonus, the F-Droid builder no longer needs a modern git installed for determining the version string. Signed-off-by: Elias Naur <[email protected]>
1 parent 6252433 commit 97a826d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ AAR=android/libs/ipn.aar
99
KEYSTORE=tailscale.jks
1010
KEYSTORE_ALIAS=tailscale
1111
TAILSCALE_VERSION=$(shell ./version/tailscale-version.sh)
12-
TAILSCALE_COMMIT=$(lastword $(subst -g, ,$(TAILSCALE_VERSION)))
1312
GIT_DESCRIBE=$(shell git describe --dirty --exclude "*" --always --abbrev=200)
1413
VERSION_LONG=$(shell ./version/mkversion.sh long $(TAILSCALE_VERSION) $(GIT_DESCRIBE))
15-
VERSION_SHORT=$(shell ./version/mkversion.sh short $(TAILSCALE_VERSION) $(GIT_DESCRIBE))
14+
# Extract the long version build.gradle's versionName and strip quotes.
15+
VERSIONNAME=$(patsubst "%",%,$(lastword $(shell grep versionName android/build.gradle)))
16+
# Extract the x.y.z part for the short version.
17+
VERSIONNAME_SHORT=$(shell echo $(VERSIONNAME) | cut -d - -f 1)
18+
TAILSCALE_COMMIT=$(shell echo $(VERSIONNAME) | cut -d - -f 2 | cut -d t -f 2)
19+
# Extract the version code from build.gradle.
1620
VERSIONCODE=$(lastword $(shell grep versionCode android/build.gradle))
1721
VERSIONCODE_PLUSONE=$(shell expr $(VERSIONCODE) + 1)
1822

@@ -30,10 +34,10 @@ $(DEBUG_APK):
3034
(cd android && ./gradlew assemblePlayDebug)
3135
mv android/build/outputs/apk/play/debug/android-play-debug.apk $@
3236

33-
# This target is also used by the F-Droid metadata.
37+
# This target is also used by the F-Droid builder.
3438
release_aar:
3539
mkdir -p android/libs
36-
go run gioui.org/cmd/gogio -ldflags "-X tailscale.com/version.Long=$(VERSION_LONG) -X tailscale.com/version.Short=$(VERSION_SHORT) -X tailscale.com/version.GitCommit=$(TAILSCALE_COMMIT)" -tags xversion -buildmode archive -target android -appid $(APPID) -o $(AAR) github.com/tailscale/tailscale-android/cmd/tailscale
40+
go run gioui.org/cmd/gogio -ldflags "-X tailscale.com/version.Long=$(VERSIONNAME) -X tailscale.com/version.Short=$(VERSIONNAME_SHORT) -X tailscale.com/version.GitCommit=$(TAILSCALE_COMMIT)" -tags xversion -buildmode archive -target android -appid $(APPID) -o $(AAR) github.com/tailscale/tailscale-android/cmd/tailscale
3741

3842
$(RELEASE_AAB): release_aar
3943
(cd android && ./gradlew bundlePlayRelease)

0 commit comments

Comments
 (0)