colcon / colcon-mixin

Extension for colcon to read CLI mixins from files
http://colcon.readthedocs.io
Apache License 2.0
2 stars 7 forks source link

Add mixin compositing #39

Open AlexisTM opened 2 years ago

AlexisTM commented 2 years ago

Introduction

In our project, we would like to create mixins from other mixins.

What that means is: When using main-mixin, we want to use a set of mixins.

This allows for a single mixin to be defining, let's say: The output folders, the toolchain, specific build functions (prod build vs dev build), etc.

Example

Currently, I am making the main-mixin with all the default commands, output directory & co, but changing some arguments by using another mixin before it. For example:

{
    "build": {
        "legacy": {
            "cmake-args": [], // Many things here
            "install-base": "/opt/company/workspace/install/legacy",
            "build-base": "/opt/company/workspace/build/legacy",
            "log-base": "/opt/company/workspace/log/legacy",
        },
        "thirdparty": {
            "install-base": "/opt/company/thirdparty/install/legacy",
            "build-base": "/opt/company/thirdparty/build/legacy",
            "log-base": "/opt/company/thirdparty/log/legacy",
        },
    }
}

Would be called as: colcon build --mixin thirdparty legacy.

Prefered solution

{
    "build": {
        "main": {
            "cmake-args": [], // Many things here
            "mixin": ["legacy_folder"],
        },
        "debug": {
            "cmake-args": [], // Many things here
            "mixin": ["legacy_folder", "asan", "ubsan"],
        },
        "thirdparty": {
            "cmake-args": [], // Many things here
            "mixin": ["thirdparty_folder"],
        },
        "legacy_folder": {
            "install-base": "/opt/company/workspace/install/legacy",
            "build-base": "/opt/company/workspace/build/legacy",
            "log-base": "/opt/company/workspace/log/legacy",
        },
        "thirdparty_folder": {
            "install-base": "/opt/company/thirdparty/install/legacy",
            "build-base": "/opt/company/thirdparty/build/legacy",
            "log-base": "/opt/company/thirdparty/log/legacy",
        },
    }
}
giuliano-97 commented 4 months ago

oh this would be a very very useful feature, is there any plan in the roadmap to implement this?