BuildIt is a simple and universal solution for automating build processes across multiple platforms, including Windows, GNU/Linux, Unix, and macOS. It reads a BuildFile
that defines functions for each platform, and then executes the corresponding commands in a platform-specific manner.
- Cross-Platform Support: Supports Windows, GNU/Linux, macOS and any Unix-like/based OS that Rust supports.
- Customizable Build Functions: Allows users to define platform-specific commands in a
BuildFile
. - Configurations: Uses a simple format to change specific things in the building process.
- Rust: The Rust programming language is required to build the application.
- Supported OS: Windows, GNU/Linux, macOS, or any Unix-like/based OS.
To install BuildIt on your system:
- AUR (for Arch GNU/Linux):
yay -S buildit-git
Follow these steps to get BuildIt up and running on your system:
-
Clone the repository:
git clone https://github.com/neoapps-dev/buildit.git
-
Navigate into the project directory:
cd buildit
-
Build the project using Cargo:
cargo build --release
-
Locate the executable in the
target/release
directory after the build is complete. -
Add to PATH: Add the
target/release/buildit
ortarget\release\buildit.exe
if you're on Windows to your PATH.
Once built and added to PATH, you can use BuildIt to automate build tasks on different platforms by specifying a function name.
buildit <FunctionName>
To execute a build
function defined in your BuildFile
, run:
buildit build
The BuildFile
is where platform-specific functions are defined. It uses a simple format to specify commands to be executed on different platforms.
# An Optional Config Function
config:buildit {
# Turns off using PowerShell on Windows. default: `false`
usePowershellOnWindows: false
# Turns off using PowerShell 7 instead of the default PowerShell 5 on Windows. default: `false`
usePowershell7: false
}
# Windows Script with a Batch Script
build:windows {
@echo off
echo "Building project on Windows"
cargo build --release
}
# GNU/Linux Script with Bash
build:lignux {
#!/bin/bash
echo "Building project on GNU/Linux"
cargo build --release
}
# macOS Script with zsh
build:macos {
#!/bin/zsh
echo "Building project on macOS"
cargo build --release
}
# Unix/BSD Script with sh
build:unix {
#!/bin/sh
echo "Hello from Unix!"
}
- The first part (
build:windows {
) specifies the function name (build
) and the platform (windows
). - The commands inside the curly braces are the steps that will be executed on the specified platform.
- Each platform-specific section can include its own commands, such as
cargo build
,gcc
, or any other shell command.
- Platform Detection: BuildIt detects the current platform (Windows, GNU/Linux, Unix, or macOS).
- Function Lookup: It looks for a function in the
BuildFile
that matches the specified function name. - Command Execution: The corresponding commands for the detected platform are extracted and executed in a temporary script (either
.bat
for Windows or.sh
for Unix-like systems). - Error Handling: If a function or platform-specific command is missing, BuildIt will output an error message and terminate the process.
If there are errors during command execution, BuildIt will display:
- An error message with the failed command.
- The specific error status for the command execution.
This project is licensed under the GNU General Public License v3.0 License.