BuildAMation

Last updated
BuildAMation
Developer(s) Mark Final
Initial releaseJanuary 7, 2018;5 years ago (2018-01-07)
Stable release
v2.0.0 / September 9, 2019;3 years ago (2019-09-09) [1]
Written in C#
Operating system Windows, macOS, Linux
Type Software development tools
License New BSD License
Website buildamation.com

BuildAMation (Bam) was a desktop multi-platform free and open-source software system for writing a single description of how to build software for desktop computers. It defines an extensible architecture based on the C#, exposing a declarative syntax to describe the dependencies between build-able modules. The core assembly exposes a generic dependency system, while packages of C# scripts extend support into multi-threaded command line builds, Microsoft Visual Studio project and solution generation, Apple Xcode project and workspace generation, and Makefile generation.

Features

BuildAMation supports building code for C/C++ and Objective C derivatives. It writes build output to a folder named the build root. This out-of-place build ensures that source trees are not modified by a build, and performing a clean build is as simple as deleting one directory.

BuildAMation is extensible by means of defining packages. [2] Packages are any directory containing a special bam folder, which contains files that BuildAMation uses. The files required are an XML file, called the package definition file, which resides directly in the bam folder, which describes the package dependencies. Also, in a Scripts subdirectory of bam, there are C# files that expose what the current package does. Packages can be logically grouped into repositories.

Example BuildAMation packages provided offer support for various compiler toolchains, and build modes. [2] Such toolchains are Microsoft Visual Studio, Clang for Apple, GCC for Linux, and multiple versions of each. Build modes define how BuildAMation generates its output. Native build mode runs a (multi-threaded) command line build, whereas the VSSolution build mode generates a Microsoft Visual Studio solution and projects.

Packages define modules. [2] Modules are either concrete buildable entities or provide an abstract base class for being able to build a class of entity. Each module may refer to a tool, which is what is used to perform the build on that module. A tool is another module, allowing tools to either be prebuilt (e.g. a compiler), or can be built as part of the current build. Tools define settings through a collection of interfaces, which expose named properties for each option to the tool. Settings have default values, but each module can individually override these settings through the use of patches. Patches can either be private (only applied to the current module) or public (applied to the current module and those modules that depend on it). Public patches allow such states as header include paths to be exposed, for example, from a module representing a static library.

Paths in BuildAMation scripts use macros [2] in order to maintain some level of abstraction and reuse. Macros are enclosed in $(macroname) markup. Predefined string functions can also be used in paths, and are enclosed in @funcname(...) markup. The combination of macros and functions allow modules to reuse and recombine parts of source paths to generate output paths.

Invocation

BuildAMation provides a command line utility called bam. This executable should be invoked in any package directory to build that package. [3]

Example script

Below is an example BuildAMation script from the suite of test packages provided with the release. It generates two dynamic libraries written in C, an executable that uses both libraries, and then collates the three binaries into a directory so that they are runnable.

usingBam.Core;namespaceTest13;publicsealedclassDynamicLibraryA:C.DynamicLibrary{protectedoverridevoidInit(Bam.Core.Moduleparent){base.Init(parent);this.CreateHeaderContainer("$(packagedir)/include/dynamicLibraryA.h");this.CreateCSourceContainer("$(packagedir)/source/dynamicLibraryA.c");this.PublicPatch((settings,appliedTo)=>{varcompiler=settingsasC.ICommonCompilerSettings;if(null!=compiler){compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/include"));}});if(this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)&&this.LinkerisVisualCCommon.LinkerBase){this.LinkAgainst<WindowsSDK.WindowsSDK>();}}}publicsealedclassDynamicLibraryB:C.DynamicLibrary{protectedoverridevoidInit(Bam.Core.Moduleparent){base.Init(parent);this.CreateHeaderContainer("$(packagedir)/include/dynamicLibraryB.h");this.CreateCSourceContainer("$(packagedir)/source/dynamicLibraryB.c");this.PublicPatch((settings,appliedTo)=>{varcompiler=settingsasC.ICommonCompilerSettings;if(null!=compiler){compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/include"));}});this.LinkAgainst<DynamicLibraryA>();if(this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)&&this.LinkerisVisualCCommon.LinkerBase){this.LinkAgainst<WindowsSDK.WindowsSDK>();}}}publicsealedclassApplication:C.ConsoleApplication{protectedoverridevoidInit(Bam.Core.Moduleparent){base.Init(parent);varsource=this.CreateCSourceContainer("$(packagedir)/source/main.c");this.PrivatePatch(settings=>{vargccLinker=settingsasGccCommon.ICommonLinkerSettings;if(null!=gccLinker){gccLinker.CanUseOrigin=true;gccLinker.RPath.AddUnique("$ORIGIN");}});this.CompileAndLinkAgainst<DynamicLibraryA>(source);this.CompileAndLinkAgainst<DynamicLibraryB>(source);if(this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)&&this.LinkerisVisualCCommon.LinkerBase){this.LinkAgainst<WindowsSDK.WindowsSDK>();}}}publicsealedclassRuntimePackage:Publisher.Collation{protectedoverridevoidInit(Bam.Core.Moduleparent){base.Init(parent);varapp=this.Include<Application>(C.ConsoleApplication.Key,EPublishingType.ConsoleApplication);this.Include<DynamicLibraryA>(C.DynamicLibrary.Key,".",app);this.Include<DynamicLibraryB>(C.DynamicLibrary.Key,".",app);}}

