-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(client): use Taskfile for tun2socks #1967
Merged
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
abcc450
Use Taskfile
fortuna d173d1a
Update description
fortuna b808880
Improve
fortuna 0d64343
Remove os
fortuna ede26cd
Fix
fortuna 3688bb0
Better
fortuna c31df07
Merge branch 'master' into fortuna-taskfile2
fortuna 3c4a5d2
Simplify build.action.mjs
fortuna f6216c2
Tweaks
fortuna cd49beb
Refactor Electron
fortuna fb392eb
Address review
fortuna 0626979
Remove .task
fortuna d98760d
Fix clean
fortuna 43fdc9a
Fix os check
fortuna 90133f8
Fix
fortuna c9eb496
Fix
fortuna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
node_modules | ||
.idea | ||
.task | ||
.vs/ | ||
.vscode | ||
*.DS_Store | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3' | ||
|
||
set: [pipefail] | ||
|
||
run: when_changed | ||
|
||
includes: | ||
client:tun2socks: ./client/src/tun2socks/Taskfile.yml | ||
|
||
tasks: | ||
clean: | ||
deps: | ||
- client:tun2socks:clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
version: '3' | ||
|
||
vars: | ||
# This needs to be updated if the file moves. | ||
REPO_ROOT: '{{joinPath .TASKFILE_DIR "../../.."}}' | ||
# TODO: Output to $REPO_ROOT/output/client/tun2socks instead. | ||
OUT_DIR: '{{joinPath .REPO_ROOT "client/output/build"}}' | ||
BIN_DIR: "{{.OUT_DIR}}/build" | ||
MOBILE_PKG: "{{.TASKFILE_DIR}}/outline/tun2socks" | ||
GOMOBILE_BIND_CMD: "env PATH=\"{{.BIN_DIR}}:${PATH}\" '{{.BIN_DIR}}/gomobile' bind -ldflags='-s -w'" | ||
|
||
tasks: | ||
electron: | ||
desc: "Build the tun2socks binary for Electron platforms" | ||
internal: true | ||
requires: {vars: [TARGET_OS]} | ||
vars: | ||
# TODO(fortuna): remove this, it's not really needed since we don't release it separately anymore. | ||
TUN2SOCKS_VERSION: "v1.16.11" | ||
OUTPUT: '{{.OUT_DIR}}/{{.TARGET_OS}}/tun2socks{{if eq .TARGET_OS "windows"}}.exe{{end}}' | ||
cmds: | ||
- rm -rf "{{dir .OUTPUT}}" && mkdir -p "{{dir .OUTPUT}}" | ||
# Linker flags: https://pkg.go.dev/cmd/link | ||
# -s Omit the symbol table and debug information. | ||
# -w Omit the DWARF symbol table. | ||
# -X Set the value of the string variable. | ||
- | | ||
{{if ne OS "{{.TARGET_OS}}" -}} | ||
GOOS={{.TARGET_OS}} GOARCH=amd64 CGO_ENABLED=1 CC='zig cc -target x86_64-{{.TARGET_OS}}' | ||
{{- end}} \ | ||
go build -trimpath -ldflags="-s -w -X=main.version={{.TUN2SOCKS_VERSION}}" -o '{{.OUTPUT}}' '{{.TASKFILE_DIR}}/outline/electron' | ||
|
||
windows: | ||
desc: "Build the tun2socks binary for Windows" | ||
cmds: [{task: electron, vars: {TARGET_OS: "windows"}}] | ||
|
||
linux: | ||
desc: "Build the tun2socks binary for Linux" | ||
cmds: [{task: electron, vars: {TARGET_OS: "linux"}}] | ||
|
||
android: | ||
desc: "Build the tun2socks.aar library for Android" | ||
vars: | ||
TARGET_DIR: "{{.OUT_DIR}}/android" | ||
# ANDROID_API must match the minSdkVersion that the Android client supports. | ||
ANDROID_API: 22 | ||
preconditions: | ||
- sh: '[[ -d "$ANDROID_HOME" ]]' | ||
msg: "Must set ANDROID_HOME" | ||
- sh: '[[ -d "$ANDROID_NDK" ]]' | ||
msg: "Must set ANDROID_NDK" | ||
cmds: | ||
- rm -rf "{{.TARGET_DIR}}" && mkdir -p "{{.TARGET_DIR}}" | ||
- "{{.GOMOBILE_BIND_CMD}} -target=android -androidapi '{{.ANDROID_API}}' -o '{{.TARGET_DIR}}/tun2socks.aar' '{{.TASKFILE_DIR}}/outline/tun2socks' '{{.TASKFILE_DIR}}/outline/shadowsocks'" | ||
deps: ["gomobile"] | ||
|
||
ios-only: | ||
desc: "Build the Tun2socks.xcframework library for iOS only" | ||
internal: true | ||
vars: | ||
TARGET_DIR: '{{.OUT_DIR}}/ios' | ||
# TARGET_IOS_VERSION must match the target version that the iOS client supports. | ||
TARGET_IOS_VERSION: 12.0 | ||
cmds: | ||
- rm -rf "{{.TARGET_DIR}}" && mkdir -p "{{.TARGET_DIR}}" | ||
- "{{.GOMOBILE_BIND_CMD}} -target=ios,iossimulator -iosversion={{.TARGET_IOS_VERSION}} -bundleid org.outline.tun2socks -o '{{.TARGET_DIR}}/Tun2socks.xcframework' '{{.TASKFILE_DIR}}/outline/tun2socks' '{{.TASKFILE_DIR}}/outline/shadowsocks'" | ||
deps: ["gomobile"] | ||
|
||
macos-only: | ||
desc: "Build the Tun2socks.xcframework library for macOS only" | ||
internal: true | ||
vars: | ||
TARGET_DIR: '{{.OUT_DIR}}/macos' | ||
# MACOSX_DEPLOYMENT_TARGET must match the version the version set in the XCode project. | ||
MACOSX_DEPLOYMENT_TARGET: 10.14 | ||
# TARGET_IOS_VERSION must be at least 13.1 for macCatalyst and >= the iOS TARGET_IOS_VERSION. | ||
TARGET_IOS_VERSION: 13.1 | ||
cmds: | ||
- rm -rf "{{.TARGET_DIR}}" && mkdir -p "{{.TARGET_DIR}}" | ||
- export MACOSX_DEPLOYMENT_TARGET={{.MACOSX_DEPLOYMENT_TARGET}}; {{.GOMOBILE_BIND_CMD}} -target=macos,maccatalyst -iosversion={{.TARGET_IOS_VERSION}} -bundleid org.outline.tun2socks -o '{{.TARGET_DIR}}/Tun2socks.xcframework' '{{.TASKFILE_DIR}}/outline/tun2socks' '{{.TASKFILE_DIR}}/outline/shadowsocks' | ||
deps: ["gomobile"] | ||
|
||
apple: | ||
desc: "Build combined Tun2socks.xcframework library for Apple platforms" | ||
aliases: [ios, macos, maccatalyst] | ||
vars: | ||
TARGET_DIR: '{{.OUT_DIR}}/apple' | ||
cmds: | ||
- rm -rf "{{.TARGET_DIR}}" && mkdir -p "{{.TARGET_DIR}}" | ||
- | | ||
find '{{.OUT_DIR}}/macos/Tun2socks.xcframework' '{{.OUT_DIR}}/ios/Tun2socks.xcframework' -name "Tun2socks.framework" -type d | | ||
xargs -I {} echo " -framework {} " | | ||
xargs xcrun xcodebuild -create-xcframework -output '{{.TARGET_DIR}}/Tun2socks.xcframework' | ||
deps: ["ios-only", "macos-only"] | ||
|
||
browser: | ||
desc: "Placeholder for the browser build. Does nothing" | ||
|
||
gomobile: | ||
desc: "Build Go Mobile" | ||
internal: true | ||
cmds: | ||
- mkdir -p "{{.BIN_DIR}}" | ||
- go build -o "{{.BIN_DIR}}" golang.org/x/mobile/cmd/gomobile golang.org/x/mobile/cmd/gobind | ||
sources: ["{{.REPO_ROOT}}/go.sum"] | ||
generates: ["{{.BIN_DIR}}/gomobile", "{{.BIN_DIR}}/gobind"] | ||
|
||
clean: | ||
cmds: | ||
- rm -r '{{.OUT_DIR}}' | ||
- go clean -i -r '{{.TASKFILE_DIR}}/outline/tun2socks' '{{.TASKFILE_DIR}}/outline/shadowsocks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,41 @@ | ||
module github.com/Jigsaw-Code/outline-apps | ||
|
||
go 1.20 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/Jigsaw-Code/outline-sdk v0.0.14-0.20240216220040-f741c57bf854 | ||
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20240223000159-142376ee10ea | ||
github.com/crazy-max/xgo v0.30.0 | ||
github.com/eycorsican/go-tun2socks v1.16.11 | ||
github.com/stretchr/testify v1.8.2 | ||
github.com/go-task/task/v3 v3.36.0 | ||
github.com/stretchr/testify v1.9.0 | ||
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a | ||
golang.org/x/sys v0.15.0 | ||
golang.org/x/sys v0.19.0 | ||
) | ||
|
||
require ( | ||
github.com/Masterminds/semver/v3 v3.2.1 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/fatih/color v1.16.0 // indirect | ||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect | ||
github.com/joho/godotenv v1.5.1 // indirect | ||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.20 // indirect | ||
github.com/mattn/go-zglob v0.0.4 // indirect | ||
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/radovskyb/watcher v1.0.7 // indirect | ||
github.com/sajari/fuzzy v1.0.0 // indirect | ||
github.com/shadowsocks/go-shadowsocks2 v0.1.5 // indirect | ||
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 // indirect | ||
golang.org/x/crypto v0.17.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/zeebo/xxh3 v1.0.2 // indirect | ||
golang.org/x/crypto v0.18.0 // indirect | ||
golang.org/x/mod v0.14.0 // indirect | ||
golang.org/x/net v0.19.0 // indirect | ||
golang.org/x/sync v0.5.0 // indirect | ||
golang.org/x/tools v0.16.0 // indirect | ||
golang.org/x/net v0.20.0 // indirect | ||
golang.org/x/sync v0.7.0 // indirect | ||
golang.org/x/term v0.19.0 // indirect | ||
golang.org/x/tools v0.17.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
mvdan.cc/sh/v3 v3.8.0 // indirect | ||
) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self that we'll need to change this to "backend" if that other PR is merged