-
Notifications
You must be signed in to change notification settings - Fork 3k
Copying JSON files to pick up config for built libraries #2471
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
Conversation
This should hopefully address one of the issues raised in #2397 |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 659 All builds and test passed! |
The |
@@ -457,6 +457,7 @@ def build_library(src_paths, build_path, target, toolchain_name, | |||
toolchain.copy_files(resources.headers, build_path, resources=resources) | |||
toolchain.copy_files(resources.objects, build_path, resources=resources) | |||
toolchain.copy_files(resources.libraries, build_path, resources=resources) | |||
toolchain.copy_files(resources.json_files, build_path, resources=resources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the scanner finds more than one mbed_lib.json
file? For example, the one for core and the one for
rtos. Are those copied in separate directories? It's important to keep all the
mbed_lib.json` files found by the scanner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the paths for mbed_lib.json
files should be preserved, though I will double check this!
@bogdanm Thanks for the feedback. Perhaps the way we should do this then is provide an option to the |
The thing is that when building you need
The second option above is probably a bit easier to implement. |
We could always create |
This came up when building tests, but affects any library that's built that uses config and included as "source" with the mbed tools. JSON files are not copied by default when building a library, so when this is built it loses the config data associated with the library. This commit copies all JSON files into the build directory when building libraries. This leads to two mbed_config.h files existing if the build directories are different between the library and application build. This is the case when building tests, so an option build_library was added to remove the mbed_config.h file when compilation is done. This disabled by default when building libraries, but it is enabled when building tests.
06a24b5
to
33672b4
Compare
I've added an option to |
/morph test |
Instead, could you possibly delete the OTOH, 👍 on the docstring update. |
@theotherjimmy I did think about doing that. Although in |
I don't like it, but you're right it would be hacky either way. |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 689 Test failed! |
@theotherjimmy @bridadan What's the status of this? |
@bogdanm Are you happy with this? |
He's away for the next days. We shall together review and do +1 if it looks good and addresses comments within this patch. @theotherjimmy happy with this? |
This came up when building tests, but affects any library using config that's first built, then included as "source" with the mbed tools. JSON files are not copied by default when building a library, so when this is built it loses the config data associated with the library. This commit copies all JSON files into the build directory when building libraries.
There is a strange side effect now which is there are now multiple
mbed_config.h
files created during the build process: one when building the library and one when building the actual application. This isn't currently a problem since none of our code explicitly includesmbed_config
, but it does look strange. Is anyone aware of potential issues with this? If so, having the ability to prevent anmbed_config.h
from being created in the API may be a solution.cc @bogdanm @AlessandroA @screamerbg