Google is developing a build system , aimed at replacing the old Android build scripts based on the make utility. Soong proposes a simple declarative method for building modules, in files with the extension '.bp' (blueprints). The file format is similar to JSON and attempts to replicate the syntax and semantics of build files . The code is written in Go and distributed under the Apache 2.0 license.
Soong build files do not support conditional operators and branching expressions but only describe the project structure, the modules to be built, and their dependencies. The files to be built are defined using patterns and grouped into packages, each of which represents a collection of files with specified dependencies. Variable definitions are possible. Variables and properties are strictly typed (the type of variables is chosen dynamically on first assignment, while the types of properties are determined statically based on the module type). Complex elements of the build logic are extracted into handlers, in Go.
Soong intertwines with a more general project , within which a meta-build system not tied to Android is being developed, which generates build scripts based on files with declarative module descriptions (a replacement for make), describing the commands to execute for building and dependencies. Instead of using complex rules or a domain-specific language to define build logic, Blueprints employ project-specific handlers in Go (Soong is essentially a set of such handlers for Android).
This approach allows large and heterogeneous projects like Android to implement complex elements of build logic in high-level programming code while maintaining the ability to make changes related to the organization of the build and project structure using a simple declarative syntax. For example, in Soong, compiler flag selection is performed by the handler , while hardware architecture-specific settings are processed by the handler , but the file binding with the code is done in the file ".bp".
cc_library {
…
srcs: ["generic.cpp"],
arch: {
arm: {
srcs: ["arm.cpp"],
},
x86: {
srcs: ["x86.cpp"],
},
},
}
Source: opennet.ru
