diff --git a/.drone.yml b/.drone.yml index c2323a8..3013606 100644 --- a/.drone.yml +++ b/.drone.yml @@ -28,7 +28,6 @@ steps: commands: - make clean # Compile Server Experiments - - go run generate/generate_bindings.go --experiments "serverExperiment" - make linux - name: build-android @@ -38,7 +37,8 @@ steps: path: /go commands: # Build Android without Server Experiment - - go run generate/generate_bindings.go + - make clean-autobindings + - env EXPERIMENTS="" make lib.go - go mod download - gomobile init - make android @@ -51,7 +51,7 @@ steps: - name: deps path: /go commands: - - go run generate/generate_bindings.go --experiments "serverExperiment" + - make clean-autobindings - make windows - name: deploy-buildfiles @@ -123,7 +123,7 @@ steps: - name: build-macos-x64 commands: - export PATH=$PATH:/usr/local/go/bin/ - - go run generate/generate_bindings.go --experiments "serverExperiment" + - env EXPERIMENTS="serverExperiment" lib.go - make libCwtch.x64.dylib - name: build-macos-arm64 when: @@ -132,7 +132,8 @@ steps: status: [ success ] commands: - export PATH=$PATH:/usr/local/go/bin/ - - go run generate/generate_bindings.go --experiments "serverExperiment" + - make clean-autobindings + - env EXPERIMENTS="serverExperiment" make lib.go - go mod download - make libCwtch.arm64.dylib - name: deploy-buildfiles @@ -161,4 +162,4 @@ trigger: branch: main event: - push - - pull_request \ No newline at end of file + - pull_request diff --git a/Makefile b/Makefile index e4d54d4..b4b7d28 100644 --- a/Makefile +++ b/Makefile @@ -2,18 +2,29 @@ IOS_OUT := ./ios .PHONY: all linux android windows macos clean ios + DEFAULT_GOAL: linux all: linux android windows +linux: EXPERIMENTS ?= serverExperiment linux: libCwtch.so +macos: EXPERIMENTS ?= serverExperiment macos: libCwtch.x64.dylib libCwtch.arm64.dylib +android: EXPERIMENTS ?= android: cwtch.aar +windows: EXPERIMENTS ?= serverExperiment windows: libCwtch.dll + + +lib.go: generate/generate_bindings.go spec + go run generate/generate_bindings.go --experiments "$(EXPERIMENTS)" + + libCwtch.so: lib.go ./switch-ffi.sh go build -trimpath -ldflags "-buildid=autobindings-$(shell git describe --tags) -X main.buildVer=autobindings-$(shell git describe --tags) -X main.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.so @@ -51,8 +62,11 @@ libCwtch.dll: lib.go mv libCwtch.dll build/windows/ mv libCwtch.h build/windows/ +clean-autobindings: + rm -f lib.go + clean: - rm -fr cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.*.dylib build + rm -fr lib.go cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.*.dylib build # iOS - for testing purposes only for now, not officially supported diff --git a/README.md b/README.md index 96fc91b..b97c77a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,12 @@ Note for the Flutter-based Cwtch UI Application see: https://git.openprivacy.ca/ **NOTE:** Autobindings currently depends on an unreleased version of Cwtch (`cwtch.im/cwtch v0.18.10-0.20230221235514-49e0d849fa3e`). +### Experiments + +Autobindings allow for comile time selection of experiments. Default selections for each target platform are supplied in Makefile but can be overridden with: + + env EXPERIMENTS="serverExperiment otherExperiment" make android + ## Spec File Format The current Cwtch Bindings Specification is defined in [spec](./spec)