@btc-vision/bitcoin 6.4.9 → 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 (230) 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/browser/index.d.ts +1 -1
  9. package/browser/index.js +1 -1
  10. package/browser/{ops.d.ts → opcodes.d.ts} +2 -3
  11. package/browser/script.d.ts +2 -2
  12. package/build/address.js +2 -1
  13. package/build/index.d.ts +1 -1
  14. package/build/index.js +1 -1
  15. package/build/{ops.d.ts → opcodes.d.ts} +2 -3
  16. package/build/{ops.js → opcodes.js} +4 -5
  17. package/build/payments/embed.js +1 -1
  18. package/build/payments/p2ms.js +1 -1
  19. package/build/payments/p2op.js +1 -1
  20. package/build/payments/p2pk.js +1 -1
  21. package/build/payments/p2pkh.js +1 -1
  22. package/build/payments/p2sh.js +3 -3
  23. package/build/payments/p2tr.js +1 -1
  24. package/build/payments/p2wpkh.js +2 -2
  25. package/build/payments/p2wsh.js +2 -2
  26. package/build/push_data.js +9 -9
  27. package/build/script.d.ts +2 -2
  28. package/build/script.js +12 -12
  29. package/build/transaction.js +1 -1
  30. package/cjs/package.json +3 -3
  31. package/gulpfile.js +42 -42
  32. package/package.json +150 -150
  33. package/src/address.ts +304 -303
  34. package/src/bip66.ts +107 -107
  35. package/src/block.ts +233 -233
  36. package/src/bufferutils.ts +188 -188
  37. package/src/crypto.ts +108 -108
  38. package/src/ecc_lib.ts +94 -94
  39. package/src/hooks/AdvancedSignatureManager.ts +104 -104
  40. package/src/hooks/SignatureManager.ts +84 -84
  41. package/src/index.ts +105 -105
  42. package/src/merkle.ts +31 -31
  43. package/src/{ops.ts → opcodes.ts} +280 -282
  44. package/src/payments/bip341.ts +140 -140
  45. package/src/payments/embed.ts +61 -61
  46. package/src/payments/index.ts +172 -172
  47. package/src/payments/lazy.ts +28 -28
  48. package/src/payments/p2ms.ts +156 -156
  49. package/src/payments/p2op.ts +195 -195
  50. package/src/payments/p2pk.ts +93 -93
  51. package/src/payments/p2pkh.ts +214 -214
  52. package/src/payments/p2sh.ts +210 -210
  53. package/src/payments/p2tr.ts +309 -309
  54. package/src/payments/p2wpkh.ts +144 -144
  55. package/src/payments/p2wsh.ts +217 -217
  56. package/src/psbt/bip371.ts +441 -441
  57. package/src/push_data.ts +97 -97
  58. package/src/script.ts +247 -247
  59. package/src/script_number.ts +72 -72
  60. package/src/script_signature.ts +91 -91
  61. package/src/transaction.ts +656 -656
  62. package/test/address.spec.ts +155 -155
  63. package/test/bitcoin.core.spec.ts +212 -212
  64. package/test/block.spec.ts +171 -171
  65. package/test/bufferutils.spec.ts +450 -450
  66. package/test/crypto.spec.ts +49 -49
  67. package/test/fixtures/address.json +329 -329
  68. package/test/fixtures/block.json +148 -148
  69. package/test/fixtures/bufferutils.json +102 -102
  70. package/test/fixtures/core/README.md +26 -26
  71. package/test/fixtures/core/base58_encode_decode.json +50 -50
  72. package/test/fixtures/core/base58_keys_invalid.json +152 -152
  73. package/test/fixtures/core/base58_keys_valid.json +452 -452
  74. package/test/fixtures/core/blocks.json +27 -27
  75. package/test/fixtures/core/sig_canonical.json +7 -7
  76. package/test/fixtures/core/sig_noncanonical.json +33 -33
  77. package/test/fixtures/core/sighash.json +3505 -3505
  78. package/test/fixtures/core/tx_valid.json +2023 -2023
  79. package/test/fixtures/crypto.json +43 -43
  80. package/test/fixtures/ecdsa.json +217 -217
  81. package/test/fixtures/ecpair.json +141 -141
  82. package/test/fixtures/embed.json +108 -108
  83. package/test/fixtures/p2ms.json +434 -434
  84. package/test/fixtures/p2pk.json +179 -179
  85. package/test/fixtures/p2pkh.json +276 -276
  86. package/test/fixtures/p2sh.json +508 -508
  87. package/test/fixtures/p2tr.json +1198 -1198
  88. package/test/fixtures/p2wpkh.json +290 -290
  89. package/test/fixtures/p2wsh.json +489 -489
  90. package/test/fixtures/psbt.json +924 -924
  91. package/test/fixtures/script.json +465 -465
  92. package/test/fixtures/script_number.json +225 -225
  93. package/test/fixtures/signature.json +140 -140
  94. package/test/fixtures/transaction.json +916 -916
  95. package/test/integration/_regtest.ts +6 -6
  96. package/test/integration/addresses.spec.ts +142 -142
  97. package/test/integration/bip32.spec.ts +130 -130
  98. package/test/integration/blocks.spec.ts +28 -28
  99. package/test/integration/cltv.spec.ts +241 -241
  100. package/test/integration/csv.spec.ts +452 -452
  101. package/test/integration/payments.spec.ts +110 -110
  102. package/test/integration/taproot.spec.ts +663 -663
  103. package/test/integration/transactions.spec.ts +668 -668
  104. package/test/payments.spec.ts +114 -114
  105. package/test/payments.utils.ts +165 -165
  106. package/test/psbt.spec.ts +1285 -1285
  107. package/test/script.spec.ts +186 -186
  108. package/test/script_number.spec.ts +26 -26
  109. package/test/script_signature.spec.ts +66 -66
  110. package/test/transaction.spec.ts +337 -337
  111. package/test/ts-node-register.js +7 -7
  112. package/test/tsconfig.json +48 -48
  113. package/test/types.spec.ts +53 -53
  114. package/tsconfig.base.json +27 -27
  115. package/tsconfig.json +19 -19
  116. package/tsconfig.webpack.json +18 -18
  117. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.ready +0 -0
  118. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.release-please-manifest.json +0 -3
  119. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CHANGELOG.md +0 -962
  120. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CONTRIBUTING.md +0 -34
  121. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/LICENSE +0 -24
  122. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/README.md +0 -273
  123. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/SECURITY.md +0 -2
  124. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/addon.gypi +0 -204
  125. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/bin/node-gyp.js +0 -138
  126. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/.release-please-manifest.json +0 -3
  127. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/LICENSE +0 -28
  128. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/ninja/build.ninja +0 -4
  129. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc +0 -12
  130. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/GypVsCMake.md +0 -116
  131. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Hacking.md +0 -46
  132. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/InputFormatReference.md +0 -1080
  133. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/LanguageSpecification.md +0 -430
  134. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/README.md +0 -27
  135. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Testing.md +0 -450
  136. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/UserDocumentation.md +0 -965
  137. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp +0 -8
  138. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp.bat +0 -5
  139. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  140. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -365
  141. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  142. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1272
  143. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  144. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  145. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  146. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  147. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  148. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -692
  149. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -711
  150. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -171
  151. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -169
  152. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -113
  153. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  154. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  155. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -804
  156. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  157. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1318
  158. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -127
  159. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  160. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -461
  161. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  162. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -57
  163. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2745
  164. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3976
  165. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  166. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2964
  167. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -67
  168. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1391
  169. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  170. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3115
  171. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  172. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  173. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1260
  174. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  175. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  176. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -373
  177. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1938
  178. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +0 -53
  179. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  180. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3198
  181. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  182. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE +0 -3
  183. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE +0 -177
  184. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD +0 -23
  185. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +0 -15
  186. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +0 -108
  187. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +0 -252
  188. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +0 -83
  189. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +0 -359
  190. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +0 -61
  191. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +0 -192
  192. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/markers.py +0 -252
  193. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +0 -825
  194. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  195. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +0 -90
  196. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +0 -1030
  197. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/tags.py +0 -553
  198. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/utils.py +0 -172
  199. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/version.py +0 -563
  200. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pyproject.toml +0 -120
  201. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/release-please-config.json +0 -11
  202. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/test_gyp.py +0 -261
  203. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/Find-VisualStudio.cs +0 -250
  204. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/build.js +0 -227
  205. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/clean.js +0 -15
  206. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/configure.js +0 -328
  207. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/create-config-gypi.js +0 -150
  208. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/download.js +0 -39
  209. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-node-directory.js +0 -63
  210. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-python.js +0 -310
  211. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-visualstudio.js +0 -590
  212. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/install.js +0 -415
  213. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/list.js +0 -26
  214. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/log.js +0 -168
  215. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/node-gyp.js +0 -188
  216. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/process-release.js +0 -146
  217. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/rebuild.js +0 -12
  218. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/remove.js +0 -43
  219. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/util.js +0 -81
  220. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/macOS_Catalina_acid_test.sh +0 -21
  221. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/package.json +0 -51
  222. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/release-please-config.json +0 -40
  223. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/src/win_delay_load_hook.cc +0 -39
  224. package/coverage/tmp/coverage-31752-1735543485354-0.json +0 -1
  225. package/coverage/tmp/coverage-59920-1735543484555-0.json +0 -1
  226. package/coverage/tmp/coverage-66252-1735543483919-0.json +0 -1
  227. package/coverage/tmp/coverage-68440-1735543485236-0.json +0 -1
  228. package/coverage/tmp/coverage-70588-1735543484426-0.json +0 -1
  229. package/coverage/tmp/coverage-79292-1735543485296-0.json +0 -1
  230. package/coverage/tmp/coverage-80212-1735543483980-0.json +0 -1
