Download the PHP package nowise/uup-build-system without Composer
On this page you can find all versions of the php package nowise/uup-build-system. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nowise/uup-build-system
More information about nowise/uup-build-system
Files in nowise/uup-build-system
Package uup-build-system
Short Description Target build system similar to make with complex dependency tree
License Apache-2.0
Homepage https://nowise.se/oss/uup/build-system
Informations about the package uup-build-system
UUP-BUILD-SYSTEM
A build system similar to make with complex dependency tree. Declare goals (target and dependencies) and evaluate the dependency tree to rebuild targets in correct order.
Goals are either defined programmatically in code or declared in one or more make-files. The remaining job for users are to implement the target interface with some concrete actions. Use the TargetBase class to simplify that task.
GETTING STARTED:
It's recommended to work with files, even though this README tries to describe both modes as simple and complete as possible.
GENERATE FILES
- Generate one or more make files using the
generate
option. - Changing default namespace and add target classes.
You can then use the make command (pbsmake) to evaluate targets. Use type=json if you prefer to work with JSON-style files.
PROGRAMMATICALLY
- Begin by creating a dependency tree.
- Add one or more goal definitions. A goal definition consists of the target (code to run) and a list of dependencies.
- Get the node evaluator for complete tree or a child node.
- Call rebuild() to build that node, its dependencies and child nodes.
Hint: The dependency tree can be obtained from a (make/json) file reader.
TARGETS:
A target has a unique name and description as properties. The class provides the isUpdated()
for
checking if a target is up-to-date and rebuild()
to build it. The name is used for other targets to express their
dependency on this target.
GOALS:
Goals are defined by its target and a list of zero or more dependencies. Dependencies are strings matching other targets (goals) by their name. A goal is what's used for constructing the dependency tree.
DECLARATIONS:
How everything should be build can either be declared programmatically in code, static declared with files or a mixture of them.
NODES & TREES:
The dependency tree can be constructed manually by adding child nodes (dependencies) and then using the node evaluator on the root node for rebuilding the manual crafted tree. More convenient is to use the dependency tree, adding nodes to it either as dependency nodes or using goal definitions.
FILES:
Dependencies can be declared in text files which are consumed by a file reader. The same reader can be used for reading rules from multiple input files:
Currently, JSON is the supported file formats.
MAKEFILE
An example of makefile declaration using the test target class looks like this:
Following conventions, the left-hand side is the rule target and right-hand side list dependencies. The Target class implements the PHP code to execute for that rule target. The T5 target depends on T2 and T3, while T6 and T7 both depends on T5.
The target class will be constructed with variadic number of arguments. It's thus possible to use the same target class in multiple rules and define different behavior from arguments.
Target name and list of dependencies will be passed to the target class instance.
In reality, the Target class will be replaced by different classes. This is just an example makefile purely for testing.
OPTIONS
Optional arguments are not limited to simple scalar values. Use standard JSON encoding for passing complex object structures as optional arguments that will be decoded into standard associative arrays.
NAMESPACES
The default namespace is declared in the makefile. If classes is placed in multiple namespaces, either declare them fully qualified or split declarations in multiple file, each with their own default namespace.
IMPLICIT
Target classes can be deduced from make rule (in Makefile or JSON file). In this case, the left-/right-hand target should be a class. The example Makefile above then becomes:
Each T* class is present in this test namespace and can be tested with:
It's possible to mix rules with implicit/explicit target classes. Classes don't have to be defined in the namespace declared in the make file, use fully qualified class name if present in some other namespace.
PROBING
Invoking the pbsmake-command without a list of makefiles will cause script to probe current directory for some standard
named files: build.make
, build.json
, makefile
, makefile.txt
and *.pbs
. The default type is assumed to be
makefiles.
Pass recursive option (-r) to enable recursive scan for makefiles starting in current directory.
VERBOSE & DEBUG
The superglobal environment ($_ENV
) gets populated with DEBUG and VERBOSE values from make files.
For convenience, either true/false, yes/no, on/off and 0/1 are recognised as boolean value.
PHONY TARGETS
Phony target function as virtual dependencies for zero or more real targets. It's easiest to explain this with an simple example.
Let's say that we define this list of phony targets:
We can then i.e. set T1 and T2 to depend on the phony all
target:
Evaluate the dependency tree starting from the builtin root-node will list:
As expected, both T1 and T2 are immediate child of the phony target all
. Evaluating target all will rebuild both of
them along with their dependencies.
Notice:
If target
option isn't specified, then the builtin root
target will be evaluated. In the example above, it will
cause clean
and dist-clean
to be evaluated too.
SPECIAL TARGETS
One common task is to execute shell commands. A builtin target exists for this:
Wrap commands within @(...)
or @@(...)
to suppress output.
Another task is to run arbitrary PHP code. Supplied code will be executed using eval()
, make sure to not use this
feature with external input.
See the unit tests for further examples.
EVALUATION:
The tree is usually completely rebuilt by evaluating its root node:
It's also possible to obtain one of the tree nodes from the registry and evaluate it:
EXAMPLES:
The example directory contains some script for constructing an example build tree. Evaluating the T5 node should rebuild T1, T2, T3, T5, T7 and T8 in that order (unless dependency node are already up-to-date).
Run them from command line:
EXCLUDE CHILD TARGETS:
The default is to build a target node with all its dependency and child nodes. For a more standard make mode, building child nodes can be disabled:
Then the output will be:
MAKE COMMAND:
The make command pbsmake can be used for executing makefiles and makes it easy to get started. Like standard make, an optional target can be passed:
Multiple makefiles can be processed. Currently, a limitation is that all makefiles must be of same type.
All versions of uup-build-system with dependencies
ext-json Version *
nowise/uup-application Version ^1.0
nowise/uup-application-options Version ^1.0