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

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 (418) hide show
  1. package/LICENSE-APACHE +201 -0
  2. package/LICENSE-MIT +21 -0
  3. package/PLUGIN.md +106 -0
  4. package/README.md +51 -1
  5. package/docs/artifacts.mara.md +374 -0
  6. package/docs/caching.mara.md +999 -0
  7. package/docs/ci.mara.md +308 -0
  8. package/docs/configuration.mara.md +508 -0
  9. package/docs/decisions.mara.md +3267 -0
  10. package/docs/execution.mara.md +533 -0
  11. package/docs/index.mara.md +51 -0
  12. package/docs/product.mara.md +366 -0
  13. package/docs/release.mara.md +493 -0
  14. package/docs/setup.mara.md +486 -0
  15. package/docs/targets.mara.md +704 -0
  16. package/docs/testing.mara.md +431 -0
  17. package/docs/verification.mara.md +465 -0
  18. package/docs/workspaces.mara.md +445 -0
  19. package/executors.json +35 -0
  20. package/generators.json +19 -0
  21. package/package.json +17 -4
  22. package/src/cargo/build-settings.d.ts +61 -0
  23. package/src/cargo/build-settings.js +103 -0
  24. package/src/cargo/build-settings.js.map +1 -0
  25. package/src/cargo/configured-runner.d.ts +36 -0
  26. package/src/cargo/configured-runner.js +99 -0
  27. package/src/cargo/configured-runner.js.map +1 -0
  28. package/src/cargo/configured-tools.d.ts +35 -0
  29. package/src/cargo/configured-tools.js +46 -0
  30. package/src/cargo/configured-tools.js.map +1 -0
  31. package/src/cargo/dep-info-basedir.d.ts +18 -0
  32. package/src/cargo/dep-info-basedir.js +38 -0
  33. package/src/cargo/dep-info-basedir.js.map +1 -0
  34. package/src/cargo/directories.d.ts +40 -0
  35. package/src/cargo/directories.js +89 -0
  36. package/src/cargo/directories.js.map +1 -0
  37. package/src/cargo/host-triple.d.ts +7 -0
  38. package/src/cargo/host-triple.js +21 -0
  39. package/src/cargo/host-triple.js.map +1 -0
  40. package/src/cargo/lockfile.d.ts +63 -0
  41. package/src/cargo/lockfile.js +157 -0
  42. package/src/cargo/lockfile.js.map +1 -0
  43. package/src/cargo/metadata.d.ts +114 -0
  44. package/src/cargo/metadata.js +37 -0
  45. package/src/cargo/metadata.js.map +1 -0
  46. package/src/cargo/package-specs.d.ts +54 -0
  47. package/src/cargo/package-specs.js +109 -0
  48. package/src/cargo/package-specs.js.map +1 -0
  49. package/src/cargo/paths-crates.d.ts +27 -0
  50. package/src/cargo/paths-crates.js +69 -0
  51. package/src/cargo/paths-crates.js.map +1 -0
  52. package/src/cargo/print-artifact-folders.d.ts +1 -0
  53. package/src/cargo/print-artifact-folders.js +58 -0
  54. package/src/cargo/print-artifact-folders.js.map +1 -0
  55. package/src/cargo/redirections.d.ts +90 -0
  56. package/src/cargo/redirections.js +200 -0
  57. package/src/cargo/redirections.js.map +1 -0
  58. package/src/cargo/run-cargo.d.ts +31 -0
  59. package/src/cargo/run-cargo.js +75 -0
  60. package/src/cargo/run-cargo.js.map +1 -0
  61. package/src/cargo/target-triples.d.ts +98 -0
  62. package/src/cargo/target-triples.js +265 -0
  63. package/src/cargo/target-triples.js.map +1 -0
  64. package/src/cargo/version-req.d.ts +12 -0
  65. package/src/cargo/version-req.js +122 -0
  66. package/src/cargo/version-req.js.map +1 -0
  67. package/src/cargo/warnings-setting.d.ts +24 -0
  68. package/src/cargo/warnings-setting.js +81 -0
  69. package/src/cargo/warnings-setting.js.map +1 -0
  70. package/src/compatibility/cargo-version.d.ts +43 -0
  71. package/src/compatibility/cargo-version.js +83 -0
  72. package/src/compatibility/cargo-version.js.map +1 -0
  73. package/src/compatibility/nx-bridge.d.ts +312 -0
  74. package/src/compatibility/nx-bridge.js +407 -0
  75. package/src/compatibility/nx-bridge.js.map +1 -0
  76. package/src/compatibility/nx-version.d.ts +104 -0
  77. package/src/compatibility/nx-version.js +272 -0
  78. package/src/compatibility/nx-version.js.map +1 -0
  79. package/src/executors/affected-inputs.d.ts +29 -0
  80. package/src/executors/affected-inputs.js +259 -0
  81. package/src/executors/affected-inputs.js.map +1 -0
  82. package/src/executors/affected-run.d.ts +54 -0
  83. package/src/executors/affected-run.js +394 -0
  84. package/src/executors/affected-run.js.map +1 -0
  85. package/src/executors/affected.d.ts +239 -0
  86. package/src/executors/affected.js +589 -0
  87. package/src/executors/affected.js.map +1 -0
  88. package/src/executors/baseline-context.d.ts +85 -0
  89. package/src/executors/baseline-context.js +227 -0
  90. package/src/executors/baseline-context.js.map +1 -0
  91. package/src/executors/baseline.d.ts +123 -0
  92. package/src/executors/baseline.js +356 -0
  93. package/src/executors/baseline.js.map +1 -0
  94. package/src/executors/batch.d.ts +75 -0
  95. package/src/executors/batch.js +434 -0
  96. package/src/executors/batch.js.map +1 -0
  97. package/src/executors/build-records.d.ts +110 -0
  98. package/src/executors/build-records.js +267 -0
  99. package/src/executors/build-records.js.map +1 -0
  100. package/src/executors/cargo/executor.d.ts +28 -0
  101. package/src/executors/cargo/executor.js +58 -0
  102. package/src/executors/cargo/executor.js.map +1 -0
  103. package/src/executors/cargo/schema.json +58 -0
  104. package/src/executors/cargo-invocation.d.ts +81 -0
  105. package/src/executors/cargo-invocation.js +109 -0
  106. package/src/executors/cargo-invocation.js.map +1 -0
  107. package/src/executors/cargo-output.d.ts +218 -0
  108. package/src/executors/cargo-output.js +660 -0
  109. package/src/executors/cargo-output.js.map +1 -0
  110. package/src/executors/command.d.ts +331 -0
  111. package/src/executors/command.js +547 -0
  112. package/src/executors/command.js.map +1 -0
  113. package/src/executors/coverage-baseline.d.ts +23 -0
  114. package/src/executors/coverage-baseline.js +284 -0
  115. package/src/executors/coverage-baseline.js.map +1 -0
  116. package/src/executors/declared-options.d.ts +21 -0
  117. package/src/executors/declared-options.js +58 -0
  118. package/src/executors/declared-options.js.map +1 -0
  119. package/src/executors/denied-warnings.d.ts +99 -0
  120. package/src/executors/denied-warnings.js +188 -0
  121. package/src/executors/denied-warnings.js.map +1 -0
  122. package/src/executors/digests.d.ts +94 -0
  123. package/src/executors/digests.js +190 -0
  124. package/src/executors/digests.js.map +1 -0
  125. package/src/executors/dotenv-check.d.ts +79 -0
  126. package/src/executors/dotenv-check.js +553 -0
  127. package/src/executors/dotenv-check.js.map +1 -0
  128. package/src/executors/group-invocations.d.ts +80 -0
  129. package/src/executors/group-invocations.js +253 -0
  130. package/src/executors/group-invocations.js.map +1 -0
  131. package/src/executors/group-run.d.ts +114 -0
  132. package/src/executors/group-run.js +601 -0
  133. package/src/executors/group-run.js.map +1 -0
  134. package/src/executors/groups.d.ts +118 -0
  135. package/src/executors/groups.js +304 -0
  136. package/src/executors/groups.js.map +1 -0
  137. package/src/executors/input-check.d.ts +52 -0
  138. package/src/executors/input-check.js +271 -0
  139. package/src/executors/input-check.js.map +1 -0
  140. package/src/executors/kept-files.d.ts +98 -0
  141. package/src/executors/kept-files.js +341 -0
  142. package/src/executors/kept-files.js.map +1 -0
  143. package/src/executors/lockfile/executor.d.ts +16 -0
  144. package/src/executors/lockfile/executor.js +37 -0
  145. package/src/executors/lockfile/executor.js.map +1 -0
  146. package/src/executors/lockfile/schema.json +50 -0
  147. package/src/executors/napi-build.d.ts +73 -0
  148. package/src/executors/napi-build.js +420 -0
  149. package/src/executors/napi-build.js.map +1 -0
  150. package/src/executors/nextest.d.ts +189 -0
  151. package/src/executors/nextest.js +504 -0
  152. package/src/executors/nextest.js.map +1 -0
  153. package/src/executors/nx-command.d.ts +95 -0
  154. package/src/executors/nx-command.js +205 -0
  155. package/src/executors/nx-command.js.map +1 -0
  156. package/src/executors/nx-task-files.d.ts +82 -0
  157. package/src/executors/nx-task-files.js +156 -0
  158. package/src/executors/nx-task-files.js.map +1 -0
  159. package/src/executors/print-test-mode.d.ts +1 -0
  160. package/src/executors/print-test-mode.js +25 -0
  161. package/src/executors/print-test-mode.js.map +1 -0
  162. package/src/executors/release-publish/executor.d.ts +24 -0
  163. package/src/executors/release-publish/executor.js +165 -0
  164. package/src/executors/release-publish/executor.js.map +1 -0
  165. package/src/executors/release-publish/schema.json +30 -0
  166. package/src/executors/run/executor.d.ts +12 -0
  167. package/src/executors/run/executor.js +27 -0
  168. package/src/executors/run/executor.js.map +1 -0
  169. package/src/executors/run/schema.json +45 -0
  170. package/src/executors/runner-script.d.ts +12 -0
  171. package/src/executors/runner-script.js +22 -0
  172. package/src/executors/runner-script.js.map +1 -0
  173. package/src/executors/runtime-input-check.d.ts +24 -0
  174. package/src/executors/runtime-input-check.js +87 -0
  175. package/src/executors/runtime-input-check.js.map +1 -0
  176. package/src/executors/shared-artifacts.d.ts +44 -0
  177. package/src/executors/shared-artifacts.js +132 -0
  178. package/src/executors/shared-artifacts.js.map +1 -0
  179. package/src/executors/split-words.d.ts +24 -0
  180. package/src/executors/split-words.js +111 -0
  181. package/src/executors/split-words.js.map +1 -0
  182. package/src/executors/stage.d.ts +163 -0
  183. package/src/executors/stage.js +526 -0
  184. package/src/executors/stage.js.map +1 -0
  185. package/src/executors/staged-run.d.ts +24 -0
  186. package/src/executors/staged-run.js +110 -0
  187. package/src/executors/staged-run.js.map +1 -0
  188. package/src/executors/task-env.d.ts +271 -0
  189. package/src/executors/task-env.js +494 -0
  190. package/src/executors/task-env.js.map +1 -0
  191. package/src/executors/task-execution.d.ts +61 -0
  192. package/src/executors/task-execution.js +122 -0
  193. package/src/executors/task-execution.js.map +1 -0
  194. package/src/executors/task-guards.d.ts +112 -0
  195. package/src/executors/task-guards.js +435 -0
  196. package/src/executors/task-guards.js.map +1 -0
  197. package/src/executors/task-options.d.ts +114 -0
  198. package/src/executors/task-options.js +258 -0
  199. package/src/executors/task-options.js.map +1 -0
  200. package/src/executors/task.d.ts +166 -0
  201. package/src/executors/task.js +527 -0
  202. package/src/executors/task.js.map +1 -0
  203. package/src/executors/test-mode.d.ts +185 -0
  204. package/src/executors/test-mode.js +397 -0
  205. package/src/executors/test-mode.js.map +1 -0
  206. package/src/executors/test-runner.d.ts +44 -0
  207. package/src/executors/test-runner.js +159 -0
  208. package/src/executors/test-runner.js.map +1 -0
  209. package/src/executors/test-steps.d.ts +121 -0
  210. package/src/executors/test-steps.js +566 -0
  211. package/src/executors/test-steps.js.map +1 -0
  212. package/src/executors/wasm-build.d.ts +56 -0
  213. package/src/executors/wasm-build.js +216 -0
  214. package/src/executors/wasm-build.js.map +1 -0
  215. package/src/generators/crate/binary.schema.json +28 -0
  216. package/src/generators/crate/crate.d.ts +24 -0
  217. package/src/generators/crate/crate.js +108 -0
  218. package/src/generators/crate/crate.js.map +1 -0
  219. package/src/generators/crate/enclosing-workspace.d.ts +25 -0
  220. package/src/generators/crate/enclosing-workspace.js +58 -0
  221. package/src/generators/crate/enclosing-workspace.js.map +1 -0
  222. package/src/generators/crate/library.schema.json +28 -0
  223. package/src/generators/init/graph-check.d.ts +81 -0
  224. package/src/generators/init/graph-check.js +299 -0
  225. package/src/generators/init/graph-check.js.map +1 -0
  226. package/src/generators/init/init.d.ts +23 -0
  227. package/src/generators/init/init.js +113 -0
  228. package/src/generators/init/init.js.map +1 -0
  229. package/src/generators/init/report.d.ts +19 -0
  230. package/src/generators/init/report.js +93 -0
  231. package/src/generators/init/report.js.map +1 -0
  232. package/src/generators/init/schema.json +9 -0
  233. package/src/graph/artifact-kinds.d.ts +29 -0
  234. package/src/graph/artifact-kinds.js +50 -0
  235. package/src/graph/artifact-kinds.js.map +1 -0
  236. package/src/graph/artifact-names.d.ts +97 -0
  237. package/src/graph/artifact-names.js +276 -0
  238. package/src/graph/artifact-names.js.map +1 -0
  239. package/src/graph/build-records.d.ts +74 -0
  240. package/src/graph/build-records.js +104 -0
  241. package/src/graph/build-records.js.map +1 -0
  242. package/src/graph/caching.d.ts +148 -0
  243. package/src/graph/caching.js +681 -0
  244. package/src/graph/caching.js.map +1 -0
  245. package/src/graph/clippy-input.d.ts +53 -0
  246. package/src/graph/clippy-input.js +107 -0
  247. package/src/graph/clippy-input.js.map +1 -0
  248. package/src/graph/collisions.d.ts +113 -0
  249. package/src/graph/collisions.js +156 -0
  250. package/src/graph/collisions.js.map +1 -0
  251. package/src/graph/computation-reports.d.ts +89 -0
  252. package/src/graph/computation-reports.js +216 -0
  253. package/src/graph/computation-reports.js.map +1 -0
  254. package/src/graph/declared-files.d.ts +190 -0
  255. package/src/graph/declared-files.js +600 -0
  256. package/src/graph/declared-files.js.map +1 -0
  257. package/src/graph/discovery.d.ts +190 -0
  258. package/src/graph/discovery.js +661 -0
  259. package/src/graph/discovery.js.map +1 -0
  260. package/src/graph/edges.d.ts +25 -0
  261. package/src/graph/edges.js +94 -0
  262. package/src/graph/edges.js.map +1 -0
  263. package/src/graph/entries.d.ts +83 -0
  264. package/src/graph/entries.js +259 -0
  265. package/src/graph/entries.js.map +1 -0
  266. package/src/graph/inputs.d.ts +422 -0
  267. package/src/graph/inputs.js +756 -0
  268. package/src/graph/inputs.js.map +1 -0
  269. package/src/graph/lockfile-task.d.ts +74 -0
  270. package/src/graph/lockfile-task.js +105 -0
  271. package/src/graph/lockfile-task.js.map +1 -0
  272. package/src/graph/names.d.ts +41 -0
  273. package/src/graph/names.js +34 -0
  274. package/src/graph/names.js.map +1 -0
  275. package/src/graph/napi.d.ts +107 -0
  276. package/src/graph/napi.js +206 -0
  277. package/src/graph/napi.js.map +1 -0
  278. package/src/graph/nx-glob.d.ts +36 -0
  279. package/src/graph/nx-glob.js +152 -0
  280. package/src/graph/nx-glob.js.map +1 -0
  281. package/src/graph/nx-internals.d.ts +57 -0
  282. package/src/graph/nx-internals.js +128 -0
  283. package/src/graph/nx-internals.js.map +1 -0
  284. package/src/graph/options.d.ts +32 -0
  285. package/src/graph/options.js +80 -0
  286. package/src/graph/options.js.map +1 -0
  287. package/src/graph/outputs.d.ts +75 -0
  288. package/src/graph/outputs.js +140 -0
  289. package/src/graph/outputs.js.map +1 -0
  290. package/src/graph/path-dependencies.d.ts +122 -0
  291. package/src/graph/path-dependencies.js +459 -0
  292. package/src/graph/path-dependencies.js.map +1 -0
  293. package/src/graph/plugin-package.d.ts +36 -0
  294. package/src/graph/plugin-package.js +132 -0
  295. package/src/graph/plugin-package.js.map +1 -0
  296. package/src/graph/plugin-version.d.ts +20 -0
  297. package/src/graph/plugin-version.js +153 -0
  298. package/src/graph/plugin-version.js.map +1 -0
  299. package/src/graph/projects.d.ts +141 -0
  300. package/src/graph/projects.js +193 -0
  301. package/src/graph/projects.js.map +1 -0
  302. package/src/graph/reached-projects.d.ts +46 -0
  303. package/src/graph/reached-projects.js +102 -0
  304. package/src/graph/reached-projects.js.map +1 -0
  305. package/src/graph/real-path.d.ts +47 -0
  306. package/src/graph/real-path.js +113 -0
  307. package/src/graph/real-path.js.map +1 -0
  308. package/src/graph/redirected-uses.d.ts +98 -0
  309. package/src/graph/redirected-uses.js +434 -0
  310. package/src/graph/redirected-uses.js.map +1 -0
  311. package/src/graph/registration.d.ts +121 -0
  312. package/src/graph/registration.js +233 -0
  313. package/src/graph/registration.js.map +1 -0
  314. package/src/graph/rustfmt-config.d.ts +42 -0
  315. package/src/graph/rustfmt-config.js +173 -0
  316. package/src/graph/rustfmt-config.js.map +1 -0
  317. package/src/graph/script-input.d.ts +46 -0
  318. package/src/graph/script-input.js +65 -0
  319. package/src/graph/script-input.js.map +1 -0
  320. package/src/graph/settings.d.ts +178 -0
  321. package/src/graph/settings.js +479 -0
  322. package/src/graph/settings.js.map +1 -0
  323. package/src/graph/target-defaults-causes.d.ts +33 -0
  324. package/src/graph/target-defaults-causes.js +202 -0
  325. package/src/graph/target-defaults-causes.js.map +1 -0
  326. package/src/graph/target-defaults-layers.d.ts +186 -0
  327. package/src/graph/target-defaults-layers.js +420 -0
  328. package/src/graph/target-defaults-layers.js.map +1 -0
  329. package/src/graph/target-defaults-meaning.d.ts +95 -0
  330. package/src/graph/target-defaults-meaning.js +292 -0
  331. package/src/graph/target-defaults-meaning.js.map +1 -0
  332. package/src/graph/target-defaults-report.d.ts +77 -0
  333. package/src/graph/target-defaults-report.js +242 -0
  334. package/src/graph/target-defaults-report.js.map +1 -0
  335. package/src/graph/target-defaults.d.ts +79 -0
  336. package/src/graph/target-defaults.js +425 -0
  337. package/src/graph/target-defaults.js.map +1 -0
  338. package/src/graph/target-fields.d.ts +16 -0
  339. package/src/graph/target-fields.js +134 -0
  340. package/src/graph/target-fields.js.map +1 -0
  341. package/src/graph/target-tables.d.ts +45 -0
  342. package/src/graph/target-tables.js +299 -0
  343. package/src/graph/target-tables.js.map +1 -0
  344. package/src/graph/targets.d.ts +371 -0
  345. package/src/graph/targets.js +408 -0
  346. package/src/graph/targets.js.map +1 -0
  347. package/src/graph/unification.d.ts +141 -0
  348. package/src/graph/unification.js +459 -0
  349. package/src/graph/unification.js.map +1 -0
  350. package/src/graph/unignored-directories.d.ts +25 -0
  351. package/src/graph/unignored-directories.js +89 -0
  352. package/src/graph/unignored-directories.js.map +1 -0
  353. package/src/graph/visibility.d.ts +17 -0
  354. package/src/graph/visibility.js +67 -0
  355. package/src/graph/visibility.js.map +1 -0
  356. package/src/graph/warnings.d.ts +38 -0
  357. package/src/graph/warnings.js +77 -0
  358. package/src/graph/warnings.js.map +1 -0
  359. package/src/graph/wasm.d.ts +56 -0
  360. package/src/graph/wasm.js +77 -0
  361. package/src/graph/wasm.js.map +1 -0
  362. package/src/index.d.ts +68 -0
  363. package/src/index.js +109 -0
  364. package/src/index.js.map +1 -0
  365. package/src/release/manifests.d.ts +95 -0
  366. package/src/release/manifests.js +164 -0
  367. package/src/release/manifests.js.map +1 -0
  368. package/src/release/places.d.ts +127 -0
  369. package/src/release/places.js +368 -0
  370. package/src/release/places.js.map +1 -0
  371. package/src/release/publish-cargo.d.ts +177 -0
  372. package/src/release/publish-cargo.js +351 -0
  373. package/src/release/publish-cargo.js.map +1 -0
  374. package/src/release/publish-crates.d.ts +124 -0
  375. package/src/release/publish-crates.js +242 -0
  376. package/src/release/publish-crates.js.map +1 -0
  377. package/src/release/publish-environments.d.ts +50 -0
  378. package/src/release/publish-environments.js +284 -0
  379. package/src/release/publish-environments.js.map +1 -0
  380. package/src/release/publish-messages.d.ts +66 -0
  381. package/src/release/publish-messages.js +273 -0
  382. package/src/release/publish-messages.js.map +1 -0
  383. package/src/release/publish-registry.d.ts +27 -0
  384. package/src/release/publish-registry.js +135 -0
  385. package/src/release/publish-registry.js.map +1 -0
  386. package/src/release/publish-settings.d.ts +26 -0
  387. package/src/release/publish-settings.js +56 -0
  388. package/src/release/publish-settings.js.map +1 -0
  389. package/src/release/publish.d.ts +59 -0
  390. package/src/release/publish.js +620 -0
  391. package/src/release/publish.js.map +1 -0
  392. package/src/release/repository.d.ts +73 -0
  393. package/src/release/repository.js +219 -0
  394. package/src/release/repository.js.map +1 -0
  395. package/src/release/requirements.d.ts +34 -0
  396. package/src/release/requirements.js +30 -0
  397. package/src/release/requirements.js.map +1 -0
  398. package/src/release/toml-edit.d.ts +67 -0
  399. package/src/release/toml-edit.js +453 -0
  400. package/src/release/toml-edit.js.map +1 -0
  401. package/src/release/version-actions.d.ts +133 -0
  402. package/src/release/version-actions.js +474 -0
  403. package/src/release/version-actions.js.map +1 -0
  404. package/src/release/version-checks.d.ts +21 -0
  405. package/src/release/version-checks.js +151 -0
  406. package/src/release/version-checks.js.map +1 -0
  407. package/src/release/version-lockfiles.d.ts +61 -0
  408. package/src/release/version-lockfiles.js +222 -0
  409. package/src/release/version-lockfiles.js.map +1 -0
  410. package/src/tools/napi-cli.d.ts +70 -0
  411. package/src/tools/napi-cli.js +63 -0
  412. package/src/tools/napi-cli.js.map +1 -0
  413. package/src/tools/optional-tools.d.ts +121 -0
  414. package/src/tools/optional-tools.js +303 -0
  415. package/src/tools/optional-tools.js.map +1 -0
  416. package/src/tools/print-napi-cli.d.ts +1 -0
  417. package/src/tools/print-napi-cli.js +24 -0
  418. package/src/tools/print-napi-cli.js.map +1 -0