@@ -1,59 +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
- class Writer:
11
- """Visual Studio XML tool file writer."""
12
-
13
- def __init__(self, tool_file_path, name):
14
- """Initializes the tool file.
15
-
16
- Args:
17
- tool_file_path: Path to the tool file.
18
- name: Name of the tool file.
19
- """
20
- self.tool_file_path = tool_file_path
21
- self.name = name
22
- self.rules_section = ["Rules"]
23
-
24
- def AddCustomBuildRule(
25
- self, name, cmd, description, additional_dependencies, outputs, extensions
26
- ):
27
- """Adds a rule to the tool file.
28
-
29
- Args:
30
- name: Name of the rule.
31
- description: Description of the rule.
32
- cmd: Command line of the rule.
33
- additional_dependencies: other files which may trigger the rule.
34
- outputs: outputs of the rule.
35
- extensions: extensions handled by the rule.
36
- """
37
- rule = [
38
- "CustomBuildRule",
39
- {
40
- "Name": name,
41
- "ExecutionDescription": description,
42
- "CommandLine": cmd,
43
- "Outputs": ";".join(outputs),
44
- "FileExtensions": ";".join(extensions),
45
- "AdditionalDependencies": ";".join(additional_dependencies),
46
- },
47
- ]
48
- self.rules_section.append(rule)
49
-
50
- def WriteIfChanged(self):
51
- """Writes the tool file."""
52
- content = [
53
- "VisualStudioToolFile",
54
- {"Version": "8.00", "Name": self.name},
55
- self.rules_section,
56
- ]
57
- easy_xml.WriteXmlIfChanged(
58
- content, self.tool_file_path, encoding="Windows-1252"
59
- )
@@ -1,153 +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 user preferences file writer."""
6
-
7
- import os
8
- import re
9
- import socket # for gethostname
10
-
11
- import gyp.easy_xml as easy_xml
12
-
13
-
14
- # ------------------------------------------------------------------------------
15
-
16
-
17
- def _FindCommandInPath(command):
18
- """If there are no slashes in the command given, this function
19
- searches the PATH env to find the given command, and converts it
20
- to an absolute path. We have to do this because MSVS is looking
21
- for an actual file to launch a debugger on, not just a command
22
- line. Note that this happens at GYP time, so anything needing to
23
- be built needs to have a full path."""
24
- if "/" in command or "\\" in command:
25
- # If the command already has path elements (either relative or
26
- # absolute), then assume it is constructed properly.
27
- return command
28
- else:
29
- # Search through the path list and find an existing file that
30
- # we can access.
31
- paths = os.environ.get("PATH", "").split(os.pathsep)
32
- for path in paths:
33
- item = os.path.join(path, command)
34
- if os.path.isfile(item) and os.access(item, os.X_OK):
35
- return item
36
- return command
37
-
38
-
39
- def _QuoteWin32CommandLineArgs(args):
40
- new_args = []
41
- for arg in args:
42
- # Replace all double-quotes with double-double-quotes to escape
43
- # them for cmd shell, and then quote the whole thing if there
44
- # are any.
45
- if arg.find('"') != -1:
46
- arg = '""'.join(arg.split('"'))
47
- arg = '"%s"' % arg
48
-
49
- # Otherwise, if there are any spaces, quote the whole arg.
50
- elif re.search(r"[ \t\n]", arg):
51
- arg = '"%s"' % arg
52
- new_args.append(arg)
53
- return new_args
54
-
55
-
56
- class Writer:
57
- """Visual Studio XML user user file writer."""
58
-
59
- def __init__(self, user_file_path, version, name):
60
- """Initializes the user file.
61
-
62
- Args:
63
- user_file_path: Path to the user file.
64
- version: Version info.
65
- name: Name of the user file.
66
- """
67
- self.user_file_path = user_file_path
68
- self.version = version
69
- self.name = name
70
- self.configurations = {}
71
-
72
- def AddConfig(self, name):
73
- """Adds a configuration to the project.
74
-
75
- Args:
76
- name: Configuration name.
77
- """
78
- self.configurations[name] = ["Configuration", {"Name": name}]
79
-
80
- def AddDebugSettings(
81
- self, config_name, command, environment={}, working_directory=""
82
- ):
83
- """Adds a DebugSettings node to the user file for a particular config.
84
-
85
- Args:
86
- command: command line to run. First element in the list is the
87
- executable. All elements of the command will be quoted if
88
- necessary.
89
- working_directory: other files which may trigger the rule. (optional)
90
- """
91
- command = _QuoteWin32CommandLineArgs(command)
92
-
93
- abs_command = _FindCommandInPath(command[0])
94
-
95
- if environment and isinstance(environment, dict):
96
- env_list = [f'{key}="{val}"' for (key, val) in environment.items()]
97
- environment = " ".join(env_list)
98
- else:
99
- environment = ""
100
-
101
- n_cmd = [
102
- "DebugSettings",
103
- {
104
- "Command": abs_command,
105
- "WorkingDirectory": working_directory,
106
- "CommandArguments": " ".join(command[1:]),
107
- "RemoteMachine": socket.gethostname(),
108
- "Environment": environment,
109
- "EnvironmentMerge": "true",
110
- # Currently these are all "dummy" values that we're just setting
111
- # in the default manner that MSVS does it. We could use some of
112
- # these to add additional capabilities, I suppose, but they might
113
- # not have parity with other platforms then.
114
- "Attach": "false",
115
- "DebuggerType": "3", # 'auto' debugger
116
- "Remote": "1",
117
- "RemoteCommand": "",
118
- "HttpUrl": "",
119
- "PDBPath": "",
120
- "SQLDebugging": "",
121
- "DebuggerFlavor": "0",
122
- "MPIRunCommand": "",
123
- "MPIRunArguments": "",
124
- "MPIRunWorkingDirectory": "",
125
- "ApplicationCommand": "",
126
- "ApplicationArguments": "",
127
- "ShimCommand": "",
128
- "MPIAcceptMode": "",
129
- "MPIAcceptFilter": "",
130
- },
131
- ]
132
-
133
- # Find the config, and add it if it doesn't exist.
134
- if config_name not in self.configurations:
135
- self.AddConfig(config_name)
136
-
137
- # Add the DebugSettings onto the appropriate config.
138
- self.configurations[config_name].append(n_cmd)
139
-
140
- def WriteIfChanged(self):
141
- """Writes the user file."""
142
- configs = ["Configurations"]
143
- for config, spec in sorted(self.configurations.items()):
144
- configs.append(spec)
145
-
146
- content = [
147
- "VisualStudioUserFile",
148
- {"Version": self.version.ProjectVersion(), "Name": self.name},
149
- configs,
150
- ]
151
- easy_xml.WriteXmlIfChanged(
152
- content, self.user_file_path, encoding="Windows-1252"
153
- )
@@ -1,271 +0,0 @@
1
- # Copyright (c) 2013 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
- """Utility functions shared amongst the Windows generators."""
6
-
7
- import copy
8
- import os
9
-
10
-
11
- # A dictionary mapping supported target types to extensions.
12
- TARGET_TYPE_EXT = {
13
- "executable": "exe",
14
- "loadable_module": "dll",
15
- "shared_library": "dll",
16
- "static_library": "lib",
17
- "windows_driver": "sys",
18
- }
19
-
20
-
21
- def _GetLargePdbShimCcPath():
22
- """Returns the path of the large_pdb_shim.cc file."""
23
- this_dir = os.path.abspath(os.path.dirname(__file__))
24
- src_dir = os.path.abspath(os.path.join(this_dir, "..", ".."))
25
- win_data_dir = os.path.join(src_dir, "data", "win")
26
- large_pdb_shim_cc = os.path.join(win_data_dir, "large-pdb-shim.cc")
27
- return large_pdb_shim_cc
28
-
29
-
30
- def _DeepCopySomeKeys(in_dict, keys):
31
- """Performs a partial deep-copy on |in_dict|, only copying the keys in |keys|.
32
-
33
- Arguments:
34
- in_dict: The dictionary to copy.
35
- keys: The keys to be copied. If a key is in this list and doesn't exist in
36
- |in_dict| this is not an error.
37
- Returns:
38
- The partially deep-copied dictionary.
39
- """
40
- d = {}
41
- for key in keys:
42
- if key not in in_dict:
43
- continue
44
- d[key] = copy.deepcopy(in_dict[key])
45
- return d
46
-
47
-
48
- def _SuffixName(name, suffix):
49
- """Add a suffix to the end of a target.
50
-
51
- Arguments:
52
- name: name of the target (foo#target)
53
- suffix: the suffix to be added
54
- Returns:
55
- Target name with suffix added (foo_suffix#target)
56
- """
57
- parts = name.rsplit("#", 1)
58
- parts[0] = f"{parts[0]}_{suffix}"
59
- return "#".join(parts)
60
-
61
-
62
- def _ShardName(name, number):
63
- """Add a shard number to the end of a target.
64
-
65
- Arguments:
66
- name: name of the target (foo#target)
67
- number: shard number
68
- Returns:
69
- Target name with shard added (foo_1#target)
70
- """
71
- return _SuffixName(name, str(number))
72
-
73
-
74
- def ShardTargets(target_list, target_dicts):
75
- """Shard some targets apart to work around the linkers limits.
76
-
77
- Arguments:
78
- target_list: List of target pairs: 'base/base.gyp:base'.
79
- target_dicts: Dict of target properties keyed on target pair.
80
- Returns:
81
- Tuple of the new sharded versions of the inputs.
82
- """
83
- # Gather the targets to shard, and how many pieces.
84
- targets_to_shard = {}
85
- for t in target_dicts:
86
- shards = int(target_dicts[t].get("msvs_shard", 0))
87
- if shards:
88
- targets_to_shard[t] = shards
89
- # Shard target_list.
90
- new_target_list = []
91
- for t in target_list:
92
- if t in targets_to_shard:
93
- for i in range(targets_to_shard[t]):
94
- new_target_list.append(_ShardName(t, i))
95
- else:
96
- new_target_list.append(t)
97
- # Shard target_dict.
98
- new_target_dicts = {}
99
- for t in target_dicts:
100
- if t in targets_to_shard:
101
- for i in range(targets_to_shard[t]):
102
- name = _ShardName(t, i)
103
- new_target_dicts[name] = copy.copy(target_dicts[t])
104
- new_target_dicts[name]["target_name"] = _ShardName(
105
- new_target_dicts[name]["target_name"], i
106
- )
107
- sources = new_target_dicts[name].get("sources", [])
108
- new_sources = []
109
- for pos in range(i, len(sources), targets_to_shard[t]):
110
- new_sources.append(sources[pos])
111
- new_target_dicts[name]["sources"] = new_sources
112
- else:
113
- new_target_dicts[t] = target_dicts[t]
114
- # Shard dependencies.
115
- for t in sorted(new_target_dicts):
116
- for deptype in ("dependencies", "dependencies_original"):
117
- dependencies = copy.copy(new_target_dicts[t].get(deptype, []))
118
- new_dependencies = []
119
- for d in dependencies:
120
- if d in targets_to_shard:
121
- for i in range(targets_to_shard[d]):
122
- new_dependencies.append(_ShardName(d, i))
123
- else:
124
- new_dependencies.append(d)
125
- new_target_dicts[t][deptype] = new_dependencies
126
-
127
- return (new_target_list, new_target_dicts)
128
-
129
-
130
- def _GetPdbPath(target_dict, config_name, vars):
131
- """Returns the path to the PDB file that will be generated by a given
132
- configuration.
133
-
134
- The lookup proceeds as follows:
135
- - Look for an explicit path in the VCLinkerTool configuration block.
136
- - Look for an 'msvs_large_pdb_path' variable.
137
- - Use '<(PRODUCT_DIR)/<(product_name).(exe|dll).pdb' if 'product_name' is
138
- specified.
139
- - Use '<(PRODUCT_DIR)/<(target_name).(exe|dll).pdb'.
140
-
141
- Arguments:
142
- target_dict: The target dictionary to be searched.
143
- config_name: The name of the configuration of interest.
144
- vars: A dictionary of common GYP variables with generator-specific values.
145
- Returns:
146
- The path of the corresponding PDB file.
147
- """
148
- config = target_dict["configurations"][config_name]
149
- msvs = config.setdefault("msvs_settings", {})
150
-
151
- linker = msvs.get("VCLinkerTool", {})
152
-
153
- pdb_path = linker.get("ProgramDatabaseFile")
154
- if pdb_path:
155
- return pdb_path
156
-
157
- variables = target_dict.get("variables", {})
158
- pdb_path = variables.get("msvs_large_pdb_path", None)
159
- if pdb_path:
160
- return pdb_path
161
-
162
- pdb_base = target_dict.get("product_name", target_dict["target_name"])
163
- pdb_base = "{}.{}.pdb".format(pdb_base, TARGET_TYPE_EXT[target_dict["type"]])
164
- pdb_path = vars["PRODUCT_DIR"] + "/" + pdb_base
165
-
166
- return pdb_path
167
-
168
-
169
- def InsertLargePdbShims(target_list, target_dicts, vars):
170
- """Insert a shim target that forces the linker to use 4KB pagesize PDBs.
171
-
172
- This is a workaround for targets with PDBs greater than 1GB in size, the
173
- limit for the 1KB pagesize PDBs created by the linker by default.
174
-
175
- Arguments:
176
- target_list: List of target pairs: 'base/base.gyp:base'.
177
- target_dicts: Dict of target properties keyed on target pair.
178
- vars: A dictionary of common GYP variables with generator-specific values.
179
- Returns:
180
- Tuple of the shimmed version of the inputs.
181
- """
182
- # Determine which targets need shimming.
183
- targets_to_shim = []
184
- for t in target_dicts:
185
- target_dict = target_dicts[t]
186
-
187
- # We only want to shim targets that have msvs_large_pdb enabled.
188
- if not int(target_dict.get("msvs_large_pdb", 0)):
189
- continue
190
- # This is intended for executable, shared_library and loadable_module
191
- # targets where every configuration is set up to produce a PDB output.
192
- # If any of these conditions is not true then the shim logic will fail
193
- # below.
194
- targets_to_shim.append(t)
195
-
196
- large_pdb_shim_cc = _GetLargePdbShimCcPath()
197
-
198
- for t in targets_to_shim:
199
- target_dict = target_dicts[t]
200
- target_name = target_dict.get("target_name")
201
-
202
- base_dict = _DeepCopySomeKeys(
203
- target_dict, ["configurations", "default_configuration", "toolset"]
204
- )
205
-
206
- # This is the dict for copying the source file (part of the GYP tree)
207
- # to the intermediate directory of the project. This is necessary because
208
- # we can't always build a relative path to the shim source file (on Windows
209
- # GYP and the project may be on different drives), and Ninja hates absolute
210
- # paths (it ends up generating the .obj and .obj.d alongside the source
211
- # file, polluting GYPs tree).
212
- copy_suffix = "large_pdb_copy"
213
- copy_target_name = target_name + "_" + copy_suffix
214
- full_copy_target_name = _SuffixName(t, copy_suffix)
215
- shim_cc_basename = os.path.basename(large_pdb_shim_cc)
216
- shim_cc_dir = vars["SHARED_INTERMEDIATE_DIR"] + "/" + copy_target_name
217
- shim_cc_path = shim_cc_dir + "/" + shim_cc_basename
218
- copy_dict = copy.deepcopy(base_dict)
219
- copy_dict["target_name"] = copy_target_name
220
- copy_dict["type"] = "none"
221
- copy_dict["sources"] = [large_pdb_shim_cc]
222
- copy_dict["copies"] = [
223
- {"destination": shim_cc_dir, "files": [large_pdb_shim_cc]}
224
- ]
225
-
226
- # This is the dict for the PDB generating shim target. It depends on the
227
- # copy target.
228
- shim_suffix = "large_pdb_shim"
229
- shim_target_name = target_name + "_" + shim_suffix
230
- full_shim_target_name = _SuffixName(t, shim_suffix)
231
- shim_dict = copy.deepcopy(base_dict)
232
- shim_dict["target_name"] = shim_target_name
233
- shim_dict["type"] = "static_library"
234
- shim_dict["sources"] = [shim_cc_path]
235
- shim_dict["dependencies"] = [full_copy_target_name]
236
-
237
- # Set up the shim to output its PDB to the same location as the final linker
238
- # target.
239
- for config_name, config in shim_dict.get("configurations").items():
240
- pdb_path = _GetPdbPath(target_dict, config_name, vars)
241
-
242
- # A few keys that we don't want to propagate.
243
- for key in ["msvs_precompiled_header", "msvs_precompiled_source", "test"]:
244
- config.pop(key, None)
245
-
246
- msvs = config.setdefault("msvs_settings", {})
247
-
248
- # Update the compiler directives in the shim target.
249
- compiler = msvs.setdefault("VCCLCompilerTool", {})
250
- compiler["DebugInformationFormat"] = "3"
251
- compiler["ProgramDataBaseFileName"] = pdb_path
252
-
253
- # Set the explicit PDB path in the appropriate configuration of the
254
- # original target.
255
- config = target_dict["configurations"][config_name]
256
- msvs = config.setdefault("msvs_settings", {})
257
- linker = msvs.setdefault("VCLinkerTool", {})
258
- linker["GenerateDebugInformation"] = "true"
259
- linker["ProgramDatabaseFile"] = pdb_path
260
-
261
- # Add the new targets. They must go to the beginning of the list so that
262
- # the dependency generation works as expected in ninja.
263
- target_list.insert(0, full_copy_target_name)
264
- target_list.insert(0, full_shim_target_name)
265
- target_dicts[full_copy_target_name] = copy_dict
266
- target_dicts[full_shim_target_name] = shim_dict
267
-
268
- # Update the original target to depend on the shim target.
269
- target_dict.setdefault("dependencies", []).append(full_shim_target_name)
270
-
271
- return (target_list, target_dicts)