WARNING: [[Work in Progress]] ozibuild has no releases yet.
Build anything with organized scripts.
ozibuild is a set of simplified functions on top of nodejs,
which enables using JavaScript as a scripting language for generic builds.
Similar to make, one of the core functions of ozibuild is to execute
shell commands using input files to produce output(s), and only repeat the
execution when input files change.
Aligned with modern javascript, output is a Promise, which allows representing
natively complex dependency graphs.
Additional support provided out-of-the-box by ozibuild includes:
ozibuild relies on nodejs for the scripting and task execution,
so it requires that nodejs and npm are already installed.
In addition, ozibuild assumes the execution in the context of a
npm package (i.e. package.json), even for building applications that
do not use javascript, npm or nodejs.
ozibuild is provided through multiple npm packages:
# Install ozibuild as development dependency, for build rules implementation.
npm install --save-dev @ozibuild/core @ozibuild/make
# Install ozibuild binary for triggering the build functions.
# Global installation makes the usage more convenient:
npm install -g @ozibuild/cli
ozibuild scripts uses source reference and runs commands.
ozibuild scripts are regular javascript, which exports async build functions.
// ./ozibuild.mjs
import {sourceDirContext} from '@ozibuild/core/index.js';
import {buildCmd} from '@ozibuild/make/index.js';
const ctx = sourceDirContext(import.meta.dirname);
// Implement a build task by exporting a standard async function.
export async function helloWorld() {
return buildCmd(ctx, {bin: 'echo', args: ['Hello', ', ', 'World!']});
}
Initialize ozibuild root once:
ozibuild root .
Use ozibuild binary to "build" the task implemented by the async function.
# Runs the build task "helloWorld" in source directory "." in either of the following
ozibuild ./oribuild.mjs:helloWorld
ozibuild oribuild.mjs:helloWorld
ozibuild .:helloWorld
ozibuild :helloWorld
ozibuild ::all
Root of a ozibuild source hierarchy is defined as the closest ancestor
having a .ozibuild directory. Initialized the root with the following command:
ozibuild root .
Within root the source directory can have any structure, root is relevant for:
.ozibuild directory for logs and metadata (e.g. files checksums)It is recommended that the root specification is not included in the source repository, and only used for building purposes.
While the output of the build process can be defined in any arbitrary location,
ozibuild provides support for generating files in an outdir hierarchy which
mirrors the source hierarchy. The outdir can be specified as a flag,
default value is dist sub-folder in the root directory:
ozibuild --outdir <dir> ...
ozibuild consists of the following sub-packages and concepts:
@ozibuild/core - core functionality of ozibuild
@ozibuild/make - make like functionality,
foundational blocks of building withing shell commands
@ozibuild/cli - command line interface for running builds
Additional packages provide useful tools and utilities for specific use cases:
@ozibuild/cpp - minimal support for C++ builds@ozibuild/web - (limited) support for building web applicationsozibuild is designed with the principle that build tasks are secondary to an application business logic, which implies:
Other design principles in ozibuild includes: