@@ -17,21 +17,7 @@ DEBUG_APK=tailscale-debug.apk
17
17
RELEASE_AAB =tailscale-release.aab
18
18
RELEASE_TV_AAB =tailscale-tv-release.aab
19
19
LIBTAILSCALE =android/libs/libtailscale.aar
20
- TAILSCALE_VERSION =$(shell ./version/tailscale-version.sh 200)
21
- OUR_VERSION =$(shell git describe --dirty --exclude "* " --always --abbrev=200)
22
- TAILSCALE_VERSION_ABBREV =$(shell ./version/tailscale-version.sh 11)
23
- OUR_VERSION_ABBREV =$(shell git describe --exclude "* " --always --abbrev=11)
24
- VERSION_LONG =$(TAILSCALE_VERSION_ABBREV ) -g$(OUR_VERSION_ABBREV )
25
- # Extract the long version build.gradle's versionName and strip quotes.
26
- VERSIONNAME =$(patsubst "% ",% ,$(lastword $(shell grep versionName android/build.gradle) ) )
27
- # Extract the x.y.z part for the short version.
28
- VERSIONNAME_SHORT =$(shell echo $(VERSIONNAME ) | cut -d - -f 1)
29
- TAILSCALE_COMMIT =$(shell echo $(TAILSCALE_VERSION ) | cut -d - -f 2 | cut -d t -f 2)
30
20
# Extract the version code from build.gradle.
31
- VERSIONCODE =$(lastword $(shell grep versionCode android/build.gradle) )
32
- VERSIONCODE_PLUSONE =$(shell expr $(VERSIONCODE ) + 1)
33
- VERSION_LDFLAGS =-X tailscale.com/version.longStamp=$(VERSIONNAME ) -X tailscale.com/version.shortStamp=$(VERSIONNAME_SHORT ) -X tailscale.com/version.gitCommitStamp=$(TAILSCALE_COMMIT ) -X tailscale.com/version.extraGitCommitStamp=$(OUR_VERSION )
34
- FULL_LDFLAGS =$(VERSION_LDFLAGS ) -w
35
21
ifeq ($(shell uname) ,Linux)
36
22
ANDROID_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip"
37
23
ANDROID_TOOLS_SUM="bd1aa17c7ef10066949c88dc6c9c8d536be27f992a1f3b5a584f9bd2ba5646a0 commandlinetools-linux-9477386_latest.zip"
@@ -111,17 +97,17 @@ tailscale-debug: $(DEBUG_APK) ## Build the debug APK
111
97
112
98
# Builds the release AAB and signs it (phone/tablet/chromeOS variant)
113
99
.PHONY : release
114
- release : update-version jarsign-env $(RELEASE_AAB ) # # Build the release AAB
100
+ release : jarsign-env $(RELEASE_AAB ) # # Build the release AAB
115
101
@jarsigner -sigalg SHA256withRSA -digestalg SHA-256 -keystore $(JKS_PATH ) -storepass $(JKS_PASSWORD ) $(RELEASE_AAB ) tailscale
116
102
117
103
# Builds the release AAB and signs it (androidTV variant)
118
104
.PHONY : release-tv
119
- release-tv : update-version jarsign-env $(RELEASE_TV_AAB ) # # Build the release AAB
105
+ release-tv : jarsign-env $(RELEASE_TV_AAB ) # # Build the release AAB
120
106
@jarsigner -sigalg SHA256withRSA -digestalg SHA-256 -keystore $(JKS_PATH ) -storepass $(JKS_PASSWORD ) $(RELEASE_TV_AAB ) tailscale
121
107
122
108
# gradle-dependencies groups together the android sources and libtailscale needed to assemble tests/debug/release builds.
123
109
.PHONY : gradle-dependencies
124
- gradle-dependencies : $(shell find android -type f -not -path "android/build/* " -not -path '* /.* ') $(LIBTAILSCALE )
110
+ gradle-dependencies : $(shell find android -type f -not -path "android/build/* " -not -path '* /.* ') $(LIBTAILSCALE ) tailscale.version
125
111
126
112
$(DEBUG_APK ) : gradle-dependencies
127
113
(cd android && ./gradlew test assembleDebug)
@@ -141,6 +127,13 @@ tailscale-test.apk: gradle-dependencies
141
127
(cd android && ./gradlew assembleApplicationTestAndroidTest)
142
128
install -C ./android/build/outputs/apk/androidTest/applicationTest/android-applicationTest-androidTest.apk $@
143
129
130
+ tailscale.version : go.mod go.sum $(wildcard .git/HEAD)
131
+ $(shell ./tool/go run tailscale.com/cmd/mkversion > tailscale.version)
132
+
133
+ .PHONY : version
134
+ version : tailscale.version # # print the current version information
135
+ cat tailscale.version
136
+
144
137
#
145
138
# Go Builds:
146
139
#
@@ -154,10 +147,10 @@ $(GOBIN)/gomobile: $(GOBIN)/gobind go.mod go.sum
154
147
$(GOBIN ) /gobind : go.mod go.sum
155
148
./tool/go install golang.org/x/mobile/cmd/gobind
156
149
157
- $(LIBTAILSCALE ) : Makefile android/libs $(shell find libtailscale -name * .go) go.mod go.sum $(GOBIN ) /gomobile
150
+ $(LIBTAILSCALE ) : Makefile android/libs $(shell find libtailscale -name * .go) go.mod go.sum $(GOBIN ) /gomobile tailscale.version
158
151
$(GOBIN ) /gomobile bind -target android -androidapi 26 \
159
152
-tags " $$ (./build-tags.sh)" \
160
- -ldflags " $( FULL_LDFLAGS ) " \
153
+ -ldflags " -w $$ (./version-ldflags.sh )" \
161
154
-o $@ ./libtailscale
162
155
163
156
.PHONY : libtailscale
@@ -202,29 +195,25 @@ androidpath:
202
195
@echo ' export PATH=$(ANDROID_HOME)/cmdline-tools/latest/bin:$(ANDROID_HOME)/platform-tools:$$PATH'
203
196
204
197
.PHONY : tag_release
205
- tag_release : # # Tag the current commit with the current version
206
- git tag -a " $( VERSION_LONG) " -m " OSS and Version updated to ${VERSION_LONG} "
198
+ tag_release : tailscale.version # # Tag the current commit with the current version
199
+ source tailscale.version && git tag -a " $$ { VERSION_LONG} " -m " OSS and Version updated to $ $ {VERSION_LONG}"
207
200
208
201
209
202
.PHONY : bumposs # # Bump to the latest oss and update the versions.
210
- bumposs : update-oss update- version
211
- git commit -sm " android: bump OSS" -m " OSS and Version updated to ${VERSION_LONG} " go.toolchain.rev android/build.gradle go.mod go.sum
212
- git tag -a " $( VERSION_LONG) " -m " OSS and Version updated to ${VERSION_LONG} "
203
+ bumposs : update-oss tailscale. version
204
+ source tailscale.version && git commit -sm " android: bump OSS" -m " OSS and Version updated to $ $ {VERSION_LONG}" go.toolchain.rev android/build.gradle go.mod go.sum
205
+ source tailscale.version && git tag -a " $$ { VERSION_LONG} " -m " OSS and Version updated to $ $ {VERSION_LONG}"
213
206
214
207
.PHONY : bump_version_code
215
208
bump_version_code : # # Bump the version code in build.gradle
216
- sed -i' .bak' ' s/versionCode .*/versionCode $(VERSIONCODE_PLUSONE)/' android/build.gradle && rm android/build.gradle.bak
217
-
218
- .PHONY : update-version
219
- update-version : # # Update the version in build.gradle
220
- sed -i' .bak' ' s/versionName .*/versionName "$(VERSION_LONG)"/' android/build.gradle && rm android/build.gradle.bak
209
+ sed -i' .bak' " s/versionCode .*/versionCode $$ (expr $$ (awk '/versionCode ([0-9]+)/{print $$ 2}' android/build.gradle) + 1)/" android/build.gradle && rm android/build.gradle.bak
221
210
222
211
.PHONY : update-oss
223
- update-oss : # # Update the tailscale.com go module and update the version in build.gradle
212
+ update-oss : # # Update the tailscale.com go module
224
213
GOPROXY=direct ./tool/go get tailscale.com@main
214
+ ./tool/go mod tidy -compat=1.23
225
215
./tool/go run tailscale.com/cmd/printdep --go > go.toolchain.rev.new
226
216
mv go.toolchain.rev.new go.toolchain.rev
227
- ./tool/go mod tidy -compat=1.23
228
217
229
218
# Get the commandline tools package, this provides (among other things) the sdkmanager binary.
230
219
$(ANDROID_HOME ) /cmdline-tools/latest/bin/sdkmanager :
@@ -310,13 +299,13 @@ docker-remove-shell-image: ## Removes all docker shell image
310
299
docker rmi --force tailscale-android-shell-amd64
311
300
312
301
.PHONY : clean
313
- clean : # # Remove build artifacts. Does not purge docker build envs. Use dockerRemoveEnv for that.
314
- clean : # # Remove build artifacts. Does not purge docker build envs. Use dockerRemoveEnv for that.
302
+ clean : clean-tailscale.version # # Remove build artifacts. Does not purge docker build envs. Use dockerRemoveEnv for that.
315
303
@echo " Cleaning up old build artifacts"
316
304
-rm -rf android/build $(DEBUG_APK ) $(RELEASE_AAB ) $(RELEASE_TV_AAB ) $(LIBTAILSCALE ) android/libs * .apk * .aab
317
305
@echo " Cleaning cached toolchain"
318
306
-rm -rf $(HOME ) /.cache/tailscale-go{,.extracted}
319
307
-pkill -f gradle
308
+ -rm tailscale.version
320
309
321
310
.PHONY : help
322
311
help : # # Show this help
0 commit comments