History

What would become BuildAMation begun development in 2010, but was then called Opus, and stored in Google Code. The name was changed in 2014 to BuildAMation to avoid confusion with the existing Opus Make, and moved to a GitHub project. A number of very early pre-releases were made.

The incentive for BuildAMation was to overcome several obstacles observed by Mark Final in his software engineering career; to write a single definition of how to build software but make use of a variety of build methods; to use a real programming language so that debugging and profiling the build system can leverage existing technologies, developer knowledge, and tools; to expose common compiler/linker features by name, rather than having to recall each toolchain syntax.

Early in 2015, the declarative syntax underwent a complete redesign after noticing the original syntax had some limitations. A cleaner, more extensible syntax is now in use, and has helped simplify and enhance existing package scripts.

See also

Related Research Articles

<span class="mw-page-title-main">Cygwin</span> Unix subsystem for Windows machines

Cygwin is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin's purpose is expressed in its motto: "Get that Linux feeling – on Windows".

<span class="mw-page-title-main">Dylan (programming language)</span>

Dylan is a multi-paradigm programming language that includes support for functional and object-oriented programming (OOP), and is dynamic and reflective while providing a programming model designed to support generating efficient machine code, including fine-grained control over dynamic and static behaviors. It was created in the early 1990s by a group led by Apple Computer.

<span class="mw-page-title-main">Oberon (programming language)</span>

Oberon is a general-purpose programming language first published in 1987 by Niklaus Wirth and the latest member of the Wirthian family of ALGOL-like languages. Oberon was the result of a concentrated effort to increase the power of Modula-2, the direct successor of Pascal, and simultaneously to reduce its complexity. Its principal new feature is the concept of type extension of record types. It permits constructing new data types on the basis of existing ones and to relate them, deviating from the dogma of strictly static typing of data. Type extension is Wirth's way of inheritance reflecting the viewpoint of the parent site. Oberon was developed as part of the implementation of an operating system, also named Oberon at ETH Zurich in Switzerland. The name is from the moon of the planet Uranus, named Oberon.

<span class="mw-page-title-main">Microsoft Visual C++</span> Integrated development environment product by Microsoft

Microsoft Visual C++ (MSVC) is a compiler for the C, C++, C++/CLI and C++/CX programming languages by Microsoft. MSVC is proprietary software; it was originally a standalone product but later became a part of Visual Studio and made available in both trialware and freeware forms. It features tools for developing and debugging C++ code, especially code written for the Windows API, DirectX and .NET.

<span class="mw-page-title-main">D (programming language)</span> Multi-paradigm system programming language

D, also known as dlang, is a multi-paradigm system programming language created by Walter Bright at Digital Mars and released in 2001. Andrei Alexandrescu joined the design and development effort in 2007. Though it originated as a re-engineering of C++, D is a profoundly different language —features of D can be considered streamlined and expanded-upon ideas from C++, however D also draws inspiration from other high-level programming languages, notably Java, Python, Ruby, C#, and Eiffel.

