@convesoft/nx-rust 0.0.0-stage → 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 +48 -2
  4. package/executors.json +35 -0
  5. package/generators.json +19 -0
  6. package/package.json +26 -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,356 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.takeoverMarkerFile = exports.collectionLockFile = exports.databaseFiles = void 0;
4
+ exports.collectionNextestArguments = collectionNextestArguments;
5
+ exports.collectArguments = collectArguments;
6
+ exports.baselineStatusArguments = baselineStatusArguments;
7
+ exports.collectionChoice = collectionChoice;
8
+ exports.previousRecordProblem = previousRecordProblem;
9
+ exports.removeBeforeCollection = removeBeforeCollection;
10
+ exports.takeCollectionLock = takeCollectionLock;
11
+ const node_fs_1 = require("node:fs");
12
+ const node_path_1 = require("node:path");
13
+ const cargo_output_1 = require("./cargo-output");
14
+ const command_1 = require("./command");
15
+ const baseline_context_1 = require("./baseline-context");
16
+ const cargo_output_2 = require("./cargo-output");
17
+ // The coverage baseline target (`DES-BASELINE`, `REQ-BASELINE`): which
18
+ // collection it runs, from what cargo-affected's report says, the files it
19
+ // removes before collecting, and the lock that keeps two collections of one
20
+ // checkout apart. Everything here but the files is a function of its
21
+ // arguments, so that the rules are tested without the tools.
22
+ /** cargo-affected's database and its SQLite files, relative to the workspace root. */
23
+ exports.databaseFiles = [
24
+ "coverage.db",
25
+ "coverage.db-wal",
26
+ "coverage.db-shm",
27
+ ].map((file) => (0, node_path_1.join)("target", "affected", file));
28
+ /**
29
+ * The file that marks a running collection of the workspace, relative to its
30
+ * root, holding the process ID of the collection's executor.
31
+ */
32
+ exports.collectionLockFile = (0, node_path_1.join)("target", "affected", "nx-rust-collect.lock");
33
+ /**
34
+ * The arguments that cargo-affected passes to `cargo nextest run` for the
35
+ * collection (`DES-BASELINE`): `--workspace --no-fail-fast`, then the cargo
36
+ * arguments of the test runs as `test` with the nextest runner gives them,
37
+ * the feature flags, `--cargo-profile` for the `profile` option, the flags of
38
+ * the `cargo` strategy and `--locked` in locked mode. No `--no-tests`:
39
+ * cargo-affected passes its own.
40
+ */
41
+ // @mara implements DES-BASELINE
42
+ function collectionNextestArguments(options, flags) {
43
+ return [
44
+ "--workspace",
45
+ "--no-fail-fast",
46
+ ...(0, command_1.compilingFlags)({
47
+ features: options.features,
48
+ allFeatures: options.allFeatures,
49
+ noDefaultFeatures: options.noDefaultFeatures,
50
+ profile: options.profile,
51
+ }, "--cargo-profile"),
52
+ ...(flags.workspaceUnification ? [...command_1.workspaceUnificationFlags] : []),
53
+ ...(flags.locked ? ["--locked"] : []),
54
+ ];
55
+ }
56
+ /** The arguments after `cargo` of the collection: `affected collect [--diff] -- <nextest arguments>`. */
57
+ function collectArguments(diff, nextestArgs) {
58
+ return ["affected", "collect", ...(diff ? ["--diff"] : []), "--", ...nextestArgs];
59
+ }
60
+ /**
61
+ * The arguments after `cargo` of the report that decides between a full
62
+ * collection and `--diff`: `affected status --report-json <file> --` and the
63
+ * collection's arguments without `--no-fail-fast`, which `cargo nextest
64
+ * list` does not take.
65
+ */
66
+ function baselineStatusArguments(reportFile, nextestArgs) {
67
+ return [
68
+ "affected",
69
+ "status",
70
+ "--report-json",
71
+ reportFile,
72
+ "--",
73
+ ...nextestArgs.filter((arg) => arg !== "--no-fail-fast"),
74
+ ];
75
+ }
76
+ /**
77
+ * The collection that the report of `cargo affected status` asks for
78
+ * (`DES-BASELINE`, `REQ-BASELINE`): `collect --diff` where the report shows
79
+ * usable data, as `hit-exact` or `hit-with-divergence` with a collection
80
+ * that `HEAD` reaches, and no reachable collection lies more than
81
+ * `threshold` commits behind `HEAD`; a full collection otherwise, with the
82
+ * reason: cargo-affected failed or wrote no report of schema 1, the report
83
+ * shows no usable data (the first run, a lost database, a changed lockfile,
84
+ * manifest, compiler, `RUSTFLAGS` or build target, or no collection that
85
+ * `HEAD` reaches), or the oldest collection is further behind. A full
86
+ * collection is always correct, so every doubt gives one.
87
+ */
88
+ // @mara implements DES-BASELINE
89
+ // @mara implements REQ-BASELINE
90
+ function collectionChoice(exit, text, stderr, threshold) {
91
+ var _a, _b;
92
+ const full = (reason) => ({ kind: "full", reason });
93
+ if (exit.failure !== undefined) {
94
+ return full(`cargo affected status could not run (${exit.failure})`);
95
+ }
96
+ if (exit.code !== 0) {
97
+ const tail = stderr
98
+ .trim()
99
+ .split("\n")
100
+ .slice(-3)
101
+ .map((line) => (0, cargo_output_1.plainLine)(line).trim())
102
+ .join(" ");
103
+ return full(`cargo affected status ${exit.signal ? `was stopped by ${exit.signal}` : `exited with status ${exit.code}`}${tail === "" ? "" : ` (${tail})`}`);
104
+ }
105
+ if (text === undefined) {
106
+ return full("cargo affected status wrote no report");
107
+ }
108
+ let data;
109
+ try {
110
+ data = JSON.parse(text);
111
+ }
112
+ catch (_c) {
113
+ return full("cargo-affected's report is no JSON");
114
+ }
115
+ const root = record(data);
116
+ if ((root === null || root === void 0 ? void 0 : root.schema_version) !== 1) {
117
+ return full(`cargo-affected's report has the schema_version ${JSON.stringify((_a = root === null || root === void 0 ? void 0 : root.schema_version) !== null && _a !== void 0 ? _a : null)}, and this version of @convesoft/nx-rust reads only 1`);
118
+ }
119
+ const cache = record(root.cache);
120
+ const status = cache === null || cache === void 0 ? void 0 : cache.status;
121
+ if (status !== "hit-exact" && status !== "hit-with-divergence") {
122
+ const labels = status === "miss-fingerprint"
123
+ ? (_b = record(Array.isArray(cache === null || cache === void 0 ? void 0 : cache.stored_fingerprints) ? cache.stored_fingerprints[0] : null)) === null || _b === void 0 ? void 0 : _b.differing_labels
124
+ : undefined;
125
+ const differing = Array.isArray(labels) && labels.length > 0 && labels.every((l) => typeof l === "string")
126
+ ? `, which differs from the stored one in ${labels.join(", ")}`
127
+ : "";
128
+ return full(`the report shows no usable data: its cache status is ${typeof status === "string" ? status : JSON.stringify(status !== null && status !== void 0 ? status : null)}${differing}`);
129
+ }
130
+ const shas = Array.isArray(cache === null || cache === void 0 ? void 0 : cache.collect_shas) ? cache.collect_shas : [];
131
+ let behind;
132
+ for (const entry of shas) {
133
+ const sha = record(entry);
134
+ if ((sha === null || sha === void 0 ? void 0 : sha.relation) === "equal") {
135
+ behind = Math.max(behind !== null && behind !== void 0 ? behind : 0, 0);
136
+ }
137
+ else if ((sha === null || sha === void 0 ? void 0 : sha.relation) === "reachable") {
138
+ const ahead = sha.commits_ahead;
139
+ if (typeof ahead !== "number" || !Number.isInteger(ahead) || ahead < 0) {
140
+ return full("cargo-affected's report names a collection without the commits since it");
141
+ }
142
+ behind = Math.max(behind !== null && behind !== void 0 ? behind : 0, ahead);
143
+ }
144
+ }
145
+ if (behind === undefined) {
146
+ return full("the report shows no usable data: HEAD reaches no collection of the baseline");
147
+ }
148
+ if (behind > threshold) {
149
+ return full(`the oldest collection of the baseline is ${behind} ${behind === 1 ? "commit" : "commits"} behind HEAD, more than fullCollectThreshold (${threshold})`);
150
+ }
151
+ return {
152
+ kind: "diff",
153
+ reason: behind === 0
154
+ ? "the baseline holds usable data of HEAD"
155
+ : `the baseline holds usable data, whose oldest collection is ${behind} ${behind === 1 ? "commit" : "commits"} behind HEAD, within fullCollectThreshold (${threshold})`,
156
+ };
157
+ }
158
+ function record(value) {
159
+ return typeof value === "object" && value !== null && !Array.isArray(value)
160
+ ? value
161
+ : undefined;
162
+ }
163
+ /**
164
+ * Why the coverage that the database holds cannot be kept for this
165
+ * collection, so that only a full collection into an empty database will
166
+ * do, or `undefined` where `collect --diff` may run (`DES-BASELINE`,
167
+ * `ADR-AFFECTED-BASELINE-CONTEXT`): `--diff` re-collects only what changed
168
+ * and keeps every other test's rows, which then stand for the context that
169
+ * the new record names. It may run only where the record that is there
170
+ * before the collection can be read, is of the current version and equals
171
+ * `collected` in every field: the cargo options, the triple, every
172
+ * environment input and every runtime input, compared with the function
173
+ * that the test runs use, and in both directions, so that an input that the
174
+ * earlier collection had and this one has not counts as well. A missing
175
+ * record, as on the first run or after a collection that failed or was
176
+ * stopped, an unreadable one, one of another version and one that differs
177
+ * each give the reason, in words for the task's output.
178
+ */
179
+ // @mara implements DES-BASELINE
180
+ function previousRecordProblem(workspaceRoot, collected) {
181
+ const file = (0, node_path_1.join)(workspaceRoot, baseline_context_1.contextRecordFile);
182
+ let present = true;
183
+ try {
184
+ (0, node_fs_1.readFileSync)(file);
185
+ }
186
+ catch (error) {
187
+ present = error.code !== "ENOENT";
188
+ }
189
+ if (!present) {
190
+ return "the baseline has no record of the context of its last collection, as on the first run or after a collection that failed or was stopped, so the coverage it holds cannot be kept";
191
+ }
192
+ const previous = (0, baseline_context_1.readContextRecord)(workspaceRoot);
193
+ if ("problem" in previous) {
194
+ return `${previous.problem.replace(/; collect the baseline again$/, "")}, so the coverage it holds cannot be kept`;
195
+ }
196
+ const differences = (0, baseline_context_1.contextDifferences)(previous.context, collected);
197
+ const dropped = [
198
+ // A variable of the prefixes counts in contextDifferences already.
199
+ ...Object.keys(previous.context.env)
200
+ .filter((name) => !(name in collected.env) &&
201
+ !baseline_context_1.contextVariablePrefixes.some((prefix) => name.startsWith(prefix)))
202
+ .map((name) => `the variable ${name}`),
203
+ ...Object.keys(previous.context.runtime)
204
+ .filter((command) => !(command in collected.runtime))
205
+ .map((command) => `the runtime input \`${command}\``),
206
+ ].sort();
207
+ const parts = [
208
+ ...(differences.length === 0
209
+ ? []
210
+ : [`${(0, cargo_output_2.describeList)(differences)} ${differences.length === 1 ? "differs" : "differ"}`]),
211
+ ...(dropped.length === 0
212
+ ? []
213
+ : [
214
+ `the last collection had ${(0, cargo_output_2.describeList)(dropped)} among its inputs, which this one has not`,
215
+ ]),
216
+ ];
217
+ return parts.length === 0
218
+ ? undefined
219
+ : `the last collection ran in another context, so the coverage it holds cannot be kept: ${parts.join(", and ")}`;
220
+ }
221
+ /**
222
+ * Removes, in the workspace root `workspaceRoot`, what a collection replaces
223
+ * before it starts ("Order of writing" in `DES-BASELINE`): the context
224
+ * record always, and for a full collection cargo-affected's database with
225
+ * its `-wal` and `-shm` files, so that it starts from an empty database.
226
+ * Nothing else: no folder of Cargo's and no other file of cargo-affected's.
227
+ */
228
+ // @mara implements DES-BASELINE
229
+ function removeBeforeCollection(workspaceRoot, full) {
230
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(workspaceRoot, baseline_context_1.contextRecordFile), { force: true });
231
+ if (full) {
232
+ for (const file of exports.databaseFiles) {
233
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(workspaceRoot, file), { force: true });
234
+ }
235
+ }
236
+ }
237
+ /** The file that marks a takeover of a stale lock, beside {@link collectionLockFile}. */
238
+ exports.takeoverMarkerFile = `${exports.collectionLockFile}.takeover`;
239
+ /**
240
+ * Takes the lock of the workspace's collection, {@link collectionLockFile}.
241
+ * The file appears whole and only if it did not exist: it is written under a
242
+ * name of this process's own and then hard-linked to the lock's name, which
243
+ * fails where the lock exists. Where a running process holds the lock, the
244
+ * collection does not start and the holder is returned: two collections of
245
+ * one checkout could leave the record of one beside the coverage of the
246
+ * other.
247
+ *
248
+ * A lock whose process no longer runs, as after a collection that was
249
+ * killed, is taken over only under the takeover marker,
250
+ * {@link takeoverMarkerFile}, which one contender at a time creates the same
251
+ * way: under it, the contender reads the lock again and removes it only
252
+ * where it still holds the dead process's ID, then creates its own as above.
253
+ * So a contender that read the same stale lock as another, which has taken
254
+ * it over meanwhile, finds the other's ID and is refused, and two
255
+ * contenders never both hold the lock. Where a stale lock and the marker
256
+ * are there, the plugin cannot tell whether a takeover runs or one was
257
+ * killed halfway, and refuses with a problem that names both files. A
258
+ * marker beside no lock, as a taker killed between removing the stale lock
259
+ * and creating its own leaves it, stops nothing: the lock is created as
260
+ * usual and the marker stays. That is safe, because a taker still alive in
261
+ * that window then fails to create the lock and is refused.
262
+ */
263
+ // @mara implements DES-BASELINE
264
+ function takeCollectionLock(workspaceRoot, pid = process.pid, seams = {}) {
265
+ var _a, _b;
266
+ const file = (0, node_path_1.join)(workspaceRoot, exports.collectionLockFile);
267
+ const marker = (0, node_path_1.join)(workspaceRoot, exports.takeoverMarkerFile);
268
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(file), { recursive: true });
269
+ const lock = {
270
+ release() {
271
+ if (readQuietly(file) === String(pid)) {
272
+ (0, node_fs_1.rmSync)(file, { force: true });
273
+ }
274
+ },
275
+ };
276
+ if (createWhole(file, pid)) {
277
+ return lock;
278
+ }
279
+ const seen = readQuietly(file);
280
+ const holder = seen === undefined ? undefined : Number.parseInt(seen, 10);
281
+ if (holder !== undefined && Number.isInteger(holder) && holder > 0 && runs(holder)) {
282
+ return { holder };
283
+ }
284
+ (_a = seams.afterStaleRead) === null || _a === void 0 ? void 0 : _a.call(seams);
285
+ if (!createWhole(marker, pid)) {
286
+ return {
287
+ problem: `another collection is taking over the lock ${exports.collectionLockFile} of a collection that ended, or one was stopped while it did and left ${exports.takeoverMarkerFile}. Run the target again; if it keeps failing and no collection runs in this checkout, remove both files`,
288
+ };
289
+ }
290
+ try {
291
+ const now = readQuietly(file);
292
+ if (now !== seen) {
293
+ const other = now === undefined ? undefined : Number.parseInt(now, 10);
294
+ return other !== undefined && Number.isInteger(other) && other > 0
295
+ ? { holder: other }
296
+ : {
297
+ problem: `the lock ${exports.collectionLockFile} changed while this collection took it over. Run the target again`,
298
+ };
299
+ }
300
+ (0, node_fs_1.rmSync)(file, { force: true });
301
+ if (createWhole(file, pid)) {
302
+ return lock;
303
+ }
304
+ const other = Number.parseInt((_b = readQuietly(file)) !== null && _b !== void 0 ? _b : "", 10);
305
+ return Number.isInteger(other) && other > 0
306
+ ? { holder: other }
307
+ : {
308
+ problem: `another collection took the lock ${exports.collectionLockFile} first. Run the target again`,
309
+ };
310
+ }
311
+ finally {
312
+ if (readQuietly(marker) === String(pid)) {
313
+ (0, node_fs_1.rmSync)(marker, { force: true });
314
+ }
315
+ }
316
+ }
317
+ // Creates `file` holding `pid`, whole, only where it does not exist: written
318
+ // under a name of this process's own, then hard-linked, which fails with
319
+ // EEXIST where `file` exists.
320
+ function createWhole(file, pid) {
321
+ const own = `${file}.${pid}.${process.hrtime.bigint()}`;
322
+ (0, node_fs_1.writeFileSync)(own, `${pid}\n`);
323
+ try {
324
+ (0, node_fs_1.linkSync)(own, file);
325
+ return true;
326
+ }
327
+ catch (error) {
328
+ if (error.code !== "EEXIST") {
329
+ throw error;
330
+ }
331
+ return false;
332
+ }
333
+ finally {
334
+ (0, node_fs_1.rmSync)(own, { force: true });
335
+ }
336
+ }
337
+ // The trimmed text of a file, or `undefined` where it cannot be read.
338
+ function readQuietly(file) {
339
+ try {
340
+ return (0, node_fs_1.readFileSync)(file, "utf8").trim();
341
+ }
342
+ catch (_a) {
343
+ return undefined;
344
+ }
345
+ }
346
+ // Whether a process with this ID runs on this machine.
347
+ function runs(pid) {
348
+ try {
349
+ process.kill(pid, 0);
350
+ return true;
351
+ }
352
+ catch (error) {
353
+ return error.code === "EPERM";
354
+ }
355
+ }
356
+ //# sourceMappingURL=baseline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/baseline.ts"],"names":[],"mappings":";;;AAiDA,gEAmBC;AAGD,4CAEC;AAQD,0DAYC;AAmBD,4CAiFC;AAyBD,sDA6CC;AAUD,wDAOC;AA4CD,gDAsDC;AA1XD,qCAAmF;AACnF,yCAA0C;AAC1C,iDAA2C;AAC3C,uCAA+F;AAC/F,yDAM4B;AAC5B,iDAA8C;AAE9C,uEAAuE;AACvE,2EAA2E;AAC3E,4EAA4E;AAC5E,qEAAqE;AACrE,6DAA6D;AAE7D,sFAAsF;AACzE,QAAA,aAAa,GAAsB;IAC9C,aAAa;IACb,iBAAiB;IACjB,iBAAiB;CAClB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,gBAAI,EAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CA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AC;QACH,OAAO,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,uDAAuD;AACvD,SAAS,IAAI,CAAC,GAAW;IACvB,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAQ,KAA+B,CAAC,IAAI,KAAK,OAAO,CAAC;IAC3D,CAAC;AACH,CAAC"}
@@ -0,0 +1,75 @@
1
+ import type { ExecutorContext, Task, TaskGraph } from "@nx/devkit";
2
+ import type { CargoTargetOptions } from "./command";
3
+ import { type PluginExecutor } from "./task";
4
+ /** The result that a batch reports for one task, as Nx 24 takes it. */
5
+ export interface BatchTaskResult {
6
+ success: boolean;
7
+ /**
8
+ * `skipped` for a task that did not run because a task of the batch that
9
+ * it depends on failed, as Nx skips such a task outside a batch.
10
+ */
11
+ status?: "success" | "failure" | "skipped";
12
+ /** The task's own output, which Nx prints, stores and replays with it. */
13
+ terminalOutput: string;
14
+ startTime: number;
15
+ endTime: number;
16
+ }
17
+ /** What the batch reports, one entry for each task as soon as it is known. */
18
+ export interface BatchReport {
19
+ task: string;
20
+ result: BatchTaskResult;
21
+ }
22
+ /**
23
+ * The batch implementation of the plugin's cargo executors (`DES-BATCH`):
24
+ * Nx hands it the tasks of one executor that it runs together, and it
25
+ * reports one result for each of them, each with its own terminal output,
26
+ * as soon as the task's group has run, so that Nx prints it then.
27
+ *
28
+ * Every task first runs the checks that a task run on its own runs before
29
+ * cargo, with its own options, environment and executor context: the
30
+ * warnings of its project and the lines for the options it ignores, the
31
+ * cache guards, the lockfile dependency and the guard of `test` after
32
+ * `build` (`DES-TARGETS`, "Guard"). A task that fails one fails alone,
33
+ * before any cargo command of the batch runs. The others form groups
34
+ * ({@link formGroups}), which run one after another, a group only once the
35
+ * groups of the tasks it depends on have run; a task whose dependency in
36
+ * the batch failed is reported skipped, as Nx skips it outside a batch.
37
+ *
38
+ * Two `build` tasks of one crate whose files lie in one folder fail before
39
+ * any cargo command runs ({@link sharedBuildFolders}). A whole-workspace
40
+ * `build` and every compile of `napi-build` and `wasm-build` build in a
41
+ * stage of their own, from which a `build` moves only its own crates' final
42
+ * artifacts (`DES-BATCH`, "Staged builds"), so that no group writes another
43
+ * task's files and every group runs in this batch.
44
+ *
45
+ * The batch reports every task that it receives ({@link unreportedProblems})
46
+ * and throws for none (`EVD-NX-24-BATCHES`: a throw fails every task of the
47
+ * batch, and a task left out runs again in a new batch process). A failure of its own machinery fails the tasks it
48
+ * concerns, with a message that says so: no task is reported successful
49
+ * without cargo's output showing that its crate passed.
50
+ *
51
+ * @param inputs Each task's options, by task id, as Nx combines them for
52
+ * the task: the target's options, its configuration's and the command line's.
53
+ */
54
+ export declare function runBatch(executor: PluginExecutor, taskGraph: TaskGraph, inputs: Record<string, CargoTargetOptions>, context: ExecutorContext): AsyncGenerator<BatchReport>;
55
+ /**
56
+ * The tasks that a batch did not report as it ends, each with the reason
57
+ * (`DES-BATCH`, "Every task in the batch that receives it"). Nx 24 runs
58
+ * again, in a new batch process, every task that a batch does not report,
59
+ * for as long as the batch leaves it out (`EVD-NX-24-BATCHES`, "Tasks left
60
+ * out"). The batch reports every task that it receives, so only a fault of
61
+ * the plugin leaves one; the batch then fails it instead of having Nx start
62
+ * it again, perhaps without end.
63
+ *
64
+ * @param ids The tasks of the batch.
65
+ * @param reported The tasks for which the batch has reported a result.
66
+ * @returns The reason for each task that has to fail, by task id, in the
67
+ * order of `ids`; empty where the batch reported every task.
68
+ */
69
+ export declare function unreportedProblems(ids: readonly string[], reported: ReadonlySet<string>): Map<string, string>;
70
+ /**
71
+ * The executor context of one task of a batch, as Nx gives it to the task
72
+ * run on its own: the batch's context, whose task graph is the whole one,
73
+ * with the task's project, target, configuration and target configuration.
74
+ */
75
+ export declare function contextOf(task: Task, context: ExecutorContext): ExecutorContext;