modm-io / lbuild

lbuild: a generic, modular code generator in Python 3
https://pypi.org/project/lbuild
BSD 2-Clause "Simplified" License
37 stars 12 forks source link

Allow declaring build order within subtrees #47

Closed salkinium closed 5 years ago

salkinium commented 5 years ago

Some post-build steps actually need to be run last, because other post-build steps add things to the buildlog (🤦‍♂).

This still builds submodules before their parent modules, but the build is grouped into the top-level modules by the sum of all selected submodule tree orders (0 being the neutral default).

Usage:

def init(module):
    module.name = ":build"
    # build this subtree really, realllly last
    module.order = sys.maxsize

In modm this allows the :build submodule tree to always be run last.

...
[INFO] lbuild.module: Build modm:debug
[INFO] lbuild.module: Build modm:driver
[INFO] lbuild.module: Build modm:build:scons
[INFO] lbuild.module: Build modm:build
[INFO] lbuild.repository: Build modm
[INFO] lbuild.module: Post-Build modm:platform:core
[INFO] lbuild.module: Post-Build modm:docs
[INFO] lbuild.module: Post-Build modm:build:scons
[INFO] lbuild.module: Post-Build modm:build

@dergraaf How evil is this? cc @nesos this will help with https://github.com/modm-io/modm/pull/307

salkinium commented 5 years ago

Thinking some more about this, this isn't pretty, but every other solution (like "preregistering" operations on the buildlog during the build step) is significantly worse.