@git.zone/tsrust 1.13.2 → 1.15.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.
Files changed (48) hide show
  1. package/.smartconfig.json +4 -0
  2. package/assets/notices/gcc-gpl-3.0.txt +674 -0
  3. package/assets/notices/gcc-runtime-library-exception-3.1.txt +73 -0
  4. package/assets/notices/glibc-lgpl-2.1.txt +502 -0
  5. package/assets/notices/musl-copyright.txt +193 -0
  6. package/dist_ts/00_commitinfo_data.js +1 -1
  7. package/dist_ts/index.d.ts +1 -0
  8. package/dist_ts/index.js +2 -1
  9. package/dist_ts/mod_cli/classes.tsrustcli.d.ts +10 -0
  10. package/dist_ts/mod_cli/classes.tsrustcli.js +91 -11
  11. package/dist_ts/mod_cli/helpers.targets.d.ts +2 -0
  12. package/dist_ts/mod_cli/helpers.targets.js +1 -1
  13. package/dist_ts/mod_matrix/classes.nativematrixbuilder.d.ts +6 -0
  14. package/dist_ts/mod_matrix/classes.nativematrixbuilder.js +44 -1
  15. package/dist_ts/mod_notices/classes.nativenoticesgenerator.d.ts +102 -0
  16. package/dist_ts/mod_notices/classes.nativenoticesgenerator.js +946 -0
  17. package/dist_ts/mod_notices/classes.noticetoolchain.d.ts +30 -0
  18. package/dist_ts/mod_notices/classes.noticetoolchain.js +69 -0
  19. package/dist_ts/mod_notices/helpers.licensetext.d.ts +12 -0
  20. package/dist_ts/mod_notices/helpers.licensetext.js +81 -0
  21. package/dist_ts/mod_notices/helpers.muslversion.d.ts +6 -0
  22. package/dist_ts/mod_notices/helpers.muslversion.js +47 -0
  23. package/dist_ts/mod_notices/helpers.noticesconfig.d.ts +71 -0
  24. package/dist_ts/mod_notices/helpers.noticesconfig.js +133 -0
  25. package/dist_ts/mod_notices/helpers.runtimetexts.d.ts +9 -0
  26. package/dist_ts/mod_notices/helpers.runtimetexts.js +45 -0
  27. package/dist_ts/mod_notices/helpers.spdx.d.ts +21 -0
  28. package/dist_ts/mod_notices/helpers.spdx.js +88 -0
  29. package/dist_ts/mod_notices/helpers.staticglibc.d.ts +26 -0
  30. package/dist_ts/mod_notices/helpers.staticglibc.js +45 -0
  31. package/dist_ts/mod_notices/index.d.ts +8 -0
  32. package/dist_ts/mod_notices/index.js +9 -0
  33. package/package.json +5 -5
  34. package/readme.md +123 -13
  35. package/ts/00_commitinfo_data.ts +1 -1
  36. package/ts/index.ts +1 -0
  37. package/ts/mod_cli/classes.tsrustcli.ts +104 -10
  38. package/ts/mod_cli/helpers.targets.ts +2 -0
  39. package/ts/mod_matrix/classes.nativematrixbuilder.ts +44 -0
  40. package/ts/mod_notices/classes.nativenoticesgenerator.ts +1201 -0
  41. package/ts/mod_notices/classes.noticetoolchain.ts +92 -0
  42. package/ts/mod_notices/helpers.licensetext.ts +111 -0
  43. package/ts/mod_notices/helpers.muslversion.ts +46 -0
  44. package/ts/mod_notices/helpers.noticesconfig.ts +235 -0
  45. package/ts/mod_notices/helpers.runtimetexts.ts +63 -0
  46. package/ts/mod_notices/helpers.spdx.ts +107 -0
  47. package/ts/mod_notices/helpers.staticglibc.ts +79 -0
  48. package/ts/mod_notices/index.ts +8 -0
@@ -17,6 +17,7 @@ import {
17
17
  } from '../mod_provenance/index.js';
18
18
  import { ToolchainManager } from '../mod_toolchain/index.js';
19
19
  import { friendlyTargetName, type ITsrustConfig } from '../mod_cli/helpers.targets.js';
20
+ import { createProjectNoticesGenerator } from '../mod_notices/index.js';
20
21
  import { commitinfo } from '../00_commitinfo_data.js';
