pw_build: GN template to evaluate expressions in a file

Pigweed's GN build wraps all invocations of a Python script with a
Python runner. One of the runner's main purposes is to determine the
binary outputs of GN libraries and executables, as this information
is not available through GN itself.

Sometimes, it is cumbersome or unfeasible to pass information to a
script through its command line arguments. Instead, the necessary
data is often written to a file for the script to parse. However,
doing so from within GN bypasses Pigweed's Python runner binary
resolution. `bloat.py` is an example of this -- it needed to import
and run the resolution logic itself.

This adds a template which runs GN binary resolution on files, enabling
the above use case more generally through the build system.

Change-Id: I70ca6e33e974f4b73e723295997c6197b0e91e43
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/108990
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Brandon Vu <brandonvu@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
8 files changed
tree: 8eeb51a88530bdaf0f0180c3b168c8b8a2aeb38a
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. pw_allocator/
  7. pw_analog/
  8. pw_android_toolchain/
  9. pw_arduino_build/
  10. pw_assert/
  11. pw_assert_basic/
  12. pw_assert_log/
  13. pw_assert_tokenized/
  14. pw_assert_zephyr/
  15. pw_base64/
  16. pw_bloat/
  17. pw_blob_store/
  18. pw_bluetooth/
  19. pw_bluetooth_hci/
  20. pw_boot/
  21. pw_boot_cortex_m/
  22. pw_build/
  23. pw_build_info/
  24. pw_build_mcuxpresso/
  25. pw_bytes/
  26. pw_checksum/
  27. pw_chrono/
  28. pw_chrono_embos/
  29. pw_chrono_freertos/
  30. pw_chrono_stl/
  31. pw_chrono_threadx/
  32. pw_chrono_zephyr/
  33. pw_cli/
  34. pw_compilation_testing/
  35. pw_console/
  36. pw_containers/
  37. pw_cpu_exception/
  38. pw_cpu_exception_cortex_m/
  39. pw_crypto/
  40. pw_digital_io/
  41. pw_docgen/
  42. pw_doctor/
  43. pw_env_setup/
  44. pw_file/
  45. pw_function/
  46. pw_fuzzer/
  47. pw_hdlc/
  48. pw_hex_dump/
  49. pw_i2c/
  50. pw_i2c_mcuxpresso/
  51. pw_ide/
  52. pw_interrupt/
  53. pw_interrupt_cortex_m/
  54. pw_interrupt_zephyr/
  55. pw_kvs/
  56. pw_libc/
  57. pw_log/
  58. pw_log_android/
  59. pw_log_basic/
  60. pw_log_null/
  61. pw_log_rpc/
  62. pw_log_string/
  63. pw_log_tokenized/
  64. pw_log_zephyr/
  65. pw_malloc/
  66. pw_malloc_freelist/
  67. pw_metric/
  68. pw_minimal_cpp_stdlib/
  69. pw_module/
  70. pw_multisink/
  71. pw_package/
  72. pw_persistent_ram/
  73. pw_polyfill/
  74. pw_preprocessor/
  75. pw_presubmit/
  76. pw_protobuf/
  77. pw_protobuf_compiler/
  78. pw_random/
  79. pw_result/
  80. pw_ring_buffer/
  81. pw_router/
  82. pw_rpc/
  83. pw_rust/
  84. pw_snapshot/
  85. pw_software_update/
  86. pw_span/
  87. pw_spi/
  88. pw_status/
  89. pw_stm32cube_build/
  90. pw_stream/
  91. pw_string/
  92. pw_symbolizer/
  93. pw_sync/
  94. pw_sync_baremetal/
  95. pw_sync_embos/
  96. pw_sync_freertos/
  97. pw_sync_stl/
  98. pw_sync_threadx/
  99. pw_sync_zephyr/
  100. pw_sys_io/
  101. pw_sys_io_arduino/
  102. pw_sys_io_baremetal_lm3s6965evb/
  103. pw_sys_io_baremetal_stm32f429/
  104. pw_sys_io_emcraft_sf2/
  105. pw_sys_io_mcuxpresso/
  106. pw_sys_io_stdio/
  107. pw_sys_io_stm32cube/
  108. pw_sys_io_zephyr/
  109. pw_system/
  110. pw_target_runner/
  111. pw_thread/
  112. pw_thread_embos/
  113. pw_thread_freertos/
  114. pw_thread_stl/
  115. pw_thread_threadx/
  116. pw_tls_client/
  117. pw_tls_client_boringssl/
  118. pw_tls_client_mbedtls/
  119. pw_tokenizer/
  120. pw_tool/
  121. pw_toolchain/
  122. pw_trace/
  123. pw_trace_tokenized/
  124. pw_transfer/
  125. pw_unit_test/
  126. pw_varint/
  127. pw_watch/
  128. pw_web/
  129. pw_work_queue/
  130. targets/
  131. third_party/
  132. ts/
  133. zephyr/
  134. .bazelignore
  135. .bazelrc
  136. .clang-format
  137. .clang-tidy
  138. .eslintrc.json
  139. .gitattributes
  140. .gitignore
  141. .gn
  142. .prettierrc.js
  143. .pw_ide.yaml
  144. .pylintrc
  145. activate.bat
  146. Android.bp
  147. AUTHORS
  148. bootstrap.bat
  149. bootstrap.sh
  150. BUILD.bazel
  151. BUILD.gn
  152. BUILDCONFIG.gn
  153. CMakeLists.txt
  154. jest.config.ts
  155. Kconfig.zephyr
  156. LICENSE
  157. modules.gni
  158. OWNERS
  159. package-lock.json
  160. package.json
  161. PIGWEED_MODULES
  162. PW_PLUGINS
  163. README.md
  164. rollup.config.js
  165. tsconfig.json
  166. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links