@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,620 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unpublishedMessage = exports.registryOptionMessage = void 0;
4
+ exports.publishTasks = publishTasks;
5
+ const tslib_1 = require("tslib");
6
+ const node_path_1 = require("node:path");
7
+ const declared_options_1 = require("../executors/declared-options");
8
+ const nx_command_1 = require("../executors/nx-command");
9
+ const task_guards_1 = require("../executors/task-guards");
10
+ const task_options_1 = require("../executors/task-options");
11
+ const collisions_1 = require("../graph/collisions");
12
+ const real_path_1 = require("../graph/real-path");
13
+ const targets_1 = require("../graph/targets");
14
+ const publish_cargo_1 = require("./publish-cargo");
15
+ const publish_crates_1 = require("./publish-crates");
16
+ const publish_environments_1 = require("./publish-environments");
17
+ const publish_messages_1 = require("./publish-messages");
18
+ Object.defineProperty(exports, "registryOptionMessage", { enumerable: true, get: function () { return publish_messages_1.registryOptionMessage; } });
19
+ Object.defineProperty(exports, "unpublishedMessage", { enumerable: true, get: function () { return publish_messages_1.unpublishedMessage; } });
20
+ const publish_registry_1 = require("./publish-registry");
21
+ /**
22
+ * The variables that Nx gives each task of its own, and which a cargo call
23
+ * for several tasks therefore cannot carry: a call runs with the environment
24
+ * of its tasks without them, and tasks whose environments differ otherwise
25
+ * share no call.
26
+ */
27
+ const perTaskVariables = [
28
+ "NX_TASK_TARGET_PROJECT",
29
+ "NX_TASK_TARGET_TARGET",
30
+ "NX_TASK_TARGET_CONFIGURATION",
31
+ "LERNA_PACKAGE_NAME",
32
+ ];
33
+ /**
34
+ * Publishes the crates of `inputs` (`DES-RELEASE`): for each task, the
35
+ * checks of the options and the crate's target registry; then one
36
+ * `cargo publish --locked` per Cargo workspace, target registry, environment
37
+ * and dry run, each after the calls whose crates its crates depend on, each
38
+ * preceded by the checks before each call (**Existing versions**,
39
+ * _Dependencies published elsewhere_ and _Dependencies published first_);
40
+ * and one result per task from cargo's output.
41
+ *
42
+ * It yields a result for every task it receives, also for one that it does
43
+ * not hand to cargo, and throws for none (`EVD-NX-24-BATCHES`): a failure of
44
+ * its own machinery fails every task that has no result yet.
45
+ */
46
+ // @mara implements DES-RELEASE
47
+ // @mara implements REQ-RELEASE
48
+ function publishTasks(inputs, run) {
49
+ return tslib_1.__asyncGenerator(this, arguments, function* publishTasks_1() {
50
+ var _a, e_1, _b, _c;
51
+ var _d;
52
+ const reported = new Set();
53
+ const report = (id, start, success, lines) => {
54
+ reported.add(id);
55
+ const output = lines.join("\n");
56
+ return {
57
+ task: id,
58
+ result: {
59
+ success,
60
+ status: success ? "success" : "failure",
61
+ terminalOutput: output === "" || output.endsWith("\n") ? output : `${output}\n`,
62
+ startTime: start,
63
+ endTime: Date.now(),
64
+ },
65
+ };
66
+ };
67
+ try {
68
+ const publisher = new Publisher(run, inputs);
69
+ const prepared = [];
70
+ for (const input of inputs) {
71
+ const start = Date.now();
72
+ const outcome = publisher.prepare(input, start);
73
+ if ("failed" in outcome) {
74
+ publisher.refuse(input);
75
+ yield yield tslib_1.__await(report(input.id, start, false, outcome.failed));
76
+ }
77
+ else {
78
+ prepared.push(outcome);
79
+ }
80
+ }
81
+ try {
82
+ for (var _e = true, _f = tslib_1.__asyncValues(publisher.publish(prepared)), _g; _g = yield tslib_1.__await(_f.next()), _a = _g.done, !_a; _e = true) {
83
+ _c = _g.value;
84
+ _e = false;
85
+ const [task, success, lines] = _c;
86
+ yield yield tslib_1.__await(report(task.id, task.start, success, [...task.head, ...lines]));
87
+ }
88
+ }
89
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
90
+ finally {
91
+ try {
92
+ if (!_e && !_a && (_b = _f.return)) yield tslib_1.__await(_b.call(_f));
93
+ }
94
+ finally { if (e_1) throw e_1.error; }
95
+ }
96
+ }
97
+ catch (error) {
98
+ const message = error instanceof Error ? ((_d = error.stack) !== null && _d !== void 0 ? _d : error.message) : String(error);
99
+ for (const input of inputs.filter(({ id }) => !reported.has(id))) {
100
+ yield yield tslib_1.__await(report(input.id, Date.now(), false, [
101
+ `${(0, publish_messages_1.labelOf)(input.task)}: @convesoft/nx-rust could not publish this crate, and nothing was uploaded for it. This is a defect of the plugin; please report it with this output.`,
102
+ message,
103
+ ]));
104
+ }
105
+ }
106
+ });
107
+ }
108
+ /** What one run of the executor knows: the repository's crates, the reports and the registries it found. */
109
+ class Publisher {
110
+ constructor(run, inputs) {
111
+ this.run = run;
112
+ /** The prepared tasks that the executor received, by the real path of their crate's folder. */
113
+ this.byFolder = new Map();
114
+ /** The other tasks of the run, by the real path of their crate's folder (`otherRunTasks`). */
115
+ this.othersByFolder = new Map();
116
+ /**
117
+ * The tasks that the executor received and that failed before their
118
+ * crate was read ({@link prepare}), by their label, under the real path of
119
+ * their crate's folder as the project graph names it.
120
+ */
121
+ this.refused = new Map();
122
+ this.received = new Set(inputs.map((input) => input.id));
123
+ this.root = run.context.root;
124
+ this.executor = {
125
+ name: targets_1.releasePublishExecutor,
126
+ shortName: "release-publish",
127
+ declared: (0, declared_options_1.declaredOptionsOf)(targets_1.releasePublishExecutor),
128
+ };
129
+ this.crates = (0, publish_crates_1.createCrateStore)(run.context);
130
+ this.dotenv = (0, publish_environments_1.createDotenvStore)(run.context);
131
+ this.registry = (0, publish_registry_1.createRegistryStore)(run.context.root, run.announce);
132
+ }
133
+ /**
134
+ * Records a task that failed {@link prepare}: it stays a task that this
135
+ * executor received and failed, never one of another run
136
+ * (`otherRunTasks`), and a crate that depends on its crate fails before
137
+ * its call (`DES-RELEASE`, "Dotenv files").
138
+ */
139
+ refuse(input) {
140
+ var _a, _b;
141
+ const project = (_b = (_a = this.run.context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b[input.task.target.project];
142
+ const cargo = project === undefined ? undefined : (0, collisions_1.cargoMetadataOf)(project);
143
+ if ((cargo === null || cargo === void 0 ? void 0 : cargo.packageName) !== undefined) {
144
+ this.refused.set((0, real_path_1.realPath)((0, node_path_1.join)(this.root, (0, node_path_1.dirname)(cargo.manifest))), (0, publish_messages_1.labelOf)(input.task));
145
+ }
146
+ }
147
+ /**
148
+ * The checks of one task that need no registry: its target, its options
149
+ * and its crate (`DES-RELEASE`, "Options"). A task whose options hold
150
+ * `registry` fails here, before cargo runs, whatever the value.
151
+ */
152
+ prepare(input, start) {
153
+ var _a, _b, _c, _d;
154
+ const { task } = input;
155
+ const label = (0, publish_messages_1.labelOf)(task);
156
+ const project = (_b = (_a = this.run.context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b[task.target.project];
157
+ const taskContext = (0, publish_environments_1.contextOf)(task, this.run.context);
158
+ const head = project === undefined ? [] : (0, task_guards_1.projectWarnings)(taskContext);
159
+ const fail = (...lines) => ({ failed: [...head, ...lines] });
160
+ const metadata = (_d = (_c = taskContext.target) === null || _c === void 0 ? void 0 : _c.metadata) === null || _d === void 0 ? void 0 : _d[targets_1.targetCargoMetadataKey];
161
+ const cargo = project === undefined ? undefined : (0, collisions_1.cargoMetadataOf)(project);
162
+ if ((metadata === null || metadata === void 0 ? void 0 : metadata.target) !== targets_1.releasePublishTarget || (cargo === null || cargo === void 0 ? void 0 : cargo.packageName) === undefined) {
163
+ return fail(`${label}: ${targets_1.releasePublishExecutor} runs only the target ${targets_1.releasePublishTarget} that @convesoft/nx-rust infers for a crate, and ${label} is not one of them. Nothing was published. Remove the target, or let the plugin infer it.`);
164
+ }
165
+ if ("failure" in input.env) {
166
+ return fail(input.env.failure);
167
+ }
168
+ const options = input.options;
169
+ if (Object.prototype.hasOwnProperty.call(options, "registry")) {
170
+ return fail((0, publish_messages_1.registryOptionMessage)(label, options.registry, task));
171
+ }
172
+ const lines = [];
173
+ for (const [name, value] of Object.entries(options)) {
174
+ if (name.startsWith("__") || this.executor.declared.has(name)) {
175
+ continue;
176
+ }
177
+ lines.push(name in publish_messages_1.npmOptions
178
+ ? (0, publish_messages_1.npmOptionLine)(label, name, value, task)
179
+ : (0, task_options_1.ignoredOptionLine)({
180
+ task: label,
181
+ target: targets_1.releasePublishTarget,
182
+ executor: this.executor,
183
+ options,
184
+ configured: (0, publish_environments_1.configuredOptions)(taskContext),
185
+ graphTask: task,
186
+ record: (0, nx_command_1.recordedNxCommand)(input.env),
187
+ }, name, value, "unknown"));
188
+ }
189
+ const env = Object.assign({}, input.env);
190
+ for (const name of perTaskVariables) {
191
+ delete env[name];
192
+ }
193
+ const envKey = (0, publish_environments_1.environmentKey)(env);
194
+ const manifest = (0, node_path_1.join)(this.root, cargo.manifest);
195
+ const workspaceRoot = (0, real_path_1.realPath)((0, node_path_1.join)(this.root, (0, node_path_1.dirname)(cargo.workspaceManifest)));
196
+ const report = (0, publish_crates_1.reportOf)(this.crates, workspaceRoot, env, envKey);
197
+ if ("failure" in report) {
198
+ return fail(...lines, `${label}: ${report.failure}`);
199
+ }
200
+ const pkg = report.packages.find((candidate) => (0, real_path_1.realPath)((0, node_path_1.dirname)(candidate.manifest_path)) === (0, real_path_1.realPath)((0, node_path_1.dirname)(manifest)));
201
+ if (pkg === undefined) {
202
+ return fail(...lines, `${label}: the report of the Cargo workspace in ${(0, publish_crates_1.folderLabel)(this.root, workspaceRoot)} has no crate with the manifest ${cargo.manifest}, so nothing was published. Run the command again; if the crate moved, Nx's project graph is out of date.`);
203
+ }
204
+ const crate = (0, publish_crates_1.crateOf)(this.crates, pkg, workspaceRoot, report);
205
+ return {
206
+ id: input.id,
207
+ label,
208
+ task: (0, publish_environments_1.withProjectRoot)(task, project === null || project === void 0 ? void 0 : project.root),
209
+ crate,
210
+ env,
211
+ envKey,
212
+ dryRun: options.dryRun === true || env.NX_DRY_RUN === "true",
213
+ head: [...head, ...lines],
214
+ start,
215
+ };
216
+ }
217
+ /**
218
+ * Publishes the prepared tasks, call by call, and yields each task's end
219
+ * as soon as it is known: the task, whether it succeeded, and its lines
220
+ * after its head.
221
+ */
222
+ publish(tasks) {
223
+ return tslib_1.__asyncGenerator(this, arguments, function* publish_1() {
224
+ var _a, e_2, _b, _c;
225
+ var _d;
226
+ const outcomes = new Map();
227
+ const byFolder = new Map(tasks.map((task) => [task.crate.folder, task]));
228
+ this.byFolder = byFolder;
229
+ // The target registry of each task's crate.
230
+ const calls = new Map();
231
+ const targeted = [];
232
+ for (const task of tasks) {
233
+ const target = yield tslib_1.__await((0, publish_registry_1.targetOf)(this.registry, this.dotenv, task.crate, task));
234
+ if (target.kind === "unknown") {
235
+ outcomes.set(task, { kind: "failed", lines: [`${task.label}: ${target.reason}`] });
236
+ yield yield tslib_1.__await([task, false, [`${task.label}: ${target.reason}`]]);
237
+ continue;
238
+ }
239
+ targeted.push(task);
240
+ const key = [
241
+ task.crate.workspaceRoot,
242
+ task.envKey,
243
+ (0, publish_cargo_1.registryKey)(target.registry),
244
+ String(task.dryRun),
245
+ ].join("\u0000");
246
+ const call = (_d = calls.get(key)) !== null && _d !== void 0 ? _d : { registry: target.registry, tasks: [] };
247
+ call.tasks.push(task);
248
+ calls.set(key, call);
249
+ }
250
+ // Checks before the first call: where the registry of any dependency of
251
+ // a crate of the run cannot be established, nothing is uploaded.
252
+ const disagreements = yield tslib_1.__await(this.disagreements(targeted, (0, publish_environments_1.otherRunTasks)(this.dotenv, this.crates, tasks, this.received, this.othersByFolder)));
253
+ if (disagreements.length > 0) {
254
+ for (const task of targeted) {
255
+ const own = disagreements.filter((disagreement) => disagreement.task === task);
256
+ const lines = own.length > 0
257
+ ? [
258
+ ...own.map((disagreement) => disagreement.message),
259
+ " Because an upload cannot be undone, @convesoft/nx-rust uploads nothing of this run until this is corrected.",
260
+ ]
261
+ : [
262
+ `${task.label}: @convesoft/nx-rust uploads nothing of this run, because the registry of a dependency of a crate that the run publishes cannot be established as the registry that the dependency goes to, and an upload cannot be undone. Nothing was uploaded for ${task.crate.name}. Correct what follows and run nx release publish again:`,
263
+ ...disagreements.map((disagreement) => (0, publish_messages_1.indented)(disagreement.message)),
264
+ ];
265
+ outcomes.set(task, { kind: "failed", lines });
266
+ yield yield tslib_1.__await([task, false, lines]);
267
+ }
268
+ return yield tslib_1.__await(void 0);
269
+ }
270
+ for (const call of orderCalls([...calls.values()], (task) => (0, publish_crates_1.dependencyFolders)(task.crate))) {
271
+ try {
272
+ for (var _e = true, _f = (e_2 = void 0, tslib_1.__asyncValues(this.publishCall(call.registry, call.tasks, outcomes, byFolder))), _g; _g = yield tslib_1.__await(_f.next()), _a = _g.done, !_a; _e = true) {
273
+ _c = _g.value;
274
+ _e = false;
275
+ const end = _c;
276
+ yield yield tslib_1.__await(end);
277
+ }
278
+ }
279
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
280
+ finally {
281
+ try {
282
+ if (!_e && !_a && (_b = _f.return)) yield tslib_1.__await(_b.call(_f));
283
+ }
284
+ finally { if (e_2) throw e_2.error; }
285
+ }
286
+ }
287
+ });
288
+ }
289
+ /**
290
+ * The checks before the first call (`DES-RELEASE`): for each crate of the
291
+ * run, those that the executor received with a target registry and the
292
+ * others of the task graph, the registry of each normal or build
293
+ * dependency with a version requirement on a crate of the repository,
294
+ * other than one that fails _Unpublished dependencies_, has to be
295
+ * established as the registry that the dependency goes to, in the
296
+ * dependency's own environment. A crate whose version its target registry
297
+ * has already is left out of the check, as it is left out of cargo.
298
+ *
299
+ * @returns Each crate whose check fails, with the message that says why.
300
+ */
301
+ disagreements(targeted, others) {
302
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
303
+ const found = [];
304
+ for (const task of [...targeted, ...others]) {
305
+ let links;
306
+ try {
307
+ links = yield (0, publish_crates_1.crateLinks)(this.crates, task);
308
+ }
309
+ catch (error) {
310
+ if (!(error instanceof publish_crates_1.LinkError)) {
311
+ throw error;
312
+ }
313
+ // Reported by the checks before the crate's call.
314
+ continue;
315
+ }
316
+ const message = yield this.disagreement(task, links);
317
+ if (message !== undefined && (yield this.reachesCargo(task))) {
318
+ found.push({ task, message });
319
+ }
320
+ }
321
+ return found;
322
+ });
323
+ }
324
+ /** The message of {@link disagreements} for one crate, or `undefined` where its dependencies' registries are established. */
325
+ disagreement(task, links) {
326
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
327
+ const foreign = task.foreign;
328
+ if (foreign !== undefined && links.length > 0) {
329
+ return `${task.label}: ${task.crate.name} depends on ${links.map((link) => link.dependency.name).join(", ")}, and Nx runs ${task.label} on its own, so @convesoft/nx-rust cannot rebuild its environment, while ${foreign}. So it cannot establish where the dependencies of ${task.crate.name} go, and nothing was uploaded. Run nx release publish with batches, as it runs by default, or give the crates of one release the same Cargo settings, such as in the environment of the command or in .cargo/config.toml.`;
330
+ }
331
+ for (const link of links) {
332
+ if ((0, publish_messages_1.unpublishedMessage)(task, link, (0, publish_crates_1.relativePath)(this.root, link.dependency.manifest)) !==
333
+ undefined ||
334
+ this.refused.has(link.dependency.folder)) {
335
+ // Failed by the check _Unpublished dependencies_, or for a dependency
336
+ // whose task failed in this run, before the crate's call.
337
+ continue;
338
+ }
339
+ const established = yield this.dependencyTarget(task, link.dependency);
340
+ if ("failure" in established) {
341
+ return established.failure;
342
+ }
343
+ const elsewhere = (0, publish_messages_1.publishedElsewhere)(task, link, established, established.own);
344
+ if (elsewhere !== undefined) {
345
+ return elsewhere;
346
+ }
347
+ }
348
+ return undefined;
349
+ });
350
+ }
351
+ /**
352
+ * Whether the lookup of `task`'s crate in its target registry leaves it
353
+ * for cargo (**Existing versions**): not where the registry has its version
354
+ * already, which leaves it out, or where the lookup fails, which fails it
355
+ * before its call, as the checks before each call report. A foreign task
356
+ * of `otherRunTasks`, whose environment is not established, counts as
357
+ * reaching cargo.
358
+ */
359
+ reachesCargo(task) {
360
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
361
+ if (task.foreign !== undefined) {
362
+ return true;
363
+ }
364
+ const target = yield (0, publish_registry_1.targetOf)(this.registry, this.dotenv, task.crate, task);
365
+ return (target.kind === "registry" &&
366
+ (yield (0, publish_registry_1.lookupVersion)(this.registry, task.crate, target.registry, task)).kind === "missing");
367
+ });
368
+ }
369
+ /**
370
+ * The target registry of `dependency`, a dependency of `task`'s crate, in
371
+ * the dependency's own environment ({@link ownRunner}), with that
372
+ * environment, or the message of `task` that says why it cannot be told.
373
+ */
374
+ dependencyTarget(task, dependency) {
375
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
376
+ const own = (0, publish_environments_1.ownRunner)(this.dotenv, this.byFolder, this.othersByFolder, dependency, task);
377
+ if ("failure" in own) {
378
+ return { failure: own.failure };
379
+ }
380
+ const target = yield (0, publish_registry_1.targetOf)(this.registry, this.dotenv, dependency, own);
381
+ if (target.kind === "unknown") {
382
+ return {
383
+ failure: `${task.label}: ${task.crate.name} depends on ${dependency.name}, whose target registry @convesoft/nx-rust cannot tell, so it publishes neither: ${target.reason}`,
384
+ };
385
+ }
386
+ return { target: target.registry, source: target.source, own };
387
+ });
388
+ }
389
+ /** The checks before one call, the call, and the result of each of its tasks. */
390
+ publishCall(registry, tasks, outcomes, byFolder) {
391
+ return tslib_1.__asyncGenerator(this, arguments, function* publishCall_1() {
392
+ var _a, _b;
393
+ const [first] = tasks;
394
+ const { env, dryRun } = first;
395
+ const cwd = first.crate.workspaceRoot;
396
+ const inCall = new Map(tasks.map((task) => [task.crate.folder, task]));
397
+ const settle = (task, outcome) => {
398
+ outcomes.set(task, outcome);
399
+ inCall.delete(task.crate.folder);
400
+ };
401
+ for (const task of tasks) {
402
+ const outcome = yield tslib_1.__await(this.checkTask(task, registry, inCall, outcomes, byFolder));
403
+ if (outcome !== undefined) {
404
+ settle(task, outcome);
405
+ }
406
+ }
407
+ // A crate of the call that depends on a crate left out of it, other than
408
+ // one whose version the registry has, is left out as well.
409
+ for (let changed = true; changed;) {
410
+ changed = false;
411
+ // A Map visits each entry once, also while entries are deleted.
412
+ for (const task of inCall.values()) {
413
+ for (const link of yield tslib_1.__await((0, publish_crates_1.crateLinks)(this.crates, task))) {
414
+ const left = tasks.find((other) => other.crate.folder === link.dependency.folder && !inCall.has(other.crate.folder));
415
+ const outcome = left === undefined ? undefined : outcomes.get(left);
416
+ if (left === undefined || outcome === undefined || outcome.kind === "succeeded") {
417
+ continue;
418
+ }
419
+ settle(task, outcome.kind === "not-verified"
420
+ ? { kind: "not-verified", lines: [(0, publish_messages_1.notVerifiedMessage)(task, left.crate, left.label)] }
421
+ : {
422
+ kind: "failed",
423
+ lines: [
424
+ `${task.label}: ${task.crate.name} depends on ${left.crate.name}, which is left out of this cargo call because ${left.label} failed, so ${task.crate.name} is left out as well and nothing was uploaded for it. Correct what the output of ${left.label} reports and run nx release publish again.`,
425
+ ],
426
+ });
427
+ changed = true;
428
+ break;
429
+ }
430
+ }
431
+ }
432
+ for (const task of tasks) {
433
+ const outcome = outcomes.get(task);
434
+ if (outcome !== undefined) {
435
+ yield yield tslib_1.__await([task, outcome.kind !== "failed", outcome.lines]);
436
+ }
437
+ }
438
+ const remaining = tasks.filter((task) => inCall.has(task.crate.folder));
439
+ if (remaining.length === 0) {
440
+ return yield tslib_1.__await(void 0);
441
+ }
442
+ const invocation = {
443
+ args: (0, publish_cargo_1.publishArguments)(remaining.map((task) => task.crate.name), registry, dryRun),
444
+ cwd,
445
+ };
446
+ yield tslib_1.__await(((_b = (_a = this.run).announce) === null || _b === void 0 ? void 0 : _b.call(_a, remaining.map((task) => task.label).join(", "), invocation)));
447
+ const result = yield tslib_1.__await((0, publish_cargo_1.runCapturedCargo)(invocation, env));
448
+ // Each task's result from what cargo's output shows for its own crate:
449
+ // uploaded in a real call, verified in a dry run. What the output does
450
+ // not show counts as failed (`DES-RELEASE`, "Batch").
451
+ const uploaded = (0, publish_cargo_1.uploadedCrates)(result.output);
452
+ const verified = (0, publish_cargo_1.verifiedCrates)(result.output);
453
+ const done = dryRun ? verified : uploaded;
454
+ const doneText = dryRun ? "verified" : "uploaded";
455
+ const output = result.output.trimEnd();
456
+ for (const task of remaining) {
457
+ const crate = `${task.crate.name} ${task.crate.version}`;
458
+ const success = done.has((0, publish_cargo_1.crateKey)(task.crate.name, task.crate.version));
459
+ const lines = output === "" ? [] : [output];
460
+ if (success && result.status !== 0) {
461
+ lines.push(`${task.label}: cargo ${doneText} ${crate} before the call failed for another of its crates, whose task says why.`);
462
+ }
463
+ if (!success) {
464
+ if ((0, publish_cargo_1.refusedStaleLockfile)(result.output)) {
465
+ lines.push(`${task.label}: Cargo.lock of the Cargo workspace in ${(0, publish_crates_1.folderLabel)(this.root, cwd)} does not match its manifests, and @convesoft/nx-rust passes --locked, so that publishing changes no tracked file. Run \`nx release version\`, which brings Cargo.lock up to date, commit the lockfile, and run nx release publish again.`);
466
+ }
467
+ if ((0, publish_cargo_1.refusedUncommittedChanges)(result.output)) {
468
+ lines.push(`${task.label}: cargo publishes committed files only, and @convesoft/nx-rust never passes --allow-dirty. Commit the new versions first: nx release commits them by default, while nx release version on its own only stages them unless its git settings ask for a commit. Then run nx release publish again.`);
469
+ }
470
+ if (result.status === 0) {
471
+ lines.push(`${task.label}: cargo publish succeeded, but its output does not show that ${crate} was ${doneText}, so @convesoft/nx-rust cannot tell whether it was and reports the task failed. Check ${(0, publish_cargo_1.registryLabel)(registry)}, and run nx release publish again; a version that the registry has by then is left out.`);
472
+ }
473
+ else if (!(0, publish_cargo_1.refusedStaleLockfile)(result.output) &&
474
+ !(0, publish_cargo_1.refusedUncommittedChanges)(result.output)) {
475
+ const before = [...done].join(", ");
476
+ lines.push(`${task.label}: cargo publish failed${before === "" ? "" : ` after it ${doneText} ${before}`}, and its output does not show that ${crate} was ${doneText}. Correct what cargo reports above and run nx release publish again; versions that the registry has by then are left out.`);
477
+ }
478
+ }
479
+ outcomes.set(task, success ? { kind: "succeeded", lines } : { kind: "failed", lines });
480
+ yield yield tslib_1.__await([task, success, lines]);
481
+ }
482
+ });
483
+ }
484
+ /**
485
+ * The checks of one crate before its call (`DES-RELEASE`): whether the
486
+ * registry has its version already (**Existing versions**), then for the
487
+ * normal and build dependencies with a version requirement on crates of
488
+ * the repository, _Unpublished dependencies_ for each of them, and then
489
+ * _Dependencies published elsewhere_ and _Dependencies published first_
490
+ * for each.
491
+ *
492
+ * @returns The task's outcome where a check settles it; `undefined` where
493
+ * it goes to cargo.
494
+ */
495
+ checkTask(task, registry, inCall, outcomes, byFolder) {
496
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
497
+ var _a;
498
+ const { crate } = task;
499
+ const existing = yield (0, publish_registry_1.lookupVersion)(this.registry, crate, registry, task);
500
+ if (existing.kind === "found") {
501
+ return {
502
+ kind: "succeeded",
503
+ lines: [
504
+ `${task.label}: ${crate.name} ${crate.version} is in ${(0, publish_cargo_1.registryLabel)(registry)} already, so it is left out of cargo publish.`,
505
+ ],
506
+ };
507
+ }
508
+ if (existing.kind !== "missing") {
509
+ return {
510
+ kind: "failed",
511
+ lines: [
512
+ (0, publish_messages_1.lookupFailure)(task, crate, registry, existing, (0, publish_crates_1.folderLabel)(this.root, crate.workspaceRoot)),
513
+ ],
514
+ };
515
+ }
516
+ let links;
517
+ try {
518
+ links = yield (0, publish_crates_1.crateLinks)(this.crates, task);
519
+ }
520
+ catch (error) {
521
+ if (!(error instanceof publish_crates_1.LinkError)) {
522
+ throw error;
523
+ }
524
+ return { kind: "failed", lines: [`${task.label}: ${error.message}`] };
525
+ }
526
+ for (const link of links) {
527
+ const unpublished = (0, publish_messages_1.unpublishedMessage)(task, link, (0, publish_crates_1.relativePath)(this.root, link.dependency.manifest));
528
+ if (unpublished !== undefined) {
529
+ return { kind: "failed", lines: [unpublished] };
530
+ }
531
+ }
532
+ for (const { dependency } of links) {
533
+ const refused = this.refused.get(dependency.folder);
534
+ if (refused !== undefined) {
535
+ return { kind: "failed", lines: [(0, publish_messages_1.refusedDependencyMessage)(task, dependency, refused)] };
536
+ }
537
+ }
538
+ let notVerified;
539
+ for (const link of links) {
540
+ const { dependency } = link;
541
+ // Established before the first call, in the dependency's own
542
+ // environment, which its lookups use as well.
543
+ const established = yield this.dependencyTarget(task, dependency);
544
+ if ("failure" in established) {
545
+ return { kind: "failed", lines: [established.failure] };
546
+ }
547
+ const target = { registry: established.target };
548
+ const elsewhere = (0, publish_messages_1.publishedElsewhere)(task, link, established, established.own);
549
+ if (elsewhere !== undefined) {
550
+ return { kind: "failed", lines: [elsewhere] };
551
+ }
552
+ if (inCall.has(dependency.folder)) {
553
+ continue;
554
+ }
555
+ const lookup = yield (0, publish_registry_1.lookupVersion)(this.registry, dependency, target.registry, established.own, task.label);
556
+ if (lookup.kind === "found") {
557
+ continue;
558
+ }
559
+ if (lookup.kind !== "missing") {
560
+ return {
561
+ kind: "failed",
562
+ lines: [
563
+ (0, publish_messages_1.lookupFailure)(task, dependency, target.registry, lookup, (0, publish_crates_1.folderLabel)(this.root, dependency.workspaceRoot)),
564
+ ],
565
+ };
566
+ }
567
+ const dependencyTask = byFolder.get(dependency.folder);
568
+ const failed = dependencyTask !== undefined && ((_a = outcomes.get(dependencyTask)) === null || _a === void 0 ? void 0 : _a.kind) === "failed";
569
+ if (task.dryRun &&
570
+ dependency.hasPublishTarget &&
571
+ dependency.project !== undefined &&
572
+ !failed) {
573
+ notVerified !== null && notVerified !== void 0 ? notVerified : (notVerified = {
574
+ kind: "not-verified",
575
+ lines: [
576
+ (0, publish_messages_1.notVerifiedMessage)(task, dependency, `${dependency.project}:${targets_1.releasePublishTarget}`),
577
+ ],
578
+ });
579
+ continue;
580
+ }
581
+ return {
582
+ kind: "failed",
583
+ lines: [
584
+ (0, publish_messages_1.publishFirstMessage)(task, dependency, target.registry, failed ? dependencyTask : undefined),
585
+ ],
586
+ };
587
+ }
588
+ return notVerified;
589
+ });
590
+ }
591
+ }
592
+ /**
593
+ * The calls in an order in which each comes after the calls whose crates its
594
+ * crates depend on, where no cycle prevents it; the calls of a cycle keep
595
+ * their order, and the checks or cargo fail the one that cannot resolve
596
+ * (`DES-RELEASE`, "Batch").
597
+ */
598
+ function orderCalls(calls, dependencies) {
599
+ const callOf = new Map();
600
+ for (const call of calls) {
601
+ for (const task of call.tasks) {
602
+ callOf.set(task.crate.folder, call);
603
+ }
604
+ }
605
+ const after = new Map(calls.map((call) => [
606
+ call,
607
+ new Set(call.tasks
608
+ .flatMap((task) => dependencies(task))
609
+ .map((folder) => callOf.get(folder))
610
+ .filter((other) => other !== undefined && other !== call)),
611
+ ]));
612
+ const ordered = [];
613
+ const remaining = [...calls];
614
+ while (remaining.length > 0) {
615
+ const index = remaining.findIndex((call) => { var _a; return [...((_a = after.get(call)) !== null && _a !== void 0 ? _a : [])].every((other) => ordered.includes(other)); });
616
+ ordered.push(...remaining.splice(index === -1 ? 0 : index, 1));
617
+ }
618
+ return ordered;
619
+ }
620
+ //# sourceMappingURL=publish.js.map