A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. For example, a compiler that runs on a PC but generates code that runs on an Android smartphone is a cross compiler.

MinGW, formerly mingw32, is a free and open source software development environment to create Microsoft Windows applications.

Harbour is a computer programming language, primarily used to create database/business programs. It is a modernized, open source and cross-platform version of the older Clipper system, which in turn developed from the dBase database market of the 1980s and 1990s.

<span class="mw-page-title-main">CMake</span> Cross-platform, compiler-independent build system generator

In software development, CMake is cross-platform free and open-source software for build automation, testing, packaging and installation of software by using a compiler-independent method. CMake is not a build system itself; it generates another system's build files. It supports directory hierarchies and applications that depend on multiple libraries. It is used in conjunction with native build environments such as Make, Qt Creator, Ninja, Android Studio, Apple's Xcode, and Microsoft Visual Studio. It has minimal dependencies, requiring only a C++ compiler on its own build system.

In computer programming, DLL injection is a technique used for running code within the address space of another process by forcing it to load a dynamic-link library. DLL injection is often used by external programs to influence the behavior of another program in a way its authors did not anticipate or intend. For example, the injected code could hook system function calls, or read the contents of password textboxes, which cannot be done the usual way. A program used to inject arbitrary code into arbitrary processes is called a DLL injector.

Classpath is a parameter in the Java Virtual Machine or the Java compiler that specifies the location of user-defined classes and packages. The parameter may be set either on the command-line, or through an environment variable.

A weak symbol denotes a specially annotated symbol during linking of Executable and Linkable Format (ELF) object files. By default, without any annotation, a symbol in an object file is strong. During linking, a strong symbol can override a weak symbol of the same name. In contrast, in the presence of two strong symbols by the same name, the linker resolves the symbol in favor of the first one found. This behavior allows an executable to override standard library functions, such as malloc(3). When linking a binary executable, a weakly declared symbol does not need a definition. In comparison, a declared strong symbol without a definition triggers an undefined symbol link error.

The Environment Modules system is a tool to help users manage their Unix or Linux shell environment, by allowing groups of related environment-variable settings to be made or removed dynamically.

<span class="mw-page-title-main">Vala (programming language)</span> Programming language

Vala is an object-oriented programming language with a self-hosting compiler that generates C code and uses the GObject system.

Cobra is a discontinued general-purpose, object-oriented programming language. Cobra is designed by Charles Esterbrook, and runs on the Microsoft .NET and Mono platforms. It is strongly influenced by Python, C#, Eiffel, Objective-C, and other programming languages. It supports both static and dynamic typing. It has support for unit tests and contracts. It has lambda expressions, closures, list comprehensions, and generators.

<span class="mw-page-title-main">FutureBASIC</span>

FutureBasic is a free BASIC compiler for Apple Inc.'s Macintosh.

Dart is a programming language designed by Lars Bak and Kasper Lund and developed by Google. The programming language can be used to develop web and mobile apps as well as server and desktop applications.

Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTSTEP operating system. Due to Apple macOS’s direct lineage from NeXTSTEP, Objective-C was the standard programming language used, supported, and promoted by Apple for developing macOS and iOS applications until the introduction of the Swift programming language in 2014.

<span class="mw-page-title-main">Nim (programming language)</span> Programming language

Nim is a general-purpose, multi-paradigm, statically typed, compiled high-level systems programming language, designed and developed by a team around Andreas Rumpf. Nim is designed to be "efficient, expressive, and elegant", supporting metaprogramming, functional, message passing, procedural, and object-oriented programming styles by providing several features such as compile time code generation, algebraic data types, a foreign function interface (FFI) with C, C++, Objective-C, and JavaScript, and supporting compiling to those same languages as intermediate representations.

eC is an object-oriented programming language, defined as a super-set of the C language.

References

  1. "Releases · markfinal/BuildAMation". github.com. BuildAMation. Archived from the original on 2020-11-30. Retrieved 2021-03-28.
  2. 1 2 3 4 Final, Mark. "BuildAMation key definitions". BuildAMation. Mark Final. Archived from the original on 19 January 2016. Retrieved 28 December 2015.
  3. Final, Mark. "BuildAMation - Running Bam". BuildAMation. Mark Final. Archived from the original on 19 January 2016. Retrieved 28 December 2015.