add Make target for lib.go, def vars for experiments #13

Merged
sarah merged 1 commits from makelibgo into main 2023-03-21 17:21:04 +00:00
3 changed files with 28 additions and 7 deletions

View File

@ -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
dan marked this conversation as resolved
Review

windows should be built with server experiments

windows should be built with server experiments
Review

windows, linux, and mac, have that serverExerpiment defiend as their experiment in the makefile, see line 19 for windows

windows, linux, and mac, have that serverExerpiment defiend as their experiment in the makefile, see line 19 for 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
- pull_request

View File

@ -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

View File

@ -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)