@invarn/cibuild 2.7.5 → 2.7.6

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 (22) hide show
  1. package/dist/cli.cjs +10 -10
  2. package/dist/src/commands/a-credential-target-follows-the-flavor-source-set.test.js +9 -6
  3. package/dist/src/commands/a-credential-two-workflows-cannot-share-is-declared-per-workflow.test.js +71 -38
  4. package/dist/src/commands/an-already-stored-value-does-not-answer-the-target-question.test.d.ts +29 -0
  5. package/dist/src/commands/an-already-stored-value-does-not-answer-the-target-question.test.d.ts.map +1 -0
  6. package/dist/src/commands/an-already-stored-value-does-not-answer-the-target-question.test.js +160 -0
  7. package/dist/src/commands/android-scanner.d.ts +9 -1
  8. package/dist/src/commands/android-scanner.d.ts.map +1 -1
  9. package/dist/src/commands/android-scanner.js +103 -3
  10. package/dist/src/commands/build.d.ts +16 -12
  11. package/dist/src/commands/build.d.ts.map +1 -1
  12. package/dist/src/commands/build.js +64 -45
  13. package/dist/src/commands/file-secret-collector.d.ts.map +1 -1
  14. package/dist/src/commands/file-secret-collector.js +24 -7
  15. package/dist/src/commands/flavors-a-convention-plugin-creates-are-still-found.test.d.ts +38 -0
  16. package/dist/src/commands/flavors-a-convention-plugin-creates-are-still-found.test.d.ts.map +1 -0
  17. package/dist/src/commands/flavors-a-convention-plugin-creates-are-still-found.test.js +300 -0
  18. package/dist/src/yaml/steps/cocoapods-install-emits-valid-bash.test.d.ts +22 -0
  19. package/dist/src/yaml/steps/cocoapods-install-emits-valid-bash.test.d.ts.map +1 -0
  20. package/dist/src/yaml/steps/cocoapods-install-emits-valid-bash.test.js +97 -0
  21. package/dist/src/yaml/steps/ios-deps.js +1 -1
  22. package/package.json +1 -1
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Every way of telling `cocoapods-install` where to look must emit shell that
3
+ * bash will actually parse.
4
+ *
5
+ * `podfile_path` did not. One stray quote —
6
+ *
7
+ * WORK_DIR="$(dirname '/path/to/Podfile')""
8
+ *
9
+ * — opened a double-quoted string that never closed, so bash swallowed the
10
+ * following line and died with `unexpected EOF while looking for matching '"'`.
11
+ * The input is documented in SPEC.md and in `steps/cocoapods-install.yml`, and
12
+ * it could never have worked. Nothing in Invarn's templates passes it, which is
13
+ * why no build ever reported it.
14
+ *
15
+ * No string assertion could have caught this, and the existing tests for the
16
+ * input asserted only that the rendered script *mentioned* the path. So this
17
+ * file parses the script instead of reading it, and it does so for **all four**
18
+ * working-directory branches rather than the one that was broken — the bug was
19
+ * in a branch nobody exercised, and the next one will be too.
20
+ */
21
+ import { execFileSync } from 'node:child_process';
22
+ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
23
+ import { tmpdir } from 'node:os';
24
+ import { join } from 'node:path';
25
+ import { describe, test, expect } from '@jest/globals';
26
+ import { CocoapodsInstallStepExecutor } from './ios-deps.js';
27
+ import { testConfig } from './test-config.js';
28
+ const render = async (inputs) => {
29
+ const result = await new CocoapodsInstallStepExecutor().execute(inputs, {}, testConfig);
30
+ return result.script;
31
+ };
32
+ /** Throws with bash's own diagnostic if the script does not parse. */
33
+ const parses = (script) => {
34
+ const dir = mkdtempSync(join(tmpdir(), 'cibuild-pods-syntax-'));
35
+ const path = join(dir, 'step.sh');
36
+ writeFileSync(path, script);
37
+ try {
38
+ execFileSync('bash', ['-n', path], { stdio: 'pipe' });
39
+ }
40
+ finally {
41
+ rmSync(dir, { recursive: true, force: true });
42
+ }
43
+ };
44
+ // The precedence the step documents: podfile_path, source_root_path,
45
+ // project_path, then $CIBUILD_SOURCE_DIR. One case per branch.
46
+ const branches = [
47
+ ['podfile_path', { podfile_path: '/path/to/Podfile' }],
48
+ ['source_root_path', { source_root_path: 'ios' }],
49
+ ['project_path', { project_path: 'ios/MyApp.xcworkspace' }],
50
+ ['neither — falls back to CIBUILD_SOURCE_DIR', {}],
51
+ ];
52
+ describe('cocoapods-install emits bash that parses, on every path to a directory', () => {
53
+ for (const [name, inputs] of branches) {
54
+ test(name, async () => {
55
+ parses(await render(inputs));
56
+ });
57
+ }
58
+ // skip_if_absent rewrites the body of the `if [ ! -f "Podfile" ]` branch, so
59
+ // it is a second dimension over the same generated shell.
60
+ for (const [name, inputs] of branches) {
61
+ test(`${name}, with skip_if_absent`, async () => {
62
+ parses(await render({ ...inputs, skip_if_absent: true }));
63
+ });
64
+ }
65
+ test('pod update rather than install', async () => {
66
+ parses(await render({ source_root_path: 'ios', command: 'update' }));
67
+ });
68
+ test('a trailing flag on the command', async () => {
69
+ parses(await render({ project_path: 'ios/MyApp.xcodeproj', command: 'install --repo-update' }));
70
+ });
71
+ // A directory with a space in it is the case that makes quoting matter, and
72
+ // it is ordinary on iOS — "My App.xcworkspace".
73
+ test('a path containing a space', async () => {
74
+ parses(await render({ project_path: 'ios/My App.xcworkspace' }));
75
+ parses(await render({ podfile_path: '/Users/me/My Project/Podfile' }));
76
+ parses(await render({ source_root_path: 'My iOS Dir' }));
77
+ });
78
+ test('verbose logging', async () => {
79
+ parses(await render({ source_root_path: 'ios', verbose: true }));
80
+ });
81
+ });
82
+ describe('podfile_path still names the directory it was given', () => {
83
+ // Guarding the fix rather than only its syntax: the stray quote could have
84
+ // been "fixed" by deleting the line.
85
+ test('cds into the dirname of the Podfile', async () => {
86
+ const script = await render({ podfile_path: '/path/to/Podfile' });
87
+ expect(script).toContain(`WORK_DIR="$(dirname '/path/to/Podfile')"`);
88
+ expect(script).toContain('cd "$WORK_DIR"');
89
+ });
90
+ test('does not leave an unbalanced quote on the assignment', async () => {
91
+ const script = await render({ podfile_path: '/path/to/Podfile' });
92
+ const line = script.split('\n').find((l) => l.startsWith('WORK_DIR='));
93
+ expect(line).toBeDefined();
94
+ expect(line.split('"').length - 1).toBe(2);
95
+ });
96
+ });
97
+ //# sourceMappingURL=cocoapods-install-emits-valid-bash.test.js.map
@@ -29,7 +29,7 @@ export class CocoapodsInstallStepExecutor extends BaseStepExecutor {
29
29
  // Determine working directory
30
30
  if (podfilePath) {
31
31
  commands.push(`# Use directory from explicit Podfile path`);
32
- commands.push(`WORK_DIR="$(dirname '${this.escapeBash(podfilePath)}')""`);
32
+ commands.push(`WORK_DIR="$(dirname '${this.escapeBash(podfilePath)}')"`);
33
33
  commands.push(`cd "$WORK_DIR"`);
34
34
  }
35
35
  else if (sourceRootPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invarn/cibuild",
3
- "version": "2.7.5",
3
+ "version": "2.7.6",
4
4
  "description": "CI Build CLI — local pipeline orchestration and validation",
5
5
  "type": "module",
6
6
  "main": "dist/cli.cjs",