-
Notifications
You must be signed in to change notification settings - Fork 30
Example gn flow #882
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
base: feature/CRTP_lighting
Are you sure you want to change the base?
Example gn flow #882
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/usr/bin/env python3 | ||
| # | ||
| # Copyright (c) 2020 Project CHIP Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use it except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # Copies CustomAppTask.cpp and CustomAppTask.h from the template | ||
|
|
||
| import os | ||
| import shutil | ||
| import sys | ||
|
|
||
|
|
||
| def main(): | ||
| if len(sys.argv) != 3: | ||
| sys.stderr.write( | ||
| "usage: ensure_local_custom_app_task.py <platform_silabs_dir> <root_build_dir>\n" | ||
| ) | ||
| sys.exit(1) | ||
|
|
||
| base = os.getcwd() | ||
| platform_dir = os.path.normpath(os.path.abspath(os.path.join(base, sys.argv[1]))) | ||
| root_build_dir = os.path.normpath(os.path.abspath(os.path.join(base, sys.argv[2]))) | ||
|
|
||
| template_cpp = os.path.join(platform_dir, "CustomAppTask.cpp") | ||
| template_h = os.path.join(platform_dir, "CustomAppTask.h") | ||
| build_config_dir = os.path.join(root_build_dir, "config") | ||
| dest_cpp = os.path.join(build_config_dir, "CustomAppTask.cpp") | ||
| dest_h = os.path.join(build_config_dir, "CustomAppTask.h") | ||
|
|
||
| for path in (template_cpp, template_h): | ||
| if not os.path.isfile(path): | ||
| sys.stderr.write("template not found: %s\n" % path) | ||
| sys.exit(1) | ||
|
|
||
| # Only copy when build dir does not have a copy | ||
| if os.path.isfile(dest_cpp): | ||
| return | ||
miduggan24 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incomplete file existence check skips copying header fileMedium Severity The early-return guard only checks whether Additional Locations (1) |
||
|
|
||
| os.makedirs(build_config_dir, exist_ok=True) | ||
| shutil.copy2(template_cpp, dest_cpp) | ||
| shutil.copy2(template_h, dest_h) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,9 +14,12 @@ | |
|
|
||
| import("//build_overrides/build.gni") | ||
| import("//build_overrides/chip.gni") | ||
| import("//build_overrides/efr32_sdk.gni") | ||
| import("${build_root}/toolchain/flashable_executable.gni") | ||
| import("silabs_board.gni") | ||
|
|
||
| _custom_app_task_dep = "${silabs_sdk_build_root}:ensure_custom_app_task" | ||
|
|
||
| template("generate_rps_file") { | ||
| forward_variables_from(invoker, | ||
| [ | ||
|
|
@@ -103,10 +106,17 @@ template("silabs_executable") { | |
| ] | ||
| flashbundle_name = "" # Stop flashable_executable from making flashbundle. | ||
|
|
||
| # copy CustomAppTask from template into build directory | ||
| _custom_app_task_gen_dir = "${root_build_dir}/config" | ||
|
|
||
| # Target to generate the s37 file, flashing script, and flashbundle. | ||
| flash_target_name = target_name + ".flash_executable" | ||
| flashable_executable(flash_target_name) { | ||
| forward_variables_from(invoker, "*") | ||
|
|
||
| sources += [ "${_custom_app_task_gen_dir}/CustomAppTask.cpp" ] | ||
| include_dirs += [ _custom_app_task_gen_dir ] | ||
| deps += [ _custom_app_task_dep ] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CustomAppTask forced into all silabs apps breaks buildsHigh Severity
Additional Locations (1) |
||
| } | ||
|
|
||
| # Target to generate the hex file. | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.