• Duncan Coutts's avatar
    Add new style project building · a6526403
    Duncan Coutts authored and Mikhail Glushenkov's avatar Mikhail Glushenkov committed
    This stage takes the ElaboratedInstallPlan and executes it. It does it
    in two passes.
    
    The first pass is the "dry run" pass where we work out which packages
    and components within packages we actually need to build. If we are in
    fact in --dry-run mode then of course this is the only pass we run, we
    have enough info after this to accurately report on what we would do.
    
    The first pass does the file monitor change stuff, which checks if
    package config has changed and probes for package file changes. Based on
    this we make a note of which phase of the build we would start at, up to
    and including skipping building that package entirely. In the latter
    case we replace the Configured package by a corresponding Installed
    package.
    
    The first pass also prunes the ElaboratedInstallPlan based on the
    targets that the user actually wants to build. For example we solve and
    plan on the basis that the user might want to run the test suites or
    benchmarks, but that doesn't mean we want to build them all the time
    (they'll usually pull in additional deps). So there's a moderately
    complex pass where we keep just the packages and components that are
    needed to build the target components.
    
    The first pass is moderately complicated but it makes no state changes
    and just returns the updated ElaboratedInstallPlan, so it should make
    things easier to debug.
    
    The second phase has very little logic it just does what its told based
    on all the earlier passes. For each package the dry run pass has worked
    out which build step to start with, e.g. downloading, configuring or
    building.
    
    The major cases the build phase has to deal with are packages that will
    be built and installed to the store, vs packages that are local and so
    are built inplace. It is only the latter that need all the complex
    rebuild checking. In both cases all the "setup $cmd" flags are
    calculated by the planning phase and we just do as we're told.
    
    (cherry picked from commit 300d9bad)
    a6526403