@convesoft/nx-rust 0.0.0 → 1.0.0-rc.1

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 (391) hide show
  1. package/LICENSE-APACHE +201 -0
  2. package/LICENSE-MIT +21 -0
  3. package/README.md +47 -1
  4. package/executors.json +35 -0
  5. package/generators.json +19 -0
  6. package/package.json +17 -4
  7. package/src/cargo/build-settings.d.ts +54 -0
  8. package/src/cargo/build-settings.js +93 -0
  9. package/src/cargo/build-settings.js.map +1 -0
  10. package/src/cargo/configured-runner.d.ts +36 -0
  11. package/src/cargo/configured-runner.js +99 -0
  12. package/src/cargo/configured-runner.js.map +1 -0
  13. package/src/cargo/configured-tools.d.ts +35 -0
  14. package/src/cargo/configured-tools.js +46 -0
  15. package/src/cargo/configured-tools.js.map +1 -0
  16. package/src/cargo/dep-info-basedir.d.ts +18 -0
  17. package/src/cargo/dep-info-basedir.js +38 -0
  18. package/src/cargo/dep-info-basedir.js.map +1 -0
  19. package/src/cargo/directories.d.ts +40 -0
  20. package/src/cargo/directories.js +89 -0
  21. package/src/cargo/directories.js.map +1 -0
  22. package/src/cargo/host-triple.d.ts +7 -0
  23. package/src/cargo/host-triple.js +21 -0
  24. package/src/cargo/host-triple.js.map +1 -0
  25. package/src/cargo/lockfile.d.ts +63 -0
  26. package/src/cargo/lockfile.js +157 -0
  27. package/src/cargo/lockfile.js.map +1 -0
  28. package/src/cargo/metadata.d.ts +112 -0
  29. package/src/cargo/metadata.js +37 -0
  30. package/src/cargo/metadata.js.map +1 -0
  31. package/src/cargo/package-specs.d.ts +54 -0
  32. package/src/cargo/package-specs.js +109 -0
  33. package/src/cargo/package-specs.js.map +1 -0
  34. package/src/cargo/paths-crates.d.ts +27 -0
  35. package/src/cargo/paths-crates.js +69 -0
  36. package/src/cargo/paths-crates.js.map +1 -0
  37. package/src/cargo/print-artifact-folders.d.ts +1 -0
  38. package/src/cargo/print-artifact-folders.js +58 -0
  39. package/src/cargo/print-artifact-folders.js.map +1 -0
  40. package/src/cargo/redirections.d.ts +87 -0
  41. package/src/cargo/redirections.js +195 -0
  42. package/src/cargo/redirections.js.map +1 -0
  43. package/src/cargo/run-cargo.d.ts +31 -0
  44. package/src/cargo/run-cargo.js +75 -0
  45. package/src/cargo/run-cargo.js.map +1 -0
  46. package/src/cargo/target-triples.d.ts +98 -0
  47. package/src/cargo/target-triples.js +265 -0
  48. package/src/cargo/target-triples.js.map +1 -0
  49. package/src/cargo/version-req.d.ts +12 -0
  50. package/src/cargo/version-req.js +122 -0
  51. package/src/cargo/version-req.js.map +1 -0
  52. package/src/compatibility/cargo-version.d.ts +43 -0
  53. package/src/compatibility/cargo-version.js +83 -0
  54. package/src/compatibility/cargo-version.js.map +1 -0
  55. package/src/compatibility/nx-bridge.d.ts +312 -0
  56. package/src/compatibility/nx-bridge.js +407 -0
  57. package/src/compatibility/nx-bridge.js.map +1 -0
  58. package/src/compatibility/nx-version.d.ts +104 -0
  59. package/src/compatibility/nx-version.js +272 -0
  60. package/src/compatibility/nx-version.js.map +1 -0
  61. package/src/executors/affected-inputs.d.ts +29 -0
  62. package/src/executors/affected-inputs.js +259 -0
  63. package/src/executors/affected-inputs.js.map +1 -0
  64. package/src/executors/affected-run.d.ts +54 -0
  65. package/src/executors/affected-run.js +394 -0
  66. package/src/executors/affected-run.js.map +1 -0
  67. package/src/executors/affected.d.ts +239 -0
  68. package/src/executors/affected.js +589 -0
  69. package/src/executors/affected.js.map +1 -0
  70. package/src/executors/baseline-context.d.ts +85 -0
  71. package/src/executors/baseline-context.js +227 -0
  72. package/src/executors/baseline-context.js.map +1 -0
  73. package/src/executors/baseline.d.ts +123 -0
  74. package/src/executors/baseline.js +356 -0
  75. package/src/executors/baseline.js.map +1 -0
  76. package/src/executors/batch.d.ts +75 -0
  77. package/src/executors/batch.js +434 -0
  78. package/src/executors/batch.js.map +1 -0
  79. package/src/executors/build-records.d.ts +110 -0
  80. package/src/executors/build-records.js +267 -0
  81. package/src/executors/build-records.js.map +1 -0
  82. package/src/executors/cargo/executor.d.ts +28 -0
  83. package/src/executors/cargo/executor.js +58 -0
  84. package/src/executors/cargo/executor.js.map +1 -0
  85. package/src/executors/cargo/schema.json +54 -0
  86. package/src/executors/cargo-invocation.d.ts +81 -0
  87. package/src/executors/cargo-invocation.js +109 -0
  88. package/src/executors/cargo-invocation.js.map +1 -0
  89. package/src/executors/cargo-output.d.ts +212 -0
  90. package/src/executors/cargo-output.js +646 -0
  91. package/src/executors/cargo-output.js.map +1 -0
  92. package/src/executors/command.d.ts +318 -0
  93. package/src/executors/command.js +517 -0
  94. package/src/executors/command.js.map +1 -0
  95. package/src/executors/coverage-baseline.d.ts +23 -0
  96. package/src/executors/coverage-baseline.js +284 -0
  97. package/src/executors/coverage-baseline.js.map +1 -0
  98. package/src/executors/declared-options.d.ts +21 -0
  99. package/src/executors/declared-options.js +58 -0
  100. package/src/executors/declared-options.js.map +1 -0
  101. package/src/executors/digests.d.ts +94 -0
  102. package/src/executors/digests.js +190 -0
  103. package/src/executors/digests.js.map +1 -0
  104. package/src/executors/dotenv-check.d.ts +79 -0
  105. package/src/executors/dotenv-check.js +553 -0
  106. package/src/executors/dotenv-check.js.map +1 -0
  107. package/src/executors/group-invocations.d.ts +80 -0
  108. package/src/executors/group-invocations.js +253 -0
  109. package/src/executors/group-invocations.js.map +1 -0
  110. package/src/executors/group-run.d.ts +114 -0
  111. package/src/executors/group-run.js +591 -0
  112. package/src/executors/group-run.js.map +1 -0
  113. package/src/executors/groups.d.ts +113 -0
  114. package/src/executors/groups.js +285 -0
  115. package/src/executors/groups.js.map +1 -0
  116. package/src/executors/input-check.d.ts +52 -0
  117. package/src/executors/input-check.js +271 -0
  118. package/src/executors/input-check.js.map +1 -0
  119. package/src/executors/kept-files.d.ts +98 -0
  120. package/src/executors/kept-files.js +341 -0
  121. package/src/executors/kept-files.js.map +1 -0
  122. package/src/executors/lockfile/executor.d.ts +16 -0
  123. package/src/executors/lockfile/executor.js +37 -0
  124. package/src/executors/lockfile/executor.js.map +1 -0
  125. package/src/executors/lockfile/schema.json +50 -0
  126. package/src/executors/napi-build.d.ts +73 -0
  127. package/src/executors/napi-build.js +420 -0
  128. package/src/executors/napi-build.js.map +1 -0
  129. package/src/executors/nextest.d.ts +185 -0
  130. package/src/executors/nextest.js +498 -0
  131. package/src/executors/nextest.js.map +1 -0
  132. package/src/executors/nx-command.d.ts +95 -0
  133. package/src/executors/nx-command.js +205 -0
  134. package/src/executors/nx-command.js.map +1 -0
  135. package/src/executors/nx-task-files.d.ts +82 -0
  136. package/src/executors/nx-task-files.js +156 -0
  137. package/src/executors/nx-task-files.js.map +1 -0
  138. package/src/executors/print-test-mode.d.ts +1 -0
  139. package/src/executors/print-test-mode.js +25 -0
  140. package/src/executors/print-test-mode.js.map +1 -0
  141. package/src/executors/release-publish/executor.d.ts +24 -0
  142. package/src/executors/release-publish/executor.js +165 -0
  143. package/src/executors/release-publish/executor.js.map +1 -0
  144. package/src/executors/release-publish/schema.json +30 -0
  145. package/src/executors/run/executor.d.ts +12 -0
  146. package/src/executors/run/executor.js +27 -0
  147. package/src/executors/run/executor.js.map +1 -0
  148. package/src/executors/run/schema.json +45 -0
  149. package/src/executors/runner-script.d.ts +12 -0
  150. package/src/executors/runner-script.js +22 -0
  151. package/src/executors/runner-script.js.map +1 -0
  152. package/src/executors/runtime-input-check.d.ts +24 -0
  153. package/src/executors/runtime-input-check.js +87 -0
  154. package/src/executors/runtime-input-check.js.map +1 -0
  155. package/src/executors/shared-artifacts.d.ts +44 -0
  156. package/src/executors/shared-artifacts.js +132 -0
  157. package/src/executors/shared-artifacts.js.map +1 -0
  158. package/src/executors/split-words.d.ts +24 -0
  159. package/src/executors/split-words.js +111 -0
  160. package/src/executors/split-words.js.map +1 -0
  161. package/src/executors/stage.d.ts +163 -0
  162. package/src/executors/stage.js +526 -0
  163. package/src/executors/stage.js.map +1 -0
  164. package/src/executors/staged-run.d.ts +24 -0
  165. package/src/executors/staged-run.js +110 -0
  166. package/src/executors/staged-run.js.map +1 -0
  167. package/src/executors/task-env.d.ts +271 -0
  168. package/src/executors/task-env.js +494 -0
  169. package/src/executors/task-env.js.map +1 -0
  170. package/src/executors/task-execution.d.ts +61 -0
  171. package/src/executors/task-execution.js +122 -0
  172. package/src/executors/task-execution.js.map +1 -0
  173. package/src/executors/task-guards.d.ts +112 -0
  174. package/src/executors/task-guards.js +430 -0
  175. package/src/executors/task-guards.js.map +1 -0
  176. package/src/executors/task-options.d.ts +114 -0
  177. package/src/executors/task-options.js +258 -0
  178. package/src/executors/task-options.js.map +1 -0
  179. package/src/executors/task.d.ts +166 -0
  180. package/src/executors/task.js +520 -0
  181. package/src/executors/task.js.map +1 -0
  182. package/src/executors/test-mode.d.ts +182 -0
  183. package/src/executors/test-mode.js +391 -0
  184. package/src/executors/test-mode.js.map +1 -0
  185. package/src/executors/test-runner.d.ts +44 -0
  186. package/src/executors/test-runner.js +159 -0
  187. package/src/executors/test-runner.js.map +1 -0
  188. package/src/executors/test-steps.d.ts +109 -0
  189. package/src/executors/test-steps.js +535 -0
  190. package/src/executors/test-steps.js.map +1 -0
  191. package/src/executors/wasm-build.d.ts +56 -0
  192. package/src/executors/wasm-build.js +216 -0
  193. package/src/executors/wasm-build.js.map +1 -0
  194. package/src/generators/crate/binary.schema.json +28 -0
  195. package/src/generators/crate/crate.d.ts +24 -0
  196. package/src/generators/crate/crate.js +108 -0
  197. package/src/generators/crate/crate.js.map +1 -0
  198. package/src/generators/crate/enclosing-workspace.d.ts +25 -0
  199. package/src/generators/crate/enclosing-workspace.js +58 -0
  200. package/src/generators/crate/enclosing-workspace.js.map +1 -0
  201. package/src/generators/crate/library.schema.json +28 -0
  202. package/src/generators/init/graph-check.d.ts +81 -0
  203. package/src/generators/init/graph-check.js +299 -0
  204. package/src/generators/init/graph-check.js.map +1 -0
  205. package/src/generators/init/init.d.ts +23 -0
  206. package/src/generators/init/init.js +113 -0
  207. package/src/generators/init/init.js.map +1 -0
  208. package/src/generators/init/report.d.ts +19 -0
  209. package/src/generators/init/report.js +93 -0
  210. package/src/generators/init/report.js.map +1 -0
  211. package/src/generators/init/schema.json +9 -0
  212. package/src/graph/artifact-kinds.d.ts +29 -0
  213. package/src/graph/artifact-kinds.js +50 -0
  214. package/src/graph/artifact-kinds.js.map +1 -0
  215. package/src/graph/artifact-names.d.ts +97 -0
  216. package/src/graph/artifact-names.js +276 -0
  217. package/src/graph/artifact-names.js.map +1 -0
  218. package/src/graph/build-records.d.ts +74 -0
  219. package/src/graph/build-records.js +104 -0
  220. package/src/graph/build-records.js.map +1 -0
  221. package/src/graph/caching.d.ts +148 -0
  222. package/src/graph/caching.js +676 -0
  223. package/src/graph/caching.js.map +1 -0
  224. package/src/graph/collisions.d.ts +106 -0
  225. package/src/graph/collisions.js +156 -0
  226. package/src/graph/collisions.js.map +1 -0
  227. package/src/graph/computation-reports.d.ts +89 -0
  228. package/src/graph/computation-reports.js +216 -0
  229. package/src/graph/computation-reports.js.map +1 -0
  230. package/src/graph/declared-files.d.ts +190 -0
  231. package/src/graph/declared-files.js +600 -0
  232. package/src/graph/declared-files.js.map +1 -0
  233. package/src/graph/discovery.d.ts +175 -0
  234. package/src/graph/discovery.js +656 -0
  235. package/src/graph/discovery.js.map +1 -0
  236. package/src/graph/edges.d.ts +25 -0
  237. package/src/graph/edges.js +94 -0
  238. package/src/graph/edges.js.map +1 -0
  239. package/src/graph/entries.d.ts +83 -0
  240. package/src/graph/entries.js +259 -0
  241. package/src/graph/entries.js.map +1 -0
  242. package/src/graph/inputs.d.ts +420 -0
  243. package/src/graph/inputs.js +746 -0
  244. package/src/graph/inputs.js.map +1 -0
  245. package/src/graph/lockfile-task.d.ts +74 -0
  246. package/src/graph/lockfile-task.js +105 -0
  247. package/src/graph/lockfile-task.js.map +1 -0
  248. package/src/graph/names.d.ts +41 -0
  249. package/src/graph/names.js +34 -0
  250. package/src/graph/names.js.map +1 -0
  251. package/src/graph/napi.d.ts +107 -0
  252. package/src/graph/napi.js +206 -0
  253. package/src/graph/napi.js.map +1 -0
  254. package/src/graph/nx-glob.d.ts +36 -0
  255. package/src/graph/nx-glob.js +152 -0
  256. package/src/graph/nx-glob.js.map +1 -0
  257. package/src/graph/nx-internals.d.ts +57 -0
  258. package/src/graph/nx-internals.js +128 -0
  259. package/src/graph/nx-internals.js.map +1 -0
  260. package/src/graph/options.d.ts +32 -0
  261. package/src/graph/options.js +80 -0
  262. package/src/graph/options.js.map +1 -0
  263. package/src/graph/outputs.d.ts +75 -0
  264. package/src/graph/outputs.js +140 -0
  265. package/src/graph/outputs.js.map +1 -0
  266. package/src/graph/path-dependencies.d.ts +122 -0
  267. package/src/graph/path-dependencies.js +459 -0
  268. package/src/graph/path-dependencies.js.map +1 -0
  269. package/src/graph/plugin-package.d.ts +36 -0
  270. package/src/graph/plugin-package.js +132 -0
  271. package/src/graph/plugin-package.js.map +1 -0
  272. package/src/graph/plugin-version.d.ts +20 -0
  273. package/src/graph/plugin-version.js +153 -0
  274. package/src/graph/plugin-version.js.map +1 -0
  275. package/src/graph/projects.d.ts +141 -0
  276. package/src/graph/projects.js +182 -0
  277. package/src/graph/projects.js.map +1 -0
  278. package/src/graph/reached-projects.d.ts +46 -0
  279. package/src/graph/reached-projects.js +102 -0
  280. package/src/graph/reached-projects.js.map +1 -0
  281. package/src/graph/real-path.d.ts +47 -0
  282. package/src/graph/real-path.js +113 -0
  283. package/src/graph/real-path.js.map +1 -0
  284. package/src/graph/redirected-uses.d.ts +98 -0
  285. package/src/graph/redirected-uses.js +434 -0
  286. package/src/graph/redirected-uses.js.map +1 -0
  287. package/src/graph/registration.d.ts +121 -0
  288. package/src/graph/registration.js +233 -0
  289. package/src/graph/registration.js.map +1 -0
  290. package/src/graph/script-input.d.ts +46 -0
  291. package/src/graph/script-input.js +65 -0
  292. package/src/graph/script-input.js.map +1 -0
  293. package/src/graph/settings.d.ts +178 -0
  294. package/src/graph/settings.js +479 -0
  295. package/src/graph/settings.js.map +1 -0
  296. package/src/graph/target-defaults-causes.d.ts +33 -0
  297. package/src/graph/target-defaults-causes.js +202 -0
  298. package/src/graph/target-defaults-causes.js.map +1 -0
  299. package/src/graph/target-defaults-layers.d.ts +186 -0
  300. package/src/graph/target-defaults-layers.js +420 -0
  301. package/src/graph/target-defaults-layers.js.map +1 -0
  302. package/src/graph/target-defaults-meaning.d.ts +95 -0
  303. package/src/graph/target-defaults-meaning.js +292 -0
  304. package/src/graph/target-defaults-meaning.js.map +1 -0
  305. package/src/graph/target-defaults-report.d.ts +77 -0
  306. package/src/graph/target-defaults-report.js +242 -0
  307. package/src/graph/target-defaults-report.js.map +1 -0
  308. package/src/graph/target-defaults.d.ts +79 -0
  309. package/src/graph/target-defaults.js +425 -0
  310. package/src/graph/target-defaults.js.map +1 -0
  311. package/src/graph/target-fields.d.ts +16 -0
  312. package/src/graph/target-fields.js +134 -0
  313. package/src/graph/target-fields.js.map +1 -0
  314. package/src/graph/target-tables.d.ts +45 -0
  315. package/src/graph/target-tables.js +299 -0
  316. package/src/graph/target-tables.js.map +1 -0
  317. package/src/graph/targets.d.ts +367 -0
  318. package/src/graph/targets.js +404 -0
  319. package/src/graph/targets.js.map +1 -0
  320. package/src/graph/unification.d.ts +141 -0
  321. package/src/graph/unification.js +459 -0
  322. package/src/graph/unification.js.map +1 -0
  323. package/src/graph/unignored-directories.d.ts +25 -0
  324. package/src/graph/unignored-directories.js +89 -0
  325. package/src/graph/unignored-directories.js.map +1 -0
  326. package/src/graph/visibility.d.ts +17 -0
  327. package/src/graph/visibility.js +67 -0
  328. package/src/graph/visibility.js.map +1 -0
  329. package/src/graph/warnings.d.ts +38 -0
  330. package/src/graph/warnings.js +77 -0
  331. package/src/graph/warnings.js.map +1 -0
  332. package/src/graph/wasm.d.ts +56 -0
  333. package/src/graph/wasm.js +77 -0
  334. package/src/graph/wasm.js.map +1 -0
  335. package/src/index.d.ts +68 -0
  336. package/src/index.js +109 -0
  337. package/src/index.js.map +1 -0
  338. package/src/release/manifests.d.ts +95 -0
  339. package/src/release/manifests.js +164 -0
  340. package/src/release/manifests.js.map +1 -0
  341. package/src/release/places.d.ts +127 -0
  342. package/src/release/places.js +368 -0
  343. package/src/release/places.js.map +1 -0
  344. package/src/release/publish-cargo.d.ts +177 -0
  345. package/src/release/publish-cargo.js +351 -0
  346. package/src/release/publish-cargo.js.map +1 -0
  347. package/src/release/publish-crates.d.ts +124 -0
  348. package/src/release/publish-crates.js +242 -0
  349. package/src/release/publish-crates.js.map +1 -0
  350. package/src/release/publish-environments.d.ts +50 -0
  351. package/src/release/publish-environments.js +284 -0
  352. package/src/release/publish-environments.js.map +1 -0
  353. package/src/release/publish-messages.d.ts +66 -0
  354. package/src/release/publish-messages.js +273 -0
  355. package/src/release/publish-messages.js.map +1 -0
  356. package/src/release/publish-registry.d.ts +27 -0
  357. package/src/release/publish-registry.js +135 -0
  358. package/src/release/publish-registry.js.map +1 -0
  359. package/src/release/publish-settings.d.ts +26 -0
  360. package/src/release/publish-settings.js +56 -0
  361. package/src/release/publish-settings.js.map +1 -0
  362. package/src/release/publish.d.ts +59 -0
  363. package/src/release/publish.js +620 -0
  364. package/src/release/publish.js.map +1 -0
  365. package/src/release/repository.d.ts +73 -0
  366. package/src/release/repository.js +219 -0
  367. package/src/release/repository.js.map +1 -0
  368. package/src/release/requirements.d.ts +34 -0
  369. package/src/release/requirements.js +30 -0
  370. package/src/release/requirements.js.map +1 -0
  371. package/src/release/toml-edit.d.ts +67 -0
  372. package/src/release/toml-edit.js +453 -0
  373. package/src/release/toml-edit.js.map +1 -0
  374. package/src/release/version-actions.d.ts +133 -0
  375. package/src/release/version-actions.js +474 -0
  376. package/src/release/version-actions.js.map +1 -0
  377. package/src/release/version-checks.d.ts +21 -0
  378. package/src/release/version-checks.js +151 -0
  379. package/src/release/version-checks.js.map +1 -0
  380. package/src/release/version-lockfiles.d.ts +61 -0
  381. package/src/release/version-lockfiles.js +222 -0
  382. package/src/release/version-lockfiles.js.map +1 -0
  383. package/src/tools/napi-cli.d.ts +70 -0
  384. package/src/tools/napi-cli.js +63 -0
  385. package/src/tools/napi-cli.js.map +1 -0
  386. package/src/tools/optional-tools.d.ts +121 -0
  387. package/src/tools/optional-tools.js +303 -0
  388. package/src/tools/optional-tools.js.map +1 -0
  389. package/src/tools/print-napi-cli.d.ts +1 -0
  390. package/src/tools/print-napi-cli.js +24 -0
  391. package/src/tools/print-napi-cli.js.map +1 -0
