-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathTaskfile.yml
More file actions
184 lines (153 loc) · 6.61 KB
/
Taskfile.yml
File metadata and controls
184 lines (153 loc) · 6.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
version: '3'
vars:
NAME: singcast
CLI_NAME: singcast
BINDIR: bin
VERSION:
sh: git describe --tags 2>/dev/null || echo "dev"
LDFLAGS: >-
-w -s
-X github.com/mapleafgo/singcast/core.Version={{.VERSION}}
BUILDTAGS: with_clash_api,with_utls,with_quic,with_gvisor
env:
CGO_ENABLED: 1
tasks:
default:
desc: Build CLI for current platform
cmds:
- task: cli
# ── CLI ──────────────────────────────────────────────
cli:
desc: Build singcast CLI binary for current platform
cmds:
- CGO_ENABLED=0 go build -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/{{.CLI_NAME}} ./cmd/singcast
- task: codesign
vars:
BINARY: "{{.BINDIR}}/{{.CLI_NAME}}"
cli-linux-amd64:
desc: Build CLI for Linux amd64
cmds:
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/{{.CLI_NAME}}-linux-amd64 ./cmd/singcast
cli-linux-arm64:
desc: Build CLI for Linux arm64
cmds:
- CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/{{.CLI_NAME}}-linux-arm64 ./cmd/singcast
cli-darwin-amd64:
desc: Build CLI for macOS amd64
cmds:
- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/{{.CLI_NAME}}-darwin-amd64 ./cmd/singcast
- task: codesign
vars:
BINARY: "{{.BINDIR}}/{{.CLI_NAME}}-darwin-amd64"
cli-darwin-arm64:
desc: Build CLI for macOS arm64
cmds:
- CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/{{.CLI_NAME}}-darwin-arm64 ./cmd/singcast
- task: codesign
vars:
BINARY: "{{.BINDIR}}/{{.CLI_NAME}}-darwin-arm64"
cli-windows-amd64:
desc: Build CLI for Windows amd64
cmds:
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/{{.CLI_NAME}}-windows-amd64.exe ./cmd/singcast
cli-windows-arm64:
desc: Build CLI for Windows arm64
cmds:
- CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/{{.CLI_NAME}}-windows-arm64.exe ./cmd/singcast
cli-all:
desc: Build CLI for all platforms
cmds:
- task: cli-linux-amd64
- task: cli-linux-arm64
- task: cli-darwin-amd64
- task: cli-darwin-arm64
- task: cli-windows-amd64
- task: cli-windows-arm64
# ── FFI Shared Library ───────────────────────────────
ffi-linux-amd64:
desc: Build FFI shared library for Linux amd64
cmds:
- GOOS=linux GOARCH=amd64 go build -buildmode=c-shared -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/lib{{.NAME}}-linux-amd64.so ./cmd/lib
ffi-linux-arm64:
desc: Build FFI shared library for Linux arm64
cmds:
- GOOS=linux GOARCH=arm64 go build -buildmode=c-shared -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/lib{{.NAME}}-linux-arm64.so ./cmd/lib
ffi-darwin-amd64:
desc: Build FFI shared library for macOS amd64
cmds:
- GOOS=darwin GOARCH=amd64 go build -buildmode=c-shared -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/lib{{.NAME}}-darwin-amd64.dylib ./cmd/lib
- task: codesign
vars:
BINARY: "{{.BINDIR}}/lib{{.NAME}}-darwin-amd64.dylib"
ffi-darwin-arm64:
desc: Build FFI shared library for macOS arm64
cmds:
- GOOS=darwin GOARCH=arm64 go build -buildmode=c-shared -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/lib{{.NAME}}-darwin-arm64.dylib ./cmd/lib
- task: codesign
vars:
BINARY: "{{.BINDIR}}/lib{{.NAME}}-darwin-arm64.dylib"
ffi-windows-amd64:
desc: Build FFI shared library for Windows amd64
cmds:
- GOOS=windows GOARCH=amd64 go build -buildmode=c-shared -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -o {{.BINDIR}}/{{.NAME}}-windows-amd64.dll ./cmd/lib
ffi-all:
desc: Build FFI shared libraries for all desktop platforms
cmds:
- task: ffi-linux-amd64
- task: ffi-linux-arm64
- task: ffi-darwin-amd64
- task: ffi-darwin-arm64
- task: ffi-windows-amd64
# ── Mobile SDK ───────────────────────────────────────
mobile-android-arm64:
desc: Build Android AAR for arm64 (gomobile)
cmds:
- mkdir -p {{.BINDIR}}
- gomobile bind -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}} -checklinkname=0' -target=android/arm64 -androidapi 29 -javapkg cn.mapleafgo -o {{.BINDIR}}/lib{{.NAME}}-android-arm64.aar ./mobile
mobile-android-amd64:
desc: Build Android AAR for amd64 (gomobile)
cmds:
- mkdir -p {{.BINDIR}}
- gomobile bind -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}} -checklinkname=0' -target=android/amd64 -androidapi 29 -javapkg cn.mapleafgo -o {{.BINDIR}}/lib{{.NAME}}-android-amd64.aar ./mobile
mobile-ios-arm64:
desc: Build iOS xcframework (gomobile)
cmds:
- mkdir -p {{.BINDIR}}
- gomobile bind -trimpath -tags '{{.BUILDTAGS}}' -ldflags '{{.LDFLAGS}}' -target=ios -o {{.BINDIR}}/{{.NAME}}.xcframework ./mobile
- task: codesign
vars:
BINARY: "{{.BINDIR}}/{{.NAME}}.xcframework"
mobile-all:
desc: Build all mobile SDK packages
cmds:
- task: mobile-android-arm64
- task: mobile-android-amd64
- task: mobile-ios-arm64
# ── Release ──────────────────────────────────────────
release:
desc: Build all release artifacts (CLI + FFI + mobile)
cmds:
- task: cli-all
- task: ffi-all
- task: mobile-all
codesign:
internal: true
cmds:
- codesign -s - {{.BINARY}}
platforms: [darwin]
status:
- test "{{OS}}" != "darwin"
# ── Development ──────────────────────────────────────
test:
desc: Run tests
cmds:
- go test -tags '{{.BUILDTAGS}}' ./translator/... ./core/...
tidy:
desc: Update all direct dependencies to latest and tidy
cmds:
- GOPROXY=https://proxy.golang.org,direct go get -u ./...
- go mod tidy
clean:
desc: Remove build artifacts
cmds:
- rm -rf {{.BINDIR}}