@roomi-fields/grillhouse 0.28.3 → 0.30.0
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.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +739 -0
- package/bin/grillhouse.mjs +128 -26
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/README.md +11 -11
- package/cadre/templates/projet/_gitignore +2 -5
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +37 -4
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +24 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +95 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +124 -0
- package/dist/temporal/installation.js +408 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +813 -53
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +161 -30
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2182 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +328 -0
- package/scripts/avancement.mjs +159 -64
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +888 -3654
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composition-des-langages.mjs +30 -11
- package/scripts/conformite.mjs +19 -10
- package/scripts/copies-finies.mjs +188 -42
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +115 -0
- package/scripts/dernier-vert.mjs +7 -15
- package/scripts/donnees-cles.mjs +228 -0
- package/scripts/droits.mjs +11 -1
- package/scripts/effets.mjs +352 -0
- package/scripts/enveloppe/enveloppe.mjs +119 -8
- package/scripts/enveloppe/lancer.sh +27 -32
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
- package/scripts/etapes.mjs +6 -3
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +187 -0
- package/scripts/fusion-du-changelog.mjs +0 -1
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/grillhouse-maj.mjs +16 -7
- package/scripts/integration/file.mjs +477 -422
- package/scripts/integration/integrer.mjs +20 -22
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +168 -28
- package/scripts/langages/cargo/commandes.mjs +426 -119
- package/scripts/langages/cargo/composants.mjs +187 -3
- package/scripts/langages/cargo/exemples.mjs +75 -17
- package/scripts/langages/cargo/index.mjs +32 -13
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
- package/scripts/langages/cargo/sccache.mjs +62 -16
- package/scripts/langages/cargo/squelette.mjs +72 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
- package/scripts/langages/cargo/tests-de-head.mjs +159 -0
- package/scripts/langages/python/commandes.mjs +232 -79
- package/scripts/langages/python/composants.mjs +65 -3
- package/scripts/langages/python/exemples.mjs +21 -12
- package/scripts/langages/python/index.mjs +25 -5
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/python/squelette.mjs +119 -17
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +19 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +48 -63
- package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
- package/scripts/langages/typescript/squelette.mjs +18 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
- package/scripts/langages/typescript/tests.mjs +17 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
- package/scripts/langages/typescript/verdict.mjs +1 -1
- package/scripts/langages/typescript/verifier.mjs +110 -296
- package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
- package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
- package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
- package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
- package/scripts/lecture-unique.mjs +51 -0
- package/scripts/mesure/pression.mjs +11 -9
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +29 -15
- package/scripts/outil.mjs +72 -0
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +0 -1
- package/scripts/paquet-npm.mjs +147 -0
- package/scripts/paquet.mjs +112 -14
- package/scripts/paquets.mjs +34 -6
- package/scripts/passe-de-la-machine.mjs +66 -0
- package/scripts/places-de-la-machine.mjs +360 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +10 -3
- package/scripts/registre.mjs +3 -2
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/resultats.mjs +29 -14
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +918 -0
- package/scripts/services-du-noyau.mjs +28 -11
- package/scripts/session-start.sh +10 -1
- package/scripts/sortie.mjs +23 -4
- package/scripts/sources.mjs +3 -3
- package/scripts/sous-commandes.mjs +39 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +382 -16
- package/scripts/tableau.mjs +329 -130
- package/scripts/taches-du-graphe.mjs +328 -0
- package/scripts/ticket-du-circuit.mjs +206 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +901 -0
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrou-de-machine.mjs +322 -62
- package/skills/developpeur/SKILL.md +11 -3
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +62 -28
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +22 -8
- package/skills/testwriter/SKILL.md +47 -39
- package/scripts/demon.mjs +0 -138
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The components of a workspace of cargo, as cargo itself describes them (`cargo metadata
|
|
2
2
|
// --format-version 1 --no-deps --offline`): the crates the module cargo answers the join with
|
|
3
3
|
// (scripts/jointure.d.ts, `composants`, `composantDe`, `matieres`, `joueDesTests`, `lecteurs`,
|
|
4
|
-
// `estUnTest`).
|
|
4
|
+
// `estUnTest`, `arbreDAvant`, `testsDeHead`).
|
|
5
5
|
//
|
|
6
6
|
// - A component is a member of the workspace (`workspace_members`): its folder, the manifest's;
|
|
7
7
|
// its name and its package, the crate's name. A directory without a Cargo.toml at its root holds
|
|
@@ -29,6 +29,13 @@
|
|
|
29
29
|
// `tests.rs` under `src/`, and any file of a folder `tests/` under `src/`, is a unit test file,
|
|
30
30
|
// played with its crate when it is Rust; a file of a crate of the shared test material is
|
|
31
31
|
// material; any other file of a crate (the code of `src/`) is none of them.
|
|
32
|
+
// - HEAD's version of a test file plays in a tree of its own (`arbreDAvant`), never beside the
|
|
33
|
+
// file: a target `tests/<nom>.rs`, a target cargo finds by itself, its tree the copy's with that
|
|
34
|
+
// file replaced, built in the cargo target directory of the copy (`envDArbre`); none for
|
|
35
|
+
// `tests/<dossier>/main.rs` nor a unit test of `src/`, whose names of tests HEAD's version holds
|
|
36
|
+
// are read without playing them (`testsDeHead`, ./tests-de-head.mjs), the proof holding each for
|
|
37
|
+
// a green HEAD holds; those of a target `tests/<nom>.rs` too, when its tree no longer compiles
|
|
38
|
+
// (grillhouse-3e2.2).
|
|
32
39
|
// - What the testwriter writes of the manifests (`manifestes`): the tables that declare what the
|
|
33
40
|
// tests of a crate depend on, `[dev-dependencies]` and `[target.<cible>.dev-dependencies]` of
|
|
34
41
|
// its Cargo.toml (cargo's book, « Development dependencies »), as the author of a test of Bazel
|
|
@@ -42,11 +49,13 @@
|
|
|
42
49
|
// when a manifest is judged, so that a project of another language, which loads this module
|
|
43
50
|
// without it, never needs it.
|
|
44
51
|
import { spawnSync } from 'node:child_process';
|
|
45
|
-
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
52
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
46
53
|
import { createRequire } from 'node:module';
|
|
47
54
|
import path from 'node:path';
|
|
48
55
|
import { isDeepStrictEqual } from 'node:util';
|
|
56
|
+
import { luUneFois } from '../../services-du-noyau.mjs';
|
|
49
57
|
import { cibleDeCompilation } from './sccache.mjs';
|
|
58
|
+
import { nomsDeHead } from './tests-de-head.mjs';
|
|
50
59
|
|
|
51
60
|
// The loader of the optional peers this module reads when it needs them (smol-toml), under the
|
|
52
61
|
// name by which knip reads a dependency.
|
|
@@ -64,6 +73,12 @@ export function metadonnees(racine) {
|
|
|
64
73
|
if (!existsSync(path.join(racine, 'Cargo.toml'))) {
|
|
65
74
|
return null;
|
|
66
75
|
}
|
|
76
|
+
// Read once in a scope of the core (`luUneFois`): a sweep asks it of every file of a folder.
|
|
77
|
+
return luUneFois(`cargo metadata ${path.resolve(racine)}`, () => lireLesMetadonnees(racine));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// What `cargo metadata` says of the workspace at <racine>, read at each call.
|
|
81
|
+
function lireLesMetadonnees(racine) {
|
|
67
82
|
// The target directory cargo reports is the one the compilations use (./sccache.mjs), named
|
|
68
83
|
// without being made: a reading writes nothing in the home.
|
|
69
84
|
const r = spawnSync('cargo', ['metadata', '--format-version', '1', '--no-deps', '--offline'], {
|
|
@@ -130,7 +145,7 @@ export const matieres = racine =>
|
|
|
130
145
|
// Whether <parts>, a path from the folder of a crate split, is a unit test file under its `src/`:
|
|
131
146
|
// a file `tests.rs`, or a file of a folder `tests/`.
|
|
132
147
|
// `src/bin/tests.rs` and `src/bin/tests/` are a binary target for cargo, its code.
|
|
133
|
-
const unitaire = parts =>
|
|
148
|
+
export const unitaire = parts =>
|
|
134
149
|
parts[0] === 'src' &&
|
|
135
150
|
parts.length > 1 &&
|
|
136
151
|
!(parts[1] === 'bin' && ['tests.rs', 'tests'].includes(parts[2])) &&
|
|
@@ -250,6 +265,94 @@ export function estUnTest(chemin, racine) {
|
|
|
250
265
|
return matiere ? { joue: false, test: false, matiere: true } : null;
|
|
251
266
|
}
|
|
252
267
|
|
|
268
|
+
/** The end of the name of a night test target, and of a time budget bench's (./commandes.mjs,
|
|
269
|
+
* `horsDuJour`). */
|
|
270
|
+
export const DE_NUIT = '_nuit';
|
|
271
|
+
export const BANC = '_budget';
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Whether HEAD's version of the test file <chemin> (from the root <racine>) plays in a tree of its
|
|
275
|
+
* own, in the same proof as the lot's: a test target `tests/<nom>.rs`, a target cargo finds by
|
|
276
|
+
* itself (`autotests`), its `mod` of the same folder read as the file's; false for any other
|
|
277
|
+
* file: a target `tests/<dossier>/main.rs` holds its modules beside it, and a unit test of
|
|
278
|
+
* `src/` is compiled in its crate's module (`testsDeHead` reads their names).
|
|
279
|
+
* @param {string} chemin
|
|
280
|
+
* @param {string} racine
|
|
281
|
+
*/
|
|
282
|
+
export function arbreDAvant(chemin, racine) {
|
|
283
|
+
const abs = path.resolve(racine, chemin);
|
|
284
|
+
const c = composantDans(
|
|
285
|
+
crates(racine).map(x => x.composant),
|
|
286
|
+
racine,
|
|
287
|
+
abs
|
|
288
|
+
);
|
|
289
|
+
const parts = c ? path.relative(c.dossier, abs).split(path.sep) : [];
|
|
290
|
+
return parts.length === 2 && parts[0] === 'tests' && parts[1].endsWith('.rs');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** The variable that names, to the launcher, the copy whose git tracks the `Cargo.lock` of a tree. */
|
|
294
|
+
export const COPIE_DE_L_ARBRE = 'GRILLHOUSE_COPIE_DE_L_ARBRE';
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* The environment a tree of HEAD's version plays under: the target directory of the copy's
|
|
298
|
+
* compilations, so that the tree builds there, whatever its place (`cibleDeCompilation`
|
|
299
|
+
* (./sccache.mjs) for a copy in the temporary directory, its `target/` otherwise; the caller's
|
|
300
|
+
* own `CARGO_TARGET_DIR` stays), and the copy itself (`COPIE_DE_L_ARBRE`), where git tracks the
|
|
301
|
+
* `Cargo.lock` the tree, which has no `.git`, carries.
|
|
302
|
+
* @param {string} _chemin
|
|
303
|
+
* @param {string} racine
|
|
304
|
+
* @returns {NodeJS.ProcessEnv}
|
|
305
|
+
*/
|
|
306
|
+
export function envDArbre(_chemin, racine) {
|
|
307
|
+
const cible = cibleDeCompilation(racine, process.env, { creer: false });
|
|
308
|
+
return {
|
|
309
|
+
...(process.env.CARGO_TARGET_DIR || cible.CARGO_TARGET_DIR
|
|
310
|
+
? cible
|
|
311
|
+
: { CARGO_TARGET_DIR: path.join(racine, 'target') }),
|
|
312
|
+
[COPIE_DE_L_ARBRE]: racine,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* The names of the tests of HEAD's version of the test file <chemin> (from the root <racine>),
|
|
318
|
+
* read without playing them, for a file whose tree the proof does not play: a unit test file of
|
|
319
|
+
* `src/` (`tests.rs`, a file of a folder `tests/` under `src/`, out of `src/bin/`) and a target
|
|
320
|
+
* `tests/<dossier>/main.rs` (./tests-de-head.mjs), and a target `tests/<nom>.rs`, whose tree the
|
|
321
|
+
* proof plays unless it no longer compiles (grillhouse-3e2.2): its names as nextest gives them,
|
|
322
|
+
* without the target, its out-of-line modules read (`mod common;`, `common::<fn>`). <lire> gives
|
|
323
|
+
* HEAD's text of a file from the root. Null for any other file, or one HEAD does not hold.
|
|
324
|
+
* @param {string} chemin
|
|
325
|
+
* @param {string} racine
|
|
326
|
+
* @param {(f: string) => string | null} lire
|
|
327
|
+
*/
|
|
328
|
+
export function testsDeHead(chemin, racine, lire) {
|
|
329
|
+
const abs = path.resolve(racine, chemin);
|
|
330
|
+
const c = composantDans(
|
|
331
|
+
crates(racine).map(x => x.composant),
|
|
332
|
+
racine,
|
|
333
|
+
abs
|
|
334
|
+
);
|
|
335
|
+
if (!c || !chemin.endsWith('.rs')) {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
const parts = path.relative(c.dossier, abs).split(path.sep);
|
|
339
|
+
if (parts.length === 3 && parts[0] === 'tests' && parts[2] === 'main.rs') {
|
|
340
|
+
return nomsDeHead(chemin, null, lire);
|
|
341
|
+
}
|
|
342
|
+
if (arbreDAvant(chemin, racine)) {
|
|
343
|
+
return nomsDeHead(chemin, null, lire);
|
|
344
|
+
}
|
|
345
|
+
if (!unitaire(parts) || parts[1] === 'bin') {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
const module = parts.slice(1);
|
|
349
|
+
module[module.length - 1] = module[module.length - 1].replace(/\.rs$/, '');
|
|
350
|
+
if (module.at(-1) === 'mod') {
|
|
351
|
+
module.pop();
|
|
352
|
+
}
|
|
353
|
+
return nomsDeHead(chemin, module, lire);
|
|
354
|
+
}
|
|
355
|
+
|
|
253
356
|
// The tables of a manifest that declare what its tests depend on.
|
|
254
357
|
const DES_TESTS = 'dev-dependencies';
|
|
255
358
|
|
|
@@ -420,3 +523,84 @@ function horsDesTests(chemin, racine, avant, apres) {
|
|
|
420
523
|
|
|
421
524
|
/** What the testwriter writes of the manifests (scripts/jointure.d.ts, `manifestes`). */
|
|
422
525
|
export const manifestes = { verrous: ['Cargo.lock'], horsDesTests };
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* The name a Cargo.toml <texte> gives its package: the `name` of its `[package]`; null for none.
|
|
529
|
+
* @param {string} texte
|
|
530
|
+
*/
|
|
531
|
+
export function nomDuManifeste(texte) {
|
|
532
|
+
let section = null;
|
|
533
|
+
for (const l of texte.split('\n')) {
|
|
534
|
+
const s = /^\s*\[([^\]]+)\]\s*(?:#.*)?$/.exec(l);
|
|
535
|
+
if (s) {
|
|
536
|
+
section = s[1].trim();
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
const n = /^\s*name\s*=\s*["']([^"']+)["']/.exec(l);
|
|
540
|
+
if (section === 'package' && n) {
|
|
541
|
+
return n[1];
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
const TABLES = ['dependencies', 'dev-dependencies', 'build-dependencies'];
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* The absolute path of the binary <sortie> of the crate at <chemin> (from the root of the workspace
|
|
551
|
+
* at <racine>): a target of kind `bin` of `cargo metadata`, in its target directory, under
|
|
552
|
+
* `release` or `debug`. Throws, named, for a folder that holds no crate and for a crate without
|
|
553
|
+
* that binary.
|
|
554
|
+
* @param {string} racine
|
|
555
|
+
* @param {string} chemin
|
|
556
|
+
* @param {string} sortie
|
|
557
|
+
* @param {{ release?: boolean }} [o]
|
|
558
|
+
*/
|
|
559
|
+
export function sortieDuPaquet(racine, chemin, sortie, { release = false } = {}) {
|
|
560
|
+
const m = metadonnees(racine);
|
|
561
|
+
const crate = m?.packages.find(
|
|
562
|
+
p => path.relative(m.workspace_root, path.dirname(p.manifest_path)) === path.normalize(chemin)
|
|
563
|
+
);
|
|
564
|
+
if (!crate) {
|
|
565
|
+
throw new Error(`${chemin} ne tient aucun crate du dépôt.`);
|
|
566
|
+
}
|
|
567
|
+
const binaires = crate.targets.filter(t => t.kind.includes('bin')).map(t => t.name);
|
|
568
|
+
if (!binaires.includes(sortie)) {
|
|
569
|
+
throw new Error(
|
|
570
|
+
`le crate ${crate.name} ne produit pas de binaire « ${sortie} » (ses binaires : ${binaires.join(', ') || 'aucun'}).`
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
return path.join(m.target_directory, release ? 'release' : 'debug', sortie);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* The internal dependencies of the crate at <chemin> (from <racine>): each dependency with a
|
|
578
|
+
* `path` (in `[dependencies]`, `[dev-dependencies]`, `[build-dependencies]` and the same under
|
|
579
|
+
* `[target.*]`; a `workspace = true` one takes the `path` of `[workspace.dependencies]` of the
|
|
580
|
+
* root Cargo.toml), named by <nomA> of the folder at that path, else by its key.
|
|
581
|
+
* @param {string} racine
|
|
582
|
+
* @param {string} chemin
|
|
583
|
+
* @param {(dossier: string) => string | null} nomA
|
|
584
|
+
*/
|
|
585
|
+
export function liensDuManifeste(racine, chemin, nomA) {
|
|
586
|
+
const { parse } = require('smol-toml');
|
|
587
|
+
const lire = f => (existsSync(f) ? parse(readFileSync(f, 'utf8')) : null);
|
|
588
|
+
const dossier = path.join(racine, chemin);
|
|
589
|
+
const m = lire(path.join(dossier, 'Cargo.toml')) ?? {};
|
|
590
|
+
const communes = lire(path.join(racine, 'Cargo.toml'))?.workspace?.dependencies ?? {};
|
|
591
|
+
const noms = new Set();
|
|
592
|
+
const tables = [
|
|
593
|
+
...TABLES.map(t => m[t]),
|
|
594
|
+
...Object.values(m.target ?? {}).flatMap(c => TABLES.map(t => c?.[t])),
|
|
595
|
+
];
|
|
596
|
+
for (const table of tables) {
|
|
597
|
+
for (const [cle, spec] of Object.entries(table ?? {})) {
|
|
598
|
+
const commune = spec?.workspace === true;
|
|
599
|
+
const lien = commune ? communes[cle]?.path : spec?.path;
|
|
600
|
+
if (typeof lien === 'string') {
|
|
601
|
+
noms.add(nomA(path.resolve(commune ? racine : dossier, lien)) ?? cle);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return { noms: [...noms], table: 'path', outil: 'cargo' };
|
|
606
|
+
}
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
// `ws-outil`, which depends on `ws-app` for its tests (`dev`) and on `ws-core` for its build
|
|
9
9
|
// script (`build`); `ws-matiere`, the shared test material (`[package.metadata.grillhouse]
|
|
10
10
|
// matiere = true`); the interfaces of `ws-core`, of `ws-app` and of the root, and the index of the
|
|
11
|
-
// interfaces they give, up to date (grillhouse-pkl.6). Committed: `espace`; the same
|
|
12
|
-
// out of every crate added: `change`, measured from its commit; the same with a second commit
|
|
11
|
+
// interfaces they give, up to date (grillhouse-pkl.6). Committed: `espace`; the same with a second commit
|
|
13
12
|
// that changes `ws-core`, adds the crate `ws-neuf` and removes `ws-outil`: `lot`; the same, the
|
|
14
13
|
// interface of `ws-core` then changed, its index late: `enRetard`.
|
|
15
14
|
// - Each workspace commits its Cargo.lock, the one cargo writes (grillhouse-rph): the commands
|
|
@@ -124,6 +123,12 @@ function espace(dans) {
|
|
|
124
123
|
ecrire('Cargo.lock', verrou(Object.entries(DEPENDANCES)));
|
|
125
124
|
ecrire('.gitignore', '/target\n');
|
|
126
125
|
ecrire('README.md', "# L'espace d'essai\n");
|
|
126
|
+
ecrire(
|
|
127
|
+
'docs/ARCHITECTURE.md',
|
|
128
|
+
`# Architecture\n\n| Composant | Langage |\n| --- | --- |\n${Object.keys(CRATES)
|
|
129
|
+
.map(n => `| \`crates/${n}\` | cargo |\n`)
|
|
130
|
+
.join('')}`
|
|
131
|
+
);
|
|
127
132
|
for (const [n, m] of Object.entries(CRATES)) {
|
|
128
133
|
ecrire(`crates/${n}/Cargo.toml`, m);
|
|
129
134
|
ecrire(`crates/${n}/src/lib.rs`, `pub fn ${n}() -> i32 {\n 1\n}\n`);
|
|
@@ -196,6 +201,37 @@ function resultats(dans, taches, rapports, cibles) {
|
|
|
196
201
|
return dossier;
|
|
197
202
|
}
|
|
198
203
|
|
|
204
|
+
// HEAD's text of a unit test file of `src/`: two tests, one in an inline module, and braces and
|
|
205
|
+
// a false test in a comment, a raw string and a character, which are not counted.
|
|
206
|
+
const UNITAIRE = [
|
|
207
|
+
'use super::*;',
|
|
208
|
+
'// fn faux() { #[test]',
|
|
209
|
+
'#[test]',
|
|
210
|
+
'fn ancien() {',
|
|
211
|
+
' let _ = r#"{ #[test] fn dans_la_chaine() {} "#;',
|
|
212
|
+
" let _ = '{';",
|
|
213
|
+
'}',
|
|
214
|
+
'/* } #[test] fn commentee() {} */',
|
|
215
|
+
'mod groupe {',
|
|
216
|
+
' #[test]',
|
|
217
|
+
' #[ignore]',
|
|
218
|
+
' fn interne() {}',
|
|
219
|
+
'}',
|
|
220
|
+
'',
|
|
221
|
+
].join('\n');
|
|
222
|
+
// HEAD's text of a target `tests/<dossier>/main.rs`: a test, one under `#[tokio::test]` in an
|
|
223
|
+
// inline module, and an out-of-line module `aide`.
|
|
224
|
+
const PRINCIPAL = [
|
|
225
|
+
'mod aide;',
|
|
226
|
+
'#[test]',
|
|
227
|
+
'fn principal() {}',
|
|
228
|
+
'mod m {',
|
|
229
|
+
' #[tokio::test]',
|
|
230
|
+
' async fn dedans() {}',
|
|
231
|
+
'}',
|
|
232
|
+
'',
|
|
233
|
+
].join('\n');
|
|
234
|
+
|
|
199
235
|
export default {
|
|
200
236
|
// The trials under <dans>.
|
|
201
237
|
preparer(dans) {
|
|
@@ -214,13 +250,6 @@ export default {
|
|
|
214
250
|
'crates/aide/Cargo.toml': manifeste('aide'),
|
|
215
251
|
'crates/aide/src/lib.rs': 'pub fn aide() {}\n',
|
|
216
252
|
});
|
|
217
|
-
const change = espace(dans);
|
|
218
|
-
const depuis = tete(change);
|
|
219
|
-
writeFileSync(
|
|
220
|
-
path.join(change, 'crates/core/src/lib.rs'),
|
|
221
|
-
'pub fn core() -> i32 {\n 2\n}\n'
|
|
222
|
-
);
|
|
223
|
-
writeFileSync(path.join(change, 'notes.txt'), 'hors des crates\n');
|
|
224
253
|
const lot = espace(dans);
|
|
225
254
|
const avantLeLot = tete(lot);
|
|
226
255
|
const ecrireLot = ecrireDans(lot);
|
|
@@ -252,8 +281,6 @@ export default {
|
|
|
252
281
|
espace: aJour,
|
|
253
282
|
seul,
|
|
254
283
|
imbrique,
|
|
255
|
-
change,
|
|
256
|
-
depuis,
|
|
257
284
|
lot,
|
|
258
285
|
avantLeLot,
|
|
259
286
|
enRetard,
|
|
@@ -288,11 +315,6 @@ export default {
|
|
|
288
315
|
'ws-absent : sans fournisseur',
|
|
289
316
|
],
|
|
290
317
|
},
|
|
291
|
-
touches: {
|
|
292
|
-
valide: { racine: aJour, depuis: 'HEAD' },
|
|
293
|
-
invalide: { racine: change, depuis },
|
|
294
|
-
attendu: ['touché ws-core', 'dépendant ws-app', 'dépendant ws-outil', 'hors notes.txt'],
|
|
295
|
-
},
|
|
296
318
|
commandes: {
|
|
297
319
|
valide: ['tester', 'verifier', 'typer', 'preparer'],
|
|
298
320
|
invalide: ['tester', 'deployer'],
|
|
@@ -343,12 +365,48 @@ export default {
|
|
|
343
365
|
'crates/matiere/src/lib.rs : matiere',
|
|
344
366
|
],
|
|
345
367
|
},
|
|
368
|
+
versionDeHead: {
|
|
369
|
+
valide: [
|
|
370
|
+
'crates/core/src/lib.rs',
|
|
371
|
+
'crates/core/src/tests.rs',
|
|
372
|
+
'crates/core/tests/common/mod.rs',
|
|
373
|
+
'crates/core/tests/scenario/main.rs',
|
|
374
|
+
'Cargo.toml',
|
|
375
|
+
],
|
|
376
|
+
// A target, a night test and a bench play in a tree, under their own name.
|
|
377
|
+
invalide: [
|
|
378
|
+
'crates/core/tests/t.rs',
|
|
379
|
+
'crates/core/tests/t_nuit.rs',
|
|
380
|
+
'crates/core/tests/t_budget.rs',
|
|
381
|
+
// A unit test of `src/` and a target `tests/<dossier>/main.rs` have no tree: the
|
|
382
|
+
// names of HEAD's tests are read, as nextest reports them (its module path), the
|
|
383
|
+
// braces of a comment, a string or a character not counted, a `mod` of main.rs read.
|
|
384
|
+
{
|
|
385
|
+
chemin: 'crates/core/src/rendu/tests.rs',
|
|
386
|
+
textes: { 'crates/core/src/rendu/tests.rs': UNITAIRE },
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
chemin: 'crates/core/tests/scenario/main.rs',
|
|
390
|
+
textes: {
|
|
391
|
+
'crates/core/tests/scenario/main.rs': PRINCIPAL,
|
|
392
|
+
'crates/core/tests/scenario/aide.rs': '#[test]\nfn aidant() {}\n',
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
],
|
|
396
|
+
attendu: [
|
|
397
|
+
'crates/core/tests/t.rs → un arbre',
|
|
398
|
+
'crates/core/tests/t_nuit.rs → un arbre',
|
|
399
|
+
'crates/core/tests/t_budget.rs → un arbre',
|
|
400
|
+
'crates/core/src/rendu/tests.rs : rendu::tests::ancien, rendu::tests::groupe::interne',
|
|
401
|
+
'crates/core/tests/scenario/main.rs : principal, m::dedans, aide::aidant',
|
|
402
|
+
],
|
|
403
|
+
},
|
|
346
404
|
fichiersEngendres: {
|
|
347
405
|
valide: aJour,
|
|
348
406
|
invalide: enRetard,
|
|
349
407
|
attendu: ["l'index des interfaces : en retard"],
|
|
350
408
|
},
|
|
351
|
-
gardes: { valide: ['clippy', 'frontieres', 'index-interfaces'] },
|
|
409
|
+
gardes: { valide: ['tailles-des-tests', 'clippy', 'frontieres', 'index-interfaces'] },
|
|
352
410
|
elementsDuLot: {
|
|
353
411
|
valide: { racine: aJour, avant: 'HEAD', apres: 'HEAD' },
|
|
354
412
|
invalide: { racine: lot, avant: avantLeLot, apres: 'HEAD' },
|
|
@@ -15,41 +15,51 @@
|
|
|
15
15
|
// - The components, a file's, the shared test material, the components that play tests, the
|
|
16
16
|
// readers of a crate, the rule of a test file and what the testwriter writes of the manifests
|
|
17
17
|
// (./composants.mjs).
|
|
18
|
-
// - The crates touched since a commit and their dependents (./touches.mjs).
|
|
19
18
|
// - The elements of a lot, one per crate (./elements-du-lot.mjs).
|
|
20
|
-
// - The commands `tester
|
|
21
|
-
//
|
|
19
|
+
// - The commands `tester` (the crates' tasks of Turborepo), `tests-du-paquet` (the body of a crate's
|
|
20
|
+
// task), `verifier`, `typer`, `preparer` and `tests-de-nuit` (./commandes.mjs),
|
|
21
|
+
// each described, `{ script, args }`, never run, `preparer` played by the integration before the
|
|
22
|
+
// verification, `tests-de-nuit` by the night (the test targets `tests/*_nuit.rs`, then the time
|
|
23
|
+
// budget benches `tests/*_budget.rs`, which the day leaves out);
|
|
22
24
|
// the verdict of a run (./verdict.mjs). The tool of a test's temporary directory, the crate
|
|
23
|
-
// `tempfile`, and its guard: `
|
|
25
|
+
// `tempfile`, and its guard: `tests-du-paquet` and `verifier` play under a base of their pass, named in
|
|
24
26
|
// TMPDIR, TMP and TEMP, and fail naming what the tests left there (./commandes.mjs).
|
|
25
27
|
// - The generated file, the index of the interfaces (./index-interfaces.mjs), its command and its
|
|
26
|
-
// check; the guards of structure, in the order they play:
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
28
|
+
// check; the guards of structure, in the order they play: the sizes of the tests
|
|
29
|
+
// (./tailles-des-tests.mjs), clippy (./clippy.mjs), the boundaries between crates
|
|
30
|
+
// (./frontieres.mjs), the index of the interfaces up to date, each a command by its name too
|
|
31
|
+
// (./commandes.mjs), which the line of a red guard names; the entries of the index of each
|
|
32
|
+
// interface (`entreesDeLIndex`), which the core assembles in a project of several languages.
|
|
33
|
+
// - Its migrations (./migrations/): 0.28.4, the large tests of the day a project holds inscribed
|
|
34
|
+
// in its debt when the guard of the sizes arrives.
|
|
31
35
|
// - Its share of the update (./mise-a-jour.mjs, `miseAJour`): the template of a project of cargo
|
|
32
36
|
// (`templates/cargo/`) and its test scripts.
|
|
33
37
|
// - The skeleton of a new crate (./squelette.mjs, `squelette`), which `grillhouse paquet` writes.
|
|
34
38
|
import { readFileSync } from 'node:fs';
|
|
35
39
|
import path from 'node:path';
|
|
36
40
|
import { fileURLToPath } from 'node:url';
|
|
37
|
-
import { commandes, GARDES } from './commandes.mjs';
|
|
41
|
+
import { commandes, fichierHorsDuJour, GARDES } from './commandes.mjs';
|
|
38
42
|
import {
|
|
39
43
|
composantDans,
|
|
40
44
|
composants,
|
|
41
45
|
estUnTest,
|
|
46
|
+
arbreDAvant,
|
|
47
|
+
envDArbre,
|
|
48
|
+
testsDeHead,
|
|
42
49
|
joueDesTests,
|
|
43
50
|
lecteurs,
|
|
51
|
+
liensDuManifeste,
|
|
44
52
|
manifestes,
|
|
45
53
|
matieres,
|
|
54
|
+
nomDuManifeste,
|
|
55
|
+
sortieDuPaquet,
|
|
46
56
|
} from './composants.mjs';
|
|
47
57
|
import { elementsDuLot } from './elements-du-lot.mjs';
|
|
48
58
|
import { enRetard, entreesDeLIndex, SORTIE } from './index-interfaces.mjs';
|
|
49
59
|
import { miseAJour } from './mise-a-jour.mjs';
|
|
60
|
+
import * as taillesDesTests from './migrations/0.28.4-tailles-des-tests.mjs';
|
|
50
61
|
import { squelette } from './squelette.mjs';
|
|
51
62
|
import { CACHE, CIBLES } from './sccache.mjs';
|
|
52
|
-
import { touches } from './touches.mjs';
|
|
53
63
|
import { verdict } from './verdict.mjs';
|
|
54
64
|
|
|
55
65
|
// The scripts of this module, beside this file.
|
|
@@ -58,6 +68,12 @@ const ici = nom => path.join(path.dirname(fileURLToPath(import.meta.url)), nom);
|
|
|
58
68
|
export default {
|
|
59
69
|
nom: 'cargo',
|
|
60
70
|
manifeste: 'Cargo.toml',
|
|
71
|
+
nomDuManifeste,
|
|
72
|
+
liensDuManifeste,
|
|
73
|
+
sortieDuPaquet,
|
|
74
|
+
construireLesPaquets: () => {
|
|
75
|
+
throw new Error('construction non prise en charge pour cargo');
|
|
76
|
+
},
|
|
61
77
|
// The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`).
|
|
62
78
|
outils: ['smol-toml'],
|
|
63
79
|
// The binaries the module runs, each at an exact version: nextest and cargo-deny at the ones the
|
|
@@ -103,11 +119,14 @@ export default {
|
|
|
103
119
|
matieres,
|
|
104
120
|
joueDesTests,
|
|
105
121
|
lecteurs,
|
|
106
|
-
touches,
|
|
107
122
|
elementsDuLot,
|
|
108
123
|
commandes,
|
|
109
124
|
verdict,
|
|
110
125
|
estUnTest,
|
|
126
|
+
horsDuJour: fichierHorsDuJour,
|
|
127
|
+
arbreDAvant,
|
|
128
|
+
envDArbre,
|
|
129
|
+
testsDeHead,
|
|
111
130
|
manifestes,
|
|
112
131
|
fichiersEngendres: () => [
|
|
113
132
|
{
|
|
@@ -122,7 +141,7 @@ export default {
|
|
|
122
141
|
],
|
|
123
142
|
entreesDeLIndex,
|
|
124
143
|
gardes: () => GARDES.map(({ script, args }) => [script, ...args]),
|
|
125
|
-
migrations: [],
|
|
144
|
+
migrations: [taillesDesTests],
|
|
126
145
|
miseAJour,
|
|
127
146
|
squelette,
|
|
128
147
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// From 0.28.4 the guard of the sizes of the tests in Rust (scripts/langages/cargo/tailles-des-tests.mjs)
|
|
2
|
+
// refuses a large test of the day, one that mounts a trial repository and starts the product
|
|
3
|
+
// there, as the module typescript's guard does since 0.25.0. A project of cargo that updates may
|
|
4
|
+
// hold such tests already (SyntHub, OSC Bridge), and its main would turn red at its next pass. As
|
|
5
|
+
// the module typescript's migration (../../typescript/migrations/0.25.0-tailles-des-tests.mjs) and
|
|
6
|
+
// ESLint's `--suppress-all` do once at the passage of a rule, the update inscribes them as the
|
|
7
|
+
// project's known debt (scripts/dette.mjs), frozen: the count never rises, a new large test of the
|
|
8
|
+
// day is refused, and its verification does not change that day.
|
|
9
|
+
//
|
|
10
|
+
// - The migration writes the section of the guard in `grillhouse-dette.json` when the guard finds a
|
|
11
|
+
// large test of the day and the file holds no section of it yet; the rest of the debt stays.
|
|
12
|
+
// - It rewrites no test of the project: the project moves each one to the night
|
|
13
|
+
// (`tests/<nom>_nuit.rs`) or reduces it, and the debt comes down with it.
|
|
14
|
+
// - Replayable without effect: once the section is written, nothing (a debt lowered since never
|
|
15
|
+
// rises again).
|
|
16
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
17
|
+
import { GARDE, verifier } from '../tailles-des-tests.mjs';
|
|
18
|
+
|
|
19
|
+
export const version = '0.28.4';
|
|
20
|
+
export const nom = 'tailles des tests';
|
|
21
|
+
|
|
22
|
+
/** Inscribes the large tests of the day of the project at <projet> in its debt; what it did. */
|
|
23
|
+
export function migrer(projet) {
|
|
24
|
+
if (lire(projet)[GARDE]) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const constats = verifier(projet);
|
|
28
|
+
if (constats.length === 0) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
32
|
+
return [
|
|
33
|
+
`${FICHIER} : ${constats.length} grand(s) test(s) de jour inscrit(s) dans la dette de ${GARDE}, gelée ; un grand test de jour neuf est refusé, et chacun passe à la nuit (tests/<nom>_nuit.rs) ou se réduit`,
|
|
34
|
+
];
|
|
35
|
+
}
|
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
// (`cacheDeLaRacine`), swept once the root is gone, as Bazel keeps its output_base under
|
|
11
11
|
// ~/.cache and never on a disk in memory; a `CARGO_TARGET_DIR` already set stays
|
|
12
12
|
// (`cibleDeCompilation`).
|
|
13
|
+
// - Cargo compiles without incremental compilation (`CARGO_INCREMENTAL=0`), as the CI of Rust and
|
|
14
|
+
// the usual continuous integrations do: a copy of a ticket compiles once and seldom again, and
|
|
15
|
+
// its `target/debug/incremental` held up to 1.1 GB of a target of 5.0 GB (SyntHub, SH-ae6.2.7,
|
|
16
|
+
// grillhouse-k5y); sccache caches no incremental compilation either. Whoever decides it keeps
|
|
17
|
+
// it, as cargo reads it, which lets each of them override every profile: the caller, by
|
|
18
|
+
// `CARGO_INCREMENTAL` (an agent or a person who debugs, `CARGO_INCREMENTAL=1`),
|
|
19
|
+
// `CARGO_BUILD_INCREMENTAL` or a `CARGO_PROFILE_<nom>_INCREMENTAL` of the environment; the
|
|
20
|
+
// project, by `incremental` in a `[profile.*]` of its Cargo.toml, or `build.incremental` or a
|
|
21
|
+
// profile of a `.cargo/config.toml` from the project up to the root, then of `$CARGO_HOME`. The
|
|
22
|
+
// frame writes no other setting of a profile.
|
|
13
23
|
// Every command of the module that compiles (tests, verification, typing, clippy) runs cargo
|
|
14
24
|
// under this environment, in a copy as in an agent's envelope.
|
|
15
25
|
//
|
|
@@ -39,11 +49,16 @@
|
|
|
39
49
|
// error of cargo that cannot run its wrapper.
|
|
40
50
|
import { spawnSync } from 'node:child_process';
|
|
41
51
|
import { createHash } from 'node:crypto';
|
|
42
|
-
import {
|
|
52
|
+
import { readFileSync, readlinkSync, realpathSync } from 'node:fs';
|
|
43
53
|
import { createRequire } from 'node:module';
|
|
44
54
|
import { homedir } from 'node:os';
|
|
45
55
|
import path from 'node:path';
|
|
46
|
-
import {
|
|
56
|
+
import {
|
|
57
|
+
cacheDeCompilation,
|
|
58
|
+
cacheDeLaRacine,
|
|
59
|
+
dansLeTemporaire,
|
|
60
|
+
trouverDansLePath,
|
|
61
|
+
} from '../../services-du-noyau.mjs';
|
|
47
62
|
|
|
48
63
|
// The loader of smol-toml, an optional peer of the package, a tool of this module.
|
|
49
64
|
const require = createRequire(import.meta.url);
|
|
@@ -130,18 +145,7 @@ export function sccacheAbsent(racine, env) {
|
|
|
130
145
|
if (lanceurDuProjet(racine, env)) {
|
|
131
146
|
return null;
|
|
132
147
|
}
|
|
133
|
-
|
|
134
|
-
.split(path.delimiter)
|
|
135
|
-
.filter(Boolean)
|
|
136
|
-
.some(d => {
|
|
137
|
-
try {
|
|
138
|
-
accessSync(path.join(d, 'sccache'), constants.X_OK);
|
|
139
|
-
return true;
|
|
140
|
-
} catch {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
return present
|
|
148
|
+
return trouverDansLePath('sccache', env)
|
|
145
149
|
? null
|
|
146
150
|
: "⛔ sccache absent du PATH : cargo compile à travers lui (RUSTC_WRAPPER=sccache) ; `npx grillhouse maj` l'installe avec les autres binaires du module cargo.";
|
|
147
151
|
}
|
|
@@ -180,16 +184,58 @@ export function cibleDeCompilation(racine, env, { creer = true } = {}) {
|
|
|
180
184
|
return { CARGO_TARGET_DIR: cacheDeLaRacine('cargo', racine, env, { creer }) };
|
|
181
185
|
}
|
|
182
186
|
|
|
187
|
+
// Whether a TOML document <toml> sets `incremental` in one of its profiles (`[profile.<nom>]`),
|
|
188
|
+
// or, with <build>, in its `[build]` table.
|
|
189
|
+
const poseLIncremental = (toml, build) =>
|
|
190
|
+
Object.values(toml?.profile ?? {}).some(p => p && Object.hasOwn(p, 'incremental')) ||
|
|
191
|
+
(build && Object.hasOwn(toml?.build ?? {}, 'incremental'));
|
|
192
|
+
|
|
193
|
+
// Whether the caller or the project at <racine> under <env> decides incremental compilation, as
|
|
194
|
+
// cargo reads it (see the header): the environment (`CARGO_INCREMENTAL`, `CARGO_BUILD_INCREMENTAL`,
|
|
195
|
+
// a `CARGO_PROFILE_<nom>_INCREMENTAL`), the profiles of the Cargo.toml at <racine>, then
|
|
196
|
+
// `build.incremental` and the profiles of each `.cargo/config.toml` (or `.cargo/config`).
|
|
197
|
+
function incrementalDecide(racine, env) {
|
|
198
|
+
if (
|
|
199
|
+
Object.keys(env).some(
|
|
200
|
+
k =>
|
|
201
|
+
k === 'CARGO_INCREMENTAL' ||
|
|
202
|
+
k === 'CARGO_BUILD_INCREMENTAL' ||
|
|
203
|
+
/^CARGO_PROFILE_\w+_INCREMENTAL$/.test(k)
|
|
204
|
+
)
|
|
205
|
+
) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
const { parse } = require('smol-toml');
|
|
209
|
+
const lu = f => {
|
|
210
|
+
try {
|
|
211
|
+
return parse(readFileSync(f, 'utf8'));
|
|
212
|
+
} catch {
|
|
213
|
+
// An absent or unreadable file decides nothing.
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
if (poseLIncremental(lu(path.join(racine, 'Cargo.toml')), false)) {
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
return dossiersDeConfiguration(racine, env).some(d =>
|
|
221
|
+
['config.toml', 'config'].some(nom => poseLIncremental(lu(path.join(d, nom)), true))
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
183
225
|
/**
|
|
184
226
|
* <env> with rustc wrapped by sccache for the copy at <racine>, its cache the home's, its server
|
|
185
227
|
* the copy's, its target out of the temporary directory (`cibleDeCompilation`); without sccache
|
|
186
|
-
* when the project sets its own wrapper.
|
|
228
|
+
* when the project sets its own wrapper. Incremental compilation is off (`CARGO_INCREMENTAL=0`)
|
|
229
|
+
* unless the caller or the project decides it (`incrementalDecide`).
|
|
187
230
|
* @param {string} racine
|
|
188
231
|
* @param {NodeJS.ProcessEnv} env
|
|
189
232
|
* @returns {NodeJS.ProcessEnv}
|
|
190
233
|
*/
|
|
191
234
|
export function avecSccache(racine, env) {
|
|
192
|
-
const cible =
|
|
235
|
+
const cible = {
|
|
236
|
+
...cibleDeCompilation(racine, env),
|
|
237
|
+
...(incrementalDecide(racine, env) ? {} : { CARGO_INCREMENTAL: '0' }),
|
|
238
|
+
};
|
|
193
239
|
if (lanceurDuProjet(racine, env)) {
|
|
194
240
|
return { ...env, ...cible };
|
|
195
241
|
}
|