Skip to content

build_mbed_libs is now aware of the configuration #2417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tools/build_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import fnmatch

from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException, ToolException, InvalidReleaseTargetException
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON, MBED_CONFIG_FILE
from tools.targets import TARGET_NAMES, TARGET_MAP
from tools.libraries import Library
from tools.toolchains import TOOLCHAIN_CLASSES
Expand Down Expand Up @@ -674,6 +674,12 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
toolchain.jobs = jobs
toolchain.build_all = clean

# Take into account the library configuration (MBED_CONFIG_FILE)
config = Config(target)
toolchain.config = config
config.add_config_files([MBED_CONFIG_FILE])
toolchain.set_config_data(toolchain.config.get_config_data())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really nice if the

toolchain.config = config

line did this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That feels a bit on the dark magic side :). Initially, config was not supposed to be an attribute of toolchain at all. Commit ac86584 added it as a convenience, so that you don't have to pass around config anymore, just toolchain. I'd keep it just as a convenience and make the calls to set_config_data explicit, so that it's clear what happens in the code.


# Source and Build Paths
BUILD_TARGET = join(MBED_LIBRARIES, "TARGET_" + target.name)
BUILD_TOOLCHAIN = join(BUILD_TARGET, "TOOLCHAIN_" + toolchain.name)
Expand Down
2 changes: 2 additions & 0 deletions tools/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

MBED_LIBRARIES = join(BUILD_DIR, "mbed")

MBED_CONFIG_FILE = join(ROOT, "mbed_lib.json")

# Tests
TEST_DIR = join(LIB_DIR, "tests")
HOST_TESTS = join(ROOT, "tools", "host_tests")
Expand Down