@@ -0,0 +1,85 @@
1
+ import type { CargoTargetOptions } from "./command";
2
+ /** The record's file in a workspace root. */
3
+ export declare const contextRecordFile: string;
4
+ /**
5
+ * The prefixes of the variables that the toolchain input of `test` with the
6
+ * nextest runner prints (`DES-INPUTS`), apart from `CARGO_TARGET_DIR`, which
7
+ * says where the artifacts go and not what they are.
8
+ */
9
+ export declare const contextVariablePrefixes: readonly ["CARGO_PROFILE_", "CARGO_TARGET_", "NEXTEST_"];
10
+ /** The context of a collection or of a test run. */
11
+ export interface BaselineContext {
12
+ /** The format's version: 2 since the record holds the runtime inputs. */
13
+ version: 2;
14
+ /** The cargo options that change what is compiled or run. */
15
+ cargo: {
16
+ features: string[];
17
+ allFeatures: boolean;
18
+ noDefaultFeatures: boolean;
19
+ profile: string | null;
20
+ target: string | null;
21
+ };
22
+ /** The target triple that cargo builds for. */
23
+ triple: string;
24
+ /** For each environment input, the SHA-256 of its value, or `null` where it is unset. */
25
+ env: Record<string, string | null>;
26
+ /**
27
+ * For each runtime input of the `test` tasks but the test mode's own, by
28
+ * its command, the SHA-256 of what the command prints, as Nx runs it.
29
+ */
30
+ runtime: Record<string, string>;
31
+ }
32
+ /**
33
+ * Whether a runtime input is the plugin's test mode command, which the
34
+ * record leaves out: its output is the mode and the baseline, which the key
35
+ * holds and which step 1 checks on its own (`DES-TEST-MODE`).
36
+ */
37
+ export declare function isTestModeCommand(command: string): boolean;
38
+ /**
39
+ * The runtime inputs that a context holds, from the commands of the `test`
40
+ * tasks' runtime inputs as Nx expands them: the declared `runtimeInputs`
41
+ * and the plugin's own, such as the toolchain command, each once, sorted,
42
+ * without the test mode command.
43
+ */
44
+ export declare function contextRuntimeCommands(commands: Iterable<string>): string[];
45
+ /**
46
+ * The SHA-256 of what each command prints, run as Nx runs a runtime input:
47
+ * through `sh -c` in the repository root with the task's environment
48
+ * (`EVD-NX-24-INPUT-SEMANTICS`); or why one cannot be run, as a command that
49
+ * fails, which Nx cannot hash either.
50
+ */
51
+ export declare function runtimeContext(commands: readonly string[], repositoryRoot: string, env: NodeJS.ProcessEnv): {
52
+ runtime: Record<string, string>;
53
+ } | {
54
+ problem: string;
55
+ };
56
+ /** The cargo options of `options` that the record holds, in a fixed form. */
57
+ export declare function cargoContext(options: CargoTargetOptions): BaselineContext["cargo"];
58
+ /**
59
+ * The names of the environment inputs that a context holds: `names`, the
60
+ * environment inputs of the `test` tasks as Nx expands them, and every
61
+ * variable of `env` whose name starts with one of
62
+ * {@link contextVariablePrefixes}, without the variables that change
63
+ * nothing that is compiled or run.
64
+ */
65
+ export declare function contextVariables(names: Iterable<string>, env: NodeJS.ProcessEnv): string[];
66
+ /** The SHA-256 of each variable's value in `env`, `null` for an unset one. */
67
+ export declare function environmentContext(names: readonly string[], env: NodeJS.ProcessEnv): Record<string, string | null>;
68
+ /** Writes the record into the workspace root, for the collection target and the tests. */
69
+ export declare function writeContextRecord(workspaceRoot: string, context: BaselineContext): void;
70
+ /** The record in a workspace root, or why there is none that can be read. */
71
+ export declare function readContextRecord(workspaceRoot: string): {
72
+ context: BaselineContext;
73
+ } | {
74
+ problem: string;
75
+ };
76
+ /**
77
+ * What differs between the record of a baseline and the group's context, one
78
+ * phrase each, such as "--features (a against b)" or "the variable FOO";
79
+ * empty where they are equal (`ADR-AFFECTED-BASELINE-CONTEXT`). A variable
80
+ * that the group has among its inputs and that the record does not hold, or
81
+ * that has a prefix of {@link contextVariablePrefixes} in either, counts by
82
+ * its value, an unset one being a value of its own; so does a runtime input
83
+ * of the group that the record does not hold, by the hash of its output.
84
+ */
85
+ export declare function contextDifferences(record: BaselineContext, current: BaselineContext): string[];
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contextVariablePrefixes = exports.contextRecordFile = void 0;
4
+ exports.isTestModeCommand = isTestModeCommand;
5
+ exports.contextRuntimeCommands = contextRuntimeCommands;
6
+ exports.runtimeContext = runtimeContext;
7
+ exports.cargoContext = cargoContext;
8
+ exports.contextVariables = contextVariables;
9
+ exports.environmentContext = environmentContext;
10
+ exports.writeContextRecord = writeContextRecord;
11
+ exports.readContextRecord = readContextRecord;
12
+ exports.contextDifferences = contextDifferences;
13
+ const node_child_process_1 = require("node:child_process");
14
+ const node_crypto_1 = require("node:crypto");
15
+ const node_fs_1 = require("node:fs");
16
+ const node_path_1 = require("node:path");
17
+ const cargo_output_1 = require("./cargo-output");
18
+ // The record of the context in which a coverage baseline was collected
19
+ // (`DES-BASELINE`, `ADR-AFFECTED-BASELINE-CONTEXT`): the collection target
20
+ // writes it beside cargo-affected's database, and step 1 of `DES-TEST-RUN`
21
+ // compares it with the group's context before it trusts a report. Both use
22
+ // this module, so that they read and write one format.
23
+ /** The record's file in a workspace root. */
24
+ exports.contextRecordFile = (0, node_path_1.join)("target", "affected", "nx-rust-context.json");
25
+ /**
26
+ * The prefixes of the variables that the toolchain input of `test` with the
27
+ * nextest runner prints (`DES-INPUTS`), apart from `CARGO_TARGET_DIR`, which
28
+ * says where the artifacts go and not what they are.
29
+ */
30
+ exports.contextVariablePrefixes = ["CARGO_PROFILE_", "CARGO_TARGET_", "NEXTEST_"];
31
+ /**
32
+ * Variables that a `test` task hashes and that change nothing that cargo
33
+ * compiles or a test reads: Nx's key for its cloud cache, and the plugin's
34
+ * mark of a run that excludes task dependencies.
35
+ */
36
+ const notContext = new Set(["NX_CLOUD_ENCRYPTION_KEY", "NX_RUST_RUN_ID"]);
37
+ /**
38
+ * Whether a runtime input is the plugin's test mode command, which the
39
+ * record leaves out: its output is the mode and the baseline, which the key
40
+ * holds and which step 1 checks on its own (`DES-TEST-MODE`).
41
+ */
42
+ function isTestModeCommand(command) {
43
+ return command.includes("print-test-mode.js");
44
+ }
45
+ /**
46
+ * The runtime inputs that a context holds, from the commands of the `test`
47
+ * tasks' runtime inputs as Nx expands them: the declared `runtimeInputs`
48
+ * and the plugin's own, such as the toolchain command, each once, sorted,
49
+ * without the test mode command.
50
+ */
51
+ function contextRuntimeCommands(commands) {
52
+ return [...new Set(commands)].filter((command) => !isTestModeCommand(command)).sort();
53
+ }
54
+ /**
55
+ * The SHA-256 of what each command prints, run as Nx runs a runtime input:
56
+ * through `sh -c` in the repository root with the task's environment
57
+ * (`EVD-NX-24-INPUT-SEMANTICS`); or why one cannot be run, as a command that
58
+ * fails, which Nx cannot hash either.
59
+ */
60
+ function runtimeContext(commands, repositoryRoot, env) {
61
+ const runtime = {};
62
+ for (const command of commands) {
63
+ const run = (0, node_child_process_1.spawnSync)("sh", ["-c", command], {
64
+ cwd: repositoryRoot,
65
+ env,
66
+ encoding: "utf8",
67
+ maxBuffer: 256 * 1024 * 1024,
68
+ stdio: ["ignore", "pipe", "pipe"],
69
+ });
70
+ if (run.error !== undefined || run.status !== 0) {
71
+ return {
72
+ problem: `the runtime input \`${command}\` ${run.error === undefined ? `exited with status ${run.status}` : `could not run (${run.error.message})`}, so the plugin cannot compare it with the baseline's`,
73
+ };
74
+ }
75
+ runtime[command] = (0, node_crypto_1.createHash)("sha256").update(run.stdout).digest("hex");
76
+ }
77
+ return { runtime };
78
+ }
79
+ /** The cargo options of `options` that the record holds, in a fixed form. */
80
+ function cargoContext(options) {
81
+ var _a, _b, _c;
82
+ return {
83
+ features: [...new Set((_a = options.features) !== null && _a !== void 0 ? _a : [])].sort(),
84
+ allFeatures: options.allFeatures === true,
85
+ noDefaultFeatures: options.noDefaultFeatures === true,
86
+ profile: (_b = options.profile) !== null && _b !== void 0 ? _b : null,
87
+ target: (_c = options.targetTriple) !== null && _c !== void 0 ? _c : null,
88
+ };
89
+ }
90
+ /**
91
+ * The names of the environment inputs that a context holds: `names`, the
92
+ * environment inputs of the `test` tasks as Nx expands them, and every
93
+ * variable of `env` whose name starts with one of
94
+ * {@link contextVariablePrefixes}, without the variables that change
95
+ * nothing that is compiled or run.
96
+ */
97
+ function contextVariables(names, env) {
98
+ const all = new Set(names);
99
+ for (const name of Object.keys(env)) {
100
+ if (env[name] !== undefined &&
101
+ name !== "CARGO_TARGET_DIR" &&
102
+ exports.contextVariablePrefixes.some((prefix) => name.startsWith(prefix))) {
103
+ all.add(name);
104
+ }
105
+ }
106
+ return [...all].filter((name) => !notContext.has(name)).sort();
107
+ }
108
+ /** The SHA-256 of each variable's value in `env`, `null` for an unset one. */
109
+ function environmentContext(names, env) {
110
+ return Object.fromEntries(names.map((name) => {
111
+ const value = env[name];
112
+ return [name, value === undefined ? null : (0, node_crypto_1.createHash)("sha256").update(value).digest("hex")];
113
+ }));
114
+ }
115
+ /** Writes the record into the workspace root, for the collection target and the tests. */
116
+ function writeContextRecord(workspaceRoot, context) {
117
+ const file = (0, node_path_1.join)(workspaceRoot, exports.contextRecordFile);
118
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(file), { recursive: true });
119
+ (0, node_fs_1.writeFileSync)(file, `${JSON.stringify(context, null, 2)}\n`);
120
+ }
121
+ /** The record in a workspace root, or why there is none that can be read. */
122
+ function readContextRecord(workspaceRoot) {
123
+ let text;
124
+ try {
125
+ text = (0, node_fs_1.readFileSync)((0, node_path_1.join)(workspaceRoot, exports.contextRecordFile), "utf8");
126
+ }
127
+ catch (error) {
128
+ return error.code === "ENOENT"
129
+ ? {
130
+ problem: `the baseline has no record of the context it was collected in (${exports.contextRecordFile}), which the collection target writes after a successful collection`,
131
+ }
132
+ : {
133
+ problem: `the record of the baseline's context, ${exports.contextRecordFile}, cannot be read (${error.message})`,
134
+ };
135
+ }
136
+ let data;
137
+ try {
138
+ data = JSON.parse(text);
139
+ }
140
+ catch (_a) {
141
+ return { problem: `the record of the baseline's context, ${exports.contextRecordFile}, is no JSON` };
142
+ }
143
+ const record = data;
144
+ if ((record === null || record === void 0 ? void 0 : record.version) === 1) {
145
+ return {
146
+ problem: `the record of the baseline's context, ${exports.contextRecordFile}, is of the form of version 1, which holds no runtime inputs; collect the baseline again`,
147
+ };
148
+ }
149
+ const cargo = record === null || record === void 0 ? void 0 : record.cargo;
150
+ const env = record === null || record === void 0 ? void 0 : record.env;
151
+ const runtime = record === null || record === void 0 ? void 0 : record.runtime;
152
+ if ((record === null || record === void 0 ? void 0 : record.version) !== 2 ||
153
+ typeof record.triple !== "string" ||
154
+ typeof cargo !== "object" ||
155
+ cargo === null ||
156
+ !Array.isArray(cargo.features) ||
157
+ !cargo.features.every((feature) => typeof feature === "string") ||
158
+ typeof cargo.allFeatures !== "boolean" ||
159
+ typeof cargo.noDefaultFeatures !== "boolean" ||
160
+ !(cargo.profile === null || typeof cargo.profile === "string") ||
161
+ !(cargo.target === null || typeof cargo.target === "string") ||
162
+ typeof env !== "object" ||
163
+ env === null ||
164
+ !Object.values(env).every((value) => value === null || typeof value === "string") ||
165
+ typeof runtime !== "object" ||
166
+ runtime === null ||
167
+ !Object.values(runtime).every((value) => typeof value === "string")) {
168
+ return {
169
+ problem: `the record of the baseline's context, ${exports.contextRecordFile}, is not of the form that this version of @convesoft/nx-rust writes`,
170
+ };
171
+ }
172
+ return { context: record };
173
+ }
174
+ /**
175
+ * What differs between the record of a baseline and the group's context, one
176
+ * phrase each, such as "--features (a against b)" or "the variable FOO";
177
+ * empty where they are equal (`ADR-AFFECTED-BASELINE-CONTEXT`). A variable
178
+ * that the group has among its inputs and that the record does not hold, or
179
+ * that has a prefix of {@link contextVariablePrefixes} in either, counts by
180
+ * its value, an unset one being a value of its own; so does a runtime input
181
+ * of the group that the record does not hold, by the hash of its output.
182
+ */
183
+ // @mara implements DES-TEST-RUN
184
+ function contextDifferences(record, current) {
185
+ const differences = [];
186
+ const option = (name, collected, now) => {
187
+ if (JSON.stringify(collected) !== JSON.stringify(now)) {
188
+ differences.push(`${name} (${show(collected)} at the collection, ${show(now)} now)`);
189
+ }
190
+ };
191
+ option("--features", record.cargo.features, current.cargo.features);
192
+ option("--all-features", record.cargo.allFeatures, current.cargo.allFeatures);
193
+ option("--no-default-features", record.cargo.noDefaultFeatures, current.cargo.noDefaultFeatures);
194
+ option("the profile", record.cargo.profile, current.cargo.profile);
195
+ option("--target", record.cargo.target, current.cargo.target);
196
+ option("the target triple", record.triple, current.triple);
197
+ const names = new Set([
198
+ ...Object.keys(current.env),
199
+ ...Object.keys(record.env).filter((name) => exports.contextVariablePrefixes.some((prefix) => name.startsWith(prefix))),
200
+ ]);
201
+ const variables = [...names]
202
+ .sort()
203
+ .filter((name) => { var _a, _b; return ((_a = record.env[name]) !== null && _a !== void 0 ? _a : null) !== ((_b = current.env[name]) !== null && _b !== void 0 ? _b : null) || !(name in record.env); });
204
+ if (variables.length > 0) {
205
+ differences.push(`the ${variables.length === 1 ? "variable" : "variables"} ${(0, cargo_output_1.describeList)(variables)}`);
206
+ }
207
+ const commands = Object.keys(current.runtime)
208
+ .sort()
209
+ .filter((command) => record.runtime[command] !== current.runtime[command]);
210
+ if (commands.length > 0) {
211
+ differences.push(`the output of the runtime ${commands.length === 1 ? "input" : "inputs"} ${(0, cargo_output_1.describeList)(commands.map((command) => `\`${command}\``))}`);
212
+ }
213
+ return differences;
214
+ }
215
+ function show(value) {
216
+ if (value === null || value === false) {
217
+ return "none";
218
+ }
219
+ if (value === true) {
220
+ return "set";
221
+ }
222
+ if (Array.isArray(value)) {
223
+ return value.length === 0 ? "none" : value.join(",");
224
+ }
225
+ return String(value);
226
+ }
227
+ //# sourceMappingURL=baseline-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-context.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/baseline-context.ts"],"names":[],"mappings":";;;AA0DA,8CAEC;AAQD,wDAEC;AAQD,wCAsBC;AAGD,oCAQC;AASD,4CAYC;AAGD,gDAUC;AAGD,gDAIC;AAGD,8C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AC;IACD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,123 @@
1
+ import { type CargoTargetOptions } from "./command";
2
+ import { type BaselineContext } from "./baseline-context";
3
+ /** cargo-affected's database and its SQLite files, relative to the workspace root. */
4
+ export declare const databaseFiles: readonly string[];
5
+ /**
6
+ * The file that marks a running collection of the workspace, relative to its
7
+ * root, holding the process ID of the collection's executor.
8
+ */
9
+ export declare const collectionLockFile: string;
10
+ /** How the commands of the collection are built, besides the target's options. */
11
+ export interface CollectionFlags {
12
+ /** Locked mode (`DES-INVOCATION`). */
13
+ locked: boolean;
14
+ /** Whether the workspace uses the `cargo` strategy (`DES-UNIFICATION`). */
15
+ workspaceUnification: boolean;
16
+ }
17
+ /**
18
+ * The arguments that cargo-affected passes to `cargo nextest run` for the
19
+ * collection (`DES-BASELINE`): `--workspace --no-fail-fast`, then the cargo
20
+ * arguments of the test runs as `test` with the nextest runner gives them,
21
+ * the feature flags, `--cargo-profile` for the `profile` option, the flags of
22
+ * the `cargo` strategy and `--locked` in locked mode. No `--no-tests`:
23
+ * cargo-affected passes its own.
24
+ */
25
+ export declare function collectionNextestArguments(options: CargoTargetOptions, flags: CollectionFlags): string[];
26
+ /** The arguments after `cargo` of the collection: `affected collect [--diff] -- <nextest arguments>`. */
27
+ export declare function collectArguments(diff: boolean, nextestArgs: readonly string[]): string[];
28
+ /**
29
+ * The arguments after `cargo` of the report that decides between a full
30
+ * collection and `--diff`: `affected status --report-json <file> --` and the
31
+ * collection's arguments without `--no-fail-fast`, which `cargo nextest
32
+ * list` does not take.
33
+ */
34
+ export declare function baselineStatusArguments(reportFile: string, nextestArgs: readonly string[]): string[];
35
+ /** Which collection the target runs, and why, in words for the task's output. */
36
+ export type CollectionChoice = {
37
+ kind: "diff" | "full";
38
+ reason: string;
39
+ };
40
+ /**
41
+ * The collection that the report of `cargo affected status` asks for
42
+ * (`DES-BASELINE`, `REQ-BASELINE`): `collect --diff` where the report shows
43
+ * usable data, as `hit-exact` or `hit-with-divergence` with a collection
44
+ * that `HEAD` reaches, and no reachable collection lies more than
45
+ * `threshold` commits behind `HEAD`; a full collection otherwise, with the
46
+ * reason: cargo-affected failed or wrote no report of schema 1, the report
47
+ * shows no usable data (the first run, a lost database, a changed lockfile,
48
+ * manifest, compiler, `RUSTFLAGS` or build target, or no collection that
49
+ * `HEAD` reaches), or the oldest collection is further behind. A full
50
+ * collection is always correct, so every doubt gives one.
51
+ */
52
+ export declare function collectionChoice(exit: {
53
+ code: number | null;
54
+ signal?: string | null;
55
+ failure?: string;
56
+ }, text: string | undefined, stderr: string, threshold: number): CollectionChoice;
57
+ /**
58
+ * Why the coverage that the database holds cannot be kept for this
59
+ * collection, so that only a full collection into an empty database will
60
+ * do, or `undefined` where `collect --diff` may run (`DES-BASELINE`,
61
+ * `ADR-AFFECTED-BASELINE-CONTEXT`): `--diff` re-collects only what changed
62
+ * and keeps every other test's rows, which then stand for the context that
63
+ * the new record names. It may run only where the record that is there
64
+ * before the collection can be read, is of the current version and equals
65
+ * `collected` in every field: the cargo options, the triple, every
66
+ * environment input and every runtime input, compared with the function
67
+ * that the test runs use, and in both directions, so that an input that the
68
+ * earlier collection had and this one has not counts as well. A missing
69
+ * record, as on the first run or after a collection that failed or was
70
+ * stopped, an unreadable one, one of another version and one that differs
71
+ * each give the reason, in words for the task's output.
72
+ */
73
+ export declare function previousRecordProblem(workspaceRoot: string, collected: BaselineContext): string | undefined;
74
+ /**
75
+ * Removes, in the workspace root `workspaceRoot`, what a collection replaces
76
+ * before it starts ("Order of writing" in `DES-BASELINE`): the context
77
+ * record always, and for a full collection cargo-affected's database with
78
+ * its `-wal` and `-shm` files, so that it starts from an empty database.
79
+ * Nothing else: no folder of Cargo's and no other file of cargo-affected's.
80
+ */
81
+ export declare function removeBeforeCollection(workspaceRoot: string, full: boolean): void;
82
+ /** The lock of a running collection, which {@link CollectionLock.release} gives back. */
83
+ export interface CollectionLock {
84
+ release(): void;
85
+ }
86
+ /** Why the lock was not taken: a running process holds it, or the plugin cannot tell. */
87
+ export type LockRefusal = {
88
+ holder: number;
89
+ } | {
90
+ problem: string;
91
+ };
92
+ /** The file that marks a takeover of a stale lock, beside {@link collectionLockFile}. */
93
+ export declare const takeoverMarkerFile: string;
94
+ /** Points in {@link takeCollectionLock} where a test can let another contender act. */
95
+ export interface LockSeams {
96
+ /** After the lock was found stale, before the takeover. */
97
+ afterStaleRead?: () => void;
98
+ }
99
+ /**
100
+ * Takes the lock of the workspace's collection, {@link collectionLockFile}.
101
+ * The file appears whole and only if it did not exist: it is written under a
102
+ * name of this process's own and then hard-linked to the lock's name, which
103
+ * fails where the lock exists. Where a running process holds the lock, the
104
+ * collection does not start and the holder is returned: two collections of
105
+ * one checkout could leave the record of one beside the coverage of the
106
+ * other.
107
+ *
108
+ * A lock whose process no longer runs, as after a collection that was
109
+ * killed, is taken over only under the takeover marker,
110
+ * {@link takeoverMarkerFile}, which one contender at a time creates the same
111
+ * way: under it, the contender reads the lock again and removes it only
112
+ * where it still holds the dead process's ID, then creates its own as above.
113
+ * So a contender that read the same stale lock as another, which has taken
114
+ * it over meanwhile, finds the other's ID and is refused, and two
115
+ * contenders never both hold the lock. Where a stale lock and the marker
116
+ * are there, the plugin cannot tell whether a takeover runs or one was
117
+ * killed halfway, and refuses with a problem that names both files. A
118
+ * marker beside no lock, as a taker killed between removing the stale lock
119
+ * and creating its own leaves it, stops nothing: the lock is created as
120
+ * usual and the marker stays. That is safe, because a taker still alive in
121
+ * that window then fails to create the lock and is refused.
122
+ */
123
+ export declare function takeCollectionLock(workspaceRoot: string, pid?: number, seams?: LockSeams): CollectionLock | LockRefusal;