Skip to content

Commit

Permalink
bali: 1.2.12 minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharlie committed Aug 4, 2021
1 parent 941d9a0 commit 8c1a77e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 165 deletions.
68 changes: 4 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,45 +76,15 @@ bali /path/to/project -p -d /tmp/output

## Bali build file format

You can choose to write project files in json or toml format.. There are two types of Bali build files. One is the project file `bali.json`(`bali.toml`), which is usually in the root directory of the project. It can also be used to create this file in other directories. When running the build, use `bali -w` or `bali /path/to/buildroot` specifies the directory where `bali.json` is located, you can also run `bali` in that directory; another build file is the `balisrc.json`(`balisrc.toml`) file under the specific program source code directory, `balisrc.json` There should be a `main` package in the directory where bali resolves `balisrc.json` by parsing `dirs` of `bali.json`, similar to the `add_subdirectory` instruction of `cmake`. Examples of both are as follows:
You can choose to write project files in json or toml format.. There are two types of Bali build files. One is the project file `bali.toml`, which is usually in the root directory of the project. It can also be used to create this file in other directories. When running the build, use `bali -w` or `bali /path/to/buildroot` specifies the directory where `bali.toml` is located, you can also run `bali` in that directory; another build file is the `balisrc.toml` file under the specific program source code directory, `balisrc.toml` There should be a `main` package in the directory where bali resolves `balisrc.toml` by parsing `dirs` of `bali.toml`, similar to the `add_subdirectory` instruction of `cmake`. Examples of both are as follows:

Project file `bali.json`:

```js
{
// Project Name
"name": "bali",
// Project Version
"version": "1.0.0",
// install files
"files": [
{
"path": "config/bali.json",
"destination": "config"
},
{
"path": "LICENSE",
// installation manual
"destination": "share",
// Rename files during installation/configuration
"newname": "LICENSE.bali",
// When creating the STGZ installation package, do not change the name, that is, if the corresponding file exists during installation, it will be overwritten, and it will not be overwritten by default.
"norename": true
}
],
// balisrc.json dirs
"dirs": [
"cmd/bali"
]
}
```

Project file `bali.toml`:

