Merge pull request #16 from tailscale/toolchain

Makefile: download Tailscale's Go toolchain
pull/17/head
Denton Gentry 3 years ago committed by GitHub
commit 9f701283bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,9 +32,9 @@ RUN echo y | $ANDROID_HOME/tools/bin/sdkmanager 'build-tools;28.0.3'
# Get Go stable release # Get Go stable release
WORKDIR $HOME WORKDIR $HOME
ARG GO_VERSION=1.17rc1 ARG GO_VERSION=1.16.5
RUN curl -O https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz RUN curl -O https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz
RUN echo "bfbd3881a01ca3826777b1c40f241acacd45b14730d373259cd673d74e15e534 go${GO_VERSION}.linux-amd64.tar.gz" | sha256sum -c RUN echo "b12c23023b68de22f74c0524f10b753e7b08b1504cb7e417eccebdd3fae49061 go${GO_VERSION}.linux-amd64.tar.gz" | sha256sum -c
RUN tar -xzf go${GO_VERSION}.linux-amd64.tar.gz && mv go goroot RUN tar -xzf go${GO_VERSION}.linux-amd64.tar.gz && mv go goroot
ENV GOROOT $HOME/goroot ENV GOROOT $HOME/goroot
ENV PATH $PATH:$GOROOT/bin:$HOME/bin:$ANDROID_HOME/platform-tools ENV PATH $PATH:$GOROOT/bin:$HOME/bin:$ANDROID_HOME/platform-tools

@ -22,6 +22,13 @@ TAILSCALE_COMMIT=$(shell echo $(TAILSCALE_VERSION) | cut -d - -f 2 | cut -d t -f
VERSIONCODE=$(lastword $(shell grep versionCode android/build.gradle)) VERSIONCODE=$(lastword $(shell grep versionCode android/build.gradle))
VERSIONCODE_PLUSONE=$(shell expr $(VERSIONCODE) + 1) VERSIONCODE_PLUSONE=$(shell expr $(VERSIONCODE) + 1)
# When you update TOOLCHAINREV, also update TOOLCHAINWANT
TOOLCHAINREV=6fa85e8201f1f75fb7323eb48a0b24274a6e33b2
TOOLCHAINDIR=${HOME}/.cache/tailscale-android-go-$(TOOLCHAINREV)
TOOLCHAINSUM=$(shell find $(TOOLCHAINDIR) -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum | cut -d" " -f1)
TOOLCHAINWANT=e336267ea2a637426c0302945d0c1f8fa2f2f627
export PATH := $(TOOLCHAINDIR)/go/bin:$(PATH)
all: $(APK) all: $(APK)
tag_release: tag_release:
@ -30,13 +37,26 @@ tag_release:
git commit -sm "android: bump version code" android/build.gradle git commit -sm "android: bump version code" android/build.gradle
git tag -a "$(VERSION_LONG)" git tag -a "$(VERSION_LONG)"
$(DEBUG_APK): toolchain:
ifneq ($(TOOLCHAINWANT),$(TOOLCHAINSUM))
@echo want: $(TOOLCHAINWANT)
@echo got: $(TOOLCHAINSUM)
rm -rf ${HOME}/.cache/tailscale-android-go-*
$(eval tmpfile=$(shell mktemp --suffix=.tgz))
wget https://github.com/tailscale/go/releases/download/build-$(TOOLCHAINREV)/linux.tar.gz -O "$(tmpfile)"
mkdir -p $(TOOLCHAINDIR)
tar xzf $(tmpfile) -C $(TOOLCHAINDIR)
rm $(tmpfile)
endif
$(DEBUG_APK): toolchain
mkdir -p android/libs mkdir -p android/libs
go run gioui.org/cmd/gogio -buildmode archive -target android -appid $(APPID) -o $(AAR) github.com/tailscale/tailscale-android/cmd/tailscale go run gioui.org/cmd/gogio -buildmode archive -target android -appid $(APPID) -o $(AAR) github.com/tailscale/tailscale-android/cmd/tailscale
(cd android && ./gradlew assemblePlayDebug) (cd android && ./gradlew assemblePlayDebug)
mv android/build/outputs/apk/play/debug/android-play-debug.apk $@ mv android/build/outputs/apk/play/debug/android-play-debug.apk $@
# This target is also used by the F-Droid builder. # This target is also used by the F-Droid builder.
release_aar: toolchain
release_aar: release_aar:
mkdir -p android/libs mkdir -p android/libs
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) -X tailscale.com/version.ExtraGitCommit=$(OUR_VERSION)" -tags xversion -buildmode archive -target android -appid $(APPID) -o $(AAR) github.com/tailscale/tailscale-android/cmd/tailscale 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) -X tailscale.com/version.ExtraGitCommit=$(OUR_VERSION)" -tags xversion -buildmode archive -target android -appid $(APPID) -o $(AAR) github.com/tailscale/tailscale-android/cmd/tailscale

Loading…
Cancel
Save