diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0588ec35a1..f1df0add05 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,6 +78,11 @@ jobs: - name: Granting private modules access run: git config --global url."https://${{ secrets.GH_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + - name: Setup protoc + uses: arduino/setup-protoc@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install latest protoc-gen-go run: go install github.com/golang/protobuf/protoc-gen-go@latest @@ -233,14 +238,18 @@ jobs: echo "VideoInterstitialZoneId=$TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID" >> app.env echo "InterstitialZoneId=$TAPSELL_INTERSTITIAL_ZONE_ID" >> app.env - - name: Setup protoc - uses: arduino/setup-protoc@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Extract app version from pubspec.yaml + id: extract_version + shell: bash + run: | + APP_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') + echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV - name: Build Lantern Library shell: bash run: make ${{matrix.platform}} + env: + VERSION: ${{ env.version }} - name: Activate plugins run: | @@ -270,32 +279,25 @@ jobs: mkdir -p "build/windows/${{inputs.windows-arch}}/runner/Release" mv liblantern.dll "build/windows/${{inputs.windows-arch}}/runner/Release" - - name: Extract app version from pubspec.yaml - id: extract_version - shell: bash - run: | - APP_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') - echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV - - name: Build Flutter app (Windows) if: matrix.platform == 'windows' run: | New-Item -Path "./dist/${{ env.APP_VERSION }}" -ItemType Directory -Force flutter_distributor package --platform windows --targets exe --skip-clean env: - VERSION: "${{ env.version }}" + VERSION: ${{ env.version }} - name: Build Flutter app (Android) if: matrix.platform == 'android' run: make ${{ matrix.platform }}-${{ matrix.target }}-release env: - VERSION: "${{ env.version }}" + VERSION: ${{ env.version }} - name: Build Flutter app if: matrix.platform != 'windows' && matrix.platform != 'android' run: make ${{ matrix.platform }}-release env: - VERSION: "${{ env.version }}" + VERSION: ${{ env.version }} - name: Rename installer if: matrix.platform == 'windows' diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e2687829fd..35ea0e74bc 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -26,6 +26,14 @@ jobs: run: | git config --global url."https://${{ secrets.CI_PRIVATE_REPOS_GH_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + - name: Setup protoc + uses: arduino/setup-protoc@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install latest protoc-gen-go + run: go install github.com/golang/protobuf/protoc-gen-go@latest + - name: Build run: LIB_NAME=liblantern.so make lantern diff --git a/Makefile b/Makefile index 786abcd44b..fa684e6ffd 100644 --- a/Makefile +++ b/Makefile @@ -105,10 +105,8 @@ CIBASE := $(shell printf "CI=$${CI:-false}" | base64) STAGING = false UPDATE_SERVER_URL ?= VERSION ?= 9999.99.99 -# Note - we don't bother stripping symbols or DWARF table as Android's packaging seems to take care of that for us -LDFLAGS := -X github.com/getlantern/lantern-client/internalsdk/common.RevisionDate=$(REVISION_DATE) \ --X github.com/getlantern/lantern-client/internalsdk/common.ApplicationVersion=$(VERSION) \ --X github.com/getlantern/lantern-client/internalsdk/common.BuildDate=$(BUILD_DATE) + +LDFLAGS := -X github.com/getlantern/lantern-client/internalsdk/common.RevisionDate=$(REVISION_DATE) -X github.com/getlantern/lantern-client/internalsdk/common.BuildDate=$(BUILD_DATE) # Ref https://pkg.go.dev/cmd/link # -w omits the DWARF table @@ -217,6 +215,20 @@ dumpvars: $(filter-out $(VARS_OLD) VARS_OLD,$(.VARIABLES)), \ $(info $(v) = $($(v)))) +EXTRA_LDFLAGS ?= + +ifdef VERSION +EXTRA_LDFLAGS += -X github.com/getlantern/lantern-client/internalsdk/common.ApplicationVersion=$(VERSION) +endif + +ifdef REPLICA +EXTRA_LDFLAGS += -X github.com/getlantern/antern-client/desktop/features.EnableReplicaFeatures=$(REPLICA) +endif + +ifdef TRAFFICLOG +EXTRA_LDFLAGS += -X github.com/getlantern/lantern-client/desktop/features.EnableTrafficlogFeatures=true +endif + .PHONY: tag tag: require-version @(git diff-index --quiet HEAD -- || (echo "Attempted to tag dirty working tree" && exit 1)) && \ @@ -242,6 +254,10 @@ require-app: guard-APP .PHONY: require-version require-version: guard-VERSION + @if ! [[ "$$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$$ ]]; then \ + echo "VERSION must be a semantic version like '1.2.10' or '1.2.10-foo"; \ + exit 1; \ + fi .PHONY: require-sentry-auth-token require-secrets-dir: guard-SENTRY_AUTH_TOKEN @@ -469,7 +485,7 @@ echo-build-tags: ## Prints build tags and extra ldflags. Run this with `REPLICA= .PHONY: desktop-lib ffigen desktop-lib: export GOPRIVATE = github.com/getlantern -desktop-lib: echo-build-tags +desktop-lib: $(GO_SOURCES) echo-build-tags CGO_ENABLED=1 go build -v -trimpath $(GO_BUILD_FLAGS) -o "$(LIB_NAME)" -tags="$(BUILD_TAGS)" -ldflags="$(LDFLAGS) $(EXTRA_LDFLAGS)" desktop/*.go # This runs a development build for lantern. For production builds, see