-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtasks.py
34 lines (28 loc) · 1.25 KB
/
tasks.py
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
# A binary builder for Macondo
from invoke import task
@task
def build(c):
tag = c.run("git describe --exact-match --tags", hide=True).stdout.strip()
print("Tag was", tag)
gitflags = f'-ldflags "-X main.GitVersion={tag}"'
# Build universal mac executable. This only works on Mac:
c.run(f"GOOS=darwin GOARCH=amd64 go build -o macondo-amd64 {gitflags} ./cmd/shell")
c.run(f"GOOS=darwin GOARCH=arm64 go build -o macondo-arm64 {gitflags} ./cmd/shell")
c.run("lipo -create -output macondo macondo-amd64 macondo-arm64")
c.run(f"zip -r macondo-{tag}-osx-universal.zip ./macondo ./data")
for os, nickname, arch, executable in [
("linux", "linux-x86_64", "amd64", "macondo"),
("windows", "win64", "amd64", "macondo.exe"),
]:
c.run(
f"GOOS={os} GOARCH={arch} go build -o {executable} {gitflags} ./cmd/shell"
)
if os == "windows":
c.run(
f"GOOS=windows GOARCH={arch} go build -o updater.exe {gitflags} ./cmd/updater"
)
c.run(
f"zip -r macondo-{tag}-{nickname}.zip ./{executable} ./updater.exe ./data"
)
if os != "windows":
c.run(f"zip -r macondo-{tag}-{nickname}.zip ./{executable} ./data")