You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 18 Current »
具体参数,使用gf build -h查看帮助
gf build -h
仅限于交叉编译使用到GoFrame框架的项目,支持绝大部分常见系统的直接交叉编译。
GoFrame
build命令自动嵌入编译变量,这些变量用户可自定义,并且在运行时通过gbuild组件获取。使用gf build的项目将会默认嵌入以下变量(参考gf -v):
build
gbuild
gf build
gf -v
Go
Git Commit
build支持同时从命令行以及配置文件指定编译参数、选项。GoFrame框架的所有组件及所有生态项目都是使用的同一个配置管理组件,默认的配置文件以及配置使用请参考章节 配置管理。以下是一个简单的配置示例供参考:
gfcli: build: name: "gf" arch: "all" system: "all" mod: "none" packSrc: "resource,manifest" version: "v1.0.0" output: "./bin" extra: ""
配置选项的释义同命令行同名选项。
name
go
windows
.exe
gf
arch
,
all
386,amd64,arm
system
当前系统平台
linux,darwin,windows
path
./bin
mod
go build -mod
none
cgo
false
CGO
packSrc
internal/packed/build_pack_data.go
public,template
packDst
version
v1.0.0
output
./bin/gf.exe
extra
go build
varMap
gfcli: build: name: "gf" arch: "all" system: "all" mod: "none" cgo: 0 varMap: k1: v1 k2: v2
exitWhenError
os.Exit(1)
dumpEnv
编译时的内置变量可以在运行时通过gbuild包 构建信息-gbuild 获取。
$ gf build 2020-12-31 00:35:25.562 start building... 2020-12-31 00:35:25.562 go build -o ./bin/darwin_amd64/gf main.go 2020-12-31 00:35:28.381 go build -o ./bin/freebsd_386/gf main.go 2020-12-31 00:35:30.650 go build -o ./bin/freebsd_amd64/gf main.go 2020-12-31 00:35:32.957 go build -o ./bin/freebsd_arm/gf main.go 2020-12-31 00:35:35.824 go build -o ./bin/linux_386/gf main.go 2020-12-31 00:35:38.082 go build -o ./bin/linux_amd64/gf main.go 2020-12-31 00:35:41.076 go build -o ./bin/linux_arm/gf main.go 2020-12-31 00:35:44.369 go build -o ./bin/linux_arm64/gf main.go 2020-12-31 00:35:47.352 go build -o ./bin/linux_ppc64/gf main.go 2020-12-31 00:35:50.293 go build -o ./bin/linux_ppc64le/gf main.go 2020-12-31 00:35:53.166 go build -o ./bin/linux_mips/gf main.go 2020-12-31 00:35:55.840 go build -o ./bin/linux_mipsle/gf main.go 2020-12-31 00:35:58.423 go build -o ./bin/linux_mips64/gf main.go 2020-12-31 00:36:01.062 go build -o ./bin/linux_mips64le/gf main.go 2020-12-31 00:36:03.502 go build -o ./bin/netbsd_386/gf main.go 2020-12-31 00:36:06.280 go build -o ./bin/netbsd_amd64/gf main.go 2020-12-31 00:36:09.332 go build -o ./bin/netbsd_arm/gf main.go 2020-12-31 00:36:11.811 go build -o ./bin/openbsd_386/gf main.go 2020-12-31 00:36:14.140 go build -o ./bin/openbsd_amd64/gf main.go 2020-12-31 00:36:17.859 go build -o ./bin/openbsd_arm/gf main.go 2020-12-31 00:36:20.327 go build -o ./bin/windows_386/gf.exe main.go 2020-12-31 00:36:22.994 go build -o ./bin/windows_amd64/gf.exe main.go 2020-12-31 00:36:25.795 done!