go-build
is an engineering build tool designed to handle complex engineering build and packaging tasks. It supports Windows, Linux, and macOS operating systems. The tool aims to simplify the build process across multiple platforms, making engineering builds more consistent and efficient.
Below is an example of a configuration file .build.txt
, which includes environment variables and build commands for different operating systems:
[win.env]
set JAVA_HOME=D:\java\jdk1.8.0_121
[win.build]
mvn clean package -DskipTests -Pproduction
[mac.env]
export JAVA_HOME=~/java/jdk1.8.0_121
[mac.build]
mvn clean package -DskipTests -Pproduction
[linux.env]
export JAVA_HOME=~/usr/java/jdk1.8.0_121
[linux.build]
mvn clean package -DskipTests -Pproduction
In engineering development, different operating systems, programming languages, and project management tools have their own build commands, making the build process complex and error-prone.
- Place the build commands in a configuration file.
- Write a program to read and execute the commands line by line.
- Handle environment variable settings and execution errors.
The tool has been developed and is open source. Follow these steps to use it:
- Visit the open source repository: go-build GitHub Repository
- Download the latest version: v1.0.0 Release
- Add the
build
command to your systemPATH
environment variable, e.g.,d:\bin
. - Create a configuration file
build.txt
with content similar to the example above. - Execute the command
build .build.txt
to build and package your project.
Assume your configuration file is named .build.txt
, with the following content:
[win.env]
set JAVA_HOME=D:\java\jdk1.8.0_121
[win.build]
mvn clean package -DskipTests -Pproduction
[mac.env]
export JAVA_HOME=~/java/jdk1.8.0_121
[mac.build]
mvn clean package -DskipTests -Pproduction
[linux.env]
export JAVA_HOME=~/usr/java/jdk1.8.0_121
[linux.build]
mvn clean package -DskipTests -Pproduction
You can run the following command in the command line:
build .build.txt
This command will read the environment variables and build commands from the configuration file, set the environment variables based on the current operating system, and execute the corresponding build commands.
We welcome feedback and suggestions for the go-build
tool. You can submit issues or pull requests through GitHub.
Thank you for using go-build
. We hope it makes your development work easier and more efficient!