@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,271 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkBuildInputs = checkBuildInputs;
4
+ const tslib_1 = require("tslib");
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const dep_info_basedir_1 = require("../cargo/dep-info-basedir");
8
+ const build_records_1 = require("./build-records");
9
+ /**
10
+ * Checks a `build` task after a cargo call that built its crate without
11
+ * error, fresh or not (`DES-BUILD-INPUT-CHECK`): reads the records that the
12
+ * call exported for the crate's library and binaries, as {@link nameRecords}
13
+ * names them, resolves every path they hold to the file it names, leaves out
14
+ * those outside the repository and in Cargo's build or artifact directory,
15
+ * enumerates a recorded folder as Nx sees it, and compares each file with
16
+ * Nx's matching of the task's file inputs.
17
+ *
18
+ * @param nx What Nx knows about the task's files, asked only where a record
19
+ * names a file in the repository.
20
+ * @returns The task's failure message where a file is not covered, naming
21
+ * the crate, each such file and the `fileInputs` line that would cover
22
+ * them; `undefined` where every file is covered.
23
+ */
24
+ // @mara implements DES-BUILD-INPUT-CHECK
25
+ // @mara implements REQ-BUILD-INPUT-CHECK
26
+ function checkBuildInputs(check, repositoryRoot, nx) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ var _a, _b;
29
+ const root = (_a = realPathOf(repositoryRoot)) !== null && _a !== void 0 ? _a : (0, node_path_1.resolve)(repositoryRoot);
30
+ const artifactDirectory = check.directories.artifact;
31
+ const cargoDirectories = [artifactDirectory, check.directories.build];
32
+ const records = (0, build_records_1.nameRecords)(check.records, check.crate, check.selection, check.env, (_b = check.recordsFolder) !== null && _b !== void 0 ? _b : artifactDirectory, check.cwd);
33
+ const found = new Map();
34
+ const folders = [];
35
+ let configuredBasedir = null;
36
+ for (const record of records) {
37
+ for (const { path, basedir } of recordedPaths(record, () => {
38
+ if (configuredBasedir === null) {
39
+ configuredBasedir = (0, dep_info_basedir_1.configuredDepInfoBasedir)(check.cwd, check.env);
40
+ }
41
+ return configuredBasedir;
42
+ })) {
43
+ const spelled = (0, node_path_1.isAbsolute)(path)
44
+ ? path
45
+ : basedir === undefined
46
+ ? undefined
47
+ : (0, node_path_1.join)(basedir, path);
48
+ const resolved = spelled === undefined ? undefined : resolveRead(spelled, root, cargoDirectories);
49
+ if (resolved === undefined) {
50
+ continue;
51
+ }
52
+ if (resolved.isFolder) {
53
+ folders.push(resolved.file);
54
+ }
55
+ else if (!found.has(resolved.file)) {
56
+ found.set(resolved.file, Object.assign({ file: resolved.file }, (resolved.link === undefined ? {} : { link: resolved.link })));
57
+ }
58
+ }
59
+ }
60
+ if (found.size === 0 && folders.length === 0) {
61
+ return undefined;
62
+ }
63
+ const files = yield nx();
64
+ for (const folder of new Set(folders)) {
65
+ for (const file of files.filesBelow(folder)) {
66
+ const resolved = resolveListed(file, repositoryRoot, root, cargoDirectories);
67
+ if (resolved !== undefined && !found.has(resolved.file)) {
68
+ found.set(resolved.file, Object.assign(Object.assign({ file: resolved.file }, (resolved.link === undefined ? {} : { link: resolved.link })), { folder }));
69
+ }
70
+ }
71
+ }
72
+ const uncovered = [...found.values()]
73
+ .filter(({ file }) => !files.inputFiles.has(file))
74
+ .sort((a, b) => (a.file < b.file ? -1 : a.file > b.file ? 1 : 0));
75
+ return uncovered.length === 0 ? undefined : failureMessage(check, uncovered, root);
76
+ });
77
+ }
78
+ /**
79
+ * The paths that a record holds, each with the folder that a relative one
80
+ * is relative to (`DES-BUILD-INPUT-CHECK`, points 3 and 4). Cargo writes a
81
+ * path relative to `build.dep-info-basedir` where that folder holds it, and
82
+ * absolute otherwise, the artifact of the rule included. The artifact lies
83
+ * beside the record, so where the record spells it relatively, the folder
84
+ * is the record's own folder without the artifact's relative path. Where it
85
+ * spells the artifact absolutely, the artifact lies outside that folder, and
86
+ * the folder comes from Cargo's configuration. A missing record names nothing.
87
+ */
88
+ function recordedPaths(record, configured) {
89
+ let text;
90
+ try {
91
+ text = (0, node_fs_1.readFileSync)(record.path, "utf8");
92
+ }
93
+ catch (_a) {
94
+ return [];
95
+ }
96
+ return (0, build_records_1.parseRecord)(text).flatMap(({ target, paths }) => {
97
+ let basedir;
98
+ if (paths.some((path) => !(0, node_path_1.isAbsolute)(path))) {
99
+ basedir = (0, node_path_1.isAbsolute)(target)
100
+ ? configured()
101
+ : basedirFromArtifact((0, node_path_1.dirname)(record.path), target);
102
+ basedir !== null && basedir !== void 0 ? basedir : (basedir = configured());
103
+ }
104
+ return paths.map((path) => ({ path, basedir }));
105
+ });
106
+ }
107
+ // The folder that a relative artifact path is relative to, given the folder
108
+ // that holds the artifact; `undefined` where the spelling does not fit.
109
+ function basedirFromArtifact(folder, artifact) {
110
+ const relativePath = (0, node_path_1.normalize)(artifact);
111
+ const full = (0, node_path_1.join)(folder, (0, node_path_1.basename)(relativePath));
112
+ const suffix = `${node_path_1.sep}${relativePath}`;
113
+ if (!full.endsWith(suffix)) {
114
+ return undefined;
115
+ }
116
+ return full.slice(0, full.length - suffix.length) || node_path_1.sep;
117
+ }
118
+ /**
119
+ * A recorded path resolved to what it names (point 4): symbolic links
120
+ * followed, `..` taken as the system takes it, and on macOS the case of the
121
+ * names on disk. `undefined` for a path that names nothing, lies outside the
122
+ * repository, or lies in Cargo's build or artifact directory.
123
+ */
124
+ function resolveRead(spelled, root, cargoDirectories) {
125
+ const real = realPathOf(spelled);
126
+ if (real === undefined) {
127
+ return undefined;
128
+ }
129
+ const file = within(root, real);
130
+ if (file === undefined ||
131
+ cargoDirectories.some((directory) => within(directory, real) !== undefined)) {
132
+ return undefined;
133
+ }
134
+ let isFolder;
135
+ try {
136
+ isFolder = (0, node_fs_1.statSync)(real).isDirectory();
137
+ }
138
+ catch (_a) {
139
+ return undefined;
140
+ }
141
+ // The link through which cargo recorded the file: the recorded spelling,
142
+ // its `..` taken as text, where that is a symbolic link in the repository.
143
+ const lexical = within(root, (0, node_path_1.resolve)(spelled));
144
+ const link = !isFolder && lexical !== undefined && lexical !== file && isLink((0, node_path_1.join)(root, lexical))
145
+ ? lexical
146
+ : undefined;
147
+ return Object.assign(Object.assign({ file }, (link === undefined ? {} : { link })), { isFolder });
148
+ }
149
+ /**
150
+ * A file that Nx lists below a recorded folder (point 5), resolved as
151
+ * {@link resolveRead} does; a symbolic link to a folder is not followed.
152
+ */
153
+ function resolveListed(listed, repositoryRoot, root, cargoDirectories) {
154
+ const path = (0, node_path_1.join)(repositoryRoot, listed);
155
+ const real = realPathOf(path);
156
+ if (real === undefined) {
157
+ return undefined;
158
+ }
159
+ const file = within(root, real);
160
+ if (file === undefined ||
161
+ cargoDirectories.some((directory) => within(directory, real) !== undefined)) {
162
+ return undefined;
163
+ }
164
+ try {
165
+ if (!(0, node_fs_1.statSync)(real).isFile()) {
166
+ return undefined;
167
+ }
168
+ }
169
+ catch (_a) {
170
+ return undefined;
171
+ }
172
+ return file === listed ? { file } : { file, link: listed };
173
+ }
174
+ // The message of a failed check (point 7).
175
+ // @mara implements DES-DIAGNOSTICS
176
+ function failureMessage(check, uncovered, root) {
177
+ var _a;
178
+ const crateFolder = (_a = realPathOf((0, node_path_1.join)(root, (0, node_path_1.dirname)(check.manifest)))) !== null && _a !== void 0 ? _a : (0, node_path_1.join)(root, (0, node_path_1.dirname)(check.manifest));
179
+ const fromCrate = (file) => {
180
+ const path = (0, node_path_1.relative)(crateFolder, (0, node_path_1.join)(root, file)).split(node_path_1.sep).join(node_path_1.posix.sep);
181
+ return path === "" ? "." : path;
182
+ };
183
+ const lines = uncovered.map(({ file, link, folder }) => {
184
+ const notes = [
185
+ ...(link === undefined ? [] : [`through the symbolic link ${link}`]),
186
+ ...(folder === undefined
187
+ ? []
188
+ : [
189
+ `in the folder ${folder === "" ? "at the repository root" : folder}, which cargo records as a whole`,
190
+ ]),
191
+ ];
192
+ return `- ${file}${notes.length === 0 ? "" : `, ${notes.join(", ")}`}`;
193
+ });
194
+ const patterns = [...new Set(uncovered.map(({ file }) => escapeGlob(fromCrate(file))))];
195
+ const folders = [
196
+ ...new Set(uncovered.flatMap(({ folder }) => (folder === undefined ? [] : [folder]))),
197
+ ];
198
+ return [
199
+ `${check.task}: cargo build read files in the repository that none of the task's inputs covers, so Nx would store its result under a cache key that misses them. The task fails, so that Nx stores no result for it.`,
200
+ `The crate ${check.crate} read:`,
201
+ ...lines,
202
+ `Declare them under fileInputs in the [package.metadata.nx] table of ${check.manifest}, beside the patterns that it lists already:`,
203
+ `fileInputs = [${patterns.map((pattern) => JSON.stringify(pattern)).join(", ")}]`,
204
+ ...folders.map((folder) => `A pattern for the folder ${folder === "" ? "at the repository root" : folder}, ${JSON.stringify(folderPattern(fromCrate(folder)))}, also covers the files that are added to it later.`),
205
+ ].join("\n");
206
+ }
207
+ // `**` below a folder relative to the crate's folder.
208
+ function folderPattern(folder) {
209
+ const escaped = escapeGlob(folder);
210
+ return escaped === "." ? "**" : `${escaped}/**`;
211
+ }
212
+ // A path with the characters that make a pattern a glob escaped by a backslash.
213
+ function escapeGlob(path) {
214
+ return path.replace(/[*?[\]{}()\\]/g, (character) => `\\${character}`);
215
+ }
216
+ // The path relative to `root` with `/` separators, `""` for the root itself;
217
+ // `undefined` outside it.
218
+ function within(root, path) {
219
+ const inside = (0, node_path_1.relative)(root, path);
220
+ if (inside === ".." || inside.startsWith(`..${node_path_1.sep}`) || (0, node_path_1.isAbsolute)(inside)) {
221
+ return undefined;
222
+ }
223
+ return inside.split(node_path_1.sep).join(node_path_1.posix.sep);
224
+ }
225
+ function isLink(path) {
226
+ try {
227
+ return (0, node_fs_1.lstatSync)(path).isSymbolicLink();
228
+ }
229
+ catch (_a) {
230
+ return false;
231
+ }
232
+ }
233
+ // The real path as the system resolves it, `..` after a link included, and
234
+ // on macOS with the case of the names on disk; `undefined` where nothing is
235
+ // there.
236
+ function realPathOf(path) {
237
+ let real;
238
+ try {
239
+ real = node_fs_1.realpathSync.native(path);
240
+ }
241
+ catch (_a) {
242
+ return undefined;
243
+ }
244
+ return process.platform === "darwin" ? caseOnDisk(real) : real;
245
+ }
246
+ /**
247
+ * The path with each name in the case that the folder holding it lists, for
248
+ * a file system that ignores case (`DES-BUILD-INPUT-CHECK`, point 4). A name
249
+ * that the folder lists as it is stays.
250
+ */
251
+ function caseOnDisk(path) {
252
+ var _a;
253
+ const names = path.split(node_path_1.sep).filter((name) => name !== "");
254
+ let current = node_path_1.sep;
255
+ for (const name of names) {
256
+ let entries = [];
257
+ try {
258
+ entries = (0, node_fs_1.readdirSync)(current);
259
+ }
260
+ catch (_b) {
261
+ return path;
262
+ }
263
+ const exact = entries.includes(name);
264
+ const stored = exact
265
+ ? name
266
+ : ((_a = entries.find((entry) => entry.toLowerCase() === name.toLowerCase())) !== null && _a !== void 0 ? _a : name);
267
+ current = (0, node_path_1.join)(current, stored);
268
+ }
269
+ return current;
270
+ }
271
+ //# sourceMappingURL=input-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-check.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/input-check.ts"],"names":[],"mappings":";;AA2EA,4CAkEC;;AA7ID,qCAAuF;AACvF,yCAUmB;AACnB,gEAAqE;AAErE,mDAAkG;AA4ClG;;;;;;;;;;;;;;GAcG;AACH,yCAAyC;AACzC,yCAAyC;AACzC,SAAsB,gBAAgB,CACpC,KAAsB,EACtB,cAAsB,EACtB,EAA8B;;;QAE9B,MAAM,IAAI,GAAG,MAAA,UAAU,CAAC,cAAc,CAAC,mCAAI,IAAA,mBAAO,EAAC,cAAc,CAAC,CAAC;QACnE,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC;QACrD,MAAM,gBAAgB,GAAG,CAA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 import { type CargoDirectories } from "../cargo/directories";
4
+ import { type MatchGlobPaths } from "../compatibility/nx-bridge";
5
+ import type { GroupMember } from "./group-run";
6
+ import type { GroupSelection } from "./groups";
7
+ import { type Stage } from "./stage";
8
+ /** A file that a group keeps while its commands run, with the build that stores it. */
9
+ export interface KeptCandidate {
10
+ /** The file, absolute, below the artifact directory's physical path. */
11
+ path: string;
12
+ /** The cached `build` task of the command that stores it, as `project:target`. */
13
+ owner: string;
14
+ }
15
+ /** What a group keeps while its commands run ({@link keepFiles}). */
16
+ export interface Keeping {
17
+ /** The stage that holds the kept files; absent where nothing is kept. */
18
+ stage?: Stage;
19
+ files: KeptFile[];
20
+ }
21
+ /** A file that a group keeps, and the stage's link to it. */
22
+ export interface KeptFile extends KeptCandidate {
23
+ /** The hard link, or copy, of the file in the stage. */
24
+ staged: string;
25
+ /** The file as the group found it. */
26
+ before: FileState;
27
+ /** The stage's file as the group made it. */
28
+ kept: FileState;
29
+ }
30
+ type FileState = Pick<Stats, "dev" | "ino" | "size" | "mtimeMs" | "mode">;
31
+ /**
32
+ * The files that a `test` or `bench` group of a batch keeps while its
33
+ * commands run, so that they are as the command's builds left them
34
+ * afterwards (`DES-BATCH`, "Files that a test batch puts back").
35
+ *
36
+ * The candidates are the final files that the group's cargo commands can
37
+ * link again: for each crate that the group can build for its tests, every
38
+ * member of the workspace where the group selects the whole workspace and
39
+ * its own crates where it selects them, those with a binary and an
40
+ * integration test or bench for `test` ({@link testReplacesExecutables}) and
41
+ * those with a binary for `bench`, the names that the outputs of a crate's
42
+ * `build` give its final files ({@link finalFileNames}), in the folder of
43
+ * each triple that the group's command builds for ({@link callTriples}) and
44
+ * of its profile ({@link profileFolder}), below the physical path of the
45
+ * artifact directory that cargo reports for the group.
46
+ *
47
+ * A candidate is kept where a cached `build` task of the command's task
48
+ * graph that is not one of the group's tasks, and for a group that selects
49
+ * its crates belongs to one of their projects, stores it: one of the
50
+ * outputs that Nx resolved for the task names the file or a folder above
51
+ * it, or is a glob that Nx's own glob matching accepts for it, with `!`
52
+ * exclusions. No folder is listed and no file is searched for.
53
+ *
54
+ * @param members The group's tasks with their commands.
55
+ * @param ids The group's task ids.
56
+ * @param match Nx's glob matching, for outputs that are globs; loaded from
57
+ * the Nx of the repository where not given.
58
+ * @param directoriesOf Cargo's directories for the group, as cargo reports them.
59
+ * @returns The candidates that a build stores, with the group's
60
+ * directories, or the problem with which the group's tasks fail.
61
+ */
62
+ export declare function filesToKeep(members: readonly GroupMember[], ids: readonly string[], selection: GroupSelection, context: ExecutorContext, match?: MatchGlobPaths, directoriesOf?: (cwd: string, env: NodeJS.ProcessEnv) => CargoDirectories): {
63
+ files: KeptCandidate[];
64
+ directories?: CargoDirectories;
65
+ } | {
66
+ problem: string;
67
+ };
68
+ /**
69
+ * Keeps each of `files` that is a regular file in a new stage of the
70
+ * artifact directory, a hard link at the same path relative to it, or a
71
+ * copy where the file system refuses a link, so that {@link putBack} can put
72
+ * it back once the group's commands have run. A missing file, or one that
73
+ * is no regular file, such as a symbolic link, is not kept. Cargo replaces
74
+ * a file that it links into the artifact directory by removing it first,
75
+ * and a linker writes a new file, so the kept one stays as it was;
76
+ * {@link putBack} checks that it did. No stage is made where nothing is kept.
77
+ *
78
+ * @returns What is kept, or the problem with the first file that could not
79
+ * be looked at or kept, in which case nothing is kept any more.
80
+ */
81
+ export declare function keepFiles(files: readonly KeptCandidate[], directories: CargoDirectories | undefined): {
82
+ keeping: Keeping;
83
+ } | {
84
+ problem: string;
85
+ };
86
+ /**
87
+ * Puts back each file that {@link keepFiles} kept where the group's commands
88
+ * replaced or removed it, by the stage's move, and removes the stage.
89
+ *
90
+ * @returns A problem for each file that could not be put back, or whose
91
+ * kept copy changed while the commands ran, and a warning where the stage
92
+ * could not be removed.
93
+ */
94
+ export declare function putBack(keeping: Keeping): {
95
+ problems: string[];
96
+ warning?: string;
97
+ };
98
+ export {};