@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,8 +0,0 @@
1
- #!/bin/sh
2
- # Copyright 2013 The Chromium Authors. All rights reserved.
3
- # Use of this source code is governed by a BSD-style license that can be
4
- # found in the LICENSE file.
5
-
6
- set -e
7
- base=$(dirname "$0")
8
- exec python "${base}/gyp_main.py" "$@"
@@ -1,5 +0,0 @@
1
- @rem Copyright (c) 2009 Google Inc. All rights reserved.
2
- @rem Use of this source code is governed by a BSD-style license that can be
3
- @rem found in the LICENSE file.
4
-
5
- @python "%~dp0gyp_main.py" %*
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- # Copyright (c) 2009 Google Inc. All rights reserved.
4
- # Use of this source code is governed by a BSD-style license that can be
5
- # found in the LICENSE file.
6
-
7
- import os
8
- import sys
9
- import subprocess
10
-
11
-
12
- def IsCygwin():
13
- # Function copied from pylib/gyp/common.py
14
- try:
15
- out = subprocess.Popen(
16
- "uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT
17
- )
18
- stdout, _ = out.communicate()
19
- return "CYGWIN" in stdout.decode("utf-8")
20
- except Exception:
21
- return False
22
-
23
-
24
- def UnixifyPath(path):
25
- try:
26
- if not IsCygwin():
27
- return path
28
- out = subprocess.Popen(
29
- ["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
30
- )
31
- stdout, _ = out.communicate()
32
- return stdout.decode("utf-8")
33
- except Exception:
34
- return path
35
-
36
-
37
- # Make sure we're using the version of pylib in this repo, not one installed
38
- # elsewhere on the system. Also convert to Unix style path on Cygwin systems,
39
- # else the 'gyp' library will not be found
40
- path = UnixifyPath(sys.argv[0])
41
- sys.path.insert(0, os.path.join(os.path.dirname(path), "pylib"))
42
- import gyp # noqa: E402
43
-
44
- if __name__ == "__main__":
45
- sys.exit(gyp.script_main())
@@ -1,365 +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
- """New implementation of Visual Studio project generation."""
6
-
7
- import hashlib
8
- import os
9
- import random
10
- from operator import attrgetter
11
-
12
- import gyp.common
13
-
14
-
15
- def cmp(x, y):
16
- return (x > y) - (x < y)
17
-
18
-
19
- # Initialize random number generator
20
- random.seed()
21
-
22
- # GUIDs for project types
23
- ENTRY_TYPE_GUIDS = {
24
- "project": "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}",
25
- "folder": "{2150E333-8FDC-42A3-9474-1A3956D46DE8}",
26
- }
27
-
28
- # ------------------------------------------------------------------------------
29
- # Helper functions
30
-
31
-
32
- def MakeGuid(name, seed="msvs_new"):
33
- """Returns a GUID for the specified target name.
34
-
35
- Args:
36
- name: Target name.
37
- seed: Seed for MD5 hash.
38
- Returns:
39
- A GUID-line string calculated from the name and seed.
40
-
41
- This generates something which looks like a GUID, but depends only on the
42
- name and seed. This means the same name/seed will always generate the same
43
- GUID, so that projects and solutions which refer to each other can explicitly
44
- determine the GUID to refer to explicitly. It also means that the GUID will
45
- not change when the project for a target is rebuilt.
46
- """
47
- # Calculate a MD5 signature for the seed and name.
48
- d = hashlib.md5((str(seed) + str(name)).encode("utf-8")).hexdigest().upper()
49
- # Convert most of the signature to GUID form (discard the rest)
50
- guid = (
51
- "{"
52
- + d[:8]
53
- + "-"
54
- + d[8:12]
55
- + "-"
56
- + d[12:16]
57
- + "-"
58
- + d[16:20]
59
- + "-"
60
- + d[20:32]
61
- + "}"
62
- )
63
- return guid
64
-
65
-
66
- # ------------------------------------------------------------------------------
67
-
68
-
69
- class MSVSSolutionEntry:
70
- def __cmp__(self, other):
71
- # Sort by name then guid (so things are in order on vs2008).
72
- return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))
73
-
74
-
75
- class MSVSFolder(MSVSSolutionEntry):
76
- """Folder in a Visual Studio project or solution."""
77
-
78
- def __init__(self, path, name=None, entries=None, guid=None, items=None):
79
- """Initializes the folder.
80
-
81
- Args:
82
- path: Full path to the folder.
83
- name: Name of the folder.
84
- entries: List of folder entries to nest inside this folder. May contain
85
- Folder or Project objects. May be None, if the folder is empty.
86
- guid: GUID to use for folder, if not None.
87
- items: List of solution items to include in the folder project. May be
88
- None, if the folder does not directly contain items.
89
- """
90
- if name:
91
- self.name = name
92
- else:
93
- # Use last layer.
94
- self.name = os.path.basename(path)
95
-
96
- self.path = path
97
- self.guid = guid
98
-
99
- # Copy passed lists (or set to empty lists)
100
- self.entries = sorted(entries or [], key=attrgetter("path"))
101
- self.items = list(items or [])
102
-
103
- self.entry_type_guid = ENTRY_TYPE_GUIDS["folder"]
104
-
105
- def get_guid(self):
106
- if self.guid is None:
107
- # Use consistent guids for folders (so things don't regenerate).
108
- self.guid = MakeGuid(self.path, seed="msvs_folder")
109
- return self.guid
110
-
111
-
112
- # ------------------------------------------------------------------------------
113
-
114
-
115
- class MSVSProject(MSVSSolutionEntry):
116
- """Visual Studio project."""
117
-
118
- def __init__(
119
- self,
120
- path,
121
- name=None,
122
- dependencies=None,
123
- guid=None,
124
- spec=None,
125
- build_file=None,
126
- config_platform_overrides=None,
127
- fixpath_prefix=None,
128
- ):
129
- """Initializes the project.
130
-
131
- Args:
132
- path: Absolute path to the project file.
133
- name: Name of project. If None, the name will be the same as the base
134
- name of the project file.
135
- dependencies: List of other Project objects this project is dependent
136
- upon, if not None.
137
- guid: GUID to use for project, if not None.
138
- spec: Dictionary specifying how to build this project.
139
- build_file: Filename of the .gyp file that the vcproj file comes from.
140
- config_platform_overrides: optional dict of configuration platforms to
141
- used in place of the default for this target.
142
- fixpath_prefix: the path used to adjust the behavior of _fixpath
143
- """
144
- self.path = path
145
- self.guid = guid
146
- self.spec = spec
147
- self.build_file = build_file
148
- # Use project filename if name not specified
149
- self.name = name or os.path.splitext(os.path.basename(path))[0]
150
-
151
- # Copy passed lists (or set to empty lists)
152
- self.dependencies = list(dependencies or [])
153
-
154
- self.entry_type_guid = ENTRY_TYPE_GUIDS["project"]
155
-
156
- if config_platform_overrides:
157
- self.config_platform_overrides = config_platform_overrides
158
- else:
159
- self.config_platform_overrides = {}
160
- self.fixpath_prefix = fixpath_prefix
161
- self.msbuild_toolset = None
162
-
163
- def set_dependencies(self, dependencies):
164
- self.dependencies = list(dependencies or [])
165
-
166
- def get_guid(self):
167
- if self.guid is None:
168
- # Set GUID from path
169
- # TODO(rspangler): This is fragile.
170
- # 1. We can't just use the project filename sans path, since there could
171
- # be multiple projects with the same base name (for example,
172
- # foo/unittest.vcproj and bar/unittest.vcproj).
173
- # 2. The path needs to be relative to $SOURCE_ROOT, so that the project
174
- # GUID is the same whether it's included from base/base.sln or
175
- # foo/bar/baz/baz.sln.
176
- # 3. The GUID needs to be the same each time this builder is invoked, so
177
- # that we don't need to rebuild the solution when the project changes.
178
- # 4. We should be able to handle pre-built project files by reading the
179
- # GUID from the files.
180
- self.guid = MakeGuid(self.name)
181
- return self.guid
182
-
183
- def set_msbuild_toolset(self, msbuild_toolset):
184
- self.msbuild_toolset = msbuild_toolset
185
-
186
-
187
- # ------------------------------------------------------------------------------
188
-
189
-
190
- class MSVSSolution:
191
- """Visual Studio solution."""
192
-
193
- def __init__(
194
- self, path, version, entries=None, variants=None, websiteProperties=True
195
- ):
196
- """Initializes the solution.
197
-
198
- Args:
199
- path: Path to solution file.
200
- version: Format version to emit.
201
- entries: List of entries in solution. May contain Folder or Project
202
- objects. May be None, if the folder is empty.
203
- variants: List of build variant strings. If none, a default list will
204
- be used.
205
- websiteProperties: Flag to decide if the website properties section
206
- is generated.
207
- """
208
- self.path = path
209
- self.websiteProperties = websiteProperties
210
- self.version = version
211
-
212
- # Copy passed lists (or set to empty lists)
213
- self.entries = list(entries or [])
214
-
215
- if variants:
216
- # Copy passed list
217
- self.variants = variants[:]
218
- else:
219
- # Use default
220
- self.variants = ["Debug|Win32", "Release|Win32"]
221
- # TODO(rspangler): Need to be able to handle a mapping of solution config
222
- # to project config. Should we be able to handle variants being a dict,
223
- # or add a separate variant_map variable? If it's a dict, we can't
224
- # guarantee the order of variants since dict keys aren't ordered.
225
-
226
- # TODO(rspangler): Automatically write to disk for now; should delay until
227
- # node-evaluation time.
228
- self.Write()
229
-
230
- def Write(self, writer=gyp.common.WriteOnDiff):
231
- """Writes the solution file to disk.
232
-
233
- Raises:
234
- IndexError: An entry appears multiple times.
235
- """
236
- # Walk the entry tree and collect all the folders and projects.
237
- all_entries = set()
238
- entries_to_check = self.entries[:]
239
- while entries_to_check:
240
- e = entries_to_check.pop(0)
241
-
242
- # If this entry has been visited, nothing to do.
243
- if e in all_entries:
244
- continue
245
-
246
- all_entries.add(e)
247
-
248
- # If this is a folder, check its entries too.
249
- if isinstance(e, MSVSFolder):
250
- entries_to_check += e.entries
251
-
252
- all_entries = sorted(all_entries, key=attrgetter("path"))
253
-
254
- # Open file and print header
255
- f = writer(self.path)
256
- f.write(
257
- "Microsoft Visual Studio Solution File, "
258
- "Format Version %s\r\n" % self.version.SolutionVersion()
259
- )
260
- f.write("# %s\r\n" % self.version.Description())
261
-
262
- # Project entries
263
- sln_root = os.path.split(self.path)[0]
264
- for e in all_entries:
265
- relative_path = gyp.common.RelativePath(e.path, sln_root)
266
- # msbuild does not accept an empty folder_name.
267
- # use '.' in case relative_path is empty.
268
- folder_name = relative_path.replace("/", "\\") or "."
269
- f.write(
270
- 'Project("%s") = "%s", "%s", "%s"\r\n'
271
- % (
272
- e.entry_type_guid, # Entry type GUID
273
- e.name, # Folder name
274
- folder_name, # Folder name (again)
275
- e.get_guid(), # Entry GUID
276
- )
277
- )
278
-
279
- # TODO(rspangler): Need a way to configure this stuff
280
- if self.websiteProperties:
281
- f.write(
282
- "\tProjectSection(WebsiteProperties) = preProject\r\n"
283
- '\t\tDebug.AspNetCompiler.Debug = "True"\r\n'
284
- '\t\tRelease.AspNetCompiler.Debug = "False"\r\n'
285
- "\tEndProjectSection\r\n"
286
- )
287
-
288
- if isinstance(e, MSVSFolder) and e.items:
289
- f.write("\tProjectSection(SolutionItems) = preProject\r\n")
290
- for i in e.items:
291
- f.write(f"\t\t{i} = {i}\r\n")
292
- f.write("\tEndProjectSection\r\n")
293
-
294
- if isinstance(e, MSVSProject) and e.dependencies:
295
- f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
296
- for d in e.dependencies:
297
- f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
298
- f.write("\tEndProjectSection\r\n")
299
-
300
- f.write("EndProject\r\n")
301
-
302
- # Global section
303
- f.write("Global\r\n")
304
-
305
- # Configurations (variants)
306
- f.write("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n")
307
- for v in self.variants:
308
- f.write(f"\t\t{v} = {v}\r\n")
309
- f.write("\tEndGlobalSection\r\n")
310
-
311
- # Sort config guids for easier diffing of solution changes.
312
- config_guids = []
313
- config_guids_overrides = {}
314
- for e in all_entries:
315
- if isinstance(e, MSVSProject):
316
- config_guids.append(e.get_guid())
317
- config_guids_overrides[e.get_guid()] = e.config_platform_overrides
318
- config_guids.sort()
319
-
320
- f.write("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n")
321
- for g in config_guids:
322
- for v in self.variants:
323
- nv = config_guids_overrides[g].get(v, v)
324
- # Pick which project configuration to build for this solution
325
- # configuration.
326
- f.write(
327
- "\t\t%s.%s.ActiveCfg = %s\r\n"
328
- % (
329
- g, # Project GUID
330
- v, # Solution build configuration
331
- nv, # Project build config for that solution config
332
- )
333
- )
334
-
335
- # Enable project in this solution configuration.
336
- f.write(
337
- "\t\t%s.%s.Build.0 = %s\r\n"
338
- % (
339
- g, # Project GUID
340
- v, # Solution build configuration
341
- nv, # Project build config for that solution config
342
- )
343
- )
344
- f.write("\tEndGlobalSection\r\n")
345
-
346
- # TODO(rspangler): Should be able to configure this stuff too (though I've
347
- # never seen this be any different)
348
- f.write("\tGlobalSection(SolutionProperties) = preSolution\r\n")
349
- f.write("\t\tHideSolutionNode = FALSE\r\n")
350
- f.write("\tEndGlobalSection\r\n")
351
-
352
- # Folder mappings
353
- # Omit this section if there are no folders
354
- if any(e.entries for e in all_entries if isinstance(e, MSVSFolder)):
355
- f.write("\tGlobalSection(NestedProjects) = preSolution\r\n")
356
- for e in all_entries:
357
- if not isinstance(e, MSVSFolder):
358
- continue # Does not apply to projects, only folders
359
- for subentry in e.entries:
360
- f.write(f"\t\t{subentry.get_guid()} = {e.get_guid()}\r\n")
361
- f.write("\tEndGlobalSection\r\n")
362
-
363
- f.write("EndGlobal\r\n")
364
-
365
- f.close()
@@ -1,206 +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
- """Visual Studio project reader/writer."""
6
-
7
- import gyp.easy_xml as easy_xml
8
-
9
- # ------------------------------------------------------------------------------
10
-
11
-
12
- class Tool:
13
- """Visual Studio tool."""
14
-
15
- def __init__(self, name, attrs=None):
16
- """Initializes the tool.
17
-
18
- Args:
19
- name: Tool name.
20
- attrs: Dict of tool attributes; may be None.
21
- """
22
- self._attrs = attrs or {}
23
- self._attrs["Name"] = name
24
-
25
- def _GetSpecification(self):
26
- """Creates an element for the tool.
27
-
28
- Returns:
29
- A new xml.dom.Element for the tool.
30
- """
31
- return ["Tool", self._attrs]
32
-
33
-
34
- class Filter:
35
- """Visual Studio filter - that is, a virtual folder."""
36
-
37
- def __init__(self, name, contents=None):
38
- """Initializes the folder.
39
-
40
- Args:
41
- name: Filter (folder) name.
42
- contents: List of filenames and/or Filter objects contained.
43
- """
44
- self.name = name
45
- self.contents = list(contents or [])
46
-
47
-
48
- # ------------------------------------------------------------------------------
49
-
50
-
51
- class Writer:
52
- """Visual Studio XML project writer."""
53
-
54
- def __init__(self, project_path, version, name, guid=None, platforms=None):
55
- """Initializes the project.
56
-
57
- Args:
58
- project_path: Path to the project file.
59
- version: Format version to emit.
60
- name: Name of the project.
61
- guid: GUID to use for project, if not None.
62
- platforms: Array of string, the supported platforms. If null, ['Win32']
63
- """
64
- self.project_path = project_path
65
- self.version = version
66
- self.name = name
67
- self.guid = guid
68
-
69
- # Default to Win32 for platforms.
70
- if not platforms:
71
- platforms = ["Win32"]
72
-
73
- # Initialize the specifications of the various sections.
74
- self.platform_section = ["Platforms"]
75
- for platform in platforms:
76
- self.platform_section.append(["Platform", {"Name": platform}])
77
- self.tool_files_section = ["ToolFiles"]
78
- self.configurations_section = ["Configurations"]
79
- self.files_section = ["Files"]
80
-
81
- # Keep a dict keyed on filename to speed up access.
82
- self.files_dict = {}
83
-
84
- def AddToolFile(self, path):
85
- """Adds a tool file to the project.
86
-
87
- Args:
88
- path: Relative path from project to tool file.
89
- """
90
- self.tool_files_section.append(["ToolFile", {"RelativePath": path}])
91
-
92
- def _GetSpecForConfiguration(self, config_type, config_name, attrs, tools):
93
- """Returns the specification for a configuration.
94
-
95
- Args:
96
- config_type: Type of configuration node.
97
- config_name: Configuration name.
98
- attrs: Dict of configuration attributes; may be None.
99
- tools: List of tools (strings or Tool objects); may be None.
100
- Returns:
101
- """
102
- # Handle defaults
103
- if not attrs:
104
- attrs = {}
105
- if not tools:
106
- tools = []
107
-
108
- # Add configuration node and its attributes
109
- node_attrs = attrs.copy()
110
- node_attrs["Name"] = config_name
111
- specification = [config_type, node_attrs]
112
-
113
- # Add tool nodes and their attributes
114
- if tools:
115
- for t in tools:
116
- if isinstance(t, Tool):
117
- specification.append(t._GetSpecification())
118
- else:
119
- specification.append(Tool(t)._GetSpecification())
120
- return specification
121
-
122
- def AddConfig(self, name, attrs=None, tools=None):
123
- """Adds a configuration to the project.
124
-
125
- Args:
126
- name: Configuration name.
127
- attrs: Dict of configuration attributes; may be None.
128
- tools: List of tools (strings or Tool objects); may be None.
129
- """
130
- spec = self._GetSpecForConfiguration("Configuration", name, attrs, tools)
131
- self.configurations_section.append(spec)
132
-
133
- def _AddFilesToNode(self, parent, files):
134
- """Adds files and/or filters to the parent node.
135
-
136
- Args:
137
- parent: Destination node
138
- files: A list of Filter objects and/or relative paths to files.
139
-
140
- Will call itself recursively, if the files list contains Filter objects.
141
- """
142
- for f in files:
143
- if isinstance(f, Filter):
144
- node = ["Filter", {"Name": f.name}]
145
- self._AddFilesToNode(node, f.contents)
146
- else:
147
- node = ["File", {"RelativePath": f}]
148
- self.files_dict[f] = node
149
- parent.append(node)
150
-
151
- def AddFiles(self, files):
152
- """Adds files to the project.
153
-
154
- Args:
155
- files: A list of Filter objects and/or relative paths to files.
156
-
157
- This makes a copy of the file/filter tree at the time of this call. If you
158
- later add files to a Filter object which was passed into a previous call
159
- to AddFiles(), it will not be reflected in this project.
160
- """
161
- self._AddFilesToNode(self.files_section, files)
162
- # TODO(rspangler) This also doesn't handle adding files to an existing
163
- # filter. That is, it doesn't merge the trees.
164
-
165
- def AddFileConfig(self, path, config, attrs=None, tools=None):
166
- """Adds a configuration to a file.
167
-
168
- Args:
169
- path: Relative path to the file.
170
- config: Name of configuration to add.
171
- attrs: Dict of configuration attributes; may be None.
172
- tools: List of tools (strings or Tool objects); may be None.
173
-
174
- Raises:
175
- ValueError: Relative path does not match any file added via AddFiles().
176
- """
177
- # Find the file node with the right relative path
178
- parent = self.files_dict.get(path)
179
- if not parent:
180
- raise ValueError('AddFileConfig: file "%s" not in project.' % path)
181
-
182
- # Add the config to the file node
183
- spec = self._GetSpecForConfiguration("FileConfiguration", config, attrs, tools)
184
- parent.append(spec)
185
-
186
- def WriteIfChanged(self):
187
- """Writes the project file."""
188
- # First create XML content definition
189
- content = [
190
- "VisualStudioProject",
191
- {
192
- "ProjectType": "Visual C++",
193
- "Version": self.version.ProjectVersion(),
194
- "Name": self.name,
195
- "ProjectGUID": self.guid,
196
- "RootNamespace": self.name,
197
- "Keyword": "Win32Proj",
198
- },
199
- self.platform_section,
200
- self.tool_files_section,
201
- self.configurations_section,
202
- ["References"], # empty section
203
- self.files_section,
204
- ["Globals"], # empty section
205
- ]
206
- easy_xml.WriteXmlIfChanged(content, self.project_path, encoding="Windows-1252")