@btc-vision/bitcoin 6.4.10 → 6.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/.babelrc +4 -4
  2. package/.mocharc.json +13 -13
  3. package/.prettierrc.json +12 -12
  4. package/CHANGELOG.md +403 -403
  5. package/CONTRIBUTING.md +83 -83
  6. package/LICENSE +21 -21
  7. package/README.md +201 -201
  8. package/cjs/package.json +3 -3
  9. package/gulpfile.js +42 -42
  10. package/package.json +150 -150
  11. package/src/bip66.ts +107 -107
  12. package/src/block.ts +233 -233
  13. package/src/bufferutils.ts +188 -188
  14. package/src/crypto.ts +108 -108
  15. package/src/ecc_lib.ts +94 -94
  16. package/src/hooks/AdvancedSignatureManager.ts +104 -104
  17. package/src/hooks/SignatureManager.ts +84 -84
  18. package/src/index.ts +105 -105
  19. package/src/merkle.ts +31 -31
  20. package/src/opcodes.ts +280 -280
  21. package/src/payments/bip341.ts +140 -140
  22. package/src/payments/embed.ts +61 -61
  23. package/src/payments/index.ts +172 -172
  24. package/src/payments/lazy.ts +28 -28
  25. package/src/payments/p2ms.ts +156 -156
  26. package/src/payments/p2op.ts +195 -195
  27. package/src/payments/p2pk.ts +93 -93
  28. package/src/payments/p2pkh.ts +214 -214
  29. package/src/payments/p2tr.ts +309 -309
  30. package/src/psbt/bip371.ts +441 -441
  31. package/src/push_data.ts +97 -97
  32. package/src/script.ts +247 -247
  33. package/src/script_number.ts +72 -72
  34. package/src/script_signature.ts +91 -91
  35. package/src/transaction.ts +656 -656
  36. package/test/address.spec.ts +155 -155
  37. package/test/bitcoin.core.spec.ts +212 -212
  38. package/test/block.spec.ts +171 -171
  39. package/test/bufferutils.spec.ts +450 -450
  40. package/test/crypto.spec.ts +49 -49
  41. package/test/fixtures/address.json +329 -329
  42. package/test/fixtures/block.json +148 -148
  43. package/test/fixtures/bufferutils.json +102 -102
  44. package/test/fixtures/core/README.md +26 -26
  45. package/test/fixtures/core/base58_encode_decode.json +50 -50
  46. package/test/fixtures/core/base58_keys_invalid.json +152 -152
  47. package/test/fixtures/core/base58_keys_valid.json +452 -452
  48. package/test/fixtures/core/blocks.json +27 -27
  49. package/test/fixtures/core/sig_canonical.json +7 -7
  50. package/test/fixtures/core/sig_noncanonical.json +33 -33
  51. package/test/fixtures/core/sighash.json +3505 -3505
  52. package/test/fixtures/core/tx_valid.json +2023 -2023
  53. package/test/fixtures/crypto.json +43 -43
  54. package/test/fixtures/ecdsa.json +217 -217
  55. package/test/fixtures/ecpair.json +141 -141
  56. package/test/fixtures/embed.json +108 -108
  57. package/test/fixtures/p2ms.json +434 -434
  58. package/test/fixtures/p2pk.json +179 -179
  59. package/test/fixtures/p2pkh.json +276 -276
  60. package/test/fixtures/p2sh.json +508 -508
  61. package/test/fixtures/p2tr.json +1198 -1198
  62. package/test/fixtures/p2wpkh.json +290 -290
  63. package/test/fixtures/p2wsh.json +489 -489
  64. package/test/fixtures/psbt.json +924 -924
  65. package/test/fixtures/script.json +465 -465
  66. package/test/fixtures/script_number.json +225 -225
  67. package/test/fixtures/signature.json +140 -140
  68. package/test/fixtures/transaction.json +916 -916
  69. package/test/integration/_regtest.ts +6 -6
  70. package/test/integration/addresses.spec.ts +142 -142
  71. package/test/integration/bip32.spec.ts +130 -130
  72. package/test/integration/blocks.spec.ts +28 -28
  73. package/test/integration/cltv.spec.ts +241 -241
  74. package/test/integration/csv.spec.ts +452 -452
  75. package/test/integration/payments.spec.ts +110 -110
  76. package/test/integration/taproot.spec.ts +663 -663
  77. package/test/integration/transactions.spec.ts +668 -668
  78. package/test/payments.spec.ts +114 -114
  79. package/test/payments.utils.ts +165 -165
  80. package/test/psbt.spec.ts +1285 -1285
  81. package/test/script.spec.ts +186 -186
  82. package/test/script_number.spec.ts +26 -26
  83. package/test/script_signature.spec.ts +66 -66
  84. package/test/transaction.spec.ts +337 -337
  85. package/test/ts-node-register.js +7 -7
  86. package/test/tsconfig.json +48 -48
  87. package/test/types.spec.ts +53 -53
  88. package/tsconfig.base.json +27 -27
  89. package/tsconfig.json +19 -19
  90. package/tsconfig.webpack.json +18 -18
  91. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.ready +0 -0
  92. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.release-please-manifest.json +0 -3
  93. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CHANGELOG.md +0 -962
  94. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CONTRIBUTING.md +0 -34
  95. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/LICENSE +0 -24
  96. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/README.md +0 -273
  97. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/SECURITY.md +0 -2
  98. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/addon.gypi +0 -204
  99. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/bin/node-gyp.js +0 -138
  100. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/.release-please-manifest.json +0 -3
  101. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/LICENSE +0 -28
  102. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/ninja/build.ninja +0 -4
  103. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc +0 -12
  104. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/GypVsCMake.md +0 -116
  105. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Hacking.md +0 -46
  106. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/InputFormatReference.md +0 -1080
  107. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/LanguageSpecification.md +0 -430
  108. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/README.md +0 -27
  109. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Testing.md +0 -450
  110. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/UserDocumentation.md +0 -965
  111. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp +0 -8
  112. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp.bat +0 -5
  113. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  114. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -365
  115. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  116. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1272
  117. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  118. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  119. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  120. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  121. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  122. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -692
  123. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -711
  124. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -171
  125. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -169
  126. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -113
  127. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  128. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  129. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -804
  130. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  131. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1318
  132. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -127
  133. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  134. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -461
  135. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  136. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -57
  137. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2745
  138. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3976
  139. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  140. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2964
  141. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -67
  142. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1391
  143. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  144. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3115
  145. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  146. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  147. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1260
  148. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  149. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  150. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -373
  151. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1938
  152. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +0 -53
  153. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  154. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3198
  155. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  156. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE +0 -3
  157. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE +0 -177
  158. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD +0 -23
  159. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +0 -15
  160. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +0 -108
  161. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +0 -252
  162. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +0 -83
  163. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +0 -359
  164. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +0 -61
  165. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +0 -192
  166. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/markers.py +0 -252
  167. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +0 -825
  168. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  169. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +0 -90
  170. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +0 -1030
  171. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/tags.py +0 -553
  172. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/utils.py +0 -172
  173. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/version.py +0 -563
  174. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pyproject.toml +0 -120
  175. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/release-please-config.json +0 -11
  176. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/test_gyp.py +0 -261
  177. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/Find-VisualStudio.cs +0 -250
  178. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/build.js +0 -227
  179. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/clean.js +0 -15
  180. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/configure.js +0 -328
  181. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/create-config-gypi.js +0 -150
  182. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/download.js +0 -39
  183. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-node-directory.js +0 -63
  184. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-python.js +0 -310
  185. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-visualstudio.js +0 -590
  186. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/install.js +0 -415
  187. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/list.js +0 -26
  188. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/log.js +0 -168
  189. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/node-gyp.js +0 -188
  190. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/process-release.js +0 -146
  191. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/rebuild.js +0 -12
  192. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/remove.js +0 -43
  193. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/util.js +0 -81
  194. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/macOS_Catalina_acid_test.sh +0 -21
  195. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/package.json +0 -51
  196. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/release-please-config.json +0 -40
  197. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/src/win_delay_load_hook.cc +0 -39
  198. package/browser/ops.d.ts +0 -126
  199. package/build/ops.d.ts +0 -126
  200. package/build/ops.js +0 -127
  201. package/coverage/tmp/coverage-31752-1735543485354-0.json +0 -1
  202. package/coverage/tmp/coverage-59920-1735543484555-0.json +0 -1
  203. package/coverage/tmp/coverage-66252-1735543483919-0.json +0 -1
  204. package/coverage/tmp/coverage-68440-1735543485236-0.json +0 -1
  205. package/coverage/tmp/coverage-70588-1735543484426-0.json +0 -1
  206. package/coverage/tmp/coverage-79292-1735543485296-0.json +0 -1
  207. package/coverage/tmp/coverage-80212-1735543483980-0.json +0 -1
