FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
atlas.sql/Recipe.go at main · fezcode/atlas.sql · GitHub
fezcode
/
atlas.sql
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
atlas.sql
/
Recipe.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (57 loc) · 1.56 KB
Breadcrumbs
atlas.sql
/
Recipe.go
Copy path
File metadata and controls
69 lines (57 loc) · 1.56 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//go:build gobake
package
bake_recipe
import
(
"fmt"
"github.com/fezcode/gobake"
)
func
Run
(
bake
*
gobake.
Engine
)
error
{
if
err
:=
bake
.
LoadRecipeInfo
(
"recipe.piml"
);
err
!=
nil
{
return
err
}
bake
.
Task
(
"build"
,
"Builds the binary for multiple platforms"
,
func
(
ctx
*
gobake.
Context
)
error
{
ctx
.
Log
(
"Building %s v%s..."
,
bake
.
Info
.
Name
,
bake
.
Info
.
Version
)
targets
:=
[]
struct
{
os
string
arch
string
}{
{
"linux"
,
"amd64"
},
{
"linux"
,
"arm64"
},
{
"windows"
,
"amd64"
},
{
"windows"
,
"arm64"
},
{
"darwin"
,
"amd64"
},
{
"darwin"
,
"arm64"
},
}
err
:=
ctx
.
Mkdir
(
"build"
)
if
err
!=
nil
{
return
err
}
ldflags
:=
fmt
.
Sprintf
(
"-X main.Version=%s"
,
bake
.
Info
.
Version
)
for
_
,
t
:=
range
targets
{
output
:=
"build/"
+
bake
.
Info
.
Name
+
"-"
+
t
.
os
+
"-"
+
t
.
arch
if
t
.
os
==
"windows"
{
output
+=
".exe"
}
// We use manual go build to inject ldflags
// Note: atlas.sql might need CGO for sqlite3, but let's try CGO_ENABLED=1 for local and consider cross-compilation later.
// Actually, for SQLite, CGO is usually required unless using a pure-go driver.
cgo
:=
"0"
if
t
.
os
==
"windows"
&&
t
.
arch
==
"amd64"
{
// cgo = "1" // Enable if needed for sqlite
}
ctx
.
Env
=
[]
string
{
"CGO_ENABLED="
+
cgo
,
"GOOS="
+
t
.
os
,
"GOARCH="
+
t
.
arch
,
}
err
:=
ctx
.
Run
(
"go"
,
"build"
,
"-ldflags"
,
ldflags
,
"-o"
,
output
,
"."
)
if
err
!=
nil
{
return
err
}
}
return
nil
})
bake
.
Task
(
"clean"
,
"Removes build artifacts"
,
func
(
ctx
*
gobake.
Context
)
error
{
return
ctx
.
Remove
(
"build"
)
})
return
nil
}
Back
|
FazBrowse Home
|
New Git URL