checkpointedBuilds: add comments in the code
This commit is contained in:
parent
c85d18ff91
commit
ddfddf4b71
1 changed files with 14 additions and 0 deletions
|
@ -20,11 +20,21 @@ rec {
|
||||||
prepareIncrementalBuild = drv: drv.overrideAttrs (old: {
|
prepareIncrementalBuild = drv: drv.overrideAttrs (old: {
|
||||||
outputs = [ "out" ];
|
outputs = [ "out" ];
|
||||||
name = drv.name + "-incrementalBuildArtifacts";
|
name = drv.name + "-incrementalBuildArtifacts";
|
||||||
|
# To determine differences between the state of the build directory
|
||||||
|
# from an earlier build and a later one we store the state of the build
|
||||||
|
# directory before build, but after patch phases.
|
||||||
|
# This way, the same derivation can be used multiple times and only changes are detected.
|
||||||
|
# Additionally Removed files are handled correctly in later builds.
|
||||||
preBuild = (old.preBuild or "") + ''
|
preBuild = (old.preBuild or "") + ''
|
||||||
mkdir -p $out/sources
|
mkdir -p $out/sources
|
||||||
cp -r ./* $out/sources/
|
cp -r ./* $out/sources/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# After the build the build directory is copied again
|
||||||
|
# to get the output files.
|
||||||
|
# We copy the complete build folder, to take care for
|
||||||
|
# Build tools, building in the source directory, instead of
|
||||||
|
# having a build root directory, e.G the Linux kernel.
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/outputs
|
mkdir -p $out/outputs
|
||||||
cp -r ./* $out/outputs/
|
cp -r ./* $out/outputs/
|
||||||
|
@ -40,6 +50,10 @@ rec {
|
||||||
* in mkIncrementalBuild drv incrementalBuildArtifacts
|
* in mkIncrementalBuild drv incrementalBuildArtifacts
|
||||||
*/
|
*/
|
||||||
mkIncrementalBuild = drv: previousBuildArtifacts: drv.overrideAttrs (old: {
|
mkIncrementalBuild = drv: previousBuildArtifacts: drv.overrideAttrs (old: {
|
||||||
|
# The actual incremental build phase.
|
||||||
|
# We compare the changed sources from a previous build with the current and create a patch
|
||||||
|
# Afterwards we clean the build directory to copy the previous output files (Including the sources)
|
||||||
|
# The source difference patch is applied to get the latest changes again to allow short build times.
|
||||||
preBuild = (old.preBuild or "") + ''
|
preBuild = (old.preBuild or "") + ''
|
||||||
set +e
|
set +e
|
||||||
diff -ur ${previousBuildArtifacts}/sources ./ > sourceDifference.patch
|
diff -ur ${previousBuildArtifacts}/sources ./ > sourceDifference.patch
|
||||||
|
|
Loading…
Reference in a new issue