@@ -1,127 +0,0 @@
1
- # Copyright (c) 2016 Ben Noordhuis <info@bnoordhuis.nl>. All rights reserved.
2
- # Use of this source code is governed by a BSD-style license that can be
3
- # found in the LICENSE file.
4
-
5
- import gyp.common
6
- import gyp.xcode_emulation
7
- import json
8
- import os
9
-
10
- generator_additional_non_configuration_keys = []
11
- generator_additional_path_sections = []
12
- generator_extra_sources_for_rules = []
13
- generator_filelist_paths = None
14
- generator_supports_multiple_toolsets = True
15
- generator_wants_sorted_dependencies = False
16
-
17
- # Lifted from make.py. The actual values don't matter much.
18
- generator_default_variables = {
19
- "CONFIGURATION_NAME": "$(BUILDTYPE)",
20
- "EXECUTABLE_PREFIX": "",
21
- "EXECUTABLE_SUFFIX": "",
22
- "INTERMEDIATE_DIR": "$(obj).$(TOOLSET)/$(TARGET)/geni",
23
- "PRODUCT_DIR": "$(builddir)",
24
- "RULE_INPUT_DIRNAME": "%(INPUT_DIRNAME)s",
25
- "RULE_INPUT_EXT": "$(suffix $<)",
26
- "RULE_INPUT_NAME": "$(notdir $<)",
27
- "RULE_INPUT_PATH": "$(abspath $<)",
28
- "RULE_INPUT_ROOT": "%(INPUT_ROOT)s",
29
- "SHARED_INTERMEDIATE_DIR": "$(obj)/gen",
30
- "SHARED_LIB_PREFIX": "lib",
31
- "STATIC_LIB_PREFIX": "lib",
32
- "STATIC_LIB_SUFFIX": ".a",
33
- }
34
-
35
-
36
- def IsMac(params):
37
- return gyp.common.GetFlavor(params) == "mac"
38
-
39
-
40
- def CalculateVariables(default_variables, params):
41
- default_variables.setdefault("OS", gyp.common.GetFlavor(params))
42
-
43
-
44
- def AddCommandsForTarget(cwd, target, params, per_config_commands):
45
- output_dir = params["generator_flags"].get("output_dir", "out")
46
- for configuration_name, configuration in target["configurations"].items():
47
- if IsMac(params):
48
- xcode_settings = gyp.xcode_emulation.XcodeSettings(target)
49
- cflags = xcode_settings.GetCflags(configuration_name)
50
- cflags_c = xcode_settings.GetCflagsC(configuration_name)
51
- cflags_cc = xcode_settings.GetCflagsCC(configuration_name)
52
- else:
53
- cflags = configuration.get("cflags", [])
54
- cflags_c = configuration.get("cflags_c", [])
55
- cflags_cc = configuration.get("cflags_cc", [])
56
-
57
- cflags_c = cflags + cflags_c
58
- cflags_cc = cflags + cflags_cc
59
-
60
- defines = configuration.get("defines", [])
61
- defines = ["-D" + s for s in defines]
62
-
63
- # TODO(bnoordhuis) Handle generated source files.
64
- extensions = (".c", ".cc", ".cpp", ".cxx")
65
- sources = [s for s in target.get("sources", []) if s.endswith(extensions)]
66
-
67
- def resolve(filename):
68
- return os.path.abspath(os.path.join(cwd, filename))
69
-
70
- # TODO(bnoordhuis) Handle generated header files.
71
- include_dirs = configuration.get("include_dirs", [])
72
- include_dirs = [s for s in include_dirs if not s.startswith("$(obj)")]
73
- includes = ["-I" + resolve(s) for s in include_dirs]
74
-
75
- defines = gyp.common.EncodePOSIXShellList(defines)
76
- includes = gyp.common.EncodePOSIXShellList(includes)
77
- cflags_c = gyp.common.EncodePOSIXShellList(cflags_c)
78
- cflags_cc = gyp.common.EncodePOSIXShellList(cflags_cc)
79
-
80
- commands = per_config_commands.setdefault(configuration_name, [])
81
- for source in sources:
82
- file = resolve(source)
83
- isc = source.endswith(".c")
84
- cc = "cc" if isc else "c++"
85
- cflags = cflags_c if isc else cflags_cc
86
- command = " ".join(
87
- (
88
- cc,
89
- defines,
90
- includes,
91
- cflags,
92
- "-c",
93
- gyp.common.EncodePOSIXShellArgument(file),
94
- )
95
- )
96
- commands.append({"command": command, "directory": output_dir, "file": file})
97
-
98
-
99
- def GenerateOutput(target_list, target_dicts, data, params):
100
- per_config_commands = {}
101
- for qualified_target, target in target_dicts.items():
102
- build_file, target_name, toolset = gyp.common.ParseQualifiedTarget(
103
- qualified_target
104
- )
105
- if IsMac(params):
106
- settings = data[build_file]
107
- gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(settings, target)
108
- cwd = os.path.dirname(build_file)
109
- AddCommandsForTarget(cwd, target, params, per_config_commands)
110
-
111
- output_dir = None
112
- try:
113
- # generator_output can be `None` on Windows machines, or even not
114
- # defined in other cases
115
- output_dir = params.get("options").generator_output
116
- except AttributeError:
117
- pass
118
- output_dir = output_dir or params["generator_flags"].get("output_dir", "out")
119
- for configuration_name, commands in per_config_commands.items():
120
- filename = os.path.join(output_dir, configuration_name, "compile_commands.json")
121
- gyp.common.EnsureDirExists(filename)
122
- fp = open(filename, "w")
123
- json.dump(commands, fp=fp, indent=0, check_circular=False)
124
-
125
-
126
- def PerformBuild(data, configurations, params):
127
- pass
@@ -1,103 +0,0 @@
1
- # Copyright (c) 2012 Google Inc. All rights reserved.
2
- # Use of this source code is governed by a BSD-style license that can be
3
- # found in the LICENSE file.
4
-
5
-
6
- import os
7
- import gyp
8
- import gyp.common
9
- import gyp.msvs_emulation
10
- import json
11
-
12
- generator_supports_multiple_toolsets = True
13
-
14
- generator_wants_static_library_dependencies_adjusted = False
15
-
16
- generator_filelist_paths = {}
17
-
18
- generator_default_variables = {}
19
- for dirname in [
20
- "INTERMEDIATE_DIR",
21
- "SHARED_INTERMEDIATE_DIR",
22
- "PRODUCT_DIR",
23
- "LIB_DIR",
24
- "SHARED_LIB_DIR",
25
- ]:
26
- # Some gyp steps fail if these are empty(!).
27
- generator_default_variables[dirname] = "dir"
28
- for unused in [
29
- "RULE_INPUT_PATH",
30
- "RULE_INPUT_ROOT",
31
- "RULE_INPUT_NAME",
32
- "RULE_INPUT_DIRNAME",
33
- "RULE_INPUT_EXT",
34
- "EXECUTABLE_PREFIX",
35
- "EXECUTABLE_SUFFIX",
36
- "STATIC_LIB_PREFIX",
37
- "STATIC_LIB_SUFFIX",
38
- "SHARED_LIB_PREFIX",
39
- "SHARED_LIB_SUFFIX",
40
- "CONFIGURATION_NAME",
41
- ]:
42
- generator_default_variables[unused] = ""
43
-
44
-
45
- def CalculateVariables(default_variables, params):
46
- generator_flags = params.get("generator_flags", {})
47
- for key, val in generator_flags.items():
48
- default_variables.setdefault(key, val)
49
- default_variables.setdefault("OS", gyp.common.GetFlavor(params))
50
-
51
- flavor = gyp.common.GetFlavor(params)
52
- if flavor == "win":
53
- gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)
54
-
55
-
56
- def CalculateGeneratorInputInfo(params):
57
- """Calculate the generator specific info that gets fed to input (called by
58
- gyp)."""
59
- generator_flags = params.get("generator_flags", {})
60
- if generator_flags.get("adjust_static_libraries", False):
61
- global generator_wants_static_library_dependencies_adjusted
62
- generator_wants_static_library_dependencies_adjusted = True
63
-
64
- toplevel = params["options"].toplevel_dir
65
- generator_dir = os.path.relpath(params["options"].generator_output or ".")
66
- # output_dir: relative path from generator_dir to the build directory.
67
- output_dir = generator_flags.get("output_dir", "out")
68
- qualified_out_dir = os.path.normpath(
69
- os.path.join(toplevel, generator_dir, output_dir, "gypfiles")
70
- )
71
- global generator_filelist_paths
72
- generator_filelist_paths = {
73
- "toplevel": toplevel,
74
- "qualified_out_dir": qualified_out_dir,
75
- }
76
-
77
-
78
- def GenerateOutput(target_list, target_dicts, data, params):
79
- # Map of target -> list of targets it depends on.
80
- edges = {}
81
-
82
- # Queue of targets to visit.
83
- targets_to_visit = target_list[:]
84
-
85
- while len(targets_to_visit) > 0:
86
- target = targets_to_visit.pop()
87
- if target in edges:
88
- continue
89
- edges[target] = []
90
-
91
- for dep in target_dicts[target].get("dependencies", []):
92
- edges[target].append(dep)
93
- targets_to_visit.append(dep)
94
-
95
- try:
96
- filepath = params["generator_flags"]["output_dir"]
97
- except KeyError:
98
- filepath = "."
99
- filename = os.path.join(filepath, "dump.json")
100
- f = open(filename, "w")
101
- json.dump(edges, f)
102
- f.close()
103
- print("Wrote json to %s." % filename)
@@ -1,461 +0,0 @@
1
- # Copyright (c) 2012 Google Inc. All rights reserved.
2
- # Use of this source code is governed by a BSD-style license that can be
3
- # found in the LICENSE file.
4
-
5
- """GYP backend that generates Eclipse CDT settings files.
6
-
7
- This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML
8
- files that can be imported into an Eclipse CDT project. The XML file contains a
9
- list of include paths and symbols (i.e. defines).
10
-
11
- Because a full .cproject definition is not created by this generator, it's not
12
- possible to properly define the include dirs and symbols for each file
13
- individually. Instead, one set of includes/symbols is generated for the entire
14
- project. This works fairly well (and is a vast improvement in general), but may
15
- still result in a few indexer issues here and there.
16
-
17
- This generator has no automated tests, so expect it to be broken.
18
- """
19
-
20
- from xml.sax.saxutils import escape
21
- import os.path
22
- import subprocess
23
- import gyp
24
- import gyp.common
25
- import gyp.msvs_emulation
26
- import shlex
27
- import xml.etree.ElementTree as ET
28
-
29
- generator_wants_static_library_dependencies_adjusted = False
30
-
31
- generator_default_variables = {}
32
-
33
- for dirname in ["INTERMEDIATE_DIR", "PRODUCT_DIR", "LIB_DIR", "SHARED_LIB_DIR"]:
34
- # Some gyp steps fail if these are empty(!), so we convert them to variables
35
- generator_default_variables[dirname] = "$" + dirname
36
-
37
- for unused in [
38
- "RULE_INPUT_PATH",
39
- "RULE_INPUT_ROOT",
40
- "RULE_INPUT_NAME",
41
- "RULE_INPUT_DIRNAME",
42
- "RULE_INPUT_EXT",
43
- "EXECUTABLE_PREFIX",
44
- "EXECUTABLE_SUFFIX",
45
- "STATIC_LIB_PREFIX",
46
- "STATIC_LIB_SUFFIX",
47
- "SHARED_LIB_PREFIX",
48
- "SHARED_LIB_SUFFIX",
49
- "CONFIGURATION_NAME",
50
- ]:
51
- generator_default_variables[unused] = ""
52
-
53
- # Include dirs will occasionally use the SHARED_INTERMEDIATE_DIR variable as
54
- # part of the path when dealing with generated headers. This value will be
55
- # replaced dynamically for each configuration.
56
- generator_default_variables["SHARED_INTERMEDIATE_DIR"] = "$SHARED_INTERMEDIATE_DIR"
57
-
58
-
59
- def CalculateVariables(default_variables, params):
60
- generator_flags = params.get("generator_flags", {})
61
- for key, val in generator_flags.items():
62
- default_variables.setdefault(key, val)
63
- flavor = gyp.common.GetFlavor(params)
64
- default_variables.setdefault("OS", flavor)
65
- if flavor == "win":
66
- gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)
67
-
68
-
69
- def CalculateGeneratorInputInfo(params):
70
- """Calculate the generator specific info that gets fed to input (called by
71
- gyp)."""
72
- generator_flags = params.get("generator_flags", {})
73
- if generator_flags.get("adjust_static_libraries", False):
74
- global generator_wants_static_library_dependencies_adjusted
75
- generator_wants_static_library_dependencies_adjusted = True
76
-
77
-
78
- def GetAllIncludeDirectories(
79
- target_list,
80
- target_dicts,
81
- shared_intermediate_dirs,
82
- config_name,
83
- params,
84
- compiler_path,
85
- ):
86
- """Calculate the set of include directories to be used.
87
-
88
- Returns:
89
- A list including all the include_dir's specified for every target followed
90
- by any include directories that were added as cflag compiler options.
91
- """
92
-
93
- gyp_includes_set = set()
94
- compiler_includes_list = []
95
-
96
- # Find compiler's default include dirs.
97
- if compiler_path:
98
- command = shlex.split(compiler_path)
99
- command.extend(["-E", "-xc++", "-v", "-"])
100
- proc = subprocess.Popen(
101
- args=command,
102
- stdin=subprocess.PIPE,
103
- stdout=subprocess.PIPE,
104
- stderr=subprocess.PIPE,
105
- )
106
- output = proc.communicate()[1].decode("utf-8")
107
- # Extract the list of include dirs from the output, which has this format:
108
- # ...
109
- # #include "..." search starts here:
110
- # #include <...> search starts here:
111
- # /usr/include/c++/4.6
112
- # /usr/local/include
113
- # End of search list.
114
- # ...
115
- in_include_list = False
116
- for line in output.splitlines():
117
- if line.startswith("#include"):
118
- in_include_list = True
119
- continue
120
- if line.startswith("End of search list."):
121
- break
122
- if in_include_list:
123
- include_dir = line.strip()
124
- if include_dir not in compiler_includes_list:
125
- compiler_includes_list.append(include_dir)
126
-
127
- flavor = gyp.common.GetFlavor(params)
128
- if flavor == "win":
129
- generator_flags = params.get("generator_flags", {})
130
- for target_name in target_list:
131
- target = target_dicts[target_name]
132
- if config_name in target["configurations"]:
133
- config = target["configurations"][config_name]
134
-
135
- # Look for any include dirs that were explicitly added via cflags. This
136
- # may be done in gyp files to force certain includes to come at the end.
137
- # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and
138
- # remove this.
139
- if flavor == "win":
140
- msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags)
141
- cflags = msvs_settings.GetCflags(config_name)
142
- else:
143
- cflags = config["cflags"]
144
- for cflag in cflags:
145
- if cflag.startswith("-I"):
146
- include_dir = cflag[2:]
147
- if include_dir not in compiler_includes_list:
148
- compiler_includes_list.append(include_dir)
149
-
150
- # Find standard gyp include dirs.
151
- if "include_dirs" in config:
152
- include_dirs = config["include_dirs"]
153
- for shared_intermediate_dir in shared_intermediate_dirs:
154
- for include_dir in include_dirs:
155
- include_dir = include_dir.replace(
156
- "$SHARED_INTERMEDIATE_DIR", shared_intermediate_dir
157
- )
158
- if not os.path.isabs(include_dir):
159
- base_dir = os.path.dirname(target_name)
160
-
161
- include_dir = base_dir + "/" + include_dir
162
- include_dir = os.path.abspath(include_dir)
163
-
164
- gyp_includes_set.add(include_dir)
165
-
166
- # Generate a list that has all the include dirs.
167
- all_includes_list = list(gyp_includes_set)
168
- all_includes_list.sort()
169
- for compiler_include in compiler_includes_list:
170
- if compiler_include not in gyp_includes_set:
171
- all_includes_list.append(compiler_include)
172
-
173
- # All done.
174
- return all_includes_list
175
-
176
-
177
- def GetCompilerPath(target_list, data, options):
178
- """Determine a command that can be used to invoke the compiler.
179
-
180
- Returns:
181
- If this is a gyp project that has explicit make settings, try to determine
182
- the compiler from that. Otherwise, see if a compiler was specified via the
183
- CC_target environment variable.
184
- """
185
- # First, see if the compiler is configured in make's settings.
186
- build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
187
- make_global_settings_dict = data[build_file].get("make_global_settings", {})
188
- for key, value in make_global_settings_dict:
189
- if key in ["CC", "CXX"]:
190
- return os.path.join(options.toplevel_dir, value)
191
-
192
- # Check to see if the compiler was specified as an environment variable.
193
- for key in ["CC_target", "CC", "CXX"]:
194
- compiler = os.environ.get(key)
195
- if compiler:
196
- return compiler
197
-
198
- return "gcc"
199
-
200
-
201
- def GetAllDefines(target_list, target_dicts, data, config_name, params, compiler_path):
202
- """Calculate the defines for a project.
203
-
204
- Returns:
205
- A dict that includes explicit defines declared in gyp files along with all
206
- of the default defines that the compiler uses.
207
- """
208
-
209
- # Get defines declared in the gyp files.
210
- all_defines = {}
211
- flavor = gyp.common.GetFlavor(params)
212
- if flavor == "win":
213
- generator_flags = params.get("generator_flags", {})
214
- for target_name in target_list:
215
- target = target_dicts[target_name]
216
-
217
- if flavor == "win":
218
- msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags)
219
- extra_defines = msvs_settings.GetComputedDefines(config_name)
220
- else:
221
- extra_defines = []
222
- if config_name in target["configurations"]:
223
- config = target["configurations"][config_name]
224
- target_defines = config["defines"]
225
- else:
226
- target_defines = []
227
- for define in target_defines + extra_defines:
228
- split_define = define.split("=", 1)
229
- if len(split_define) == 1:
230
- split_define.append("1")
231
- if split_define[0].strip() in all_defines:
232
- # Already defined
233
- continue
234
- all_defines[split_define[0].strip()] = split_define[1].strip()
235
- # Get default compiler defines (if possible).
236
- if flavor == "win":
237
- return all_defines # Default defines already processed in the loop above.
238
- if compiler_path:
239
- command = shlex.split(compiler_path)
240
- command.extend(["-E", "-dM", "-"])
241
- cpp_proc = subprocess.Popen(
242
- args=command, cwd=".", stdin=subprocess.PIPE, stdout=subprocess.PIPE
243
- )
244
- cpp_output = cpp_proc.communicate()[0].decode("utf-8")
245
- cpp_lines = cpp_output.split("\n")
246
- for cpp_line in cpp_lines:
247
- if not cpp_line.strip():
248
- continue
249
- cpp_line_parts = cpp_line.split(" ", 2)
250
- key = cpp_line_parts[1]
251
- val = cpp_line_parts[2] if len(cpp_line_parts) >= 3 else "1"
252
- all_defines[key] = val
253
-
254
- return all_defines
255
-
256
-
257
- def WriteIncludePaths(out, eclipse_langs, include_dirs):
258
- """Write the includes section of a CDT settings export file."""
259
-
260
- out.write(
261
- ' <section name="org.eclipse.cdt.internal.ui.wizards.'
262
- 'settingswizards.IncludePaths">\n'
263
- )
264
- out.write(' <language name="holder for library settings"></language>\n')
265
- for lang in eclipse_langs:
266
- out.write(' <language name="%s">\n' % lang)
267
- for include_dir in include_dirs:
268
- out.write(
269
- ' <includepath workspace_path="false">%s</includepath>\n'
270
- % include_dir
271
- )
272
- out.write(" </language>\n")
273
- out.write(" </section>\n")
274
-
275
-
276
- def WriteMacros(out, eclipse_langs, defines):
277
- """Write the macros section of a CDT settings export file."""
278
-
279
- out.write(
280
- ' <section name="org.eclipse.cdt.internal.ui.wizards.'
281
- 'settingswizards.Macros">\n'
282
- )
283
- out.write(' <language name="holder for library settings"></language>\n')
284
- for lang in eclipse_langs:
285
- out.write(' <language name="%s">\n' % lang)
286
- for key in sorted(defines):
287
- out.write(
288
- " <macro><name>%s</name><value>%s</value></macro>\n"
289
- % (escape(key), escape(defines[key]))
290
- )
291
- out.write(" </language>\n")
292
- out.write(" </section>\n")
293
-
294
-
295
- def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name):
296
- options = params["options"]
297
- generator_flags = params.get("generator_flags", {})
298
-
299
- # build_dir: relative path from source root to our output files.
300
- # e.g. "out/Debug"
301
- build_dir = os.path.join(generator_flags.get("output_dir", "out"), config_name)
302
-
303
- toplevel_build = os.path.join(options.toplevel_dir, build_dir)
304
- # Ninja uses out/Debug/gen while make uses out/Debug/obj/gen as the
305
- # SHARED_INTERMEDIATE_DIR. Include both possible locations.
306
- shared_intermediate_dirs = [
307
- os.path.join(toplevel_build, "obj", "gen"),
308
- os.path.join(toplevel_build, "gen"),
309
- ]
310
-
311
- GenerateCdtSettingsFile(
312
- target_list,
313
- target_dicts,
314
- data,
315
- params,
316
- config_name,
317
- os.path.join(toplevel_build, "eclipse-cdt-settings.xml"),
318
- options,
319
- shared_intermediate_dirs,
320
- )
321
- GenerateClasspathFile(
322
- target_list,
323
- target_dicts,
324
- options.toplevel_dir,
325
- toplevel_build,
326
- os.path.join(toplevel_build, "eclipse-classpath.xml"),
327
- )
328
-
329
-
330
- def GenerateCdtSettingsFile(
331
- target_list,
332
- target_dicts,
333
- data,
334
- params,
335
- config_name,
336
- out_name,
337
- options,
338
- shared_intermediate_dirs,
339
- ):
340
- gyp.common.EnsureDirExists(out_name)
341
- with open(out_name, "w") as out:
342
- out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
343
- out.write("<cdtprojectproperties>\n")
344
-
345
- eclipse_langs = [
346
- "C++ Source File",
347
- "C Source File",
348
- "Assembly Source File",
349
- "GNU C++",
350
- "GNU C",
351
- "Assembly",
352
- ]
353
- compiler_path = GetCompilerPath(target_list, data, options)
354
- include_dirs = GetAllIncludeDirectories(
355
- target_list,
356
- target_dicts,
357
- shared_intermediate_dirs,
358
- config_name,
359
- params,
360
- compiler_path,
361
- )
362
- WriteIncludePaths(out, eclipse_langs, include_dirs)
363
- defines = GetAllDefines(
364
- target_list, target_dicts, data, config_name, params, compiler_path
365
- )
366
- WriteMacros(out, eclipse_langs, defines)
367
-
368
- out.write("</cdtprojectproperties>\n")
369
-
370
-
371
- def GenerateClasspathFile(
372
- target_list, target_dicts, toplevel_dir, toplevel_build, out_name
373
- ):
374
- """Generates a classpath file suitable for symbol navigation and code
375
- completion of Java code (such as in Android projects) by finding all
376
- .java and .jar files used as action inputs."""
377
- gyp.common.EnsureDirExists(out_name)
378
- result = ET.Element("classpath")
379
-
380
- def AddElements(kind, paths):
381
- # First, we need to normalize the paths so they are all relative to the
382
- # toplevel dir.
383
- rel_paths = set()
384
- for path in paths:
385
- if os.path.isabs(path):
386
- rel_paths.add(os.path.relpath(path, toplevel_dir))
387
- else:
388
- rel_paths.add(path)
389
-
390
- for path in sorted(rel_paths):
391
- entry_element = ET.SubElement(result, "classpathentry")
392
- entry_element.set("kind", kind)
393
- entry_element.set("path", path)
394
-
395
- AddElements("lib", GetJavaJars(target_list, target_dicts, toplevel_dir))
396
- AddElements("src", GetJavaSourceDirs(target_list, target_dicts, toplevel_dir))
397
- # Include the standard JRE container and a dummy out folder
398
- AddElements("con", ["org.eclipse.jdt.launching.JRE_CONTAINER"])
399
- # Include a dummy out folder so that Eclipse doesn't use the default /bin
400
- # folder in the root of the project.
401
- AddElements("output", [os.path.join(toplevel_build, ".eclipse-java-build")])
402
-
403
- ET.ElementTree(result).write(out_name)
404
-
405
-
406
- def GetJavaJars(target_list, target_dicts, toplevel_dir):
407
- """Generates a sequence of all .jars used as inputs."""
408
- for target_name in target_list:
409
- target = target_dicts[target_name]
410
- for action in target.get("actions", []):
411
- for input_ in action["inputs"]:
412
- if os.path.splitext(input_)[1] == ".jar" and not input_.startswith("$"):
413
- if os.path.isabs(input_):
414
- yield input_
415
- else:
416
- yield os.path.join(os.path.dirname(target_name), input_)
417
-
418
-
419
- def GetJavaSourceDirs(target_list, target_dicts, toplevel_dir):
420
- """Generates a sequence of all likely java package root directories."""
421
- for target_name in target_list:
422
- target = target_dicts[target_name]
423
- for action in target.get("actions", []):
424
- for input_ in action["inputs"]:
425
- if os.path.splitext(input_)[1] == ".java" and not input_.startswith(
426
- "$"
427
- ):
428
- dir_ = os.path.dirname(
429
- os.path.join(os.path.dirname(target_name), input_)
430
- )
431
- # If there is a parent 'src' or 'java' folder, navigate up to it -
432
- # these are canonical package root names in Chromium. This will
433
- # break if 'src' or 'java' exists in the package structure. This
434
- # could be further improved by inspecting the java file for the
435
- # package name if this proves to be too fragile in practice.
436
- parent_search = dir_
437
- while os.path.basename(parent_search) not in ["src", "java"]:
438
- parent_search, _ = os.path.split(parent_search)
439
- if not parent_search or parent_search == toplevel_dir:
440
- # Didn't find a known root, just return the original path
441
- yield dir_
442
- break
443
- else:
444
- yield parent_search
445
-
446
-
447
- def GenerateOutput(target_list, target_dicts, data, params):
448
- """Generate an XML settings file that can be imported into a CDT project."""
449
-
450
- if params["options"].generator_output:
451
- raise NotImplementedError("--generator_output not implemented for eclipse")
452
-
453
- user_config = params.get("generator_flags", {}).get("config", None)
454
- if user_config:
455
- GenerateOutputForConfig(target_list, target_dicts, data, params, user_config)
456
- else:
457
- config_names = target_dicts[target_list[0]]["configurations"]
458
- for config_name in config_names:
459
- GenerateOutputForConfig(
460
- target_list, target_dicts, data, params, config_name
461
- )