```toml
# https://toml.io/en/
name = "bali"
version = "1.2.11"
version = "1.2.12"
dirs = [
"cmd/bali", # dirs
]
Expand All @@ -137,43 +107,13 @@ Built-in environment variables:

Other environment variables can be used in goflags.

Program build file `balisrc.json`:

```js
{
// Binary file name, use directory name if it does not exist
"name": "bali",
// Description information, which is filled into the FileDescription of the PE file version information by default
"description": "Bali - Minimalist Golang build and packaging tool",
// installation manual
"destination": "bin",
// Version information, in goflags, you can expand $BUILD_VERSION
"version": "1.0.0",
// Binary symbolic links, like GCC-9
"links": [
"bin/baligo"
],
// Go compiler parameters, which will be expanded using ExpandEnv
"goflags": [
"-ldflags",
"-X 'main.VERSION=$BUILD_VERSION' -X 'main.BUILDTIME=$BUILD_TIME' -X 'main.BUILDBRANCH=$BUILD_BRANCH' -X 'main.BUILDCOMMIT=$BUILD_COMMIT' -X 'main.GOVERSION=$BUILD_GOVERSION'"
],
// Build Windows target, version information of PE file
"versioninfo": "res/versioninfo.json",
// Build Windows target, icon for PE file
"icon": "res/bali.ico",
// Build Windows target, application list of PE files
"manifest": "res/bali.manifest"
}
```

Program build file `balisrc.toml`:

```toml
name = "bali"
description = "Bali - Minimalist Golang build and packaging tool"
destination = "bin"
version = "1.2.11"
version = "1.2.12"
versioninfo = "res/versioninfo.json"
icon = "res/bali.ico"
manifest = "res/bali.manifest"
Expand Down Expand Up @@ -231,7 +171,7 @@ goflags = [
}
```

Bali integrates [`goversioninfo`](https://github.com/josephspurrier/goversioninfo). When the target is Windows, it can embed version information into the executable program. The `versioninfo` field is similar to the `goversioninfo` project. But more loosely, some specific values, such as version, description will be filled with the value of `bali.json/balisrc.json`, and `icon`/`manifest` will override `versioninfo.json`.
Bali integrates [`goversioninfo`](https://github.com/josephspurrier/goversioninfo). When the target is Windows, it can embed version information into the executable program. The `versioninfo` field is similar to the `goversioninfo` project. But more loosely, some specific values, such as version, description will be filled with the value of `bali.toml/balisrc.toml`, and `icon`/`manifest` will override `versioninfo.json`.

The benefits of adding a reference program manifest are self-evident. For example, Windows UAC privilege escalation, Windows 10 long path support (ie path support> 260 characters), Windows Vista style controls, TaskDialog, DPI settings, etc. all need to modify the application manifest.

Expand Down
71 changes: 5 additions & 66 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,45 +68,14 @@ bali /path/to/project -p -d /tmp/output

## Bali 构建文件格式

Bali 同时支持 TOML 或者 JSON 格式的项目文件,JSON 使用内置解析不支持注释,TOML 支持注释。Bali 构建文件有两种,一种是项目文件 `bali.json`(`bali.toml`),通常在项目根目录下,用于也可以在其他目录创建此文件,运行构建时,通过 `bali -w` 或者 `bali /path/to/buildroot` 指定 `bali.json` 所在目录,也可以在那个目录下运行 `bali`;另一种构建文件是特定程序源码目录下的 `balisrc.json`(`balisrc.toml`) 文件,`balisrc.json` 所在目录应当存在 `main` 包,bali 通过解析 `bali.json``dirs` 解析 `balisrc.json`,与 `cmake``add_subdirectory` 指令类似。二者示例如下:

项目文件 `bali.json`:

```js
{
// name 用于项目打包命名
"name": "bali",
// 用于打包的版本
"version": "1.0.0",
// bali 配置文件等
"files": [
{
"path": "config/bali.json",
"destination": "config"
},
{
"path": "LICENSE",
// 安装目录
"destination": "share",
// 安装/配置时重命名文件
"newname": "LICENSE.bali",
// 创建 STGZ 安装包时,不改名,即安装时如果存在相应文件则会覆盖,默认不会覆盖
"norename": true
}
],
// 程序相对目录
"dirs": [
"cmd/bali"
]
}
```
Bali 同时支持 TOML 或者 JSON 格式的项目文件,JSON 使用内置解析不支持注释,TOML 支持注释。Bali 构建文件有两种,一种是项目文件 `bali.toml`,通常在项目根目录下,用于也可以在其他目录创建此文件,运行构建时,通过 `bali -w` 或者 `bali /path/to/buildroot` 指定 `bali.toml` 所在目录,也可以在那个目录下运行 `bali`;另一种构建文件是特定程序源码目录下的 `balisrc.toml` 文件,`balisrc.toml` 所在目录应当存在 `main` 包,bali 通过解析 `bali.toml``dirs` 解析 `balisrc.toml`,与 `cmake``add_subdirectory` 指令类似。二者示例如下:

项目文件 `bali.toml`:

```toml
# https://toml.io/en/
name = "bali"
version = "1.2.11"
version = "1.2.12"
dirs = [
"cmd/bali", # dirs
]
Expand All @@ -119,43 +88,13 @@ norename = true

