1 Star 0 Fork 11

opsfast / baligo

forked from 江二十三 / baligo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ReadMe.md 3.11 KB
一键复制 编辑 原始数据 按行查看 历史
江二十三 提交于 2020-04-14 15:55 . bootstrap

Baligo - Bali re-implemented with golang

When developing a project based on Golang, although go build can be used to easily complete the build, I still encountered some troubles during packaging and other operations. Therefore, I implemented a cross-platform tool based on PowerShell Core bali, to simplify this process, as early as 2017, bali was born, and now has reached 2020, I also have a new understanding of project construction and packaging , So in order to improve bali written based on PowerShell, bali was rewritten using Golang in this project.

Usage

baligo usage:

Bali - Minimalist build and packaging tool
usage: bali <option> args ...
  -h|--help        Show usage text and quit
  -v|--version     Show version number and quit
  -V|--verbose     Make the operation more talkative
  -F|--force       Turn on force mode. eg: Overwrite configuration file
  -c|--cwd         Build dir. (Position 0, default cwd)
  -a|--arch        Build arch: amd64 386 arm arm64
  -t|--target      Build target: windows linux darwin ...
  -o|--out         Build output dir. default '$CWD/build'
  -z|--zip         Create archive file after successful build
  -m|--mkstgz      After successful build, create STGZ installation package
  -d|--dist        STGZ/TarGz package distribution directory

Build:

bali /path/to/project

Create Tar.gz:

bali /path/to/project -z

Create STGZ installation package, mainly used on Linux/macOS platform:

bali /path/to/project -m

Bali Project files

There are two types of Bali project files, including bali.json in the root directory of the project and balisrc.json file in the specific program of the project. Examples are as follows:

bali.json:

{
  // Package name
    "name": "baligo",
    // Package version
    "version": "1.0.0",
    // Project profiles
    "files": [
        {
            "path": "config/bali.json",
            "destination": "config"
        }
    ],
    // Sources dir
    "dirs": [
        "cmd/bali"
    ]
}

balisrc.json:

{
    // Binary name
    "name": "bali",
    // destination
    "destination": "bin",
    // binary version
    "version": "1.0.0",
    // Goflags, each one will be expanded using environment variables, BUILD_VERSION corresponds to version, BUILD_TIME is the RFC3339 format of local time
    // BUILD_GOVERSION is go version to remove the prefix
    // git commit information of BUILD_COMMIT project, use None instead for non-go repository.
    "goflags": [
        "-ldflags",
        "-X 'main.VERSION=$BUILD_VERSION' -X 'main.BUILDTIME=$BUILD_TIME' -X 'main.BUILDCOMMIT=$BUILD_COMMIT' -X 'main.GOVERSION=$BUILD_GOVERSION'"
    ]
}

Install Bali

You can download the pre-built binary directly after the project's Release is decompressed and install it, or you can compile the bootstrap by running the bootstrap file. With Golang configured on Linux / macOS, run:

./script/bootstrap.sh

Run under Windows:

pwsh ./script/bootstrap.ps1

Or it can be run in CMD:

script / bootstrap.bat

Anyway, it's relatively simple.

Go
1
https://gitee.com/opsfast/baligo.git
git@gitee.com:opsfast/baligo.git
opsfast
baligo
baligo
master

搜索帮助