@@ -0,0 +1,185 @@
1
+ /** The environment variable that chooses the test mode of a run (`DES-TEST-MODE`). */
2
+ export declare const testModeVariable = "NX_RUST_TEST_MODE";
3
+ /**
4
+ * cargo-affected's database in a workspace root, whatever the target
5
+ * directory is (`EVD-CARGO-AFFECTED-REPORT`).
6
+ */
7
+ export declare const baselineDatabase: string;
8
+ /**
9
+ * Whether Nx detects CI in `env`: the rule of `isCI` in Nx 24.0.6
10
+ * (`nx/src/utils/is-ci`), which `nx` uses for its own defaults. The plugin
11
+ * keeps a copy, because the mode command runs in a process of its own,
12
+ * where loading Nx would cost more than the rest of the command; a test
13
+ * compares the copy with the installed Nx's function.
14
+ */
15
+ export declare function nxDetectsCI(env: NodeJS.ProcessEnv): boolean;
16
+ /** The mode that a run asks for, before the baseline counts (steps 1 and 2 of `DES-TEST-MODE`). */
17
+ export type AskedTestMode = {
18
+ kind: "full";
19
+ reason: string;
20
+ } | {
21
+ kind: "affected";
22
+ reason: string;
23
+ } | {
24
+ kind: "invalid";
25
+ value: string;
26
+ };
27
+ /**
28
+ * The mode that `env` asks for: `NX_RUST_TEST_MODE` set to `full` or
29
+ * `affected`, and without it `full` where Nx detects CI and `affected`
30
+ * elsewhere. Any other value, the empty one included, is invalid and fails
31
+ * the task.
32
+ */
33
+ export declare function askedTestMode(env: NodeJS.ProcessEnv): AskedTestMode;
34
+ /** The commits of a coverage baseline, or why there is none that can be read. */
35
+ export type BaselineCommits = {
36
+ commits: string[];
37
+ } | {
38
+ problem: string;
39
+ };
40
+ /**
41
+ * A step that a test runs between the reader's first look at the files and
42
+ * its open of the database ({@link baselineCommits}), so that what another
43
+ * process does in between can be checked without timing luck.
44
+ */
45
+ export interface BaselineReadSteps {
46
+ beforeOpen?(): void;
47
+ }
48
+ /**
49
+ * The commits that cargo-affected's database in `workspaceRoot` holds
50
+ * coverage for, of every fingerprint, sorted and without repeats
51
+ * (`DES-TEST-MODE`, step 3). It reads `target/affected/coverage.db` with
52
+ * Node's SQLite and starts no cargo-affected, whose `status` builds the
53
+ * tests (`EVD-CARGO-AFFECTED-COST`).
54
+ *
55
+ * It never opens the database in a way that can write: only as immutable
56
+ * and read-only, which creates no file, since an ordinary read-only
57
+ * connection to a database in WAL mode creates `-wal` and `-shm` files and
58
+ * leaves them behind (`EVD-TEST-MODE-READING`). An immutable read ignores
59
+ * a `-wal` file and takes no lock, so it counts only where the database is
60
+ * whole and settled: a `-wal` file beside it before the read or after it,
61
+ * as while a collection runs or after one was interrupted, or a database
62
+ * file whose size, modification time or inode differs between the two
63
+ * looks, gives a problem and no commits. So do a missing database, a Node
64
+ * without `node:sqlite`, a database of another schema, as after
65
+ * cargo-affected changed it, one that cannot be read, one without coverage,
66
+ * and a commit that is not lower-case hexadecimal.
67
+ *
68
+ * @param workspaceRoot The workspace's root folder, absolute or relative to
69
+ * the current folder.
70
+ * @param steps For tests: a step between the first look and the open.
71
+ */
72
+ export declare function baselineCommits(workspaceRoot: string, steps?: BaselineReadSteps): BaselineCommits;
73
+ /** The test mode of a run (`TERM-TEST-MODE`), with why it is that mode. */
74
+ export type TestMode = {
75
+ kind: "full";
76
+ reason: string;
77
+ } | {
78
+ kind: "affected";
79
+ commits: string[];
80
+ reason: string;
81
+ } | {
82
+ kind: "invalid";
83
+ value: string;
84
+ };
85
+ /**
86
+ * The test mode of a run in the workspace at `workspaceRoot`, by the rule
87
+ * that the mode command and the test executor share (`DES-TEST-MODE`): the
88
+ * mode that `env` asks for, where `affected` stays `affected` only with a
89
+ * baseline whose commits can be read, and becomes `full` otherwise, with
90
+ * the reason.
91
+ */
92
+ export declare function testMode(env: NodeJS.ProcessEnv, workspaceRoot: string): TestMode;
93
+ /**
94
+ * What the mode command prints for `mode`, and with it what the key of a
95
+ * `test` task holds: `full`, `affected:<commits>` with the baseline's
96
+ * commits joined by `,`, or for an invalid `NX_RUST_TEST_MODE` a line that
97
+ * names the value, so that a failure that Nx stores with
98
+ * `NX_CACHE_FAILURES=true` is never restored for a valid mode.
99
+ */
100
+ export declare function testModeText(mode: TestMode): string;
101
+ /**
102
+ * The message of a task that fails before cargo runs because
103
+ * `NX_RUST_TEST_MODE` has another value than `full` or `affected`.
104
+ */
105
+ export declare function invalidTestModeMessage(task: string, value: string): string;
106
+ /**
107
+ * The line at the top of a `test` task's output in a workspace that uses
108
+ * selection, which says which suite the task runs and why (`DES-TEST-MODE`,
109
+ * `REQ-AFFECTED-TESTS`).
110
+ *
111
+ * @param optedOut Whether the task's `affectedTests` option is `false`, as a
112
+ * crate's table or `--affectedTests=false` sets it.
113
+ * @param testTarget The test target that the task's `test` option names,
114
+ * which it runs in either mode as in mode `full`, also where its
115
+ * `affectedTests` is `false` (`DES-TEST-RUN`, "One test target").
116
+ */
117
+ export declare function testModeNote(task: string, mode: TestMode, optedOut: boolean, testTarget?: string): string | undefined;
118
+ /**
119
+ * The folder under the repository root in which the mode command and the
120
+ * test executor keep their record of one `nx` command (`DES-TEST-MODE`,
121
+ * "Between hashing and the run"), one folder per command and workspace.
122
+ * Nx leaves `.nx/workspace-data` out of its file map, and the plugin's
123
+ * `postTasksExecution` hook removes a command's folders when it ends.
124
+ */
125
+ export declare const testModeRecordRoot = ".nx/workspace-data/nx-rust/test-mode";
126
+ /**
127
+ * The id that the plugin's `preTasksExecution` hook gives the `nx` command
128
+ * whose task has the environment `env`, with only the characters that a
129
+ * folder name keeps; `undefined` without one.
130
+ */
131
+ export declare function commandIdOf(env: NodeJS.ProcessEnv): string | undefined;
132
+ /**
133
+ * The folder of the record of the command `commandId` for the workspace at
134
+ * `workspaceRoot` ({@link testModeRecordRoot}).
135
+ *
136
+ * @param workspaceRoot The workspace's root folder, relative to the repository root.
137
+ */
138
+ export declare function testModeRecordFolder(repositoryRoot: string, workspaceRoot: string, commandId: string): string;
139
+ /** A value that no other evaluation prints, so that no stored result is ever restored under it. */
140
+ export declare function neverRestored(): string;
141
+ /**
142
+ * What the mode command prints for a task with the environment `env` in
143
+ * the workspace at `workspaceRoot` (`DES-TEST-MODE`, "Between hashing and the
144
+ * run"): the text of its test mode ({@link testModeText}), with two
145
+ * exceptions that keep a subset's result from being stored under a key that
146
+ * it does not satisfy. Where a task of the same `nx` command has run, or is
147
+ * about to run, a subset in another mode than this text, it prints a value
148
+ * that is never restored ({@link neverRestored}): Nx hashes some tasks again
149
+ * after they ran, and the key of such a task must not say `full` or name
150
+ * another baseline. And where it cannot add what it prints to the command's
151
+ * record, it prints such a value as well, since the executor could then not
152
+ * see it.
153
+ *
154
+ * Without a command id from the plugin's hook, as where Nx hashes outside a
155
+ * run, it prints the text and records nothing.
156
+ *
157
+ * @param workspaceRoot The workspace's root folder, relative to `repositoryRoot`.
158
+ */
159
+ export declare function printedTestMode(env: NodeJS.ProcessEnv, repositoryRoot: string, workspaceRoot: string, steps?: BaselineReadSteps): string;
160
+ /**
161
+ * Why a task in affected mode must not run a subset, because the test mode
162
+ * that Nx hashed for it may differ from the one its executor reads
163
+ * (`DES-TEST-MODE`, "Between hashing and the run"; `RISK-SUBSET-AS-FULL`), or
164
+ * `undefined` where it may. Nx hands an executor neither the task's hash
165
+ * details nor the output of its runtime inputs, so the executor reads what
166
+ * the mode command recorded for the command: every value that it printed in
167
+ * this command for a task of the workspace, whatever mode the task asked
168
+ * for, has to be `text`, the executor's own reading, and at least one has
169
+ * to be there. The task's own evaluation is among them, since Nx hashes a
170
+ * task after the command's `preTasksExecution` hook and before the task
171
+ * runs, and nothing in the record tells it from another task's.
172
+ *
173
+ * @param workspaceRoot The workspace's root folder, relative to `repositoryRoot`.
174
+ * @param text The test mode as the executor reads it, `affected:<commits>`.
175
+ */
176
+ export declare function hashedModeProblem(env: NodeJS.ProcessEnv, repositoryRoot: string, workspaceRoot: string, text: string): string | undefined;
177
+ /**
178
+ * Adds `text` to the command's record of the modes in which its tasks run a
179
+ * subset, before the subset runs, so that the mode command prints a value
180
+ * that is never restored wherever Nx hashes a task of the workspace again
181
+ * in this command with another mode ({@link printedTestMode}).
182
+ *
183
+ * @returns Whether the record holds it; where not, the task must run its full suite.
184
+ */
185
+ export declare function recordSubset(env: NodeJS.ProcessEnv, repositoryRoot: string, workspaceRoot: string, text: string): boolean;
@@ -0,0 +1,397 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.testModeRecordRoot = exports.baselineDatabase = exports.testModeVariable = void 0;
4
+ exports.nxDetectsCI = nxDetectsCI;
5
+ exports.askedTestMode = askedTestMode;
6
+ exports.baselineCommits = baselineCommits;
7
+ exports.testMode = testMode;
8
+ exports.testModeText = testModeText;
9
+ exports.invalidTestModeMessage = invalidTestModeMessage;
10
+ exports.testModeNote = testModeNote;
11
+ exports.commandIdOf = commandIdOf;
12
+ exports.testModeRecordFolder = testModeRecordFolder;
13
+ exports.neverRestored = neverRestored;
14
+ exports.printedTestMode = printedTestMode;
15
+ exports.hashedModeProblem = hashedModeProblem;
16
+ exports.recordSubset = recordSubset;
17
+ const node_crypto_1 = require("node:crypto");
18
+ const node_fs_1 = require("node:fs");
19
+ const node_path_1 = require("node:path");
20
+ const node_url_1 = require("node:url");
21
+ const lockfile_task_1 = require("../graph/lockfile-task");
22
+ /** The environment variable that chooses the test mode of a run (`DES-TEST-MODE`). */
23
+ exports.testModeVariable = "NX_RUST_TEST_MODE";
24
+ /**
25
+ * cargo-affected's database in a workspace root, whatever the target
26
+ * directory is (`EVD-CARGO-AFFECTED-REPORT`).
27
+ */
28
+ exports.baselineDatabase = (0, node_path_1.join)("target", "affected", "coverage.db");
29
+ /**
30
+ * Whether Nx detects CI in `env`: the rule of `isCI` in Nx 24.0.6
31
+ * (`nx/src/utils/is-ci`), which `nx` uses for its own defaults. The plugin
32
+ * keeps a copy, because the mode command runs in a process of its own,
33
+ * where loading Nx would cost more than the rest of the command; a test
34
+ * compares the copy with the installed Nx's function.
35
+ */
36
+ // @mara implements DES-TEST-MODE
37
+ function nxDetectsCI(env) {
38
+ if (env.CI === "false") {
39
+ return false;
40
+ }
41
+ return Boolean(env.CI ||
42
+ env.TF_BUILD === "true" ||
43
+ env.GITHUB_ACTIONS === "true" ||
44
+ env.BUILDKITE === "true" ||
45
+ env.CIRCLECI === "true" ||
46
+ env.CIRRUS_CI === "true" ||
47
+ env.TRAVIS === "true" ||
48
+ env["bamboo.buildKey"] ||
49
+ env.bamboo_buildKey ||
50
+ env.CODEBUILD_BUILD_ID ||
51
+ env.GITLAB_CI ||
52
+ env.HEROKU_TEST_RUN_ID ||
53
+ env.BUILD_ID ||
54
+ env.BUILD_NUMBER ||
55
+ env.BUILD_BUILDID ||
56
+ env.TEAMCITY_VERSION ||
57
+ env.JENKINS_URL ||
58
+ env.HUDSON_URL);
59
+ }
60
+ /**
61
+ * The mode that `env` asks for: `NX_RUST_TEST_MODE` set to `full` or
62
+ * `affected`, and without it `full` where Nx detects CI and `affected`
63
+ * elsewhere. Any other value, the empty one included, is invalid and fails
64
+ * the task.
65
+ */
66
+ // @mara implements DES-TEST-MODE
67
+ function askedTestMode(env) {
68
+ const value = env[exports.testModeVariable];
69
+ if (value === undefined) {
70
+ return nxDetectsCI(env)
71
+ ? { kind: "full", reason: `Nx detects CI and ${exports.testModeVariable} is not set` }
72
+ : { kind: "affected", reason: `${exports.testModeVariable} is not set and Nx detects no CI` };
73
+ }
74
+ if (value === "full" || value === "affected") {
75
+ return { kind: value, reason: `${exports.testModeVariable} is "${value}"` };
76
+ }
77
+ return { kind: "invalid", value };
78
+ }
79
+ /**
80
+ * The commits that cargo-affected's database in `workspaceRoot` holds
81
+ * coverage for, of every fingerprint, sorted and without repeats
82
+ * (`DES-TEST-MODE`, step 3). It reads `target/affected/coverage.db` with
83
+ * Node's SQLite and starts no cargo-affected, whose `status` builds the
84
+ * tests (`EVD-CARGO-AFFECTED-COST`).
85
+ *
86
+ * It never opens the database in a way that can write: only as immutable
87
+ * and read-only, which creates no file, since an ordinary read-only
88
+ * connection to a database in WAL mode creates `-wal` and `-shm` files and
89
+ * leaves them behind (`EVD-TEST-MODE-READING`). An immutable read ignores
90
+ * a `-wal` file and takes no lock, so it counts only where the database is
91
+ * whole and settled: a `-wal` file beside it before the read or after it,
92
+ * as while a collection runs or after one was interrupted, or a database
93
+ * file whose size, modification time or inode differs between the two
94
+ * looks, gives a problem and no commits. So do a missing database, a Node
95
+ * without `node:sqlite`, a database of another schema, as after
96
+ * cargo-affected changed it, one that cannot be read, one without coverage,
97
+ * and a commit that is not lower-case hexadecimal.
98
+ *
99
+ * @param workspaceRoot The workspace's root folder, absolute or relative to
100
+ * the current folder.
101
+ * @param steps For tests: a step between the first look and the open.
102
+ */
103
+ // @mara implements DES-TEST-MODE
104
+ function baselineCommits(workspaceRoot, steps = {}) {
105
+ var _a;
106
+ const database = (0, node_path_1.join)(workspaceRoot, exports.baselineDatabase);
107
+ const wal = `${database}-wal`;
108
+ const unsettled = `the coverage baseline in ${exports.baselineDatabase} has a -wal file beside it, as while a collection runs or after one was interrupted`;
109
+ const before = fileState(database);
110
+ if (before === undefined) {
111
+ return { problem: `there is no coverage baseline: ${exports.baselineDatabase} does not exist` };
112
+ }
113
+ if ((0, node_fs_1.existsSync)(wal)) {
114
+ return { problem: unsettled };
115
+ }
116
+ let sqlite;
117
+ try {
118
+ sqlite = require("node:sqlite");
119
+ }
120
+ catch (_b) {
121
+ return {
122
+ problem: `this Node.js has no node:sqlite, with which @convesoft/nx-rust reads the coverage baseline in ${exports.baselineDatabase}`,
123
+ };
124
+ }
125
+ (_a = steps.beforeOpen) === null || _a === void 0 ? void 0 : _a.call(steps);
126
+ let values;
127
+ try {
128
+ const location = (0, node_url_1.pathToFileURL)(database);
129
+ location.searchParams.set("immutable", "1");
130
+ const connection = new sqlite.DatabaseSync(location, { readOnly: true });
131
+ try {
132
+ values = connection
133
+ .prepare("SELECT DISTINCT collect_sha FROM test_regions")
134
+ .all()
135
+ .map((row) => row.collect_sha);
136
+ }
137
+ finally {
138
+ connection.close();
139
+ }
140
+ }
141
+ catch (error) {
142
+ return {
143
+ problem: `the coverage baseline in ${exports.baselineDatabase} could not be read (${error instanceof Error ? error.message : String(error)})`,
144
+ };
145
+ }
146
+ if ((0, node_fs_1.existsSync)(wal)) {
147
+ return { problem: unsettled };
148
+ }
149
+ if (fileState(database) !== before) {
150
+ return { problem: `the coverage baseline in ${exports.baselineDatabase} changed while it was read` };
151
+ }
152
+ const commits = [...new Set(values)];
153
+ if (commits.length === 0) {
154
+ return { problem: `the coverage baseline in ${exports.baselineDatabase} holds no coverage` };
155
+ }
156
+ if (!commits.every((commit) => typeof commit === "string" && /^[0-9a-f]+$/.test(commit))) {
157
+ return {
158
+ problem: `the coverage baseline in ${exports.baselineDatabase} names a commit that is no hexadecimal object name`,
159
+ };
160
+ }
161
+ return { commits: commits.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)) };
162
+ }
163
+ /** The size, modification time and inode of a file, or `undefined` where it is missing. */
164
+ function fileState(path) {
165
+ try {
166
+ const stat = (0, node_fs_1.statSync)(path);
167
+ return stat.isFile() ? `${stat.size}:${stat.mtimeMs}:${stat.ino}` : undefined;
168
+ }
169
+ catch (_a) {
170
+ return undefined;
171
+ }
172
+ }
173
+ /**
174
+ * The test mode of a run in the workspace at `workspaceRoot`, by the rule
175
+ * that the mode command and the test executor share (`DES-TEST-MODE`): the
176
+ * mode that `env` asks for, where `affected` stays `affected` only with a
177
+ * baseline whose commits can be read, and becomes `full` otherwise, with
178
+ * the reason.
179
+ */
180
+ // @mara implements DES-TEST-MODE
181
+ function testMode(env, workspaceRoot) {
182
+ return testModeAt(env, workspaceRoot);
183
+ }
184
+ function testModeAt(env, workspaceRoot, steps = {}) {
185
+ const asked = askedTestMode(env);
186
+ if (asked.kind !== "affected") {
187
+ return asked;
188
+ }
189
+ const baseline = baselineCommits(workspaceRoot, steps);
190
+ return "commits" in baseline
191
+ ? { kind: "affected", commits: baseline.commits, reason: asked.reason }
192
+ : { kind: "full", reason: `${asked.reason}, but ${baseline.problem}` };
193
+ }
194
+ /**
195
+ * What the mode command prints for `mode`, and with it what the key of a
196
+ * `test` task holds: `full`, `affected:<commits>` with the baseline's
197
+ * commits joined by `,`, or for an invalid `NX_RUST_TEST_MODE` a line that
198
+ * names the value, so that a failure that Nx stores with
199
+ * `NX_CACHE_FAILURES=true` is never restored for a valid mode.
200
+ */
201
+ // @mara implements DES-TEST-MODE
202
+ function testModeText(mode) {
203
+ switch (mode.kind) {
204
+ case "full":
205
+ return "full";
206
+ case "affected":
207
+ return `affected:${mode.commits.join(",")}`;
208
+ case "invalid":
209
+ return `invalid ${exports.testModeVariable}=${JSON.stringify(mode.value)}`;
210
+ }
211
+ }
212
+ /**
213
+ * The message of a task that fails before cargo runs because
214
+ * `NX_RUST_TEST_MODE` has another value than `full` or `affected`.
215
+ */
216
+ function invalidTestModeMessage(task, value) {
217
+ return `${task}: ${exports.testModeVariable} is ${JSON.stringify(value)}, but it can only be "full", which runs the whole suite, or "affected", which runs the tests that a change can affect. Set it to one of the two, or unset it: a run then selects on a developer's machine and runs the whole suite where Nx detects CI. The task does not run, so that Nx stores no result for it.`;
218
+ }
219
+ /**
220
+ * The line at the top of a `test` task's output in a workspace that uses
221
+ * selection, which says which suite the task runs and why (`DES-TEST-MODE`,
222
+ * `REQ-AFFECTED-TESTS`).
223
+ *
224
+ * @param optedOut Whether the task's `affectedTests` option is `false`, as a
225
+ * crate's table or `--affectedTests=false` sets it.
226
+ * @param testTarget The test target that the task's `test` option names,
227
+ * which it runs in either mode as in mode `full`, also where its
228
+ * `affectedTests` is `false` (`DES-TEST-RUN`, "One test target").
229
+ */
230
+ function testModeNote(task, mode, optedOut, testTarget) {
231
+ if (mode.kind === "invalid") {
232
+ return undefined;
233
+ }
234
+ const text = testModeText(mode);
235
+ if (testTarget !== undefined) {
236
+ return `${task}: runs the test target ${JSON.stringify(testTarget)} that its option test names, as in test mode full, and selects no affected tests; the test mode is ${text}.`;
237
+ }
238
+ if (optedOut) {
239
+ return `${task}: runs the full suite, because its option affectedTests is false; the test mode is ${text}.`;
240
+ }
241
+ if (mode.kind === "full") {
242
+ return `${task}: runs the full suite in test mode full, because ${mode.reason}.`;
243
+ }
244
+ return `${task}: test mode ${text}, because ${mode.reason}.`;
245
+ }
246
+ /**
247
+ * The folder under the repository root in which the mode command and the
248
+ * test executor keep their record of one `nx` command (`DES-TEST-MODE`,
249
+ * "Between hashing and the run"), one folder per command and workspace.
250
+ * Nx leaves `.nx/workspace-data` out of its file map, and the plugin's
251
+ * `postTasksExecution` hook removes a command's folders when it ends.
252
+ */
253
+ exports.testModeRecordRoot = ".nx/workspace-data/nx-rust/test-mode";
254
+ /** The record's file of the modes that the mode command printed, one line each. */
255
+ const printedFile = "printed";
256
+ /** The record's file of the modes in which a task of the command ran a subset, one line each. */
257
+ const subsetFile = "subsets";
258
+ /**
259
+ * The id that the plugin's `preTasksExecution` hook gives the `nx` command
260
+ * whose task has the environment `env`, with only the characters that a
261
+ * folder name keeps; `undefined` without one.
262
+ */
263
+ function commandIdOf(env) {
264
+ var _a;
265
+ const id = ((_a = env[lockfile_task_1.commandIdVariable]) !== null && _a !== void 0 ? _a : "").replace(/[^A-Za-z0-9-]/g, "");
266
+ return id === "" ? undefined : id;
267
+ }
268
+ /**
269
+ * The folder of the record of the command `commandId` for the workspace at
270
+ * `workspaceRoot` ({@link testModeRecordRoot}).
271
+ *
272
+ * @param workspaceRoot The workspace's root folder, relative to the repository root.
273
+ */
274
+ function testModeRecordFolder(repositoryRoot, workspaceRoot, commandId) {
275
+ return (0, node_path_1.join)(repositoryRoot, exports.testModeRecordRoot, commandId, (0, lockfile_task_1.workspaceSegment)(workspaceRoot === "" ? "." : workspaceRoot));
276
+ }
277
+ // The lines of a record's file; none where it does not exist.
278
+ function recordLines(file) {
279
+ try {
280
+ return (0, node_fs_1.readFileSync)(file, "utf8")
281
+ .split("\n")
282
+ .filter((line) => line !== "");
283
+ }
284
+ catch (error) {
285
+ return error.code === "ENOENT" ? [] : undefined;
286
+ }
287
+ }
288
+ /** A value that no other evaluation prints, so that no stored result is ever restored under it. */
289
+ function neverRestored() {
290
+ return `unrestorable ${(0, node_crypto_1.randomBytes)(16).toString("hex")}`;
291
+ }
292
+ /**
293
+ * What the mode command prints for a task with the environment `env` in
294
+ * the workspace at `workspaceRoot` (`DES-TEST-MODE`, "Between hashing and the
295
+ * run"): the text of its test mode ({@link testModeText}), with two
296
+ * exceptions that keep a subset's result from being stored under a key that
297
+ * it does not satisfy. Where a task of the same `nx` command has run, or is
298
+ * about to run, a subset in another mode than this text, it prints a value
299
+ * that is never restored ({@link neverRestored}): Nx hashes some tasks again
300
+ * after they ran, and the key of such a task must not say `full` or name
301
+ * another baseline. And where it cannot add what it prints to the command's
302
+ * record, it prints such a value as well, since the executor could then not
303
+ * see it.
304
+ *
305
+ * Without a command id from the plugin's hook, as where Nx hashes outside a
306
+ * run, it prints the text and records nothing.
307
+ *
308
+ * @param workspaceRoot The workspace's root folder, relative to `repositoryRoot`.
309
+ */
310
+ // @mara implements DES-TEST-MODE
311
+ function printedTestMode(env, repositoryRoot, workspaceRoot, steps = {}) {
312
+ const text = testModeText(testModeAt(env, (0, node_path_1.join)(repositoryRoot, workspaceRoot), steps));
313
+ const id = commandIdOf(env);
314
+ if (id === undefined) {
315
+ return text;
316
+ }
317
+ const folder = testModeRecordFolder(repositoryRoot, workspaceRoot, id);
318
+ const subsets = recordLines((0, node_path_1.join)(folder, subsetFile));
319
+ const printed = subsets === undefined || subsets.some((subset) => subset !== text) ? neverRestored() : text;
320
+ try {
321
+ (0, node_fs_1.mkdirSync)(folder, { recursive: true });
322
+ (0, node_fs_1.appendFileSync)((0, node_path_1.join)(folder, printedFile), `${askedTestMode(env).kind}\t${printed}\n`);
323
+ }
324
+ catch (_a) {
325
+ return neverRestored();
326
+ }
327
+ return printed;
328
+ }
329
+ /**
330
+ * Why a task in affected mode must not run a subset, because the test mode
331
+ * that Nx hashed for it may differ from the one its executor reads
332
+ * (`DES-TEST-MODE`, "Between hashing and the run"; `RISK-SUBSET-AS-FULL`), or
333
+ * `undefined` where it may. Nx hands an executor neither the task's hash
334
+ * details nor the output of its runtime inputs, so the executor reads what
335
+ * the mode command recorded for the command: every value that it printed in
336
+ * this command for a task of the workspace, whatever mode the task asked
337
+ * for, has to be `text`, the executor's own reading, and at least one has
338
+ * to be there. The task's own evaluation is among them, since Nx hashes a
339
+ * task after the command's `preTasksExecution` hook and before the task
340
+ * runs, and nothing in the record tells it from another task's.
341
+ *
342
+ * @param workspaceRoot The workspace's root folder, relative to `repositoryRoot`.
343
+ * @param text The test mode as the executor reads it, `affected:<commits>`.
344
+ */
345
+ // @mara implements DES-TEST-MODE
346
+ function hashedModeProblem(env, repositoryRoot, workspaceRoot, text) {
347
+ const id = commandIdOf(env);
348
+ if (id === undefined) {
349
+ return `this run has no command id from the preTasksExecution hook of @convesoft/nx-rust, so the plugin cannot see which test mode Nx put into the task's cache key`;
350
+ }
351
+ const lines = recordLines((0, node_path_1.join)(testModeRecordFolder(repositoryRoot, workspaceRoot, id), printedFile));
352
+ if (lines === undefined) {
353
+ return `the record of the test modes that Nx hashed for this nx command cannot be read`;
354
+ }
355
+ // Every evaluation counts, whatever mode its task asked for: Nx runs the
356
+ // command with an environment that names no task, so the record cannot
357
+ // tell this task's evaluation from another's (`EVD-TEST-MODE-GUARD`).
358
+ const hashed = [...new Set(lines.map((line) => { var _a; return (_a = line.split("\t")[1]) !== null && _a !== void 0 ? _a : ""; }))];
359
+ if (hashed.length === 0) {
360
+ return `the mode command recorded no test mode for this nx command, so the plugin cannot see which one Nx put into the task's cache key`;
361
+ }
362
+ const other = hashed.filter((value) => value !== text);
363
+ if (other.length > 0) {
364
+ return `the tasks of this workspace in this nx command were hashed in different test modes: Nx hashed one with ${describeHashed(other)}, while the baseline now gives ${text} to this task, as where the tasks' environments ask for different modes or a collection created or changed the baseline after hashing, and a subset must not be stored under a key that may say otherwise`;
365
+ }
366
+ return undefined;
367
+ }
368
+ function describeHashed(values) {
369
+ return values
370
+ .map((value) => (value.startsWith("unrestorable ") ? "that is never restored" : value))
371
+ .join(" and ");
372
+ }
373
+ /**
374
+ * Adds `text` to the command's record of the modes in which its tasks run a
375
+ * subset, before the subset runs, so that the mode command prints a value
376
+ * that is never restored wherever Nx hashes a task of the workspace again
377
+ * in this command with another mode ({@link printedTestMode}).
378
+ *
379
+ * @returns Whether the record holds it; where not, the task must run its full suite.
380
+ */
381
+ // @mara implements DES-TEST-MODE
382
+ function recordSubset(env, repositoryRoot, workspaceRoot, text) {
383
+ const id = commandIdOf(env);
384
+ if (id === undefined) {
385
+ return false;
386
+ }
387
+ const folder = testModeRecordFolder(repositoryRoot, workspaceRoot, id);
388
+ try {
389
+ (0, node_fs_1.mkdirSync)(folder, { recursive: true });
390
+ (0, node_fs_1.appendFileSync)((0, node_path_1.join)(folder, subsetFile), `${text}\n`);
391
+ return true;
392
+ }
393
+ catch (_a) {
394
+ return false;
395
+ }
396
+ }
397
+ //# sourceMappingURL=test-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-mode.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/test-mode.ts"],"names":[],"mappings":";;;AAuBA,kCAwBC;AAeD,sCAWC;AAuCD,0CAyDC;AA0BD,4BAEC;AAyBD,oCASC;AAMD,wDAEC;AAaD,oCAoBC;AAsBD,kCAGC;AAQD,oDAWC;AAcD,sCAEC;AAqBD,0CAsBC;AAmBD,8CA4BC;AAiBD,oCAkBC;AAzcD,6CAA0C;AAC1C,qCAAwF;AACxF,yCAAiC;AACjC,uCAAyC;AACzC,0DAA6E;AAE7E,sFAAsF;AACzE,QAAA,gBAAgB,GAAG,mBAAmB,CAAC;AAEpD;;;GAGG;AACU,QAAA,gBAAgB,GAAG,IAAA,gBAAI,EAAC,QAAQ,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;AAE1E;;;;;;GAMG;AACH,iCAAiC;AACjC,SAAgB,WAAW,CAAC,GAAsB;IAChD,IAAI,GAAG,CAAC,EAAE,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CACZ,GAAG,CAAC,EAAE;QACN,GAAG,CAAC,QAAQ,KAAK,MAAM;QACvB,GAAG,CAAC,cAAc,KAAK,MAAM;QAC7B,GAAG,CAAC,SAAS,KAAK,MAAM;QACxB,GAAG,CAAC,QAAQ,KAAK,MAAM;QACvB,GAAG,CAAC,SAAS,KAAK,MAAM;QACxB,GAAG,CAAC,MAAM,KAAK,MAAM;QACrB,GA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AAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,IAAA,wBAAc,EAAC,IAAA,gBAAI,EAAC,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** The variable that names the group's packages, as `:a:b:`. */
2
+ export declare const packagesVariable = "NX_RUST_TEST_PACKAGES";
3
+ /** The variable that names the folder of the step's record. */
4
+ export declare const recordVariable = "NX_RUST_TEST_RECORD";
5
+ /** The status with which the runner ends where it cannot do its part. */
6
+ export declare const runnerFailureStatus = 125;
7
+ /** One entry of a record file, one JSON object per line. */
8
+ export type RecordEntry = {
9
+ start: {
10
+ package: string;
11
+ program: string;
12
+ };
13
+ } | {
14
+ skip: true;
15
+ } | {
16
+ error: string;
17
+ } | {
18
+ end: {
19
+ status: number;
20
+ } | {
21
+ signal: string;
22
+ };
23
+ };
24
+ /** What {@link superviseChild} needs from a started program. */
25
+ export interface SupervisedChild {
26
+ kill(signal: NodeJS.Signals): unknown;
27
+ on(event: "error", listener: (error: Error) => void): unknown;
28
+ on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): unknown;
29
+ }
30
+ /** How the runner ends: by a signal it raises on itself, or with a status. */
31
+ export interface RunnerEnding {
32
+ raise(signal: NodeJS.Signals): void;
33
+ exit(status: number): void;
34
+ }
35
+ /** The runner's own ending: the child's signal raised on the runner's own process. */
36
+ export declare const processEnding: RunnerEnding;
37
+ /**
38
+ * Forwards the signals that end a run to the started program and, once it
39
+ * has ended, adds the end entry to the record file `fd` and ends the runner
40
+ * the same way, through `ending`. Tests pass an ending of their own, so
41
+ * that a program ended by a signal that dumps core does not make the test
42
+ * process raise it on itself.
43
+ */
44
+ export declare function superviseChild(child: SupervisedChild, fd: number, program: string, ending?: RunnerEnding): void;