xcodebuild-axi 0.1.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/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +304 -0
- package/dist/bin/xcodebuild-axi.d.ts +2 -0
- package/dist/bin/xcodebuild-axi.js +8 -0
- package/dist/bin/xcodebuild-axi.js.map +1 -0
- package/dist/src/action.d.ts +68 -0
- package/dist/src/action.js +373 -0
- package/dist/src/action.js.map +1 -0
- package/dist/src/archive.d.ts +33 -0
- package/dist/src/archive.js +77 -0
- package/dist/src/archive.js.map +1 -0
- package/dist/src/args.d.ts +23 -0
- package/dist/src/args.js +123 -0
- package/dist/src/args.js.map +1 -0
- package/dist/src/auth.d.ts +11 -0
- package/dist/src/auth.js +51 -0
- package/dist/src/auth.js.map +1 -0
- package/dist/src/cli.d.ts +20 -0
- package/dist/src/cli.js +132 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/analyze.d.ts +2 -0
- package/dist/src/commands/analyze.js +32 -0
- package/dist/src/commands/analyze.js.map +1 -0
- package/dist/src/commands/archive.d.ts +2 -0
- package/dist/src/commands/archive.js +63 -0
- package/dist/src/commands/archive.js.map +1 -0
- package/dist/src/commands/build.d.ts +2 -0
- package/dist/src/commands/build.js +60 -0
- package/dist/src/commands/build.js.map +1 -0
- package/dist/src/commands/clean.d.ts +2 -0
- package/dist/src/commands/clean.js +39 -0
- package/dist/src/commands/clean.js.map +1 -0
- package/dist/src/commands/coverage.d.ts +2 -0
- package/dist/src/commands/coverage.js +111 -0
- package/dist/src/commands/coverage.js.map +1 -0
- package/dist/src/commands/destinations.d.ts +2 -0
- package/dist/src/commands/destinations.js +56 -0
- package/dist/src/commands/destinations.js.map +1 -0
- package/dist/src/commands/export.d.ts +2 -0
- package/dist/src/commands/export.js +170 -0
- package/dist/src/commands/export.js.map +1 -0
- package/dist/src/commands/find.d.ts +2 -0
- package/dist/src/commands/find.js +70 -0
- package/dist/src/commands/find.js.map +1 -0
- package/dist/src/commands/home.d.ts +9 -0
- package/dist/src/commands/home.js +97 -0
- package/dist/src/commands/home.js.map +1 -0
- package/dist/src/commands/info.d.ts +2 -0
- package/dist/src/commands/info.js +95 -0
- package/dist/src/commands/info.js.map +1 -0
- package/dist/src/commands/localize.d.ts +2 -0
- package/dist/src/commands/localize.js +121 -0
- package/dist/src/commands/localize.js.map +1 -0
- package/dist/src/commands/migrate.d.ts +8 -0
- package/dist/src/commands/migrate.js +177 -0
- package/dist/src/commands/migrate.js.map +1 -0
- package/dist/src/commands/packages.d.ts +2 -0
- package/dist/src/commands/packages.js +108 -0
- package/dist/src/commands/packages.js.map +1 -0
- package/dist/src/commands/platforms.d.ts +2 -0
- package/dist/src/commands/platforms.js +379 -0
- package/dist/src/commands/platforms.js.map +1 -0
- package/dist/src/commands/result.d.ts +2 -0
- package/dist/src/commands/result.js +100 -0
- package/dist/src/commands/result.js.map +1 -0
- package/dist/src/commands/schemes.d.ts +2 -0
- package/dist/src/commands/schemes.js +39 -0
- package/dist/src/commands/schemes.js.map +1 -0
- package/dist/src/commands/settings.d.ts +2 -0
- package/dist/src/commands/settings.js +191 -0
- package/dist/src/commands/settings.js.map +1 -0
- package/dist/src/commands/setup.d.ts +2 -0
- package/dist/src/commands/setup.js +84 -0
- package/dist/src/commands/setup.js.map +1 -0
- package/dist/src/commands/sim.d.ts +2 -0
- package/dist/src/commands/sim.js +187 -0
- package/dist/src/commands/sim.js.map +1 -0
- package/dist/src/commands/test.d.ts +2 -0
- package/dist/src/commands/test.js +317 -0
- package/dist/src/commands/test.js.map +1 -0
- package/dist/src/commands/testplans.d.ts +8 -0
- package/dist/src/commands/testplans.js +75 -0
- package/dist/src/commands/testplans.js.map +1 -0
- package/dist/src/commands/tests.d.ts +13 -0
- package/dist/src/commands/tests.js +154 -0
- package/dist/src/commands/tests.js.map +1 -0
- package/dist/src/commands/xcframework.d.ts +2 -0
- package/dist/src/commands/xcframework.js +77 -0
- package/dist/src/commands/xcframework.js.map +1 -0
- package/dist/src/context.d.ts +23 -0
- package/dist/src/context.js +72 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/destination.d.ts +50 -0
- package/dist/src/destination.js +174 -0
- package/dist/src/destination.js.map +1 -0
- package/dist/src/errors.d.ts +6 -0
- package/dist/src/errors.js +55 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/packages.d.ts +31 -0
- package/dist/src/packages.js +117 -0
- package/dist/src/packages.js.map +1 -0
- package/dist/src/report.d.ts +20 -0
- package/dist/src/report.js +39 -0
- package/dist/src/report.js.map +1 -0
- package/dist/src/scheme.d.ts +22 -0
- package/dist/src/scheme.js +66 -0
- package/dist/src/scheme.js.map +1 -0
- package/dist/src/simctl.d.ts +33 -0
- package/dist/src/simctl.js +85 -0
- package/dist/src/simctl.js.map +1 -0
- package/dist/src/surface.d.ts +55 -0
- package/dist/src/surface.js +350 -0
- package/dist/src/surface.js.map +1 -0
- package/dist/src/toon.d.ts +34 -0
- package/dist/src/toon.js +79 -0
- package/dist/src/toon.js.map +1 -0
- package/dist/src/version.d.ts +1 -0
- package/dist/src/version.js +24 -0
- package/dist/src/version.js.map +1 -0
- package/dist/src/xccov.d.ts +25 -0
- package/dist/src/xccov.js +78 -0
- package/dist/src/xccov.js.map +1 -0
- package/dist/src/xcodebuild.d.ts +65 -0
- package/dist/src/xcodebuild.js +163 -0
- package/dist/src/xcodebuild.js.map +1 -0
- package/dist/src/xcresult.d.ts +96 -0
- package/dist/src/xcresult.js +156 -0
- package/dist/src/xcresult.js.map +1 -0
- package/package.json +75 -0
- package/skills/xcodebuild-axi/SKILL.md +64 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { AxiError } from "../errors.js";
|
|
3
|
+
import { runMetadata, stripPreamble } from "../xcodebuild.js";
|
|
4
|
+
import { renderFields, renderHelp, renderOutput, tildePath } from "../toon.js";
|
|
5
|
+
import { getListFlag, getFlag, rejectUnknownFlags } from "../args.js";
|
|
6
|
+
export const XCFRAMEWORK_HELP = `usage: xcodebuild-axi xcframework --output <path.xcframework> [flags]
|
|
7
|
+
Bundles prebuilt frameworks or libraries into one .xcframework.
|
|
8
|
+
flags[4]:
|
|
9
|
+
--output <path> the .xcframework to write (required)
|
|
10
|
+
--framework <path> a built .framework to include; repeatable
|
|
11
|
+
--library <path> a built static or dynamic library to include; repeatable
|
|
12
|
+
--headers <path> headers for the library that precedes it; repeatable
|
|
13
|
+
note:
|
|
14
|
+
--headers applies to the --library it follows, which is how xcodebuild pairs
|
|
15
|
+
them. Give them in matching order.
|
|
16
|
+
examples:
|
|
17
|
+
xcodebuild-axi xcframework --output Out.xcframework --framework A.framework --framework B.framework
|
|
18
|
+
xcodebuild-axi xcframework --output Out.xcframework --library libA.a --headers include
|
|
19
|
+
`;
|
|
20
|
+
const FLAGS = ["--output", "--framework", "--library", "--headers"];
|
|
21
|
+
export async function xcframeworkCommand(args) {
|
|
22
|
+
rejectUnknownFlags(args, "xcframework", FLAGS, FLAGS);
|
|
23
|
+
const output = getFlag(args, "--output");
|
|
24
|
+
if (output === undefined) {
|
|
25
|
+
throw new AxiError("xcframework needs --output", "VALIDATION_ERROR", [
|
|
26
|
+
"xcodebuild-axi xcframework --output Out.xcframework --framework A.framework",
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
const frameworks = getListFlag(args, "--framework");
|
|
30
|
+
const libraries = getListFlag(args, "--library");
|
|
31
|
+
const headers = getListFlag(args, "--headers");
|
|
32
|
+
if (frameworks.length === 0 && libraries.length === 0) {
|
|
33
|
+
throw new AxiError("xcframework needs at least one --framework or --library", "VALIDATION_ERROR", [
|
|
34
|
+
"xcodebuild-axi xcframework --output Out.xcframework --framework A.framework",
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
const missing = [...frameworks, ...libraries].filter((path) => !existsSync(path));
|
|
38
|
+
if (missing.length > 0) {
|
|
39
|
+
// xcodebuild reports this one input at a time; naming them all at once
|
|
40
|
+
// saves a round trip per missing path.
|
|
41
|
+
throw new AxiError(`Missing input: ${missing.join(", ")}`, "VALIDATION_ERROR", ["Build each slice first, then pass the built products here"]);
|
|
42
|
+
}
|
|
43
|
+
const { stdout, stderr, exitCode } = await runMetadata([
|
|
44
|
+
"-create-xcframework",
|
|
45
|
+
...frameworks.flatMap((path) => ["-framework", path]),
|
|
46
|
+
...libraries.flatMap((path, index) => [
|
|
47
|
+
"-library",
|
|
48
|
+
path,
|
|
49
|
+
...(headers[index] !== undefined
|
|
50
|
+
? ["-headers", headers[index]]
|
|
51
|
+
: []),
|
|
52
|
+
]),
|
|
53
|
+
"-output",
|
|
54
|
+
output,
|
|
55
|
+
]);
|
|
56
|
+
if (exitCode !== 0) {
|
|
57
|
+
throw new AxiError(firstMeaningfulLine(`${stderr}\n${stdout}`) ||
|
|
58
|
+
"Could not create the xcframework", "UNKNOWN");
|
|
59
|
+
}
|
|
60
|
+
return renderOutput([
|
|
61
|
+
renderFields({
|
|
62
|
+
xcframework: tildePath(output),
|
|
63
|
+
frameworks: frameworks.length,
|
|
64
|
+
libraries: libraries.length,
|
|
65
|
+
}),
|
|
66
|
+
renderHelp([
|
|
67
|
+
"Add the .xcframework to a target's Frameworks build phase to use it",
|
|
68
|
+
]),
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
function firstMeaningfulLine(output) {
|
|
72
|
+
return (stripPreamble(output)
|
|
73
|
+
.split("\n")
|
|
74
|
+
.map((line) => line.trim())
|
|
75
|
+
.find((line) => line.length > 0) ?? "");
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=xcframework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xcframework.js","sourceRoot":"","sources":["../../../src/commands/xcframework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO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AAC;SAClB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CACzC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ProjectKind = "workspace" | "project" | "package";
|
|
2
|
+
export interface ProjectContext {
|
|
3
|
+
kind: ProjectKind;
|
|
4
|
+
/** Absolute path to the container (or the directory, for a package). */
|
|
5
|
+
path: string;
|
|
6
|
+
/** Display name: "MyApps" for MyApps.xcworkspace. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** The `-workspace X` / `-project X` pair to pass xcodebuild, if any. */
|
|
9
|
+
flags: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Find the thing xcodebuild should be pointed at, in the directory the agent
|
|
13
|
+
* is standing in.
|
|
14
|
+
*
|
|
15
|
+
* A workspace wins over a bare project because that is the container Xcode
|
|
16
|
+
* itself opens when both are present, and because a project inside a workspace
|
|
17
|
+
* usually cannot resolve the workspace's package graph on its own.
|
|
18
|
+
*
|
|
19
|
+
* `project.xcworkspace` is skipped: every `.xcodeproj` contains one, and it is
|
|
20
|
+
* an implementation detail rather than something a user ever builds.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveProject(dir?: string): ProjectContext | undefined;
|
|
23
|
+
export declare function requireProject(dir?: string): ProjectContext;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
2
|
+
import { basename, join, resolve } from "node:path";
|
|
3
|
+
import { AxiError } from "./errors.js";
|
|
4
|
+
/**
|
|
5
|
+
* Find the thing xcodebuild should be pointed at, in the directory the agent
|
|
6
|
+
* is standing in.
|
|
7
|
+
*
|
|
8
|
+
* A workspace wins over a bare project because that is the container Xcode
|
|
9
|
+
* itself opens when both are present, and because a project inside a workspace
|
|
10
|
+
* usually cannot resolve the workspace's package graph on its own.
|
|
11
|
+
*
|
|
12
|
+
* `project.xcworkspace` is skipped: every `.xcodeproj` contains one, and it is
|
|
13
|
+
* an implementation detail rather than something a user ever builds.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveProject(dir = process.cwd()) {
|
|
16
|
+
const root = resolve(dir);
|
|
17
|
+
let entries;
|
|
18
|
+
try {
|
|
19
|
+
entries = readdirSync(root);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const workspaces = entries.filter((entry) => entry.endsWith(".xcworkspace") && entry !== "project.xcworkspace");
|
|
25
|
+
if (workspaces.length > 0) {
|
|
26
|
+
const chosen = pickOne(workspaces, "workspace", root);
|
|
27
|
+
return {
|
|
28
|
+
kind: "workspace",
|
|
29
|
+
path: join(root, chosen),
|
|
30
|
+
name: basename(chosen, ".xcworkspace"),
|
|
31
|
+
flags: ["-workspace", join(root, chosen)],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const projects = entries.filter((entry) => entry.endsWith(".xcodeproj"));
|
|
35
|
+
if (projects.length > 0) {
|
|
36
|
+
const chosen = pickOne(projects, "project", root);
|
|
37
|
+
return {
|
|
38
|
+
kind: "project",
|
|
39
|
+
path: join(root, chosen),
|
|
40
|
+
name: basename(chosen, ".xcodeproj"),
|
|
41
|
+
flags: ["-project", join(root, chosen)],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// A Swift package has no container to pass: xcodebuild synthesizes an
|
|
45
|
+
// implicit workspace from Package.swift in the working directory, which is
|
|
46
|
+
// why the runner must never cd away from it.
|
|
47
|
+
if (existsSync(join(root, "Package.swift"))) {
|
|
48
|
+
return { kind: "package", path: root, name: basename(root), flags: [] };
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
export function requireProject(dir = process.cwd()) {
|
|
53
|
+
const project = resolveProject(dir);
|
|
54
|
+
if (!project) {
|
|
55
|
+
throw new AxiError(`No .xcworkspace, .xcodeproj, or Package.swift in ${dir}`, "NO_PROJECT", ["cd to the directory holding the workspace or project, then re-run"]);
|
|
56
|
+
}
|
|
57
|
+
return project;
|
|
58
|
+
}
|
|
59
|
+
function pickOne(candidates, label, root) {
|
|
60
|
+
const sorted = [...candidates].sort();
|
|
61
|
+
const first = sorted[0];
|
|
62
|
+
if (first === undefined) {
|
|
63
|
+
throw new AxiError(`No ${label} found in ${root}`, "NO_PROJECT");
|
|
64
|
+
}
|
|
65
|
+
if (sorted.length > 1) {
|
|
66
|
+
// Ambiguity an agent cannot resolve by guessing: say which ones, so the
|
|
67
|
+
// next call can cd into the right place rather than re-run blind.
|
|
68
|
+
throw new AxiError(`${sorted.length} ${label}s in ${root}: ${sorted.join(", ")}`, "NO_PROJECT", ["cd into the directory holding the one you want, then re-run"]);
|
|
69
|
+
}
|
|
70
|
+
return first;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAcvC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAEnB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IAC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I,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC1E,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAChD,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,QAAQ,CAChB,oDAAoD,GAAG,EAAE,EACzD,YAAY,EACZ,CAAC,mEAAmE,CAAC,CACtE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CAAC,UAAoB,EAAE,KAAa,EAAE,IAAY;IAChE,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,aAAa,IAAI,EAAE,EAAE,YAAY,CAAC,CAAC;IACnE,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,wEAAwE;QACxE,kEAAkE;QAClE,MAAM,IAAI,QAAQ,CAChB,GAAG,MAAM,CAAC,MAAM,IAAI,KAAK,QAAQ,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAC7D,YAAY,EACZ,CAAC,6DAA6D,CAAC,CAChE,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ProjectContext } from "./context.js";
|
|
2
|
+
export interface Destination {
|
|
3
|
+
platform: string;
|
|
4
|
+
name: string;
|
|
5
|
+
id: string;
|
|
6
|
+
os: string;
|
|
7
|
+
arch: string;
|
|
8
|
+
/** xcodebuild listed it under "Ineligible destinations". */
|
|
9
|
+
eligible: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse one `-showdestinations` row.
|
|
13
|
+
*
|
|
14
|
+
* Rows look like
|
|
15
|
+
* { platform:iOS Simulator, arch:arm64, id:55D8…, OS:26.5, name:iPad (A16) }
|
|
16
|
+
* Values are unquoted and can contain spaces and parentheses, so the split is
|
|
17
|
+
* driven by the next `key:` rather than by commas.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseDestinationLine(line: string): Destination | undefined;
|
|
20
|
+
export declare function listDestinations(project: ProjectContext, scheme: string): Promise<Destination[]>;
|
|
21
|
+
export interface ResolveDestinationOptions {
|
|
22
|
+
project: ProjectContext;
|
|
23
|
+
scheme: string;
|
|
24
|
+
/** A simulator or device name, e.g. "iPhone 17 Pro". */
|
|
25
|
+
device?: string;
|
|
26
|
+
/** A full xcodebuild destination specifier, passed through untouched. */
|
|
27
|
+
raw?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Work out what to pass `-destination`.
|
|
31
|
+
*
|
|
32
|
+
* Choosing a destination is the single most common thing an agent gets wrong
|
|
33
|
+
* against raw xcodebuild — the specifier syntax is unguessable and a miss
|
|
34
|
+
* costs a full failed invocation. So: an explicit `--destination` passes
|
|
35
|
+
* through, a `--device` name is matched against what the scheme actually
|
|
36
|
+
* supports, and with neither we pick the newest eligible simulator rather than
|
|
37
|
+
* making the agent ask first (AXI principle 4).
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveDestination(options: ResolveDestinationOptions): Promise<{
|
|
40
|
+
specifier: string;
|
|
41
|
+
described: string;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Prefer a simulator over hardware — a device build needs signing an agent
|
|
45
|
+
* cannot supply — then iOS over the other platforms, then the newest OS, which
|
|
46
|
+
* is what Xcode's own scheme selector lands on.
|
|
47
|
+
*/
|
|
48
|
+
export declare function pickDefault(destinations: Destination[]): Destination;
|
|
49
|
+
/** A filesystem-safe stem for the log and result bundle of this run. */
|
|
50
|
+
export declare function destinationSlug(described: string): string;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { AxiError } from "./errors.js";
|
|
2
|
+
import { runMetadata } from "./xcodebuild.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parse one `-showdestinations` row.
|
|
5
|
+
*
|
|
6
|
+
* Rows look like
|
|
7
|
+
* { platform:iOS Simulator, arch:arm64, id:55D8…, OS:26.5, name:iPad (A16) }
|
|
8
|
+
* Values are unquoted and can contain spaces and parentheses, so the split is
|
|
9
|
+
* driven by the next `key:` rather than by commas.
|
|
10
|
+
*/
|
|
11
|
+
export function parseDestinationLine(line) {
|
|
12
|
+
const inner = line.trim().match(/^\{(.*)\}$/)?.[1];
|
|
13
|
+
if (inner === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
const fields = {};
|
|
16
|
+
for (const match of inner.matchAll(/(\w+):(.*?)(?=,\s*\w+:|$)/g)) {
|
|
17
|
+
const key = match[1];
|
|
18
|
+
const value = match[2];
|
|
19
|
+
if (key !== undefined && value !== undefined)
|
|
20
|
+
fields[key] = value.trim();
|
|
21
|
+
}
|
|
22
|
+
const platform = fields["platform"] ?? "";
|
|
23
|
+
if (platform.length === 0)
|
|
24
|
+
return undefined;
|
|
25
|
+
return {
|
|
26
|
+
platform,
|
|
27
|
+
name: fields["name"] ?? "",
|
|
28
|
+
id: fields["id"] ?? "",
|
|
29
|
+
os: fields["OS"] ?? "",
|
|
30
|
+
arch: fields["arch"] ?? "",
|
|
31
|
+
eligible: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Placeholders ("Any iOS Device") are not runnable and only add rows. */
|
|
35
|
+
function isPlaceholder(destination) {
|
|
36
|
+
return destination.id.includes("placeholder");
|
|
37
|
+
}
|
|
38
|
+
export async function listDestinations(project, scheme) {
|
|
39
|
+
const { stdout, stderr } = await runMetadata([
|
|
40
|
+
...project.flags,
|
|
41
|
+
"-scheme",
|
|
42
|
+
scheme,
|
|
43
|
+
"-showdestinations",
|
|
44
|
+
]);
|
|
45
|
+
const out = [];
|
|
46
|
+
let eligible = true;
|
|
47
|
+
for (const line of `${stdout}\n${stderr}`.split("\n")) {
|
|
48
|
+
if (/Ineligible destinations/i.test(line)) {
|
|
49
|
+
eligible = false;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (/Available destinations|Destinations compatible/i.test(line)) {
|
|
53
|
+
eligible = true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const parsed = parseDestinationLine(line);
|
|
57
|
+
if (parsed && !isPlaceholder(parsed))
|
|
58
|
+
out.push({ ...parsed, eligible });
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
/** Compare two "26.5"-style versions; newest first. */
|
|
63
|
+
function compareOS(a, b) {
|
|
64
|
+
const partsA = a.split(".").map(Number);
|
|
65
|
+
const partsB = b.split(".").map(Number);
|
|
66
|
+
for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {
|
|
67
|
+
const diff = (partsB[i] ?? 0) - (partsA[i] ?? 0);
|
|
68
|
+
if (diff !== 0)
|
|
69
|
+
return diff;
|
|
70
|
+
}
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Work out what to pass `-destination`.
|
|
75
|
+
*
|
|
76
|
+
* Choosing a destination is the single most common thing an agent gets wrong
|
|
77
|
+
* against raw xcodebuild — the specifier syntax is unguessable and a miss
|
|
78
|
+
* costs a full failed invocation. So: an explicit `--destination` passes
|
|
79
|
+
* through, a `--device` name is matched against what the scheme actually
|
|
80
|
+
* supports, and with neither we pick the newest eligible simulator rather than
|
|
81
|
+
* making the agent ask first (AXI principle 4).
|
|
82
|
+
*/
|
|
83
|
+
export async function resolveDestination(options) {
|
|
84
|
+
if (options.raw) {
|
|
85
|
+
return { specifier: options.raw, described: options.raw };
|
|
86
|
+
}
|
|
87
|
+
const destinations = (await listDestinations(options.project, options.scheme)).filter((destination) => destination.eligible);
|
|
88
|
+
if (destinations.length === 0) {
|
|
89
|
+
throw new AxiError(`Scheme '${options.scheme}' has no runnable destinations`, "DESTINATION_NOT_FOUND", [
|
|
90
|
+
"Run `xcodebuild-axi destinations --scheme " +
|
|
91
|
+
options.scheme +
|
|
92
|
+
"` to see everything xcodebuild reported",
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
if (options.device) {
|
|
96
|
+
const wanted = options.device.toLowerCase();
|
|
97
|
+
const match = destinations.find((d) => d.name.toLowerCase() === wanted) ??
|
|
98
|
+
destinations.find((d) => d.id.toLowerCase() === wanted) ??
|
|
99
|
+
destinations.find((d) => d.name.toLowerCase().includes(wanted));
|
|
100
|
+
if (!match) {
|
|
101
|
+
const names = [...new Set(destinations.map((d) => d.name))].slice(0, 12);
|
|
102
|
+
throw new AxiError(`Scheme '${options.scheme}' has no destination named '${options.device}'`, "DESTINATION_NOT_FOUND", [`available: ${names.join(", ")}`]);
|
|
103
|
+
}
|
|
104
|
+
return { specifier: specifierFor(match), described: describe(match) };
|
|
105
|
+
}
|
|
106
|
+
const preferred = pickDefault(destinations);
|
|
107
|
+
return { specifier: specifierFor(preferred), described: describe(preferred) };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* When several platforms are eligible, iOS is the one meant.
|
|
111
|
+
*
|
|
112
|
+
* A cross-platform Swift package reports simulators for every platform it
|
|
113
|
+
* supports, and sorting those by OS version alone lands on whichever happens
|
|
114
|
+
* to carry the highest number — a watchOS build for a package nobody was
|
|
115
|
+
* thinking about watchOS for. Anything unlisted sorts after these.
|
|
116
|
+
*/
|
|
117
|
+
const PLATFORM_ORDER = [
|
|
118
|
+
"iOS Simulator",
|
|
119
|
+
"tvOS Simulator",
|
|
120
|
+
"visionOS Simulator",
|
|
121
|
+
"watchOS Simulator",
|
|
122
|
+
];
|
|
123
|
+
function platformRank(platform) {
|
|
124
|
+
const index = PLATFORM_ORDER.indexOf(platform);
|
|
125
|
+
return index === -1 ? PLATFORM_ORDER.length : index;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Within one platform and OS the tie would otherwise fall to whatever
|
|
129
|
+
* xcodebuild listed first, which is an iPad as often as an iPhone. Xcode's own
|
|
130
|
+
* default is a phone, and so is almost every agent's intent.
|
|
131
|
+
*/
|
|
132
|
+
function deviceRank(name) {
|
|
133
|
+
return /^iPhone/.test(name) ? 0 : 1;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Prefer a simulator over hardware — a device build needs signing an agent
|
|
137
|
+
* cannot supply — then iOS over the other platforms, then the newest OS, which
|
|
138
|
+
* is what Xcode's own scheme selector lands on.
|
|
139
|
+
*/
|
|
140
|
+
export function pickDefault(destinations) {
|
|
141
|
+
const simulators = destinations.filter((d) => d.platform.includes("Simulator"));
|
|
142
|
+
const pool = simulators.length > 0 ? simulators : destinations;
|
|
143
|
+
const sorted = [...pool].sort((a, b) => platformRank(a.platform) - platformRank(b.platform) ||
|
|
144
|
+
compareOS(a.os, b.os) ||
|
|
145
|
+
deviceRank(a.name) - deviceRank(b.name));
|
|
146
|
+
const first = sorted[0];
|
|
147
|
+
if (first === undefined) {
|
|
148
|
+
throw new AxiError("No destination to choose from", "DESTINATION_NOT_FOUND");
|
|
149
|
+
}
|
|
150
|
+
return first;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Address a simulator by id, not by name.
|
|
154
|
+
*
|
|
155
|
+
* Two runtimes routinely publish the same device name ("iPhone 17 Pro" on both
|
|
156
|
+
* iOS 26.4 and 26.5), and a name-based specifier silently resolves to whichever
|
|
157
|
+
* xcodebuild sees first — so a run can land on a different OS than the one
|
|
158
|
+
* reported here. The udid is unambiguous.
|
|
159
|
+
*/
|
|
160
|
+
function specifierFor(destination) {
|
|
161
|
+
if (destination.id.length > 0) {
|
|
162
|
+
return `platform=${destination.platform},id=${destination.id}`;
|
|
163
|
+
}
|
|
164
|
+
return `platform=${destination.platform},name=${destination.name}`;
|
|
165
|
+
}
|
|
166
|
+
function describe(destination) {
|
|
167
|
+
const os = destination.os.length > 0 ? ` · ${destination.os}` : "";
|
|
168
|
+
return `${destination.name}${os}`;
|
|
169
|
+
}
|
|
170
|
+
/** A filesystem-safe stem for the log and result bundle of this run. */
|
|
171
|
+
export function destinationSlug(described) {
|
|
172
|
+
return described.replace(/[^A-Za-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=destination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../../src/destination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAY9C;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAE1C,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;QACjE,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,GAAG,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC3E,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IAC1C,IAAI,QAA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,CAC1C,CAAC;IACF,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,QAAQ,CAChB,+BAA+B,EAC/B,uBAAuB,CACxB,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,WAAwB;IAC5C,IAAI,WAAW,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,YAAY,WAAW,CAAC,QAAQ,OAAO,WAAW,CAAC,EAAE,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,YAAY,WAAW,CAAC,QAAQ,SAAS,WAAW,CAAC,IAAI,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,QAAQ,CAAC,WAAwB;IACxC,MAAM,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,OAAO,GAAG,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC;AACpC,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AxiError, exitCodeForError } from "axi-sdk-js";
|
|
2
|
+
export type ErrorCode = "XCODE_NOT_INSTALLED" | "NO_PROJECT" | "SCHEME_NOT_FOUND" | "DESTINATION_NOT_FOUND" | "RESULT_NOT_FOUND" | "SIMULATOR_NOT_FOUND" | "NOT_FOUND" | "VALIDATION_ERROR" | "BUILD_FAILED" | "TEST_FAILED" | "UNKNOWN";
|
|
3
|
+
export { AxiError, exitCodeForError };
|
|
4
|
+
/** Translate an xcodebuild transcript into a structured error, or undefined. */
|
|
5
|
+
export declare function mapXcodebuildError(transcript: string): AxiError | undefined;
|
|
6
|
+
export declare function xcodeNotInstalledError(): AxiError;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AxiError, exitCodeForError } from "axi-sdk-js";
|
|
2
|
+
export { AxiError, exitCodeForError };
|
|
3
|
+
const patterns = [
|
|
4
|
+
{
|
|
5
|
+
pattern: /does not contain a scheme named "([^"]+)"|The (?:project|workspace) named "[^"]+" does not contain a scheme named "([^"]+)"/,
|
|
6
|
+
code: "SCHEME_NOT_FOUND",
|
|
7
|
+
message: (m) => `No scheme named '${m[1] ?? m[2]}' in this project`,
|
|
8
|
+
suggestions: () => ["Run `xcodebuild-axi schemes` to list the real names"],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
pattern: /Unable to find a destination matching the provided destination specifier/,
|
|
12
|
+
code: "DESTINATION_NOT_FOUND",
|
|
13
|
+
message: () => "No destination matched the requested device",
|
|
14
|
+
suggestions: () => [
|
|
15
|
+
"Run `xcodebuild-axi destinations --scheme <scheme>` to see what this scheme supports",
|
|
16
|
+
'Pass a simulator by name: `--device "iPhone 17 Pro"`',
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
pattern: /Existing file at -resultBundlePath/,
|
|
21
|
+
code: "VALIDATION_ERROR",
|
|
22
|
+
message: () => "A result bundle already exists at that path and xcodebuild will not overwrite it",
|
|
23
|
+
suggestions: () => [
|
|
24
|
+
"Re-run without `--result`, or delete the existing bundle first",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
pattern: /Signing for "([^"]+)" requires a development team/,
|
|
29
|
+
code: "VALIDATION_ERROR",
|
|
30
|
+
message: (m) => `Target '${m[1]}' needs a development team to sign`,
|
|
31
|
+
suggestions: () => [
|
|
32
|
+
"For a simulator build, signing is not needed — `xcodebuild-axi build` disables it by default",
|
|
33
|
+
"For a device build, pass `--sign` and set DEVELOPMENT_TEAM in the project",
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
pattern: /xcodebuild: error: (.+)/,
|
|
38
|
+
code: "UNKNOWN",
|
|
39
|
+
message: (m) => (m[1] ?? "").trim(),
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
/** Translate an xcodebuild transcript into a structured error, or undefined. */
|
|
43
|
+
export function mapXcodebuildError(transcript) {
|
|
44
|
+
for (const { pattern, code, message, suggestions } of patterns) {
|
|
45
|
+
const match = transcript.match(pattern);
|
|
46
|
+
if (match) {
|
|
47
|
+
return new AxiError(message(match), code, suggestions?.(match) ?? []);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
export function xcodeNotInstalledError() {
|
|
53
|
+
return new AxiError("Xcode command line tools are not available — `xcodebuild` is not on PATH", "XCODE_NOT_INSTALLED", ["Install Xcode, then run `xcode-select --switch /Applications/Xcode.app`"]);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAexD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AAiBtC,MAAM,QAAQ,GAAmB;IAC/B;QACE,OAAO,EACL,6HAA6H;QAC/H,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,mBAAmB;QACnE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,qDAAqD,CAAC;KAC3E;IACD;QACE,OAAO,EACL,0EAA0E;QAC5E,IAAI,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,yEAAyE,CAAC,CAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ProjectContext } from "./context.js";
|
|
2
|
+
/**
|
|
3
|
+
* Read the pinned package versions out of `Package.resolved`.
|
|
4
|
+
*
|
|
5
|
+
* Xcode hides this file in a different place depending on the container, and
|
|
6
|
+
* an agent asking "what version of X am I on?" otherwise has to know all of
|
|
7
|
+
* them. Reading it needs no subprocess at all, which makes this the cheapest
|
|
8
|
+
* useful answer in the whole tool.
|
|
9
|
+
*/
|
|
10
|
+
export interface Pin {
|
|
11
|
+
identity: string;
|
|
12
|
+
version: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
location: string;
|
|
15
|
+
revision: string;
|
|
16
|
+
}
|
|
17
|
+
/** Every place Xcode and SwiftPM keep the file, most specific first. */
|
|
18
|
+
export declare function resolvedFileCandidates(project: ProjectContext): string[];
|
|
19
|
+
export declare function findResolvedFile(project: ProjectContext): string | undefined;
|
|
20
|
+
export declare function readPins(path: string): Pin[];
|
|
21
|
+
/**
|
|
22
|
+
* Package-resolution behavior, shared by the build family and `packages`.
|
|
23
|
+
*
|
|
24
|
+
* These are the flags that decide whether xcodebuild is allowed to reach the
|
|
25
|
+
* network mid-build. An agent on a flaky or offline runner needs them, and
|
|
26
|
+
* they are otherwise eleven long camelCase names to remember.
|
|
27
|
+
*/
|
|
28
|
+
export declare const PACKAGE_FLAGS: readonly ["--offline", "--cache", "--package-cache", "--no-auto-resolve", "--skip-package-updates", "--no-package-cache", "--skip-plugin-validation", "--skip-signature-validation", "--package-auth", "--registry-url", "--scm-to-registry", "--fingerprint-policy", "--signing-entity-policy", "--scm-provider"];
|
|
29
|
+
export declare const PACKAGE_VALUE_FLAGS: readonly ["--cache", "--package-cache", "--package-auth", "--registry-url", "--scm-to-registry", "--fingerprint-policy", "--signing-entity-policy", "--scm-provider"];
|
|
30
|
+
export declare const PACKAGE_FLAG_HELP = " --offline resolve using only the versions already in Package.resolved\n --cache <path> clone remote packages into this directory\n --package-cache <path> shared package cache directory (across projects)\n --no-auto-resolve never resolve automatically; fail if Package.resolved is stale\n --skip-package-updates use the packages already cloned, without checking for updates\n --no-package-cache ignore the shared package repository cache\n --skip-plugin-validation trust build plugins without prompting\n --skip-signature-validation do not verify package signatures\n --package-auth <kind> keychain or netrc\n --registry-url <url> default package registry\n --scm-to-registry <kind> none, identity, or swift-package-registry\n --fingerprint-policy <kind> strict or warn\n --signing-entity-policy <kind> strict or warn\n --scm-provider <kind> system or xcode";
|
|
31
|
+
export declare function packageArgs(args: string[]): string[];
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { getFlag, hasFlag } from "./args.js";
|
|
4
|
+
/** Every place Xcode and SwiftPM keep the file, most specific first. */
|
|
5
|
+
export function resolvedFileCandidates(project) {
|
|
6
|
+
const root = project.kind === "package" ? project.path : dirname(project.path);
|
|
7
|
+
return [
|
|
8
|
+
// Workspace- and project-scoped copies, which win when both exist.
|
|
9
|
+
join(project.path, "xcshareddata", "swiftpm", "Package.resolved"),
|
|
10
|
+
join(project.path, "project.xcworkspace", "xcshareddata", "swiftpm", "Package.resolved"),
|
|
11
|
+
join(root, "Package.resolved"),
|
|
12
|
+
// Tuist keeps the workspace's graph here rather than inside the generated
|
|
13
|
+
// workspace, which is regenerated and so cannot hold source of truth.
|
|
14
|
+
join(root, "Tuist", "Package.resolved"),
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
export function findResolvedFile(project) {
|
|
18
|
+
return resolvedFileCandidates(project).find((candidate) => existsSync(candidate));
|
|
19
|
+
}
|
|
20
|
+
export function readPins(path) {
|
|
21
|
+
let parsed;
|
|
22
|
+
try {
|
|
23
|
+
parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return (parsed.pins ?? [])
|
|
29
|
+
.map((pin) => ({
|
|
30
|
+
identity: pin.identity ?? "unknown",
|
|
31
|
+
// A branch pin has no version; reporting an empty cell would read as
|
|
32
|
+
// "unpinned" when it is in fact pinned to a moving target.
|
|
33
|
+
version: pin.state?.version ??
|
|
34
|
+
(pin.state?.branch ? `branch ${pin.state.branch}` : "revision"),
|
|
35
|
+
kind: (pin.kind ?? "")
|
|
36
|
+
.replace("remoteSourceControl", "remote")
|
|
37
|
+
.replace("localSourceControl", "local"),
|
|
38
|
+
location: pin.location ?? "",
|
|
39
|
+
revision: (pin.state?.revision ?? "").slice(0, 7),
|
|
40
|
+
}))
|
|
41
|
+
.sort((a, b) => a.identity.localeCompare(b.identity));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Package-resolution behavior, shared by the build family and `packages`.
|
|
45
|
+
*
|
|
46
|
+
* These are the flags that decide whether xcodebuild is allowed to reach the
|
|
47
|
+
* network mid-build. An agent on a flaky or offline runner needs them, and
|
|
48
|
+
* they are otherwise eleven long camelCase names to remember.
|
|
49
|
+
*/
|
|
50
|
+
export const PACKAGE_FLAGS = [
|
|
51
|
+
"--offline",
|
|
52
|
+
"--cache",
|
|
53
|
+
"--package-cache",
|
|
54
|
+
"--no-auto-resolve",
|
|
55
|
+
"--skip-package-updates",
|
|
56
|
+
"--no-package-cache",
|
|
57
|
+
"--skip-plugin-validation",
|
|
58
|
+
"--skip-signature-validation",
|
|
59
|
+
"--package-auth",
|
|
60
|
+
"--registry-url",
|
|
61
|
+
"--scm-to-registry",
|
|
62
|
+
"--fingerprint-policy",
|
|
63
|
+
"--signing-entity-policy",
|
|
64
|
+
"--scm-provider",
|
|
65
|
+
];
|
|
66
|
+
export const PACKAGE_VALUE_FLAGS = [
|
|
67
|
+
"--cache",
|
|
68
|
+
"--package-cache",
|
|
69
|
+
"--package-auth",
|
|
70
|
+
"--registry-url",
|
|
71
|
+
"--scm-to-registry",
|
|
72
|
+
"--fingerprint-policy",
|
|
73
|
+
"--signing-entity-policy",
|
|
74
|
+
"--scm-provider",
|
|
75
|
+
];
|
|
76
|
+
export const PACKAGE_FLAG_HELP = ` --offline resolve using only the versions already in Package.resolved
|
|
77
|
+
--cache <path> clone remote packages into this directory
|
|
78
|
+
--package-cache <path> shared package cache directory (across projects)
|
|
79
|
+
--no-auto-resolve never resolve automatically; fail if Package.resolved is stale
|
|
80
|
+
--skip-package-updates use the packages already cloned, without checking for updates
|
|
81
|
+
--no-package-cache ignore the shared package repository cache
|
|
82
|
+
--skip-plugin-validation trust build plugins without prompting
|
|
83
|
+
--skip-signature-validation do not verify package signatures
|
|
84
|
+
--package-auth <kind> keychain or netrc
|
|
85
|
+
--registry-url <url> default package registry
|
|
86
|
+
--scm-to-registry <kind> none, identity, or swift-package-registry
|
|
87
|
+
--fingerprint-policy <kind> strict or warn
|
|
88
|
+
--signing-entity-policy <kind> strict or warn
|
|
89
|
+
--scm-provider <kind> system or xcode`;
|
|
90
|
+
const SWITCHES = [
|
|
91
|
+
["--offline", "-onlyUsePackageVersionsFromResolvedFile"],
|
|
92
|
+
["--no-auto-resolve", "-disableAutomaticPackageResolution"],
|
|
93
|
+
["--skip-package-updates", "-skipPackageUpdates"],
|
|
94
|
+
["--no-package-cache", "-disablePackageRepositoryCache"],
|
|
95
|
+
["--skip-plugin-validation", "-skipPackagePluginValidation"],
|
|
96
|
+
["--skip-signature-validation", "-skipPackageSignatureValidation"],
|
|
97
|
+
];
|
|
98
|
+
const VALUES = [
|
|
99
|
+
["--cache", "-clonedSourcePackagesDirPath"],
|
|
100
|
+
["--package-cache", "-packageCachePath"],
|
|
101
|
+
["--package-auth", "-packageAuthorizationProvider"],
|
|
102
|
+
["--registry-url", "-defaultPackageRegistryURL"],
|
|
103
|
+
["--scm-to-registry", "-packageDependencySCMToRegistryTransformation"],
|
|
104
|
+
["--fingerprint-policy", "-packageFingerprintPolicy"],
|
|
105
|
+
["--signing-entity-policy", "-packageSigningEntityPolicy"],
|
|
106
|
+
["--scm-provider", "-scmProvider"],
|
|
107
|
+
];
|
|
108
|
+
export function packageArgs(args) {
|
|
109
|
+
return [
|
|
110
|
+
...SWITCHES.filter(([flag]) => hasFlag(args, flag)).map(([, name]) => name),
|
|
111
|
+
...VALUES.flatMap(([flag, name]) => {
|
|
112
|
+
const value = getFlag(args, flag);
|
|
113
|
+
return value === undefined ? [] : [name, value];
|
|
114
|
+
}),
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.js","sourceRoot":"","sources":["../../src/packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4B7C,wEAAwE;AACxE,MAAM,UAAU,sBAAsB,CAAC,OAAuB;IAC5D,MAAM,IAAI,GACR,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,OAAO;QACL,mEAAmE;QACnE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,kBAAkB,CAAC;QACjE,IAAI,CACF,OAAO,CAAC,IAAI,EACZ,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,kBAAkB,CACnB;QACD,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC;QAC9B,0EAA0E;QAC1E,sEAAsE;QACtE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,kBAAkB,CAAC;KACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAuB;IACtD,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAA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