Each project build is initialized by the
This class constructs the
triggers a new build and handles the build result. When a user executes the
composer create-project command, the bootstrapping process is triggered.
For each project type an appropriate template configuration exists. Project templates are distributed through external Composer packages. The configuration file describes how the project is being built and which (optional) properties are required to successfully run the build.
Read more at
Based on the loaded configuration, a new service container is built. Its configuration can be extended by each project type and contains all relevant services to successfully run the project generation.
Read more at
The whole project generation process is described by various build steps. Each step
provides two main methods:
run(Builder\BuildResult $buildResult): boolexecutes the step with the appropriate step configuration. It is responsible for performing I/O operations and finally applying the step to the build result.
revert(Builder\BuildResult $buildResult): voidis used once a step fails to be processed. It should provide a way to revert any changes made while processing the step, e.g. generating temporary files.
With the hydrated
Config object, a new
Generator is created. It is responsible for
running and reverting steps. If a processed step either returns
false or throws
an exception, all previously processed steps get reverted.
Read more at
Processing build steps.
Once all project build steps are successfully processed, the generated project is
cleaned up. This is done by the
which must not be referenced anywhere else than in the bootstrapping process. It is
responsible for assuring a clean project state. For this, all protected library
files necessary to successfully execute the project generation are now removed.
The cleanup step is the second last part in the whole project generation lifecycle. Thus, it is considered final and cannot be reverted. If an error occurs during clean up, it is recommended to re-run the project generation.
A template package can be configured to create a build artifact during project generation. Build artifacts are JSON files that contain various information about the project generation progress:
Used template package and provider
Generator package data
Final build properties
Applied build steps
List of processed files
Build artifacts are versioned. Depending on which version of the project builder was used, the artifact file structure might be different.
The complete JSON schema can be found at
Build artifacts are not generated by default. Instead, template packages must be
explicitly configured to create such files. This can be done by including the
GenerateBuildArtifactStep in the