21
22
  import {
22
23
  MatrixCommandRunner,
@@ -157,6 +158,8 @@ export interface INativeMatrixBuilderOptions {
157
158
  config: ITsrustConfig;
158
159
  environment?: NodeJS.ProcessEnv;
159
160
  commandRunner?: IMatrixCommandRunner;
161
+ /** Verifies the native notices on the coordinator; defaults to `tsrust notices --check`. */
162
+ verifyNotices?: () => Promise<void>;
160
163
  }
161
164
 
162
165
  export interface INativeMatrixCheckResult {
@@ -221,9 +224,13 @@ export class NativeMatrixBuilder {
221
224
  private readonly environment: NodeJS.ProcessEnv;
222
225
  private readonly commandRunner: IMatrixCommandRunner;
223
226
  private readonly plan: IResolvedMatrixPlan;
227
+ private readonly config: ITsrustConfig;
228
+ private readonly verifyNoticesOverride?: () => Promise<void>;
224
229
 
225
230
  constructor(optionsArg: INativeMatrixBuilderOptions) {
226
231
  this.workspace = path.resolve(optionsArg.workspace);
232
+ this.config = optionsArg.config;
233
+ this.verifyNoticesOverride = optionsArg.verifyNotices;
227
234
  this.environment = { ...process.env, ...(optionsArg.environment || {}) };
228
235
  this.commandRunner =
229
236
  optionsArg.commandRunner || new MatrixCommandRunner(this.environment);
@@ -233,6 +240,7 @@ export class NativeMatrixBuilder {
233
240
 
234
241
  public async check(): Promise<INativeMatrixCheckResult> {
235
242
  await this.assertBundleCompatibleSource();
243
+ await this.verifyNotices();
236
244
  await this.commandRunner.execute('git', ['--version'], {
237
245
  cwd: this.workspace,
238
246
  capture: true,
@@ -1008,9 +1016,45 @@ export class NativeMatrixBuilder {
1008
1016
  'exec',
1009
1017
  'tsrust',
1010
1018
  ...workerArg.targets.flatMap((target) => ['--target', target.friendly]),
1019
+ // The coordinator verified the notices of this commit in check().
1020
+ ...(this.config.notices === undefined ? [] : ['--no-notices-check']),
1011
1021
  ];
1012
1022
  }
1013
1023
 
1024
+ /** Native notices are verified once, here on the coordinator, for all targets. */
1025
+ private async verifyNotices(): Promise<void> {
1026
+ if (this.config.notices === undefined) return;
1027
+ if (this.verifyNoticesOverride) {
1028
+ await this.verifyNoticesOverride();
1029
+ return;
1030
+ }
1031
+ let envPrefix = '';
1032
+ try {
1033
+ await this.commandRunner.execute('cargo', ['--version'], {
1034
+ cwd: this.workspace,
1035
+ capture: true,
1036
+ timeoutMs: capabilityCommandTimeoutMs,
1037
+ });
1038
+ } catch {
1039
+ // The check installs nothing: use the bundled toolchain only if present.
1040
+ const toolchainManager = new ToolchainManager();
1041
+ if (!(await toolchainManager.isInstalled())) {
1042
+ throw new Error('Native notices check needs a Rust toolchain on the coordinator; install rustup or run `tsrust notices`');
1043
+ }
1044
+ envPrefix = toolchainManager.getEnvPrefix();
1045
+ }
1046
+ const generator = await createProjectNoticesGenerator({
1047
+ projectDir: this.workspace,
1048
+ rustDir: await this.detectRustDirectory(),
1049
+ config: this.config,
1050
+ staticLinking: this.config.static === true,
1051
+ envPrefix,
1052
+ install: false,
1053
+ });
1054
+ const bundle = await generator.check();
1055
+ console.log(`Verified native notices: ${path.relative(this.workspace, bundle.directory)}`);
1056
+ }
1057
+
1014
1058
  private workerVerificationArgs(workerArg: IResolvedMatrixWorker): string[] {
1015
1059
  const bootstrap = "import { ToolchainManager } from './node_modules/@git.zone/tsrust/dist_ts/mod_toolchain/index.js'; await new ToolchainManager().ensureInstalled();";
1016
1060
  return [