```

程序构建文件 `balisrc.json`:

```js
{
// 二进制文件名称,不存在时使用目录名
"name": "bali",
// 描述信息,默认填充到 PE 文件版本信息的 FileDescription
"description": "Bali - Minimalist Golang build and packaging tool",
// 安装目录
"destination": "bin",
// 版本信息,在 goflags 中,可以推导 $BUILD_VERSION
"version": "1.0.0",
// 二进制的符号链接,比如在 GCC/Clang 编译后,程序为 GCC-9 然后会创建 GCC 的符号链接。
"links": [
"bin/baligo"
],
// Go 编译器的参数,这些参数会使用 ExpandEnv 展开
"goflags": [
"-ldflags",
"-X 'main.VERSION=$BUILD_VERSION' -X 'main.BUILDTIME=$BUILD_TIME' -X 'main.BUILDBRANCH=$BUILD_BRANCH' -X 'main.BUILDCOMMIT=$BUILD_COMMIT' -X 'main.GOVERSION=$BUILD_GOVERSION'"
],
// 构建 Windows 目标,PE 文件的版本信息
"versioninfo": "res/versioninfo.json",
// 构建 Windows 目标,PE 文件的图标
"icon": "res/bali.ico",
// 构建 Windows 目标,PE 文件的应用程序清单
"manifest": "res/bali.manifest"
}
```

程序构建文件 `balisrc.toml`:

```toml
name = "bali"
description = "Bali - Minimalist Golang build and packaging tool"
destination = "bin"
version = "1.2.11"
version = "1.2.12"
versioninfo = "res/versioninfo.json"
icon = "res/bali.ico"
manifest = "res/bali.manifest"
Expand All @@ -169,7 +108,7 @@ goflags = [

内置环境变量:

+ `BUILD_VERSION` 由 balisrc.json/balisrc.toml 的 `version` 字段填充
+ `BUILD_VERSION` 由 balisrc.toml 的 `version` 字段填充
+ `BUILD_TIME` 由构建时间按照 `RFC3339` 格式化后填充
+ `BUILD_COMMIT` 由存储库(为 git 存储库时) 的 commit id 填充
+ `BUILD_GOVERSION``go version` 输出(删除了 `go version` 前缀)填充
Expand Down Expand Up @@ -223,7 +162,7 @@ goflags = [
}
```

Bali 整合了 [`goversioninfo`](https://github.com/josephspurrier/goversioninfo),在目标为 Windows 时,能够将版本信息嵌入到可执行程序中,`versioninfo` 字段与 `goversioninfo` 项目类似,但更宽松,一些特定的值,比如版本,描述会使用 `bali.json/balisrc.json` 的值填充过去,`icon`/`manifest` 则会覆盖 `versioninfo.json`
Bali 整合了 [`goversioninfo`](https://github.com/josephspurrier/goversioninfo),在目标为 Windows 时,能够将版本信息嵌入到可执行程序中,`versioninfo` 字段与 `goversioninfo` 项目类似,但更宽松,一些特定的值,比如版本,描述会使用 `bali.toml/balisrc.toml` 的值填充过去,`icon`/`manifest` 则会覆盖 `versioninfo.json`

添加引用程序清单的好处不言而喻,比如 Windows 的 UAC 提权,Windows 10 长路经支持(即路径支持 >260 字符),Windows Vista 风格控件,TaskDialog,DPI 设置等都需要修改应用程序清单。

Expand Down
15 changes: 0 additions & 15 deletions bali.json

This file was deleted.

4 changes: 2 additions & 2 deletions bali.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# https://toml.io/en/
name = "bali"
version = "1.2.11"
version = "1.2.12"
dirs = [
"cmd/bali", # dirs
]
]
destination = "Bali - Minimalist Golang build and packaging tool"

[[files]]
Expand Down
16 changes: 0 additions & 16 deletions cmd/bali/balisrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/bali/balisrc.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "bali"
description = "Bali - Minimalist Golang build and packaging tool"
destination = "bin"
version = "1.2.11"
version = "1.2.12"
versioninfo = "res/versioninfo.json"
icon = "res/bali.ico"
manifest = "res/bali.manifest"
Expand Down
2 changes: 1 addition & 1 deletion cmd/bali/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (

// version info
var (
VERSION = "1.2.11"
VERSION = "1.2.12"
BUILDTIME string = "NONE"
BUILDCOMMIT string = "NONE"
BUILDBRANCH string = "NONE"
Expand Down

0 comments on commit 8c1a77e

Please sign in to comment.