peachsim 0.1.2429 → 0.1.2432
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/cli/commands/preview.ts +2 -1
- package/cli/outbound-endpoints.ts +10 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +15792 -5999
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +14638 -4887
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +15465 -5754
- package/dist-lib/host/fetch-proxy-handler.cjs +3205 -54
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +3542 -391
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +3438 -287
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +174 -81
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +16787 -6994
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +95 -27
- package/dist-lib/vite.cjs +3331 -180
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/src/expo-native-workspace.ts +23 -63
- package/src/pbx-table.ts +200 -0
- package/src/pod-sources.ts +628 -0
- package/src/podfile-cocoapods.ts +40 -3
- package/src/pods-analysis.ts +488 -0
- package/src/pods-build-settings.ts +1015 -0
- package/src/pods-files.ts +478 -0
- package/src/pods-install.ts +475 -0
- package/src/pods-integration.ts +778 -0
- package/src/pods-post-install.ts +1811 -0
- package/src/pods-project.ts +2416 -0
- package/src/pods-scripts.ts +409 -0
- package/src/pods-targets.ts +757 -0
- package/src/pods-xcconfig.ts +198 -0
- package/src/podspec-cocoapods.ts +29 -3
- package/src/podspec-ruby-stdlib.ts +111 -10
- package/src/podspec-ruby.ts +52 -8
- package/src/swift-catalog-png.ts +75 -0
- package/src/swift-host.ts +4 -3
- package/src/swift-root-lock.ts +0 -10
- package/src/swift-source-pods.ts +29 -73
- package/src/turbo-source.ts +16 -37
package/dist-lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2432 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -7493,9 +7493,17 @@ module Pod
|
|
|
7493
7493
|
end
|
|
7494
7494
|
|
|
7495
7495
|
def module_name
|
|
7496
|
-
attributes_hash['module_name'] ||
|
|
7496
|
+
attributes_hash['module_name'] ||
|
|
7497
|
+
c99ext_identifier(attributes_hash['header_dir']) ||
|
|
7498
|
+
c99ext_identifier(attributes_hash['name'])
|
|
7497
7499
|
end
|
|
7498
7500
|
|
|
7501
|
+
def c99ext_identifier(name)
|
|
7502
|
+
return nil if name.nil?
|
|
7503
|
+
name.gsub(/^([0-9])/, '_\1').gsub(/[^a-zA-Z0-9_]/, '_').gsub(/_+/, '_')
|
|
7504
|
+
end
|
|
7505
|
+
private :c99ext_identifier
|
|
7506
|
+
|
|
7499
7507
|
def homepage
|
|
7500
7508
|
attributes_hash['homepage']
|
|
7501
7509
|
end
|
|
@@ -7797,7 +7805,9 @@ end
|
|
|
7797
7805
|
`],
|
|
7798
7806
|
["xcodebuild -version", `Xcode ${NATIVE_GRAPH_SDK_VERSION}
|
|
7799
7807
|
`],
|
|
7800
|
-
["/usr/sbin/sysctl -n hw.optional.arm64 2>&1", "1\n"]
|
|
7808
|
+
["/usr/sbin/sysctl -n hw.optional.arm64 2>&1", "1\n"],
|
|
7809
|
+
// peach compiles without ccache
|
|
7810
|
+
["command -v ccache", ""]
|
|
7801
7811
|
]);
|
|
7802
7812
|
}
|
|
7803
7813
|
});
|
|
@@ -10574,7 +10584,7 @@ var STANDIN_SOURCE_DIGEST;
|
|
|
10574
10584
|
var init_swift_standin_digest = __esm({
|
|
10575
10585
|
"src/swift-standin-digest.ts"() {
|
|
10576
10586
|
"use strict";
|
|
10577
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
10587
|
+
STANDIN_SOURCE_DIGEST = true ? "3475ca483b1e5005a2c76ec887310c0d0f44c91ea427496b33acbb5bf6188684" : standinSourceDigest();
|
|
10578
10588
|
}
|
|
10579
10589
|
});
|
|
10580
10590
|
|
|
@@ -10613,6 +10623,150 @@ var init_native_prebuilt = __esm({
|
|
|
10613
10623
|
}
|
|
10614
10624
|
});
|
|
10615
10625
|
|
|
10626
|
+
// src/openstep-plist.ts
|
|
10627
|
+
function parseOpenStepPlist(text3) {
|
|
10628
|
+
let i = 0;
|
|
10629
|
+
const fail = (message) => {
|
|
10630
|
+
const line = text3.slice(0, i).split("\n").length;
|
|
10631
|
+
throw new Error(`project.pbxproj line ${line}: ${message}`);
|
|
10632
|
+
};
|
|
10633
|
+
const skip = () => {
|
|
10634
|
+
for (; ; ) {
|
|
10635
|
+
const ch = text3[i];
|
|
10636
|
+
if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
|
|
10637
|
+
else if (ch === "/" && text3[i + 1] === "*") {
|
|
10638
|
+
const end = text3.indexOf("*/", i + 2);
|
|
10639
|
+
if (end < 0) fail("unterminated comment");
|
|
10640
|
+
i = end + 2;
|
|
10641
|
+
} else if (ch === "/" && text3[i + 1] === "/") {
|
|
10642
|
+
const end = text3.indexOf("\n", i);
|
|
10643
|
+
i = end < 0 ? text3.length : end + 1;
|
|
10644
|
+
} else return;
|
|
10645
|
+
}
|
|
10646
|
+
};
|
|
10647
|
+
const quoted = () => {
|
|
10648
|
+
i++;
|
|
10649
|
+
let out = "";
|
|
10650
|
+
for (; ; ) {
|
|
10651
|
+
const ch = text3[i++];
|
|
10652
|
+
if (ch === void 0) fail("unterminated string");
|
|
10653
|
+
if (ch === '"') return out;
|
|
10654
|
+
if (ch !== "\\") {
|
|
10655
|
+
out += ch;
|
|
10656
|
+
continue;
|
|
10657
|
+
}
|
|
10658
|
+
const next = text3[i++];
|
|
10659
|
+
if (next === "n") out += "\n";
|
|
10660
|
+
else if (next === "t") out += " ";
|
|
10661
|
+
else if (next === "r") out += "\r";
|
|
10662
|
+
else if (next === "U") {
|
|
10663
|
+
out += String.fromCharCode(parseInt(text3.slice(i, i + 4), 16));
|
|
10664
|
+
i += 4;
|
|
10665
|
+
} else out += next;
|
|
10666
|
+
}
|
|
10667
|
+
};
|
|
10668
|
+
const value = () => {
|
|
10669
|
+
skip();
|
|
10670
|
+
const ch = text3[i];
|
|
10671
|
+
if (ch === "{") {
|
|
10672
|
+
i++;
|
|
10673
|
+
const dict = {};
|
|
10674
|
+
for (; ; ) {
|
|
10675
|
+
skip();
|
|
10676
|
+
if (text3[i] === "}") {
|
|
10677
|
+
i++;
|
|
10678
|
+
return dict;
|
|
10679
|
+
}
|
|
10680
|
+
const key = value();
|
|
10681
|
+
if (typeof key !== "string") fail("dictionary key is not a string");
|
|
10682
|
+
skip();
|
|
10683
|
+
if (text3[i++] !== "=") fail("expected =");
|
|
10684
|
+
if (Object.hasOwn(dict, key)) fail(`duplicate key ${key}`);
|
|
10685
|
+
dict[key] = value();
|
|
10686
|
+
skip();
|
|
10687
|
+
if (text3[i++] !== ";") fail("expected ;");
|
|
10688
|
+
}
|
|
10689
|
+
}
|
|
10690
|
+
if (ch === "(") {
|
|
10691
|
+
i++;
|
|
10692
|
+
const list2 = [];
|
|
10693
|
+
for (; ; ) {
|
|
10694
|
+
skip();
|
|
10695
|
+
if (text3[i] === ")") {
|
|
10696
|
+
i++;
|
|
10697
|
+
return list2;
|
|
10698
|
+
}
|
|
10699
|
+
list2.push(value());
|
|
10700
|
+
skip();
|
|
10701
|
+
if (text3[i] === ",") i++;
|
|
10702
|
+
else if (text3[i] !== ")") fail("expected , or )");
|
|
10703
|
+
}
|
|
10704
|
+
}
|
|
10705
|
+
if (ch === '"') return quoted();
|
|
10706
|
+
const start = i;
|
|
10707
|
+
while (i < text3.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text3[i])) i++;
|
|
10708
|
+
if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
|
|
10709
|
+
return text3.slice(start, i);
|
|
10710
|
+
};
|
|
10711
|
+
if (text3.startsWith("// !$*UTF8*$!")) i = text3.indexOf("\n") + 1;
|
|
10712
|
+
const root = value();
|
|
10713
|
+
skip();
|
|
10714
|
+
if (i !== text3.length) fail("trailing content");
|
|
10715
|
+
return root;
|
|
10716
|
+
}
|
|
10717
|
+
var isDict, str2, list;
|
|
10718
|
+
var init_openstep_plist = __esm({
|
|
10719
|
+
"src/openstep-plist.ts"() {
|
|
10720
|
+
"use strict";
|
|
10721
|
+
isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10722
|
+
str2 = (value) => typeof value === "string" ? value : void 0;
|
|
10723
|
+
list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
10724
|
+
}
|
|
10725
|
+
});
|
|
10726
|
+
|
|
10727
|
+
// src/pod-sources.ts
|
|
10728
|
+
var COCOAPODS_VERSION, USER_AGENT, HEADER_EXTENSIONS, SOURCE_EXTENSIONS, SOURCE_FILES_PATTERN;
|
|
10729
|
+
var init_pod_sources = __esm({
|
|
10730
|
+
"src/pod-sources.ts"() {
|
|
10731
|
+
"use strict";
|
|
10732
|
+
init_home_paths();
|
|
10733
|
+
COCOAPODS_VERSION = "1.17.0";
|
|
10734
|
+
USER_AGENT = `'CocoaPods/${COCOAPODS_VERSION} cocoapods-downloader/2.1'`;
|
|
10735
|
+
HEADER_EXTENSIONS = [
|
|
10736
|
+
".h",
|
|
10737
|
+
".hh",
|
|
10738
|
+
".hpp",
|
|
10739
|
+
".ipp",
|
|
10740
|
+
".tpp",
|
|
10741
|
+
".hxx",
|
|
10742
|
+
".def",
|
|
10743
|
+
".inl",
|
|
10744
|
+
".inc"
|
|
10745
|
+
];
|
|
10746
|
+
SOURCE_EXTENSIONS = [
|
|
10747
|
+
".m",
|
|
10748
|
+
".mm",
|
|
10749
|
+
".i",
|
|
10750
|
+
".c",
|
|
10751
|
+
".cc",
|
|
10752
|
+
".cxx",
|
|
10753
|
+
".cpp",
|
|
10754
|
+
".c++",
|
|
10755
|
+
".swift",
|
|
10756
|
+
...HEADER_EXTENSIONS
|
|
10757
|
+
];
|
|
10758
|
+
SOURCE_FILES_PATTERN = `*{${SOURCE_EXTENSIONS.join(",")}}`;
|
|
10759
|
+
}
|
|
10760
|
+
});
|
|
10761
|
+
|
|
10762
|
+
// src/cocoapods-trunk.ts
|
|
10763
|
+
var init_cocoapods_trunk = __esm({
|
|
10764
|
+
"src/cocoapods-trunk.ts"() {
|
|
10765
|
+
"use strict";
|
|
10766
|
+
init_home_paths();
|
|
10767
|
+
}
|
|
10768
|
+
});
|
|
10769
|
+
|
|
10616
10770
|
// src/plist.ts
|
|
10617
10771
|
function parsePlistSource(source) {
|
|
10618
10772
|
return import_plist.default.parse(source);
|
|
@@ -10625,6 +10779,16 @@ var init_plist = __esm({
|
|
|
10625
10779
|
}
|
|
10626
10780
|
});
|
|
10627
10781
|
|
|
10782
|
+
// src/plist-bytes.ts
|
|
10783
|
+
var import_bplist_parser;
|
|
10784
|
+
var init_plist_bytes = __esm({
|
|
10785
|
+
"src/plist-bytes.ts"() {
|
|
10786
|
+
"use strict";
|
|
10787
|
+
import_bplist_parser = __toESM(require("bplist-parser"), 1);
|
|
10788
|
+
init_plist();
|
|
10789
|
+
}
|
|
10790
|
+
});
|
|
10791
|
+
|
|
10628
10792
|
// src/bazel-project.ts
|
|
10629
10793
|
function isBazelPackage(input) {
|
|
10630
10794
|
return /^BUILD(?:\.bazel)?$/.test(import_node_path20.default.basename(input)) && import_node_fs20.default.statSync(input).isFile();
|
|
@@ -11237,7 +11401,7 @@ ${published.map(
|
|
|
11237
11401
|
const contents = new Map([
|
|
11238
11402
|
[
|
|
11239
11403
|
"Info.plist",
|
|
11240
|
-
|
|
11404
|
+
import_plist3.default.build({
|
|
11241
11405
|
AvailableLibraries: [
|
|
11242
11406
|
{
|
|
11243
11407
|
LibraryIdentifier: "ios-arm64-simulator",
|
|
@@ -11317,7 +11481,7 @@ ${published.map(
|
|
|
11317
11481
|
const infoPlistReady = infoPlistFiles.every((file) => import_node_fs20.default.existsSync(file));
|
|
11318
11482
|
const info = {};
|
|
11319
11483
|
for (const file of infoPlistReady ? infoPlistFiles : []) {
|
|
11320
|
-
const fragment =
|
|
11484
|
+
const fragment = import_plist3.default.parse(import_node_fs20.default.readFileSync(file, "utf8"));
|
|
11321
11485
|
if (!fragment || typeof fragment !== "object" || Array.isArray(fragment) || fragment instanceof Date || Buffer.isBuffer(fragment))
|
|
11322
11486
|
throw new Error(`${file} is not a plist dictionary`);
|
|
11323
11487
|
for (const [key, value] of Object.entries(fragment)) {
|
|
@@ -11386,7 +11550,7 @@ ${published.map(
|
|
|
11386
11550
|
rootDir: root,
|
|
11387
11551
|
projectFiles: buildFiles.sort(),
|
|
11388
11552
|
projectDirs: [root],
|
|
11389
|
-
infoPlist: infoPlistReady ?
|
|
11553
|
+
infoPlist: infoPlistReady ? import_plist3.default.build(info) : null,
|
|
11390
11554
|
infoPlistFile: null,
|
|
11391
11555
|
postBundleScripts: [],
|
|
11392
11556
|
appIconName: "",
|
|
@@ -11438,7 +11602,7 @@ function shellTokens(options) {
|
|
|
11438
11602
|
return words;
|
|
11439
11603
|
});
|
|
11440
11604
|
}
|
|
11441
|
-
var import_node_child_process9, import_node_crypto9, import_node_fs20, import_node_os6, import_node_path20,
|
|
11605
|
+
var import_node_child_process9, import_node_crypto9, import_node_fs20, import_node_os6, import_node_path20, import_plist3, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER, PRODUCTS, graphs, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
|
|
11442
11606
|
var init_bazel_project = __esm({
|
|
11443
11607
|
"src/bazel-project.ts"() {
|
|
11444
11608
|
"use strict";
|
|
@@ -11447,7 +11611,7 @@ var init_bazel_project = __esm({
|
|
|
11447
11611
|
import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
11448
11612
|
import_node_os6 = __toESM(require("node:os"), 1);
|
|
11449
11613
|
import_node_path20 = __toESM(require("node:path"), 1);
|
|
11450
|
-
|
|
11614
|
+
import_plist3 = __toESM(require("plist"), 1);
|
|
11451
11615
|
init_is_record();
|
|
11452
11616
|
LIBRARY_RULES = /* @__PURE__ */ new Set(["swift_library", "objc_library", "cc_library"]);
|
|
11453
11617
|
QUERIED_RULES = [
|
|
@@ -12136,107 +12300,6 @@ var init_nativeAppIconContract = __esm({
|
|
|
12136
12300
|
}
|
|
12137
12301
|
});
|
|
12138
12302
|
|
|
12139
|
-
// src/openstep-plist.ts
|
|
12140
|
-
function parseOpenStepPlist(text3) {
|
|
12141
|
-
let i = 0;
|
|
12142
|
-
const fail = (message) => {
|
|
12143
|
-
const line = text3.slice(0, i).split("\n").length;
|
|
12144
|
-
throw new Error(`project.pbxproj line ${line}: ${message}`);
|
|
12145
|
-
};
|
|
12146
|
-
const skip = () => {
|
|
12147
|
-
for (; ; ) {
|
|
12148
|
-
const ch = text3[i];
|
|
12149
|
-
if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
|
|
12150
|
-
else if (ch === "/" && text3[i + 1] === "*") {
|
|
12151
|
-
const end = text3.indexOf("*/", i + 2);
|
|
12152
|
-
if (end < 0) fail("unterminated comment");
|
|
12153
|
-
i = end + 2;
|
|
12154
|
-
} else if (ch === "/" && text3[i + 1] === "/") {
|
|
12155
|
-
const end = text3.indexOf("\n", i);
|
|
12156
|
-
i = end < 0 ? text3.length : end + 1;
|
|
12157
|
-
} else return;
|
|
12158
|
-
}
|
|
12159
|
-
};
|
|
12160
|
-
const quoted = () => {
|
|
12161
|
-
i++;
|
|
12162
|
-
let out = "";
|
|
12163
|
-
for (; ; ) {
|
|
12164
|
-
const ch = text3[i++];
|
|
12165
|
-
if (ch === void 0) fail("unterminated string");
|
|
12166
|
-
if (ch === '"') return out;
|
|
12167
|
-
if (ch !== "\\") {
|
|
12168
|
-
out += ch;
|
|
12169
|
-
continue;
|
|
12170
|
-
}
|
|
12171
|
-
const next = text3[i++];
|
|
12172
|
-
if (next === "n") out += "\n";
|
|
12173
|
-
else if (next === "t") out += " ";
|
|
12174
|
-
else if (next === "r") out += "\r";
|
|
12175
|
-
else if (next === "U") {
|
|
12176
|
-
out += String.fromCharCode(parseInt(text3.slice(i, i + 4), 16));
|
|
12177
|
-
i += 4;
|
|
12178
|
-
} else out += next;
|
|
12179
|
-
}
|
|
12180
|
-
};
|
|
12181
|
-
const value = () => {
|
|
12182
|
-
skip();
|
|
12183
|
-
const ch = text3[i];
|
|
12184
|
-
if (ch === "{") {
|
|
12185
|
-
i++;
|
|
12186
|
-
const dict = {};
|
|
12187
|
-
for (; ; ) {
|
|
12188
|
-
skip();
|
|
12189
|
-
if (text3[i] === "}") {
|
|
12190
|
-
i++;
|
|
12191
|
-
return dict;
|
|
12192
|
-
}
|
|
12193
|
-
const key = value();
|
|
12194
|
-
if (typeof key !== "string") fail("dictionary key is not a string");
|
|
12195
|
-
skip();
|
|
12196
|
-
if (text3[i++] !== "=") fail("expected =");
|
|
12197
|
-
if (Object.hasOwn(dict, key)) fail(`duplicate key ${key}`);
|
|
12198
|
-
dict[key] = value();
|
|
12199
|
-
skip();
|
|
12200
|
-
if (text3[i++] !== ";") fail("expected ;");
|
|
12201
|
-
}
|
|
12202
|
-
}
|
|
12203
|
-
if (ch === "(") {
|
|
12204
|
-
i++;
|
|
12205
|
-
const list2 = [];
|
|
12206
|
-
for (; ; ) {
|
|
12207
|
-
skip();
|
|
12208
|
-
if (text3[i] === ")") {
|
|
12209
|
-
i++;
|
|
12210
|
-
return list2;
|
|
12211
|
-
}
|
|
12212
|
-
list2.push(value());
|
|
12213
|
-
skip();
|
|
12214
|
-
if (text3[i] === ",") i++;
|
|
12215
|
-
else if (text3[i] !== ")") fail("expected , or )");
|
|
12216
|
-
}
|
|
12217
|
-
}
|
|
12218
|
-
if (ch === '"') return quoted();
|
|
12219
|
-
const start = i;
|
|
12220
|
-
while (i < text3.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text3[i])) i++;
|
|
12221
|
-
if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
|
|
12222
|
-
return text3.slice(start, i);
|
|
12223
|
-
};
|
|
12224
|
-
if (text3.startsWith("// !$*UTF8*$!")) i = text3.indexOf("\n") + 1;
|
|
12225
|
-
const root = value();
|
|
12226
|
-
skip();
|
|
12227
|
-
if (i !== text3.length) fail("trailing content");
|
|
12228
|
-
return root;
|
|
12229
|
-
}
|
|
12230
|
-
var isDict, str2, list;
|
|
12231
|
-
var init_openstep_plist = __esm({
|
|
12232
|
-
"src/openstep-plist.ts"() {
|
|
12233
|
-
"use strict";
|
|
12234
|
-
isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12235
|
-
str2 = (value) => typeof value === "string" ? value : void 0;
|
|
12236
|
-
list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
12237
|
-
}
|
|
12238
|
-
});
|
|
12239
|
-
|
|
12240
12303
|
// src/xcode-target-members.ts
|
|
12241
12304
|
function groupParentsOf(objects) {
|
|
12242
12305
|
let parents = groupParents.get(objects);
|
|
@@ -13985,7 +14048,7 @@ var init_swift_compile = __esm({
|
|
|
13985
14048
|
FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
13986
14049
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
13987
14050
|
).join("");
|
|
13988
|
-
compilerSourceDigest = true ? "
|
|
14051
|
+
compilerSourceDigest = true ? "da253e49615973dfc65a40000574546cbf7dc4c9d44a36295773bd33442d8c1d" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
13989
14052
|
C_WORDS = new Set(
|
|
13990
14053
|
"auto bool break case char const continue default do double else enum extern false float for goto if inline int long register restrict return short signed sizeof static struct switch true typedef union unsigned void volatile while YES NO NULL nil Nil id self super instancetype".split(
|
|
13991
14054
|
" "
|
|
@@ -15294,7 +15357,7 @@ ${output2}`
|
|
|
15294
15357
|
if (process.platform !== "darwin") {
|
|
15295
15358
|
let launchName = settings("INFOPLIST_KEY_UILaunchStoryboardName");
|
|
15296
15359
|
if (!launchName && infoPlistOutput && import_node_fs23.default.existsSync(infoPlistOutput)) {
|
|
15297
|
-
const info =
|
|
15360
|
+
const info = import_plist4.default.parse(import_node_fs23.default.readFileSync(infoPlistOutput, "utf8"));
|
|
15298
15361
|
const declared = isRecord(info) ? info.UILaunchStoryboardName : void 0;
|
|
15299
15362
|
if (typeof declared === "string") launchName = expand(declared, settings);
|
|
15300
15363
|
}
|
|
@@ -16397,9 +16460,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16397
16460
|
path: bundlePath,
|
|
16398
16461
|
...product ? {
|
|
16399
16462
|
resources: product.module.resources,
|
|
16400
|
-
infoPlist:
|
|
16463
|
+
infoPlist: import_plist4.default.build(
|
|
16401
16464
|
expandValue(
|
|
16402
|
-
|
|
16465
|
+
import_plist4.default.parse(import_node_fs23.default.readFileSync(infoFile, "utf8")),
|
|
16403
16466
|
product.settings
|
|
16404
16467
|
)
|
|
16405
16468
|
)
|
|
@@ -16414,7 +16477,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16414
16477
|
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path25.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
16415
16478
|
const entitlementsFile = settings("CODE_SIGN_ENTITLEMENTS") ? import_node_path25.default.resolve(app.project.projectDir, settings("CODE_SIGN_ENTITLEMENTS")) : null;
|
|
16416
16479
|
const infoPlistPending = module2.generatedInfoPlist && !options.prepareGeneratedSources;
|
|
16417
|
-
const sourceInfo = infoPlistFile && !infoPlistPending ?
|
|
16480
|
+
const sourceInfo = infoPlistFile && !infoPlistPending ? import_plist4.default.parse(import_node_fs23.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
16418
16481
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
16419
16482
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
16420
16483
|
}
|
|
@@ -16439,7 +16502,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16439
16502
|
}
|
|
16440
16503
|
const bundleIdentifier = settings("PRODUCT_BUNDLE_IDENTIFIER") || (typeof info.CFBundleIdentifier === "string" ? info.CFBundleIdentifier : "");
|
|
16441
16504
|
const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
|
|
16442
|
-
|
|
16505
|
+
import_plist4.default.parse(import_node_fs23.default.readFileSync(entitlementsFile, "utf8")),
|
|
16443
16506
|
(value) => expand(value, (key) => {
|
|
16444
16507
|
if (key === "AppIdentifierPrefix") return "FAKETEAMID.";
|
|
16445
16508
|
if (key === "TeamIdentifierPrefix") return "";
|
|
@@ -16771,7 +16834,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16771
16834
|
].sort(),
|
|
16772
16835
|
projectDirs: [...new Set(used.map((project) => project.projectDir))].sort(),
|
|
16773
16836
|
appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
|
|
16774
|
-
infoPlist: infoPlistPending ? null :
|
|
16837
|
+
infoPlist: infoPlistPending ? null : import_plist4.default.build(info),
|
|
16775
16838
|
infoPlistFile,
|
|
16776
16839
|
...keychainAccessGroups === void 0 ? {} : { keychainAccessGroups },
|
|
16777
16840
|
postBundleScripts,
|
|
@@ -16793,7 +16856,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16793
16856
|
cocoapods
|
|
16794
16857
|
};
|
|
16795
16858
|
}
|
|
16796
|
-
var import_node_child_process13, import_node_crypto11, import_node_fs23, import_node_path25,
|
|
16859
|
+
var import_node_child_process13, import_node_crypto11, import_node_fs23, import_node_path25, import_plist4, XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET, runScriptTimeoutMs, CXX_STANDARD_ALIASES, PRE_CXX20_STANDARDS, APPLICATION, APP_EXTENSION, RESOURCE_BUNDLE, PRODUCT_MACH_O_TYPES, FRAMEWORK_PRODUCTS, HEADER_FILE, MODULE_PRODUCTS, CONDITIONS, isDirectory, loaded2, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
|
|
16797
16860
|
var init_xcode_project = __esm({
|
|
16798
16861
|
"src/xcode-project.ts"() {
|
|
16799
16862
|
"use strict";
|
|
@@ -16801,7 +16864,7 @@ var init_xcode_project = __esm({
|
|
|
16801
16864
|
import_node_crypto11 = require("node:crypto");
|
|
16802
16865
|
import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
16803
16866
|
import_node_path25 = __toESM(require("node:path"), 1);
|
|
16804
|
-
|
|
16867
|
+
import_plist4 = __toESM(require("plist"), 1);
|
|
16805
16868
|
init_bazel_project();
|
|
16806
16869
|
init_ios_sdk_frameworks();
|
|
16807
16870
|
init_is_record();
|
|
@@ -17241,16 +17304,6 @@ var init_nitroContract = __esm({
|
|
|
17241
17304
|
}
|
|
17242
17305
|
});
|
|
17243
17306
|
|
|
17244
|
-
// src/plist-bytes.ts
|
|
17245
|
-
var import_bplist_parser;
|
|
17246
|
-
var init_plist_bytes = __esm({
|
|
17247
|
-
"src/plist-bytes.ts"() {
|
|
17248
|
-
"use strict";
|
|
17249
|
-
import_bplist_parser = __toESM(require("bplist-parser"), 1);
|
|
17250
|
-
init_plist();
|
|
17251
|
-
}
|
|
17252
|
-
});
|
|
17253
|
-
|
|
17254
17307
|
// src/swift-xcframework.ts
|
|
17255
17308
|
var init_swift_xcframework = __esm({
|
|
17256
17309
|
"src/swift-xcframework.ts"() {
|
|
@@ -17504,7 +17557,7 @@ var init_react_native_core = __esm({
|
|
|
17504
17557
|
init_swift_distribution();
|
|
17505
17558
|
init_swift_package();
|
|
17506
17559
|
init_swiftContract();
|
|
17507
|
-
recipe = true ? "
|
|
17560
|
+
recipe = true ? "f850b012b3ddd1d19a158d194b24b05cb032a23ccf2e459caa45620c0a5a823a" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
|
|
17508
17561
|
}
|
|
17509
17562
|
});
|
|
17510
17563
|
|
|
@@ -17514,6 +17567,7 @@ var init_bundleAssets = __esm({
|
|
|
17514
17567
|
"../sootsim-swift/src/bundleAssets.ts"() {
|
|
17515
17568
|
"use strict";
|
|
17516
17569
|
import_svgpath = __toESM(require("svgpath"), 1);
|
|
17570
|
+
init_mapLimit();
|
|
17517
17571
|
init_assetCatalogContract();
|
|
17518
17572
|
init_swiftContract();
|
|
17519
17573
|
SYMBOL_CAP_HEIGHT_EM = 1443 / 2048;
|
|
@@ -17548,8 +17602,18 @@ var init_core_data_model = __esm({
|
|
|
17548
17602
|
}
|
|
17549
17603
|
});
|
|
17550
17604
|
|
|
17551
|
-
// src/swift-
|
|
17552
|
-
var
|
|
17605
|
+
// src/swift-catalog-png.ts
|
|
17606
|
+
var import_pngjs, pngSignature;
|
|
17607
|
+
var init_swift_catalog_png = __esm({
|
|
17608
|
+
"src/swift-catalog-png.ts"() {
|
|
17609
|
+
"use strict";
|
|
17610
|
+
import_pngjs = require("pngjs");
|
|
17611
|
+
pngSignature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
17612
|
+
}
|
|
17613
|
+
});
|
|
17614
|
+
|
|
17615
|
+
// src/swift-cxx-reachable.ts
|
|
17616
|
+
var init_swift_cxx_reachable = __esm({
|
|
17553
17617
|
"src/swift-cxx-reachable.ts"() {
|
|
17554
17618
|
"use strict";
|
|
17555
17619
|
init_is_record();
|
|
@@ -17622,6 +17686,7 @@ var init_swift_host = __esm({
|
|
|
17622
17686
|
init_plist();
|
|
17623
17687
|
init_prepared_xcode_phases();
|
|
17624
17688
|
init_swift_binary_modules();
|
|
17689
|
+
init_swift_catalog_png();
|
|
17625
17690
|
init_swift_compile();
|
|
17626
17691
|
init_xcode_assets();
|
|
17627
17692
|
init_swift_cxx_reachable();
|
|
@@ -17647,14 +17712,6 @@ var init_swift_host = __esm({
|
|
|
17647
17712
|
}
|
|
17648
17713
|
});
|
|
17649
17714
|
|
|
17650
|
-
// src/cocoapods-trunk.ts
|
|
17651
|
-
var init_cocoapods_trunk = __esm({
|
|
17652
|
-
"src/cocoapods-trunk.ts"() {
|
|
17653
|
-
"use strict";
|
|
17654
|
-
init_home_paths();
|
|
17655
|
-
}
|
|
17656
|
-
});
|
|
17657
|
-
|
|
17658
17715
|
// src/installed-native-libraries.ts
|
|
17659
17716
|
var init_installed_native_libraries = __esm({
|
|
17660
17717
|
"src/installed-native-libraries.ts"() {
|
|
@@ -17683,15 +17740,12 @@ var init_turbo_codegen_intake = __esm({
|
|
|
17683
17740
|
});
|
|
17684
17741
|
|
|
17685
17742
|
// src/turbo-source.ts
|
|
17686
|
-
var import_node_child_process17, import_node_util8, execFileAsync3;
|
|
17687
17743
|
var init_turbo_source = __esm({
|
|
17688
17744
|
"src/turbo-source.ts"() {
|
|
17689
17745
|
"use strict";
|
|
17690
|
-
import_node_child_process17 = require("node:child_process");
|
|
17691
|
-
import_node_util8 = require("node:util");
|
|
17692
17746
|
init_cocoapods_trunk();
|
|
17693
|
-
init_home_paths();
|
|
17694
17747
|
init_installed_native_libraries();
|
|
17748
|
+
init_pod_sources();
|
|
17695
17749
|
init_answeredNativePackages();
|
|
17696
17750
|
init_expo_autolinking();
|
|
17697
17751
|
init_nitro_dependencies();
|
|
@@ -17702,7 +17756,6 @@ var init_turbo_source = __esm({
|
|
|
17702
17756
|
init_swiftContract();
|
|
17703
17757
|
init_turbo_codegen_intake();
|
|
17704
17758
|
init_xcode_project();
|
|
17705
|
-
execFileAsync3 = (0, import_node_util8.promisify)(import_node_child_process17.execFile);
|
|
17706
17759
|
}
|
|
17707
17760
|
});
|
|
17708
17761
|
|
|
@@ -23766,7 +23819,7 @@ init_answeredNativePackages();
|
|
|
23766
23819
|
init_expo_autolinking();
|
|
23767
23820
|
|
|
23768
23821
|
// src/expo-native-prebuilt.ts
|
|
23769
|
-
var
|
|
23822
|
+
var import_plist7 = __toESM(require("plist"), 1);
|
|
23770
23823
|
init_answeredNativePackages();
|
|
23771
23824
|
|
|
23772
23825
|
// src/expo-native-compiler-digest.ts
|
|
@@ -23801,246 +23854,3345 @@ init_bundle_global_footer();
|
|
|
23801
23854
|
init_is_record();
|
|
23802
23855
|
init_swiftContract();
|
|
23803
23856
|
|
|
23804
|
-
// src/
|
|
23805
|
-
|
|
23857
|
+
// src/pods-install.ts
|
|
23858
|
+
init_openstep_plist();
|
|
23859
|
+
|
|
23860
|
+
// src/pbx-table.ts
|
|
23861
|
+
init_openstep_plist();
|
|
23862
|
+
var ARRAY_SETTINGS = /* @__PURE__ */ new Set([
|
|
23863
|
+
"ALTERNATE_PERMISSIONS_FILES",
|
|
23864
|
+
"ARCHS",
|
|
23865
|
+
"BUILD_VARIANTS",
|
|
23866
|
+
"EXCLUDED_SOURCE_FILE_NAMES",
|
|
23867
|
+
"FRAMEWORK_SEARCH_PATHS",
|
|
23868
|
+
"GCC_PREPROCESSOR_DEFINITIONS",
|
|
23869
|
+
"GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS",
|
|
23870
|
+
"HEADER_SEARCH_PATHS",
|
|
23871
|
+
"INCLUDED_SOURCE_FILE_NAMES",
|
|
23872
|
+
"INFOPLIST_PREPROCESSOR_DEFINITIONS",
|
|
23873
|
+
"LD_RUNPATH_SEARCH_PATHS",
|
|
23874
|
+
"LIBRARY_SEARCH_PATHS",
|
|
23875
|
+
"LOCALIZED_STRING_MACRO_NAMES",
|
|
23876
|
+
"OTHER_CFLAGS",
|
|
23877
|
+
"OTHER_CPLUSPLUSFLAGS",
|
|
23878
|
+
"OTHER_LDFLAGS",
|
|
23879
|
+
"REZ_SEARCH_PATHS",
|
|
23880
|
+
"SECTORDER_FLAGS",
|
|
23881
|
+
"SYSTEM_FRAMEWORK_SEARCH_PATHS",
|
|
23882
|
+
"SYSTEM_HEADER_SEARCH_PATHS",
|
|
23883
|
+
"USER_HEADER_SEARCH_PATHS",
|
|
23884
|
+
"WARNING_CFLAGS",
|
|
23885
|
+
"WARNING_LDFLAGS"
|
|
23886
|
+
]);
|
|
23887
|
+
var LEGACY_ARRAY_SETTINGS = new Set(
|
|
23888
|
+
[...ARRAY_SETTINGS].filter(
|
|
23889
|
+
(key) => ![
|
|
23890
|
+
"INCLUDED_SOURCE_FILE_NAMES",
|
|
23891
|
+
"LD_RUNPATH_SEARCH_PATHS",
|
|
23892
|
+
"LOCALIZED_STRING_MACRO_NAMES",
|
|
23893
|
+
"SYSTEM_FRAMEWORK_SEARCH_PATHS",
|
|
23894
|
+
"SYSTEM_HEADER_SEARCH_PATHS",
|
|
23895
|
+
"USER_HEADER_SEARCH_PATHS"
|
|
23896
|
+
].includes(key)
|
|
23897
|
+
)
|
|
23898
|
+
);
|
|
23806
23899
|
|
|
23807
|
-
// src/
|
|
23808
|
-
|
|
23900
|
+
// src/pods-install.ts
|
|
23901
|
+
init_pod_sources();
|
|
23809
23902
|
|
|
23810
|
-
// src/
|
|
23811
|
-
|
|
23812
|
-
|
|
23813
|
-
|
|
23814
|
-
|
|
23815
|
-
|
|
23816
|
-
|
|
23817
|
-
|
|
23818
|
-
|
|
23819
|
-
|
|
23820
|
-
|
|
23821
|
-
|
|
23822
|
-
|
|
23823
|
-
|
|
23824
|
-
|
|
23825
|
-
|
|
23826
|
-
|
|
23827
|
-
|
|
23828
|
-
|
|
23829
|
-
|
|
23830
|
-
|
|
23831
|
-
|
|
23832
|
-
|
|
23833
|
-
|
|
23834
|
-
|
|
23835
|
-
|
|
23836
|
-
|
|
23837
|
-
|
|
23838
|
-
|
|
23839
|
-
|
|
23840
|
-
|
|
23841
|
-
|
|
23842
|
-
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
|
|
23847
|
-
|
|
23848
|
-
|
|
23849
|
-
|
|
23850
|
-
|
|
23851
|
-
|
|
23852
|
-
}
|
|
23853
|
-
|
|
23854
|
-
|
|
23855
|
-
|
|
23856
|
-
|
|
23857
|
-
|
|
23858
|
-
|
|
23859
|
-
|
|
23860
|
-
|
|
23861
|
-
|
|
23862
|
-
|
|
23863
|
-
|
|
23864
|
-
|
|
23865
|
-
|
|
23866
|
-
|
|
23867
|
-
)
|
|
23868
|
-
|
|
23869
|
-
|
|
23870
|
-
|
|
23871
|
-
|
|
23872
|
-
|
|
23873
|
-
|
|
23874
|
-
|
|
23875
|
-
|
|
23876
|
-
|
|
23877
|
-
|
|
23878
|
-
|
|
23879
|
-
|
|
23880
|
-
|
|
23881
|
-
|
|
23882
|
-
|
|
23883
|
-
|
|
23884
|
-
|
|
23885
|
-
|
|
23886
|
-
|
|
23887
|
-
|
|
23888
|
-
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
|
|
23892
|
-
|
|
23893
|
-
|
|
23894
|
-
|
|
23895
|
-
|
|
23896
|
-
|
|
23897
|
-
|
|
23898
|
-
|
|
23899
|
-
|
|
23900
|
-
|
|
23901
|
-
|
|
23902
|
-
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
|
|
23906
|
-
|
|
23907
|
-
|
|
23908
|
-
|
|
23909
|
-
|
|
23910
|
-
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23915
|
-
|
|
23916
|
-
|
|
23917
|
-
|
|
23918
|
-
|
|
23919
|
-
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
|
|
23926
|
-
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
|
|
23930
|
-
|
|
23931
|
-
|
|
23932
|
-
|
|
23933
|
-
|
|
23934
|
-
|
|
23935
|
-
|
|
23936
|
-
|
|
23937
|
-
|
|
23938
|
-
|
|
23939
|
-
|
|
23940
|
-
|
|
23941
|
-
|
|
23942
|
-
|
|
23943
|
-
|
|
23944
|
-
|
|
23945
|
-
|
|
23946
|
-
|
|
23947
|
-
|
|
23948
|
-
|
|
23949
|
-
|
|
23950
|
-
|
|
23951
|
-
|
|
23952
|
-
|
|
23953
|
-
|
|
23954
|
-
|
|
23955
|
-
|
|
23956
|
-
|
|
23957
|
-
|
|
23958
|
-
|
|
23959
|
-
|
|
23960
|
-
|
|
23961
|
-
|
|
23962
|
-
|
|
23963
|
-
|
|
23964
|
-
|
|
23965
|
-
|
|
23966
|
-
|
|
23967
|
-
|
|
23968
|
-
|
|
23969
|
-
|
|
23970
|
-
|
|
23971
|
-
|
|
23972
|
-
|
|
23973
|
-
|
|
23974
|
-
if
|
|
23975
|
-
|
|
23976
|
-
|
|
23977
|
-
|
|
23978
|
-
|
|
23979
|
-
|
|
23980
|
-
|
|
23981
|
-
|
|
23982
|
-
|
|
23983
|
-
|
|
23984
|
-
|
|
23985
|
-
|
|
23986
|
-
|
|
23987
|
-
|
|
23988
|
-
|
|
23989
|
-
|
|
23990
|
-
|
|
23991
|
-
|
|
23992
|
-
|
|
23993
|
-
|
|
23994
|
-
|
|
23995
|
-
|
|
23996
|
-
|
|
23997
|
-
|
|
23998
|
-
|
|
23999
|
-
|
|
24000
|
-
|
|
24001
|
-
|
|
24002
|
-
|
|
24003
|
-
|
|
24004
|
-
|
|
24005
|
-
|
|
24006
|
-
|
|
24007
|
-
|
|
24008
|
-
|
|
24009
|
-
|
|
24010
|
-
|
|
24011
|
-
|
|
24012
|
-
|
|
24013
|
-
|
|
24014
|
-
|
|
24015
|
-
|
|
24016
|
-
|
|
24017
|
-
|
|
24018
|
-
|
|
24019
|
-
|
|
24020
|
-
|
|
24021
|
-
|
|
24022
|
-
|
|
24023
|
-
|
|
24024
|
-
|
|
24025
|
-
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
|
|
24029
|
-
|
|
24030
|
-
|
|
24031
|
-
|
|
24032
|
-
|
|
24033
|
-
|
|
24034
|
-
|
|
24035
|
-
|
|
24036
|
-
|
|
24037
|
-
|
|
24038
|
-
|
|
24039
|
-
|
|
24040
|
-
|
|
24041
|
-
|
|
24042
|
-
|
|
24043
|
-
|
|
23903
|
+
// src/podfile-cocoapods.ts
|
|
23904
|
+
init_cocoapods_trunk();
|
|
23905
|
+
init_podspec_cocoapods();
|
|
23906
|
+
init_podspec_ruby();
|
|
23907
|
+
init_podspec_ruby_stdlib();
|
|
23908
|
+
var PODFILE = String.raw`
|
|
23909
|
+
module Pod
|
|
23910
|
+
class BuildType
|
|
23911
|
+
KNOWN_PACKAGING_OPTIONS = { :library => [:static, :dynamic], :framework => [:static, :dynamic] }.freeze
|
|
23912
|
+
attr_reader :packaging, :linkage
|
|
23913
|
+
def initialize(linkage: :static, packaging: :library)
|
|
23914
|
+
raise ArgumentError, "Invalid linkage option #{linkage.inspect}, valid options are #{KNOWN_PACKAGING_OPTIONS[packaging].inspect}" unless KNOWN_PACKAGING_OPTIONS[packaging].include?(linkage)
|
|
23915
|
+
@packaging = packaging
|
|
23916
|
+
@linkage = linkage
|
|
23917
|
+
end
|
|
23918
|
+
def self.dynamic_library; new(:linkage => :dynamic, :packaging => :library); end
|
|
23919
|
+
def self.static_library; new(:linkage => :static, :packaging => :library); end
|
|
23920
|
+
def self.dynamic_framework; new(:linkage => :dynamic, :packaging => :framework); end
|
|
23921
|
+
def self.static_framework; new(:linkage => :static, :packaging => :framework); end
|
|
23922
|
+
def dynamic?; linkage == :dynamic; end
|
|
23923
|
+
def static?; linkage == :static; end
|
|
23924
|
+
def framework?; packaging == :framework; end
|
|
23925
|
+
def library?; packaging == :library; end
|
|
23926
|
+
def dynamic_framework?; dynamic? && framework?; end
|
|
23927
|
+
def dynamic_library?; dynamic? && library?; end
|
|
23928
|
+
def static_framework?; static? && framework?; end
|
|
23929
|
+
def static_library?; static? && library?; end
|
|
23930
|
+
def to_s
|
|
23931
|
+
"#{linkage} #{packaging}"
|
|
23932
|
+
end
|
|
23933
|
+
def to_hash
|
|
23934
|
+
{ :linkage => linkage, :packaging => packaging }
|
|
23935
|
+
end
|
|
23936
|
+
def ==(other)
|
|
23937
|
+
linkage == other.linkage && packaging == other.packaging
|
|
23938
|
+
end
|
|
23939
|
+
end
|
|
23940
|
+
|
|
23941
|
+
class Sandbox
|
|
23942
|
+
attr_reader :root, :stored_podspecs
|
|
23943
|
+
def initialize(root)
|
|
23944
|
+
@root = Pathname.new(root)
|
|
23945
|
+
@stored_podspecs = {}
|
|
23946
|
+
@local_paths = {}
|
|
23947
|
+
end
|
|
23948
|
+
def specifications_root
|
|
23949
|
+
root + 'Local Podspecs'
|
|
23950
|
+
end
|
|
23951
|
+
def specification(name)
|
|
23952
|
+
@stored_podspecs[Specification.root_name(name)]
|
|
23953
|
+
end
|
|
23954
|
+
def store_local_path(name, path, was_absolute = false)
|
|
23955
|
+
@local_paths[Specification.root_name(name)] = [path.dirname, was_absolute]
|
|
23956
|
+
end
|
|
23957
|
+
def local_path(name)
|
|
23958
|
+
@local_paths[Specification.root_name(name)]&.first
|
|
23959
|
+
end
|
|
23960
|
+
def local?(name)
|
|
23961
|
+
@local_paths.key?(Specification.root_name(name))
|
|
23962
|
+
end
|
|
23963
|
+
def development_pods
|
|
23964
|
+
@local_paths.transform_values(&:first)
|
|
23965
|
+
end
|
|
23966
|
+
def store_podspec(name, podspec, _external_source = false, json = false)
|
|
23967
|
+
file_name = json ? "#{name}.podspec.json" : "#{name}.podspec"
|
|
23968
|
+
output_path = specifications_root + file_name
|
|
23969
|
+
spec = case podspec
|
|
23970
|
+
when Specification
|
|
23971
|
+
raise ArgumentError, 'can only store Specification objects as json' unless json
|
|
23972
|
+
# the checksum of the JSON CocoaPods writes to output_path
|
|
23973
|
+
podspec.dup.tap { |stored| stored.instance_variable_set(:@checksum, Digest::SHA1.hexdigest(podspec.to_pretty_json)) }
|
|
23974
|
+
else
|
|
23975
|
+
raise ArgumentError, "Peach stores only evaluated podspecs, not #{podspec.inspect}"
|
|
23976
|
+
end
|
|
23977
|
+
spec.defined_in_file = output_path
|
|
23978
|
+
unless spec.name == name
|
|
23979
|
+
raise Informative, "The name of the given podspec '#{spec.name}' doesn't match the expected one '#{name}'"
|
|
23980
|
+
end
|
|
23981
|
+
@stored_podspecs[spec.name] = spec
|
|
23982
|
+
end
|
|
23983
|
+
end
|
|
23984
|
+
|
|
23985
|
+
class Installer
|
|
23986
|
+
attr_reader :sandbox, :podfile, :lockfile
|
|
23987
|
+
attr_accessor :pod_targets, :aggregate_targets
|
|
23988
|
+
def initialize(sandbox, podfile, lockfile = nil)
|
|
23989
|
+
@sandbox = sandbox
|
|
23990
|
+
@podfile = podfile
|
|
23991
|
+
@lockfile = lockfile
|
|
23992
|
+
@pod_targets = []
|
|
23993
|
+
@aggregate_targets = []
|
|
23994
|
+
end
|
|
23995
|
+
|
|
23996
|
+
private
|
|
23997
|
+
|
|
23998
|
+
def run_podfile_pre_install_hooks
|
|
23999
|
+
podfile.pre_install!(self)
|
|
24000
|
+
end
|
|
24001
|
+
|
|
24002
|
+
def run_podfile_post_install_hooks
|
|
24003
|
+
podfile.post_install!(self)
|
|
24004
|
+
end
|
|
24005
|
+
|
|
24006
|
+
def run_podfile_post_integrate_hooks
|
|
24007
|
+
podfile.post_integrate!(self)
|
|
24008
|
+
end
|
|
24009
|
+
|
|
24010
|
+
# upstream runs plugin hooks and prints warnings here; Peach loads no plugins
|
|
24011
|
+
def perform_post_install_actions
|
|
24012
|
+
end
|
|
24013
|
+
|
|
24014
|
+
# the workspace, deintegration of targets the Podfile dropped and the
|
|
24015
|
+
# override warnings are left out: Peach builds from the projects in memory
|
|
24016
|
+
class UserProjectIntegrator
|
|
24017
|
+
attr_reader :podfile, :sandbox, :installation_root, :targets, :targets_to_integrate, :use_input_output_paths
|
|
24018
|
+
alias use_input_output_paths? use_input_output_paths
|
|
24019
|
+
|
|
24020
|
+
def initialize(podfile, sandbox, installation_root, targets, targets_to_integrate, use_input_output_paths: true)
|
|
24021
|
+
@podfile = podfile
|
|
24022
|
+
@sandbox = sandbox
|
|
24023
|
+
@installation_root = installation_root
|
|
24024
|
+
@targets = targets
|
|
24025
|
+
@targets_to_integrate = targets_to_integrate
|
|
24026
|
+
@use_input_output_paths = use_input_output_paths
|
|
24027
|
+
end
|
|
24028
|
+
|
|
24029
|
+
def integrate!
|
|
24030
|
+
integrate_user_targets
|
|
24031
|
+
save_projects(user_projects_to_integrate)
|
|
24032
|
+
end
|
|
24033
|
+
|
|
24034
|
+
private
|
|
24035
|
+
|
|
24036
|
+
def integrate_user_targets
|
|
24037
|
+
Peach::Pods.integrate_user_targets(targets_to_integrate.sort_by(&:name).map(&:label))
|
|
24038
|
+
end
|
|
24039
|
+
|
|
24040
|
+
def user_projects_to_integrate
|
|
24041
|
+
targets_to_integrate.map(&:user_project).compact.uniq
|
|
24042
|
+
end
|
|
24043
|
+
|
|
24044
|
+
def save_projects(projects)
|
|
24045
|
+
projects.each(&:save)
|
|
24046
|
+
end
|
|
24047
|
+
end
|
|
24048
|
+
end
|
|
24049
|
+
|
|
24050
|
+
class Specification
|
|
24051
|
+
SCRIPT_PHASE_REQUIRED_KEYS = [:name, :script].freeze
|
|
24052
|
+
SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :input_file_lists, :output_file_lists,
|
|
24053
|
+
:show_env_vars_in_log, :execution_position, :dependency_file, :always_out_of_date].freeze
|
|
24054
|
+
EXECUTION_POSITION_KEYS = [:before_compile, :after_compile, :before_headers, :after_headers, :any].freeze
|
|
24055
|
+
ALL_SCRIPT_PHASE_KEYS = (SCRIPT_PHASE_REQUIRED_KEYS + SCRIPT_PHASE_OPTIONAL_KEYS).freeze
|
|
24056
|
+
|
|
24057
|
+
def defined_in_file
|
|
24058
|
+
root? ? @defined_in_file : root.defined_in_file
|
|
24059
|
+
end
|
|
24060
|
+
|
|
24061
|
+
def defined_in_file=(file)
|
|
24062
|
+
raise StandardError, 'Defined in file can be set only for root specs.' unless root?
|
|
24063
|
+
@defined_in_file = file
|
|
24064
|
+
end
|
|
24065
|
+
|
|
24066
|
+
def self.root_name(full_name)
|
|
24067
|
+
if full_name[0] == '/'
|
|
24068
|
+
full_name.split('/', 3).first(2).join('/')
|
|
24069
|
+
else
|
|
24070
|
+
full_name.split('/', 2).first
|
|
24071
|
+
end
|
|
24072
|
+
end
|
|
24073
|
+
|
|
24074
|
+
def self.from_json(json, path = nil)
|
|
24075
|
+
from_hash(JSON.parse(json)).tap { |spec| spec.defined_in_file = path }
|
|
24076
|
+
end
|
|
24077
|
+
|
|
24078
|
+
def ==(other)
|
|
24079
|
+
other.is_a?(self.class) && name == other.name && version == other.version
|
|
24080
|
+
end
|
|
24081
|
+
alias_method :eql?, :==
|
|
24082
|
+
|
|
24083
|
+
def hash
|
|
24084
|
+
(name.hash * 53) ^ version.hash
|
|
24085
|
+
end
|
|
24086
|
+
|
|
24087
|
+
def test_specs
|
|
24088
|
+
subspecs.select(&:test_specification?)
|
|
24089
|
+
end
|
|
24090
|
+
|
|
24091
|
+
def app_specs
|
|
24092
|
+
subspecs.select(&:app_specification?)
|
|
24093
|
+
end
|
|
24094
|
+
|
|
24095
|
+
def recursive_subspecs
|
|
24096
|
+
mapper = lambda do |spec|
|
|
24097
|
+
spec.subspecs.map do |subspec|
|
|
24098
|
+
[subspec, *mapper.call(subspec)]
|
|
24099
|
+
end.flatten
|
|
24100
|
+
end
|
|
24101
|
+
mapper.call(self)
|
|
24102
|
+
end
|
|
24103
|
+
|
|
24104
|
+
def all_dependencies(platform = nil)
|
|
24105
|
+
dependencies(platform) + subspec_dependencies(platform)
|
|
24106
|
+
end
|
|
24107
|
+
|
|
24108
|
+
def subspec_dependencies(platform = nil)
|
|
24109
|
+
specs = if default_subspecs.empty?
|
|
24110
|
+
subspecs.compact.reject(&:non_library_specification?)
|
|
24111
|
+
else
|
|
24112
|
+
default_subspecs.map do |subspec_name|
|
|
24113
|
+
root.subspec_by_name("#{name}/#{subspec_name}")
|
|
24114
|
+
end
|
|
24115
|
+
end
|
|
24116
|
+
if platform
|
|
24117
|
+
specs = specs.select { |s| s.supported_on_platform?(platform) }
|
|
24118
|
+
end
|
|
24119
|
+
specs.map { |s| Dependency.new(s.name, version) }
|
|
24120
|
+
end
|
|
24121
|
+
|
|
24122
|
+
def supported_on_platform?(platform, target = nil)
|
|
24123
|
+
platform = Platform.new(platform, target) unless platform.is_a?(Platform)
|
|
24124
|
+
available_platforms.any? { |available| platform.supports?(available) }
|
|
24125
|
+
end
|
|
24126
|
+
|
|
24127
|
+
def to_pretty_json(*a)
|
|
24128
|
+
JSON.pretty_generate(to_hash, *a) << "\n"
|
|
24129
|
+
end
|
|
24130
|
+
|
|
24131
|
+
def checksum
|
|
24132
|
+
@checksum ||= begin
|
|
24133
|
+
if root?
|
|
24134
|
+
unless defined_in_file.nil?
|
|
24135
|
+
require 'digest'
|
|
24136
|
+
checksum = Digest::SHA1.hexdigest(File.read(defined_in_file))
|
|
24137
|
+
checksum = checksum.encode('UTF-8') if checksum.respond_to?(:encode)
|
|
24138
|
+
checksum
|
|
24139
|
+
end
|
|
24140
|
+
else
|
|
24141
|
+
root.checksum
|
|
24142
|
+
end
|
|
24143
|
+
end
|
|
24144
|
+
end
|
|
24145
|
+
end
|
|
24146
|
+
|
|
24147
|
+
class Podfile
|
|
24148
|
+
class StandardError < ::StandardError; end
|
|
24149
|
+
|
|
24150
|
+
module DSL
|
|
24151
|
+
def install!(installation_method, options = {})
|
|
24152
|
+
unless current_target_definition.root?
|
|
24153
|
+
raise Informative, 'The installation method can only be set at the root level of the Podfile.'
|
|
24154
|
+
end
|
|
24155
|
+
set_hash_value('installation_method', 'name' => installation_method, 'options' => options)
|
|
24156
|
+
end
|
|
24157
|
+
|
|
24158
|
+
# checks the Bundler running CocoaPods; Peach runs neither
|
|
24159
|
+
def ensure_bundler!(version = '>= 0')
|
|
24160
|
+
end
|
|
24161
|
+
|
|
24162
|
+
def pod(name = nil, *requirements)
|
|
24163
|
+
unless name
|
|
24164
|
+
raise StandardError, 'A dependency requires a name.'
|
|
24165
|
+
end
|
|
24166
|
+
if block_given?
|
|
24167
|
+
raise StandardError, "A block was passed to pod #{name}, which is not supported."
|
|
24168
|
+
end
|
|
24169
|
+
current_target_definition.store_pod(name, *requirements)
|
|
24170
|
+
end
|
|
24171
|
+
|
|
24172
|
+
def podspec(options = nil)
|
|
24173
|
+
current_target_definition.store_podspec(options)
|
|
24174
|
+
end
|
|
24175
|
+
|
|
24176
|
+
def target(name, options = nil)
|
|
24177
|
+
if options
|
|
24178
|
+
raise Informative, "Unsupported options #{options} for target #{name}."
|
|
24179
|
+
end
|
|
24180
|
+
parent = current_target_definition
|
|
24181
|
+
definition = TargetDefinition.new(name, parent)
|
|
24182
|
+
self.current_target_definition = definition
|
|
24183
|
+
yield if block_given?
|
|
24184
|
+
ensure
|
|
24185
|
+
self.current_target_definition = parent
|
|
24186
|
+
end
|
|
24187
|
+
|
|
24188
|
+
def script_phase(options)
|
|
24189
|
+
raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?
|
|
24190
|
+
raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?
|
|
24191
|
+
current_target_definition.store_script_phase(options)
|
|
24192
|
+
end
|
|
24193
|
+
|
|
24194
|
+
def abstract_target(name)
|
|
24195
|
+
target(name) do
|
|
24196
|
+
abstract!
|
|
24197
|
+
yield if block_given?
|
|
24198
|
+
end
|
|
24199
|
+
end
|
|
24200
|
+
|
|
24201
|
+
def abstract!(abstract = true)
|
|
24202
|
+
current_target_definition.abstract = abstract
|
|
24203
|
+
end
|
|
24204
|
+
|
|
24205
|
+
def inherit!(inheritance)
|
|
24206
|
+
current_target_definition.inheritance = inheritance
|
|
24207
|
+
end
|
|
24208
|
+
|
|
24209
|
+
def platform(name, target = nil)
|
|
24210
|
+
current_target_definition.set_platform!(name, target)
|
|
24211
|
+
end
|
|
24212
|
+
|
|
24213
|
+
def project(path, build_configurations = {})
|
|
24214
|
+
current_target_definition.user_project_path = path
|
|
24215
|
+
current_target_definition.build_configurations = build_configurations
|
|
24216
|
+
end
|
|
24217
|
+
|
|
24218
|
+
def inhibit_all_warnings!
|
|
24219
|
+
current_target_definition.inhibit_all_warnings = true
|
|
24220
|
+
end
|
|
24221
|
+
|
|
24222
|
+
def use_modular_headers!
|
|
24223
|
+
current_target_definition.use_modular_headers_for_all_pods = true
|
|
24224
|
+
end
|
|
24225
|
+
|
|
24226
|
+
def use_frameworks!(option = true)
|
|
24227
|
+
current_target_definition.use_frameworks!(option)
|
|
24228
|
+
end
|
|
24229
|
+
|
|
24230
|
+
def supports_swift_versions(*requirements)
|
|
24231
|
+
current_target_definition.store_swift_version_requirements(*requirements)
|
|
24232
|
+
end
|
|
24233
|
+
|
|
24234
|
+
def workspace(path)
|
|
24235
|
+
set_hash_value('workspace', path)
|
|
24236
|
+
end
|
|
24237
|
+
|
|
24238
|
+
def generate_bridge_support!
|
|
24239
|
+
set_hash_value('generate_bridge_support', true)
|
|
24240
|
+
end
|
|
24241
|
+
|
|
24242
|
+
def set_arc_compatibility_flag!
|
|
24243
|
+
set_hash_value('set_arc_compatibility_flag', true)
|
|
24244
|
+
end
|
|
24245
|
+
|
|
24246
|
+
def source(source)
|
|
24247
|
+
hash_sources = get_hash_value('sources') || []
|
|
24248
|
+
hash_sources << source
|
|
24249
|
+
set_hash_value('sources', hash_sources.uniq)
|
|
24250
|
+
end
|
|
24251
|
+
|
|
24252
|
+
def plugin(name, options = {})
|
|
24253
|
+
hash_plugins = get_hash_value('plugins') || {}
|
|
24254
|
+
(hash_plugins[name] ||= {}).merge!(options)
|
|
24255
|
+
set_hash_value('plugins', hash_plugins)
|
|
24256
|
+
end
|
|
24257
|
+
|
|
24258
|
+
def pre_install(&block)
|
|
24259
|
+
@pre_install_callback = block
|
|
24260
|
+
end
|
|
24261
|
+
|
|
24262
|
+
def pre_integrate(&block)
|
|
24263
|
+
@pre_integrate_callback = block
|
|
24264
|
+
end
|
|
24265
|
+
|
|
24266
|
+
def post_install(&block)
|
|
24267
|
+
@post_install_callback = block
|
|
24268
|
+
end
|
|
24269
|
+
|
|
24270
|
+
def post_integrate(&block)
|
|
24271
|
+
@post_integrate_callback = block
|
|
24272
|
+
end
|
|
24273
|
+
end
|
|
24274
|
+
|
|
24275
|
+
include DSL
|
|
24276
|
+
|
|
24277
|
+
HASH_KEYS = %w(installation_method workspace sources plugins set_arc_compatibility_flag generate_bridge_support target_definitions).freeze
|
|
24278
|
+
|
|
24279
|
+
attr_accessor :defined_in_file
|
|
24280
|
+
attr_accessor :current_target_definition
|
|
24281
|
+
attr_reader :internal_hash
|
|
24282
|
+
|
|
24283
|
+
def initialize(defined_in_file = nil, internal_hash = {})
|
|
24284
|
+
@defined_in_file = defined_in_file
|
|
24285
|
+
@internal_hash = internal_hash
|
|
24286
|
+
default_target_def = TargetDefinition.new('Pods', self)
|
|
24287
|
+
default_target_def.abstract = true
|
|
24288
|
+
@root_target_definitions = [default_target_def]
|
|
24289
|
+
@current_target_definition = default_target_def
|
|
24290
|
+
end
|
|
24291
|
+
|
|
24292
|
+
def to_s
|
|
24293
|
+
'Podfile'
|
|
24294
|
+
end
|
|
24295
|
+
|
|
24296
|
+
def target_definitions
|
|
24297
|
+
Hash[target_definition_list.map { |td| [td.name, td] }]
|
|
24298
|
+
end
|
|
24299
|
+
|
|
24300
|
+
def target_definition_list
|
|
24301
|
+
root_target_definitions.map { |td| [td, td.recursive_children] }.flatten
|
|
24302
|
+
end
|
|
24303
|
+
|
|
24304
|
+
attr_accessor :root_target_definitions
|
|
24305
|
+
|
|
24306
|
+
def dependencies
|
|
24307
|
+
target_definition_list.map(&:dependencies).flatten.uniq
|
|
24308
|
+
end
|
|
24309
|
+
|
|
24310
|
+
def checksum
|
|
24311
|
+
@checksum ||= Digest::SHA1.hexdigest(File.read(defined_in_file)) unless defined_in_file.nil?
|
|
24312
|
+
end
|
|
24313
|
+
|
|
24314
|
+
def workspace_path
|
|
24315
|
+
path = get_hash_value('workspace')
|
|
24316
|
+
if path
|
|
24317
|
+
if File.extname(path) == '.xcworkspace'
|
|
24318
|
+
path
|
|
24319
|
+
else
|
|
24320
|
+
"#{path}.xcworkspace"
|
|
24321
|
+
end
|
|
24322
|
+
end
|
|
24323
|
+
end
|
|
24324
|
+
|
|
24325
|
+
def generate_bridge_support?
|
|
24326
|
+
get_hash_value('generate_bridge_support')
|
|
24327
|
+
end
|
|
24328
|
+
|
|
24329
|
+
def set_arc_compatibility_flag?
|
|
24330
|
+
get_hash_value('set_arc_compatibility_flag')
|
|
24331
|
+
end
|
|
24332
|
+
|
|
24333
|
+
def installation_method
|
|
24334
|
+
get_hash_value('installation_method', 'name' => 'cocoapods', 'options' => {}).values_at('name', 'options')
|
|
24335
|
+
end
|
|
24336
|
+
|
|
24337
|
+
def sources
|
|
24338
|
+
get_hash_value('sources') || []
|
|
24339
|
+
end
|
|
24340
|
+
|
|
24341
|
+
def plugins
|
|
24342
|
+
get_hash_value('plugins') || {}
|
|
24343
|
+
end
|
|
24344
|
+
|
|
24345
|
+
def to_hash
|
|
24346
|
+
hash = {}
|
|
24347
|
+
hash['target_definitions'] = root_target_definitions.map(&:to_hash)
|
|
24348
|
+
hash.merge!(internal_hash)
|
|
24349
|
+
hash
|
|
24350
|
+
end
|
|
24351
|
+
|
|
24352
|
+
def pre_install!(installer)
|
|
24353
|
+
@pre_install_callback ? @pre_install_callback.call(installer) || true : false
|
|
24354
|
+
end
|
|
24355
|
+
|
|
24356
|
+
def post_install!(installer)
|
|
24357
|
+
@post_install_callback ? @post_install_callback.call(installer) || true : false
|
|
24358
|
+
end
|
|
24359
|
+
|
|
24360
|
+
def post_integrate!(installer)
|
|
24361
|
+
@post_integrate_callback ? @post_integrate_callback.call(installer) || true : false
|
|
24362
|
+
end
|
|
24363
|
+
|
|
24364
|
+
def set_hash_value(key, value)
|
|
24365
|
+
raise StandardError, "Unsupported hash key '#{key}'" unless HASH_KEYS.include?(key)
|
|
24366
|
+
internal_hash[key] = value
|
|
24367
|
+
end
|
|
24368
|
+
|
|
24369
|
+
def get_hash_value(key, default = nil)
|
|
24370
|
+
raise StandardError, "Unsupported hash key '#{key}'" unless HASH_KEYS.include?(key)
|
|
24371
|
+
internal_hash.fetch(key, default)
|
|
24372
|
+
end
|
|
24373
|
+
|
|
24374
|
+
class TargetDefinition
|
|
24375
|
+
attr_reader :parent
|
|
24376
|
+
attr_reader :internal_hash
|
|
24377
|
+
attr_accessor :children
|
|
24378
|
+
|
|
24379
|
+
HASH_KEYS = %w(
|
|
24380
|
+
name platform podspecs exclusive link_with link_with_first_target inhibit_warnings use_modular_headers
|
|
24381
|
+
user_project_path build_configurations project_names dependencies script_phases children
|
|
24382
|
+
configuration_pod_whitelist uses_frameworks swift_version_requirements inheritance abstract swift_version
|
|
24383
|
+
).freeze
|
|
24384
|
+
|
|
24385
|
+
def initialize(name, parent, internal_hash = nil)
|
|
24386
|
+
@internal_hash = internal_hash || {}
|
|
24387
|
+
@parent = parent
|
|
24388
|
+
@children = []
|
|
24389
|
+
@label = nil
|
|
24390
|
+
self.name ||= name
|
|
24391
|
+
if parent.is_a?(TargetDefinition)
|
|
24392
|
+
parent.children << self
|
|
24393
|
+
end
|
|
24394
|
+
end
|
|
24395
|
+
|
|
24396
|
+
def recursive_children
|
|
24397
|
+
(children + children.map(&:recursive_children)).flatten
|
|
24398
|
+
end
|
|
24399
|
+
|
|
24400
|
+
def root?
|
|
24401
|
+
parent.is_a?(Podfile) || parent.nil?
|
|
24402
|
+
end
|
|
24403
|
+
|
|
24404
|
+
def root
|
|
24405
|
+
if root?
|
|
24406
|
+
self
|
|
24407
|
+
else
|
|
24408
|
+
parent.root
|
|
24409
|
+
end
|
|
24410
|
+
end
|
|
24411
|
+
|
|
24412
|
+
def podfile
|
|
24413
|
+
root.parent
|
|
24414
|
+
end
|
|
24415
|
+
|
|
24416
|
+
def dependencies
|
|
24417
|
+
if exclusive?
|
|
24418
|
+
non_inherited_dependencies
|
|
24419
|
+
else
|
|
24420
|
+
non_inherited_dependencies + parent.dependencies
|
|
24421
|
+
end
|
|
24422
|
+
end
|
|
24423
|
+
|
|
24424
|
+
def targets_to_inherit_search_paths
|
|
24425
|
+
return [] unless inheritance == 'search_paths'
|
|
24426
|
+
if root? || !matches_platform?(parent)
|
|
24427
|
+
raise StandardError, "Non-root target definitions (#{label}) need a parent target definition with the same platform."
|
|
24428
|
+
elsif parent.inheritance == 'search_paths'
|
|
24429
|
+
parent.targets_to_inherit_search_paths << parent
|
|
24430
|
+
else
|
|
24431
|
+
[parent]
|
|
24432
|
+
end
|
|
24433
|
+
end
|
|
24434
|
+
|
|
24435
|
+
def non_inherited_dependencies
|
|
24436
|
+
pod_dependencies.concat(podspec_dependencies)
|
|
24437
|
+
end
|
|
24438
|
+
|
|
24439
|
+
def empty?
|
|
24440
|
+
non_inherited_dependencies.empty?
|
|
24441
|
+
end
|
|
24442
|
+
|
|
24443
|
+
def label
|
|
24444
|
+
@label ||= if root? && name == 'Pods'
|
|
24445
|
+
'Pods'
|
|
24446
|
+
elsif exclusive? || parent.nil?
|
|
24447
|
+
"Pods-#{name}"
|
|
24448
|
+
else
|
|
24449
|
+
"#{parent.label}-#{name}"
|
|
24450
|
+
end
|
|
24451
|
+
end
|
|
24452
|
+
|
|
24453
|
+
alias_method :to_s, :label
|
|
24454
|
+
|
|
24455
|
+
def inspect
|
|
24456
|
+
"#<#{self.class} label=#{label}>"
|
|
24457
|
+
end
|
|
24458
|
+
|
|
24459
|
+
def name
|
|
24460
|
+
get_hash_value('name')
|
|
24461
|
+
end
|
|
24462
|
+
|
|
24463
|
+
def name=(name)
|
|
24464
|
+
@label = nil
|
|
24465
|
+
set_hash_value('name', name)
|
|
24466
|
+
end
|
|
24467
|
+
|
|
24468
|
+
def abstract?
|
|
24469
|
+
get_hash_value('abstract', root?)
|
|
24470
|
+
end
|
|
24471
|
+
|
|
24472
|
+
def abstract=(abstract)
|
|
24473
|
+
set_hash_value('abstract', abstract)
|
|
24474
|
+
end
|
|
24475
|
+
|
|
24476
|
+
def swift_version
|
|
24477
|
+
get_hash_value('swift_version')
|
|
24478
|
+
end
|
|
24479
|
+
|
|
24480
|
+
def swift_version=(version)
|
|
24481
|
+
set_hash_value('swift_version', version)
|
|
24482
|
+
end
|
|
24483
|
+
|
|
24484
|
+
def swift_version_requirements
|
|
24485
|
+
get_hash_value('swift_version_requirements')
|
|
24486
|
+
end
|
|
24487
|
+
|
|
24488
|
+
def store_swift_version_requirements(*requirements)
|
|
24489
|
+
set_hash_value('swift_version_requirements', requirements.flatten.map(&:to_s))
|
|
24490
|
+
end
|
|
24491
|
+
|
|
24492
|
+
def inheritance
|
|
24493
|
+
get_hash_value('inheritance', 'complete')
|
|
24494
|
+
end
|
|
24495
|
+
|
|
24496
|
+
def inheritance=(inheritance)
|
|
24497
|
+
inheritance = inheritance.to_s
|
|
24498
|
+
unless %w(none search_paths complete).include?(inheritance)
|
|
24499
|
+
raise Informative, "Unrecognized inheritance option '#{inheritance}' specified for target '#{name}'."
|
|
24500
|
+
end
|
|
24501
|
+
if root?
|
|
24502
|
+
raise Informative, 'Cannot set inheritance for the root target definition.'
|
|
24503
|
+
end
|
|
24504
|
+
if abstract?
|
|
24505
|
+
raise Informative, 'Cannot set inheritance for abstract target definition.'
|
|
24506
|
+
end
|
|
24507
|
+
set_hash_value('inheritance', inheritance)
|
|
24508
|
+
end
|
|
24509
|
+
|
|
24510
|
+
def exclusive?
|
|
24511
|
+
if root?
|
|
24512
|
+
true
|
|
24513
|
+
else
|
|
24514
|
+
!matches_platform?(parent) || (inheritance != 'complete')
|
|
24515
|
+
end
|
|
24516
|
+
end
|
|
24517
|
+
|
|
24518
|
+
def matches_platform?(target_definition)
|
|
24519
|
+
return false unless target_definition
|
|
24520
|
+
return true if target_definition.platform == platform
|
|
24521
|
+
!target_definition.platform && target_definition.abstract?
|
|
24522
|
+
end
|
|
24523
|
+
|
|
24524
|
+
def user_project_path
|
|
24525
|
+
path = get_hash_value('user_project_path')
|
|
24526
|
+
if path
|
|
24527
|
+
Pathname(path).sub_ext('.xcodeproj').to_path
|
|
24528
|
+
else
|
|
24529
|
+
parent.user_project_path unless root?
|
|
24530
|
+
end
|
|
24531
|
+
end
|
|
24532
|
+
|
|
24533
|
+
def user_project_path=(path)
|
|
24534
|
+
set_hash_value('user_project_path', path)
|
|
24535
|
+
end
|
|
24536
|
+
|
|
24537
|
+
def build_configurations
|
|
24538
|
+
if root?
|
|
24539
|
+
get_hash_value('build_configurations')
|
|
24540
|
+
else
|
|
24541
|
+
get_hash_value('build_configurations') || parent.build_configurations
|
|
24542
|
+
end
|
|
24543
|
+
end
|
|
24544
|
+
|
|
24545
|
+
def build_configurations=(hash)
|
|
24546
|
+
set_hash_value('build_configurations', hash) unless hash.empty?
|
|
24547
|
+
end
|
|
24548
|
+
|
|
24549
|
+
def script_phases
|
|
24550
|
+
script_phases_hashes = get_hash_value('script_phases', [])
|
|
24551
|
+
script_phases_hashes.map do |script_phase_hash|
|
|
24552
|
+
Specification.convert_keys_to_symbol(script_phase_hash)
|
|
24553
|
+
end
|
|
24554
|
+
end
|
|
24555
|
+
|
|
24556
|
+
def project_name_for_pod(pod_name)
|
|
24557
|
+
if root?
|
|
24558
|
+
raw_project_names_hash[pod_name]
|
|
24559
|
+
else
|
|
24560
|
+
raw_project_names_hash[pod_name] || parent.project_name_for_pod(pod_name)
|
|
24561
|
+
end
|
|
24562
|
+
end
|
|
24563
|
+
|
|
24564
|
+
def inhibits_warnings_for_pod?(pod_name)
|
|
24565
|
+
if Array(inhibit_warnings_hash['not_for_pods']).include?(pod_name)
|
|
24566
|
+
false
|
|
24567
|
+
elsif Array(inhibit_warnings_hash['for_pods']).include?(pod_name)
|
|
24568
|
+
true
|
|
24569
|
+
elsif inhibit_warnings_hash['all']
|
|
24570
|
+
true
|
|
24571
|
+
elsif !root? && parent.inhibits_warnings_for_pod?(pod_name)
|
|
24572
|
+
true
|
|
24573
|
+
else
|
|
24574
|
+
false
|
|
24575
|
+
end
|
|
24576
|
+
end
|
|
24577
|
+
|
|
24578
|
+
def inhibit_all_warnings=(flag)
|
|
24579
|
+
raw_inhibit_warnings_hash['all'] = flag
|
|
24580
|
+
end
|
|
24581
|
+
|
|
24582
|
+
def set_inhibit_warnings_for_pod(pod_name, should_inhibit)
|
|
24583
|
+
hash_key = case should_inhibit
|
|
24584
|
+
when true
|
|
24585
|
+
'for_pods'
|
|
24586
|
+
when false
|
|
24587
|
+
'not_for_pods'
|
|
24588
|
+
when nil
|
|
24589
|
+
return
|
|
24590
|
+
else
|
|
24591
|
+
raise ArgumentError, "Got '#{should_inhibit.inspect}', should be a boolean"
|
|
24592
|
+
end
|
|
24593
|
+
raw_inhibit_warnings_hash[hash_key] ||= []
|
|
24594
|
+
raw_inhibit_warnings_hash[hash_key] << pod_name
|
|
24595
|
+
end
|
|
24596
|
+
|
|
24597
|
+
def build_pod_as_module?(pod_name)
|
|
24598
|
+
if Array(use_modular_headers_hash['not_for_pods']).include?(pod_name)
|
|
24599
|
+
false
|
|
24600
|
+
elsif Array(use_modular_headers_hash['for_pods']).include?(pod_name)
|
|
24601
|
+
true
|
|
24602
|
+
elsif use_modular_headers_hash['all']
|
|
24603
|
+
true
|
|
24604
|
+
elsif !root? && parent.build_pod_as_module?(pod_name)
|
|
24605
|
+
true
|
|
24606
|
+
else
|
|
24607
|
+
false
|
|
24608
|
+
end
|
|
24609
|
+
end
|
|
24610
|
+
|
|
24611
|
+
def use_modular_headers_for_all_pods=(flag)
|
|
24612
|
+
raw_use_modular_headers_hash['all'] = flag
|
|
24613
|
+
end
|
|
24614
|
+
|
|
24615
|
+
def set_use_modular_headers_for_pod(pod_name, flag)
|
|
24616
|
+
hash_key = case flag
|
|
24617
|
+
when true
|
|
24618
|
+
'for_pods'
|
|
24619
|
+
when false
|
|
24620
|
+
'not_for_pods'
|
|
24621
|
+
when nil
|
|
24622
|
+
return
|
|
24623
|
+
else
|
|
24624
|
+
raise ArgumentError, "Got '#{flag.inspect}', should be a boolean"
|
|
24625
|
+
end
|
|
24626
|
+
raw_use_modular_headers_hash[hash_key] ||= []
|
|
24627
|
+
raw_use_modular_headers_hash[hash_key] << pod_name
|
|
24628
|
+
end
|
|
24629
|
+
|
|
24630
|
+
def use_frameworks!(option = true)
|
|
24631
|
+
value = case option
|
|
24632
|
+
when true, false
|
|
24633
|
+
option ? BuildType.dynamic_framework : BuildType.static_library
|
|
24634
|
+
when Hash
|
|
24635
|
+
BuildType.new(:linkage => option.fetch(:linkage), :packaging => :framework)
|
|
24636
|
+
else
|
|
24637
|
+
raise ArgumentError, "Got '#{option.inspect}', should be a boolean or hash."
|
|
24638
|
+
end
|
|
24639
|
+
set_hash_value('uses_frameworks', value.to_hash)
|
|
24640
|
+
end
|
|
24641
|
+
|
|
24642
|
+
def build_type
|
|
24643
|
+
value = get_hash_value('uses_frameworks', root? ? BuildType.static_library.to_hash : parent.build_type.to_hash)
|
|
24644
|
+
case value
|
|
24645
|
+
when true, false
|
|
24646
|
+
value ? BuildType.dynamic_framework : BuildType.static_library
|
|
24647
|
+
when Hash
|
|
24648
|
+
BuildType.new(:linkage => value.fetch(:linkage), :packaging => value.fetch(:packaging))
|
|
24649
|
+
when BuildType
|
|
24650
|
+
value
|
|
24651
|
+
else
|
|
24652
|
+
raise ArgumentError, "Got '#{value.inspect}', should be a boolean, hash or BuildType."
|
|
24653
|
+
end
|
|
24654
|
+
end
|
|
24655
|
+
|
|
24656
|
+
def uses_frameworks?
|
|
24657
|
+
if internal_hash['uses_frameworks'].nil?
|
|
24658
|
+
root? ? false : parent.uses_frameworks?
|
|
24659
|
+
else
|
|
24660
|
+
build_type.framework?
|
|
24661
|
+
end
|
|
24662
|
+
end
|
|
24663
|
+
|
|
24664
|
+
def whitelist_pod_for_configuration(pod_name, configuration_name)
|
|
24665
|
+
found = raw_configuration_pod_whitelist.find { |configuration, _| configuration.casecmp(configuration_name.to_s).zero? }
|
|
24666
|
+
configuration_name = found.nil? ? configuration_name.to_s : found.first
|
|
24667
|
+
list = raw_configuration_pod_whitelist[configuration_name] ||= []
|
|
24668
|
+
list << pod_name
|
|
24669
|
+
end
|
|
24670
|
+
|
|
24671
|
+
def pod_whitelisted_for_configuration?(pod_name, configuration_name)
|
|
24672
|
+
found = false
|
|
24673
|
+
configuration_pod_whitelist.each do |configuration, pods|
|
|
24674
|
+
if pods.include?(pod_name)
|
|
24675
|
+
found = true
|
|
24676
|
+
if configuration.casecmp(configuration_name.to_s).zero?
|
|
24677
|
+
return true
|
|
24678
|
+
end
|
|
24679
|
+
end
|
|
24680
|
+
end
|
|
24681
|
+
!found && (root? || (inheritance != 'none' && parent.pod_whitelisted_for_configuration?(pod_name, configuration_name)))
|
|
24682
|
+
end
|
|
24683
|
+
|
|
24684
|
+
def all_whitelisted_configurations
|
|
24685
|
+
parent_configurations = (root? || inheritance == 'none') ? [] : parent.all_whitelisted_configurations
|
|
24686
|
+
(configuration_pod_whitelist.keys + parent_configurations).uniq
|
|
24687
|
+
end
|
|
24688
|
+
|
|
24689
|
+
def platform
|
|
24690
|
+
name_or_hash = get_hash_value('platform')
|
|
24691
|
+
if name_or_hash
|
|
24692
|
+
if name_or_hash.is_a?(Hash)
|
|
24693
|
+
name = name_or_hash.keys.first.to_sym
|
|
24694
|
+
target = name_or_hash.values.first
|
|
24695
|
+
else
|
|
24696
|
+
name = name_or_hash.to_sym
|
|
24697
|
+
end
|
|
24698
|
+
target ||= (name == :ios ? '4.3' : '10.6')
|
|
24699
|
+
Platform.new(name, target)
|
|
24700
|
+
else
|
|
24701
|
+
parent.platform unless root?
|
|
24702
|
+
end
|
|
24703
|
+
end
|
|
24704
|
+
|
|
24705
|
+
def set_platform(name, target = nil)
|
|
24706
|
+
name = :osx if name == :macos
|
|
24707
|
+
unless [:ios, :osx, :tvos, :visionos, :watchos].include?(name)
|
|
24708
|
+
raise StandardError, "Unsupported platform '#{name}'. Platform must be ':ios', ':osx', ':macos', ':tvos', :visionos, or ':watchos'."
|
|
24709
|
+
end
|
|
24710
|
+
if target
|
|
24711
|
+
value = { name.to_s => target }
|
|
24712
|
+
else
|
|
24713
|
+
value = name.to_s
|
|
24714
|
+
end
|
|
24715
|
+
set_hash_value('platform', value)
|
|
24716
|
+
end
|
|
24717
|
+
|
|
24718
|
+
def set_platform!(name, target = nil)
|
|
24719
|
+
raise StandardError, "The target '#{label}' already has a platform set." if get_hash_value('platform')
|
|
24720
|
+
set_platform(name, target)
|
|
24721
|
+
end
|
|
24722
|
+
|
|
24723
|
+
def store_pod(name, *requirements)
|
|
24724
|
+
return if parse_subspecs(name, requirements)
|
|
24725
|
+
parse_inhibit_warnings(name, requirements)
|
|
24726
|
+
parse_modular_headers(name, requirements)
|
|
24727
|
+
parse_configuration_whitelist(name, requirements)
|
|
24728
|
+
parse_project_name(name, requirements)
|
|
24729
|
+
if requirements && !requirements.empty?
|
|
24730
|
+
pod = { name => requirements }
|
|
24731
|
+
else
|
|
24732
|
+
pod = name
|
|
24733
|
+
end
|
|
24734
|
+
get_hash_value('dependencies', []) << pod
|
|
24735
|
+
nil
|
|
24736
|
+
end
|
|
24737
|
+
|
|
24738
|
+
def store_podspec(options = nil)
|
|
24739
|
+
options ||= {}
|
|
24740
|
+
unless options.keys.all? { |key| [:autodetect, :path, :name, :subspecs, :subspec].include?(key) }
|
|
24741
|
+
raise StandardError, "Unrecognized options for the podspec method '#{options}'"
|
|
24742
|
+
end
|
|
24743
|
+
if subspec_name = options[:subspec]
|
|
24744
|
+
options[:subspecs] = [subspec_name]
|
|
24745
|
+
end
|
|
24746
|
+
options[:autodetect] = true if !options.include?(:name) && !options.include?(:path)
|
|
24747
|
+
get_hash_value('podspecs', []) << options
|
|
24748
|
+
end
|
|
24749
|
+
|
|
24750
|
+
def store_script_phase(options)
|
|
24751
|
+
option_keys = options.keys
|
|
24752
|
+
unrecognized_keys = option_keys - Specification::ALL_SCRIPT_PHASE_KEYS
|
|
24753
|
+
unless unrecognized_keys.empty?
|
|
24754
|
+
raise StandardError, "Unrecognized options '#{unrecognized_keys}' in shell script '#{options[:name]}' within '#{name}' target. Available options are '#{Specification::ALL_SCRIPT_PHASE_KEYS}'."
|
|
24755
|
+
end
|
|
24756
|
+
missing_required_keys = Specification::SCRIPT_PHASE_REQUIRED_KEYS - option_keys
|
|
24757
|
+
unless missing_required_keys.empty?
|
|
24758
|
+
raise StandardError, "Missing required shell script phase options '#{missing_required_keys.join(', ')}'"
|
|
24759
|
+
end
|
|
24760
|
+
script_phases_hash = get_hash_value('script_phases', [])
|
|
24761
|
+
if script_phases_hash.map { |script_phase_options| script_phase_options[:name] }.include?(options[:name])
|
|
24762
|
+
raise StandardError, "Script phase with name '#{options[:name]}' name already present for target '#{name}'."
|
|
24763
|
+
end
|
|
24764
|
+
options[:execution_position] = :any unless options.key?(:execution_position)
|
|
24765
|
+
unless Specification::EXECUTION_POSITION_KEYS.include?(options[:execution_position])
|
|
24766
|
+
raise StandardError, "Invalid execution position value '#{options[:execution_position]}' in shell script '#{options[:name]}' within '#{name}' target. Available options are '#{Specification::EXECUTION_POSITION_KEYS}'."
|
|
24767
|
+
end
|
|
24768
|
+
script_phases_hash << options
|
|
24769
|
+
end
|
|
24770
|
+
|
|
24771
|
+
def to_hash
|
|
24772
|
+
hash = internal_hash.dup
|
|
24773
|
+
unless children.empty?
|
|
24774
|
+
hash['children'] = children.map(&:to_hash)
|
|
24775
|
+
end
|
|
24776
|
+
hash
|
|
24777
|
+
end
|
|
24778
|
+
|
|
24779
|
+
private
|
|
24780
|
+
|
|
24781
|
+
def set_hash_value(key, value)
|
|
24782
|
+
unless HASH_KEYS.include?(key)
|
|
24783
|
+
raise StandardError, "Unsupported hash key '#{key}'"
|
|
24784
|
+
end
|
|
24785
|
+
internal_hash[key] = value
|
|
24786
|
+
end
|
|
24787
|
+
|
|
24788
|
+
def get_hash_value(key, base_value = nil)
|
|
24789
|
+
unless HASH_KEYS.include?(key)
|
|
24790
|
+
raise StandardError, "Unsupported hash key '#{key}'"
|
|
24791
|
+
end
|
|
24792
|
+
internal_hash[key] = base_value if internal_hash[key].nil?
|
|
24793
|
+
internal_hash[key]
|
|
24794
|
+
end
|
|
24795
|
+
|
|
24796
|
+
def raw_inhibit_warnings_hash
|
|
24797
|
+
get_hash_value('inhibit_warnings', {})
|
|
24798
|
+
end
|
|
24799
|
+
|
|
24800
|
+
def inhibit_warnings_hash
|
|
24801
|
+
inhibit_hash = raw_inhibit_warnings_hash
|
|
24802
|
+
if exclusive?
|
|
24803
|
+
inhibit_hash
|
|
24804
|
+
else
|
|
24805
|
+
parent_hash = parent.send(:inhibit_warnings_hash).dup
|
|
24806
|
+
if parent_hash['not_for_pods']
|
|
24807
|
+
parent_hash['not_for_pods'] -= Array(inhibit_hash['for_pods'])
|
|
24808
|
+
end
|
|
24809
|
+
if parent_hash['for_pods']
|
|
24810
|
+
parent_hash['for_pods'] -= Array(inhibit_hash['not_for_pods'])
|
|
24811
|
+
end
|
|
24812
|
+
if inhibit_hash['all']
|
|
24813
|
+
parent_hash['all'] = true
|
|
24814
|
+
end
|
|
24815
|
+
parent_hash.merge(inhibit_hash) do |_, l, r|
|
|
24816
|
+
Array(l).concat(r).uniq
|
|
24817
|
+
end
|
|
24818
|
+
end
|
|
24819
|
+
end
|
|
24820
|
+
|
|
24821
|
+
def raw_use_modular_headers_hash
|
|
24822
|
+
get_hash_value('use_modular_headers', {})
|
|
24823
|
+
end
|
|
24824
|
+
|
|
24825
|
+
def use_modular_headers_hash
|
|
24826
|
+
raw_hash = raw_use_modular_headers_hash
|
|
24827
|
+
if exclusive?
|
|
24828
|
+
raw_hash
|
|
24829
|
+
else
|
|
24830
|
+
parent_hash = parent.send(:use_modular_headers_hash).dup
|
|
24831
|
+
if parent_hash['not_for_pods']
|
|
24832
|
+
parent_hash['not_for_pods'] -= Array(raw_hash['for_pods'])
|
|
24833
|
+
end
|
|
24834
|
+
if parent_hash['for_pods']
|
|
24835
|
+
parent_hash['for_pods'] -= Array(raw_hash['not_for_pods'])
|
|
24836
|
+
end
|
|
24837
|
+
if raw_hash['all']
|
|
24838
|
+
parent_hash['all'] = true
|
|
24839
|
+
end
|
|
24840
|
+
parent_hash.merge(raw_hash) do |_, l, r|
|
|
24841
|
+
Array(l).concat(r).uniq
|
|
24842
|
+
end
|
|
24843
|
+
end
|
|
24844
|
+
end
|
|
24845
|
+
|
|
24846
|
+
def raw_project_names_hash
|
|
24847
|
+
get_hash_value('project_names', {})
|
|
24848
|
+
end
|
|
24849
|
+
|
|
24850
|
+
def raw_configuration_pod_whitelist
|
|
24851
|
+
get_hash_value('configuration_pod_whitelist', {})
|
|
24852
|
+
end
|
|
24853
|
+
|
|
24854
|
+
def configuration_pod_whitelist
|
|
24855
|
+
raw_configuration_pod_whitelist
|
|
24856
|
+
end
|
|
24857
|
+
|
|
24858
|
+
def pod_dependencies
|
|
24859
|
+
pods = get_hash_value('dependencies') || []
|
|
24860
|
+
pods.map do |name_or_hash|
|
|
24861
|
+
if name_or_hash.is_a?(Hash)
|
|
24862
|
+
name = name_or_hash.keys.first
|
|
24863
|
+
requirements = name_or_hash.values.first
|
|
24864
|
+
else
|
|
24865
|
+
name = name_or_hash
|
|
24866
|
+
requirements = []
|
|
24867
|
+
end
|
|
24868
|
+
Dependency.new(name, *requirements)
|
|
24869
|
+
end
|
|
24870
|
+
end
|
|
24871
|
+
|
|
24872
|
+
def podspec_dependencies
|
|
24873
|
+
podspecs = get_hash_value('podspecs') || []
|
|
24874
|
+
podspecs.map do |options|
|
|
24875
|
+
file = podspec_path_from_options(options)
|
|
24876
|
+
spec = Specification.from_file(file)
|
|
24877
|
+
subspec_names = options[:subspecs] || options[:subspec]
|
|
24878
|
+
specs = if subspec_names.blank?
|
|
24879
|
+
[spec]
|
|
24880
|
+
else
|
|
24881
|
+
subspec_names = [subspec_names] if subspec_names.is_a?(String)
|
|
24882
|
+
subspec_names.map { |subspec_name| spec.subspec_by_name("#{spec.name}/#{subspec_name}") }
|
|
24883
|
+
end
|
|
24884
|
+
specs.map do |subspec|
|
|
24885
|
+
all_specs = [subspec, *subspec.recursive_subspecs]
|
|
24886
|
+
all_deps = all_specs.map { |s| s.dependencies(platform) }.flatten
|
|
24887
|
+
all_deps.reject { |dep| dep.root_name == subspec.root.name }
|
|
24888
|
+
end.flatten
|
|
24889
|
+
end.flatten.uniq
|
|
24890
|
+
end
|
|
24891
|
+
|
|
24892
|
+
def podspec_path_from_options(options)
|
|
24893
|
+
if path = options[:path]
|
|
24894
|
+
if File.basename(path).include?('.podspec')
|
|
24895
|
+
path_with_ext = path
|
|
24896
|
+
else
|
|
24897
|
+
path_with_ext = "#{path}.podspec"
|
|
24898
|
+
end
|
|
24899
|
+
path_without_tilde = path_with_ext.gsub('~', ENV['HOME'])
|
|
24900
|
+
podfile.defined_in_file.dirname + path_without_tilde
|
|
24901
|
+
elsif name = options[:name]
|
|
24902
|
+
name = File.basename(name).include?('.podspec') ? name : "#{name}.podspec"
|
|
24903
|
+
podfile.defined_in_file.dirname + name
|
|
24904
|
+
elsif options[:autodetect]
|
|
24905
|
+
glob_pattern = podfile.defined_in_file.dirname + '*.podspec{,.json}'
|
|
24906
|
+
path = Pathname.glob(glob_pattern).first
|
|
24907
|
+
unless path
|
|
24908
|
+
raise Informative, 'Could not locate a podspec in the current directory. ' \
|
|
24909
|
+
'You can specify the path via the path option.'
|
|
24910
|
+
end
|
|
24911
|
+
path
|
|
24912
|
+
end
|
|
24913
|
+
end
|
|
24914
|
+
|
|
24915
|
+
def parse_inhibit_warnings(name, requirements)
|
|
24916
|
+
options = requirements.last
|
|
24917
|
+
return requirements unless options.is_a?(Hash)
|
|
24918
|
+
should_inhibit = options.delete(:inhibit_warnings)
|
|
24919
|
+
pod_name = Specification.root_name(name)
|
|
24920
|
+
set_inhibit_warnings_for_pod(pod_name, should_inhibit)
|
|
24921
|
+
requirements.pop if options.empty?
|
|
24922
|
+
end
|
|
24923
|
+
|
|
24924
|
+
def parse_modular_headers(name, requirements)
|
|
24925
|
+
options = requirements.last
|
|
24926
|
+
return requirements unless options.is_a?(Hash)
|
|
24927
|
+
defines_module = options.delete(:modular_headers)
|
|
24928
|
+
pod_name = Specification.root_name(name)
|
|
24929
|
+
set_use_modular_headers_for_pod(pod_name, defines_module)
|
|
24930
|
+
requirements.pop if options.empty?
|
|
24931
|
+
end
|
|
24932
|
+
|
|
24933
|
+
def parse_project_name(name, requirements)
|
|
24934
|
+
options = requirements.last
|
|
24935
|
+
return requirements unless options.is_a?(Hash)
|
|
24936
|
+
project_name = options.delete(:project_name)
|
|
24937
|
+
pod_name = Specification.root_name(name)
|
|
24938
|
+
raw_project_names_hash[pod_name] = project_name if project_name
|
|
24939
|
+
requirements.pop if options.empty?
|
|
24940
|
+
end
|
|
24941
|
+
|
|
24942
|
+
def parse_configuration_whitelist(name, requirements)
|
|
24943
|
+
options = requirements.last
|
|
24944
|
+
return requirements unless options.is_a?(Hash)
|
|
24945
|
+
configurations = options.delete(:configurations)
|
|
24946
|
+
configurations ||= options.delete(:configuration)
|
|
24947
|
+
Array(configurations).each do |configuration|
|
|
24948
|
+
whitelist_pod_for_configuration(name, configuration)
|
|
24949
|
+
end
|
|
24950
|
+
requirements.pop if options.empty?
|
|
24951
|
+
end
|
|
24952
|
+
|
|
24953
|
+
def parse_subspecs(name, requirements)
|
|
24954
|
+
options = requirements.last
|
|
24955
|
+
return false unless options.is_a?(Hash)
|
|
24956
|
+
subspecs = options.delete(:subspecs)
|
|
24957
|
+
test_specs = options.delete(:testspecs)
|
|
24958
|
+
app_specs = options.delete(:appspecs)
|
|
24959
|
+
if subspecs && subspecs.empty?
|
|
24960
|
+
raise StandardError, 'Empty subspecs list.'
|
|
24961
|
+
end
|
|
24962
|
+
subspecs.each do |ss|
|
|
24963
|
+
store_pod("#{name}/#{ss}", *requirements.dup)
|
|
24964
|
+
end if subspecs
|
|
24965
|
+
requirements.pop if options.empty?
|
|
24966
|
+
if test_specs || app_specs
|
|
24967
|
+
options[:testspecs] = test_specs.uniq if test_specs
|
|
24968
|
+
options[:appspecs] = app_specs.uniq if app_specs
|
|
24969
|
+
requirements.push(options)
|
|
24970
|
+
end
|
|
24971
|
+
!subspecs.nil?
|
|
24972
|
+
end
|
|
24973
|
+
end
|
|
24974
|
+
end
|
|
24975
|
+
end
|
|
24976
|
+
`;
|
|
24977
|
+
var RESOLVER = String.raw`
|
|
24978
|
+
module Pod
|
|
24979
|
+
module ExternalSources
|
|
24980
|
+
def self.from_dependency(dependency, podfile_path)
|
|
24981
|
+
params = dependency.external_source
|
|
24982
|
+
name = dependency.root_name
|
|
24983
|
+
if params.key?(:podspec)
|
|
24984
|
+
PodspecSource.new(name, params, podfile_path)
|
|
24985
|
+
elsif params.key?(:path)
|
|
24986
|
+
PathSource.new(name, params, podfile_path)
|
|
24987
|
+
else
|
|
24988
|
+
raise Informative, "Peach does not fetch the external source of '#{name}': #{params}"
|
|
24989
|
+
end
|
|
24990
|
+
end
|
|
24991
|
+
|
|
24992
|
+
class AbstractExternalSource
|
|
24993
|
+
attr_reader :name, :params, :podfile_path
|
|
24994
|
+
def initialize(name, params, podfile_path)
|
|
24995
|
+
@name = name
|
|
24996
|
+
@params = params
|
|
24997
|
+
@podfile_path = podfile_path
|
|
24998
|
+
end
|
|
24999
|
+
|
|
25000
|
+
def normalized_podspec_path(declared_path)
|
|
25001
|
+
extension = File.extname(declared_path)
|
|
25002
|
+
if extension == '.podspec' || extension == '.json'
|
|
25003
|
+
path_with_ext = declared_path
|
|
25004
|
+
else
|
|
25005
|
+
path_with_ext = "#{declared_path}/#{name}.podspec"
|
|
25006
|
+
end
|
|
25007
|
+
podfile_dir = File.dirname(podfile_path || '')
|
|
25008
|
+
File.expand_path(path_with_ext, podfile_dir)
|
|
25009
|
+
end
|
|
25010
|
+
|
|
25011
|
+
private
|
|
25012
|
+
|
|
25013
|
+
def store_podspec(sandbox, spec, json = false)
|
|
25014
|
+
sandbox.store_podspec(name, Specification.from_file(spec), true, true)
|
|
25015
|
+
end
|
|
25016
|
+
end
|
|
25017
|
+
|
|
25018
|
+
class PathSource < AbstractExternalSource
|
|
25019
|
+
def fetch(sandbox)
|
|
25020
|
+
podspec = podspec_path
|
|
25021
|
+
raise Informative, "No podspec found for '#{name}' in '#{declared_path}'" unless podspec.exist?
|
|
25022
|
+
store_podspec(sandbox, podspec, podspec.extname == '.json')
|
|
25023
|
+
sandbox.store_local_path(name, podspec, Pathname(declared_path).absolute? || declared_path.start_with?('~'))
|
|
25024
|
+
end
|
|
25025
|
+
|
|
25026
|
+
def declared_path
|
|
25027
|
+
result = params[:path]
|
|
25028
|
+
result.to_s if result
|
|
25029
|
+
end
|
|
25030
|
+
|
|
25031
|
+
def podspec_path
|
|
25032
|
+
path = Pathname(normalized_podspec_path(declared_path))
|
|
25033
|
+
path.exist? ? path : Pathname("#{path}.json")
|
|
25034
|
+
end
|
|
25035
|
+
end
|
|
25036
|
+
|
|
25037
|
+
class PodspecSource < AbstractExternalSource
|
|
25038
|
+
def fetch(sandbox)
|
|
25039
|
+
podspec_path = Pathname(podspec_uri)
|
|
25040
|
+
raise Informative, "Peach does not download the podspec of '#{name}' from #{podspec_uri}" unless podspec_path.exist?
|
|
25041
|
+
store_podspec(sandbox, podspec_path, podspec_path.extname == '.json')
|
|
25042
|
+
end
|
|
25043
|
+
|
|
25044
|
+
def podspec_uri
|
|
25045
|
+
declared_path = params[:podspec].to_s
|
|
25046
|
+
declared_path =~ %r{^.+://} ? declared_path : normalized_podspec_path(declared_path)
|
|
25047
|
+
end
|
|
25048
|
+
end
|
|
25049
|
+
end
|
|
25050
|
+
|
|
25051
|
+
class Resolver
|
|
25052
|
+
class Vertex
|
|
25053
|
+
attr_reader :name, :requirements, :origins
|
|
25054
|
+
attr_accessor :spec, :platforms
|
|
25055
|
+
def initialize(name)
|
|
25056
|
+
@name = name
|
|
25057
|
+
@requirements = []
|
|
25058
|
+
@origins = []
|
|
25059
|
+
@platforms = []
|
|
25060
|
+
end
|
|
25061
|
+
end
|
|
25062
|
+
|
|
25063
|
+
attr_reader :vertices, :trunk_roots
|
|
25064
|
+
|
|
25065
|
+
# trunk answers versions(name) with its published version strings and
|
|
25066
|
+
# specification(name, version) with the Specification, or nil until fetched
|
|
25067
|
+
def initialize(sandbox, podfile, trunk)
|
|
25068
|
+
@sandbox = sandbox
|
|
25069
|
+
@podfile = podfile
|
|
25070
|
+
@trunk = trunk
|
|
25071
|
+
@chosen = {}
|
|
25072
|
+
@learned = Hash.new { |h, k| h[k] = [] }
|
|
25073
|
+
@excluded = Hash.new { |h, k| h[k] = [] }
|
|
25074
|
+
end
|
|
25075
|
+
|
|
25076
|
+
def fetch_external_sources
|
|
25077
|
+
@podfile.dependencies.select(&:external_source).uniq(&:root_name).sort.each do |dependency|
|
|
25078
|
+
ExternalSources.from_dependency(dependency, @podfile.defined_in_file).fetch(@sandbox)
|
|
25079
|
+
end
|
|
25080
|
+
end
|
|
25081
|
+
|
|
25082
|
+
# the trunk names and versions still to fetch, empty once resolved
|
|
25083
|
+
def resolve
|
|
25084
|
+
@platforms_by_dependency = Hash.new { |h, k| h[k] = [] }
|
|
25085
|
+
explicit = []
|
|
25086
|
+
@podfile.target_definition_list.each do |target|
|
|
25087
|
+
target.dependencies.each do |dep|
|
|
25088
|
+
explicit << dep
|
|
25089
|
+
@platforms_by_dependency[dep.to_s].push(target.platform) if target.platform
|
|
25090
|
+
end
|
|
25091
|
+
end
|
|
25092
|
+
explicit.uniq!
|
|
25093
|
+
@platforms_by_dependency.each_value(&:uniq!)
|
|
25094
|
+
@podfile_requirements = @podfile.dependencies.group_by(&:root_name)
|
|
25095
|
+
100.times do
|
|
25096
|
+
@missing = []
|
|
25097
|
+
activate(explicit)
|
|
25098
|
+
return @missing.uniq unless @missing.empty?
|
|
25099
|
+
return [] if consistent?
|
|
25100
|
+
end
|
|
25101
|
+
raise Informative, 'CocoaPods dependency resolution did not settle'
|
|
25102
|
+
end
|
|
25103
|
+
|
|
25104
|
+
def specs_by_target
|
|
25105
|
+
@podfile.target_definition_list.each_with_object({}) do |target, result|
|
|
25106
|
+
next if target.abstract? && !target.platform
|
|
25107
|
+
explicit = target.dependencies.map(&:name)
|
|
25108
|
+
used = {}
|
|
25109
|
+
loop do
|
|
25110
|
+
added = @vertices.values.select do |v|
|
|
25111
|
+
v.spec && !used[v.name] && (explicit.include?(v.name) || v.origins.any? { |origin, dep| used[origin] && edge_valid?(origin, dep, target.platform) })
|
|
25112
|
+
end
|
|
25113
|
+
break if added.empty?
|
|
25114
|
+
added.each { |v| used[v.name] = true }
|
|
25115
|
+
end
|
|
25116
|
+
aggregate = {}
|
|
25117
|
+
loop do
|
|
25118
|
+
added = used.keys.select do |name|
|
|
25119
|
+
!aggregate[name] && @vertices[name].spec.library_specification? &&
|
|
25120
|
+
(explicit.include?(name) || @vertices[name].origins.any? { |origin, _| aggregate[origin] })
|
|
25121
|
+
end
|
|
25122
|
+
break if added.empty?
|
|
25123
|
+
added.each { |name| aggregate[name] = true }
|
|
25124
|
+
end
|
|
25125
|
+
result[target] = used.keys.map { |name| [@vertices[name].spec, !aggregate[name]] }.sort_by { |spec, _| spec.name }
|
|
25126
|
+
end
|
|
25127
|
+
end
|
|
25128
|
+
|
|
25129
|
+
def specifications
|
|
25130
|
+
specs_by_target.values.flatten(1).map(&:first).uniq
|
|
25131
|
+
end
|
|
25132
|
+
|
|
25133
|
+
private
|
|
25134
|
+
|
|
25135
|
+
def activate(explicit)
|
|
25136
|
+
@vertices = {}
|
|
25137
|
+
@requirements = Hash.new { |h, k| h[k] = [] }
|
|
25138
|
+
@trunk_roots = []
|
|
25139
|
+
queue = explicit.map { |dep| [dep, nil] }
|
|
25140
|
+
until queue.empty?
|
|
25141
|
+
dep, origin = queue.shift
|
|
25142
|
+
vertex = (@vertices[dep.name] ||= Vertex.new(dep.name))
|
|
25143
|
+
vertex.requirements << dep
|
|
25144
|
+
vertex.origins << [origin, dep] if origin
|
|
25145
|
+
@requirements[dep.root_name] << dep
|
|
25146
|
+
next if vertex.requirements.size > 1
|
|
25147
|
+
root_spec = root_specification(dep)
|
|
25148
|
+
next unless root_spec
|
|
25149
|
+
spec = root_spec.subspec_by_name(dep.name, false, true)
|
|
25150
|
+
raise Informative, "Unable to find a specification for '#{dep}'" unless spec
|
|
25151
|
+
vertex.spec = spec
|
|
25152
|
+
dependencies_for(spec).each { |d| queue << [d, dep.name] }
|
|
25153
|
+
end
|
|
25154
|
+
end
|
|
25155
|
+
|
|
25156
|
+
def dependencies_for(spec)
|
|
25157
|
+
root_name = Specification.root_name(spec.name)
|
|
25158
|
+
spec.all_dependencies.map do |dependency|
|
|
25159
|
+
dependency.root_name == root_name ? dependency.dup.tap { |d| d.specific_version = spec.version } : dependency
|
|
25160
|
+
end
|
|
25161
|
+
end
|
|
25162
|
+
|
|
25163
|
+
def root_specification(dep)
|
|
25164
|
+
root = dep.root_name
|
|
25165
|
+
stored = @sandbox.specification(root)
|
|
25166
|
+
return stored if stored
|
|
25167
|
+
raise Informative, "Unable to find a specification for '#{dep}'" if dep.external_source
|
|
25168
|
+
@trunk_roots << root unless @trunk_roots.include?(root)
|
|
25169
|
+
version = (@chosen[root] ||= choose(root))
|
|
25170
|
+
return nil unless version
|
|
25171
|
+
spec = @trunk.specification(root, version.to_s)
|
|
25172
|
+
@missing << [root, version.to_s] unless spec
|
|
25173
|
+
spec
|
|
25174
|
+
end
|
|
25175
|
+
|
|
25176
|
+
def choose(root)
|
|
25177
|
+
versions = @trunk.versions(root)
|
|
25178
|
+
unless versions
|
|
25179
|
+
@missing << [root, nil]
|
|
25180
|
+
return nil
|
|
25181
|
+
end
|
|
25182
|
+
deps = @requirements[root] + Array(@podfile_requirements[root])
|
|
25183
|
+
requirements = deps.map(&:requirement) + @learned[root]
|
|
25184
|
+
prerelease = deps.any? { |d| d.prerelease? || d.external_source }
|
|
25185
|
+
candidates = versions.map { |v| Version.new(v) }.sort.reverse.reject { |v| @excluded[root].include?(v) }
|
|
25186
|
+
chosen = candidates.find { |v| requirements.all? { |r| r.satisfied_by?(v) } && (prerelease || !v.prerelease?) }
|
|
25187
|
+
raise Informative, "CocoaPods could not find compatible versions for pod '#{root}': #{requirements.map(&:to_s).uniq.join(', ')}" unless chosen
|
|
25188
|
+
chosen
|
|
25189
|
+
end
|
|
25190
|
+
|
|
25191
|
+
# the version each pod took satisfies every requirement on it and the
|
|
25192
|
+
# platforms of every target that reaches it; otherwise the pass repeats
|
|
25193
|
+
def consistent?
|
|
25194
|
+
platforms
|
|
25195
|
+
settled = true
|
|
25196
|
+
@vertices.each_value do |vertex|
|
|
25197
|
+
spec = vertex.spec
|
|
25198
|
+
root = Specification.root_name(vertex.name)
|
|
25199
|
+
unsatisfied = @requirements[root].map(&:requirement).reject { |r| r.satisfied_by?(spec.version) }
|
|
25200
|
+
unless unsatisfied.empty?
|
|
25201
|
+
raise Informative, "CocoaPods could not satisfy #{unsatisfied.map(&:to_s).join(', ')} with '#{root}' (#{spec.version})" unless @chosen.key?(root)
|
|
25202
|
+
@learned[root] |= unsatisfied
|
|
25203
|
+
@chosen.delete(root)
|
|
25204
|
+
settled = false
|
|
25205
|
+
next
|
|
25206
|
+
end
|
|
25207
|
+
next if platform_compatible?(vertex)
|
|
25208
|
+
raise Informative, "The platforms of '#{vertex.name}' (#{spec.available_platforms.map(&:to_s).join(', ')}) do not support #{vertex.platforms.map(&:to_s).join(', ')}" unless @chosen.key?(root)
|
|
25209
|
+
@excluded[root] << spec.version
|
|
25210
|
+
@chosen.delete(root)
|
|
25211
|
+
settled = false
|
|
25212
|
+
end
|
|
25213
|
+
settled
|
|
25214
|
+
end
|
|
25215
|
+
|
|
25216
|
+
def platforms
|
|
25217
|
+
@vertices.each_value do |vertex|
|
|
25218
|
+
vertex.platforms = vertex.requirements.reject { |dep| vertex.origins.any? { |_, d| d.equal?(dep) } }.flat_map { |dep| @platforms_by_dependency[dep.to_s] }.uniq
|
|
25219
|
+
end
|
|
25220
|
+
loop do
|
|
25221
|
+
grew = false
|
|
25222
|
+
@vertices.each_value do |vertex|
|
|
25223
|
+
inherited = vertex.origins.flat_map { |origin, _| @vertices[origin].platforms } - vertex.platforms
|
|
25224
|
+
next if inherited.empty?
|
|
25225
|
+
vertex.platforms |= inherited
|
|
25226
|
+
grew = true
|
|
25227
|
+
end
|
|
25228
|
+
break unless grew
|
|
25229
|
+
end
|
|
25230
|
+
end
|
|
25231
|
+
|
|
25232
|
+
def platform_compatible?(vertex)
|
|
25233
|
+
spec = vertex.spec
|
|
25234
|
+
vertex.platforms.all? do |platform|
|
|
25235
|
+
spec.available_platforms.all? do |spec_platform|
|
|
25236
|
+
spec_platform.name != platform.name || spec.non_library_specification? || platform.supports?(spec_platform)
|
|
25237
|
+
end
|
|
25238
|
+
end
|
|
25239
|
+
end
|
|
25240
|
+
|
|
25241
|
+
def edge_valid?(origin, dep, platform)
|
|
25242
|
+
@vertices[origin].spec.all_dependencies(platform).any? { |d| d.name == dep.name }
|
|
25243
|
+
end
|
|
25244
|
+
end
|
|
25245
|
+
end
|
|
25246
|
+
`;
|
|
25247
|
+
|
|
25248
|
+
// src/pods-analysis.ts
|
|
25249
|
+
init_podspec_cocoapods();
|
|
25250
|
+
init_podspec_ruby();
|
|
25251
|
+
init_podspec_ruby_stdlib();
|
|
25252
|
+
var ANALYSIS = String.raw`
|
|
25253
|
+
module Pod
|
|
25254
|
+
class Podfile
|
|
25255
|
+
class TargetDefinition
|
|
25256
|
+
def supports_swift_version?(swift_version)
|
|
25257
|
+
if swift_version_requirements.nil?
|
|
25258
|
+
root? || parent.supports_swift_version?(swift_version)
|
|
25259
|
+
else
|
|
25260
|
+
Requirement.create(swift_version_requirements).satisfied_by?(swift_version)
|
|
25261
|
+
end
|
|
25262
|
+
end
|
|
25263
|
+
end
|
|
25264
|
+
end
|
|
25265
|
+
|
|
25266
|
+
class Sandbox
|
|
25267
|
+
def pod_dir(name)
|
|
25268
|
+
root_name = Specification.root_name(name)
|
|
25269
|
+
local?(root_name) ? Pathname.new(local_path(root_name)) : root + root_name
|
|
25270
|
+
end
|
|
25271
|
+
end
|
|
25272
|
+
|
|
25273
|
+
class Specification
|
|
25274
|
+
def static_framework
|
|
25275
|
+
attributes_hash['static_framework']
|
|
25276
|
+
end
|
|
25277
|
+
|
|
25278
|
+
def info_plist
|
|
25279
|
+
attributes_hash['info_plist'] || {}
|
|
25280
|
+
end
|
|
25281
|
+
|
|
25282
|
+
def dependency_whitelisted_for_configuration?(dependency, configuration)
|
|
25283
|
+
inherited = -> { root? ? true : parent.dependency_whitelisted_for_configuration?(dependency, configuration) }
|
|
25284
|
+
return inherited[] unless configuration_whitelist = attributes_hash['configuration_pod_whitelist']
|
|
25285
|
+
return inherited[] unless whitelist_for_pod = configuration_whitelist[dependency.name]
|
|
25286
|
+
whitelist_for_pod.include?(configuration.to_s.downcase)
|
|
25287
|
+
end
|
|
25288
|
+
end
|
|
25289
|
+
|
|
25290
|
+
class Target
|
|
25291
|
+
DEFAULT_BUILD_CONFIGURATIONS = { 'Release' => :release, 'Debug' => :debug }.freeze
|
|
25292
|
+
attr_reader :sandbox, :user_build_configurations, :archs, :platform, :build_type
|
|
25293
|
+
private :build_type
|
|
25294
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform)
|
|
25295
|
+
@sandbox = sandbox
|
|
25296
|
+
@user_build_configurations = user_build_configurations
|
|
25297
|
+
@archs = archs
|
|
25298
|
+
@platform = platform
|
|
25299
|
+
@build_type = build_type
|
|
25300
|
+
end
|
|
25301
|
+
def name; label; end
|
|
25302
|
+
alias to_s name
|
|
25303
|
+
def build_as_dynamic?; build_type.dynamic?; end
|
|
25304
|
+
def build_as_dynamic_framework?; build_type.dynamic_framework?; end
|
|
25305
|
+
def build_as_framework?; build_type.framework?; end
|
|
25306
|
+
def build_as_library?; build_type.library?; end
|
|
25307
|
+
def build_as_static?; build_type.static?; end
|
|
25308
|
+
def build_as_static_framework?; build_type.static_framework?; end
|
|
25309
|
+
def build_as_static_library?; build_type.static_library?; end
|
|
25310
|
+
def requires_frameworks?; build_as_framework?; end
|
|
25311
|
+
def inspect; "#<#{self.class} name=#{name}>"; end
|
|
25312
|
+
end
|
|
25313
|
+
|
|
25314
|
+
class PodTarget < Target
|
|
25315
|
+
attr_reader :specs, :library_specs, :test_specs, :app_specs, :target_definitions, :swift_version, :dependent_targets, :dependent_targets_by_config
|
|
25316
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform, specs, target_definitions, swift_version)
|
|
25317
|
+
super(sandbox, build_type, user_build_configurations, archs, platform)
|
|
25318
|
+
@specs = specs.dup.freeze
|
|
25319
|
+
@target_definitions = target_definitions
|
|
25320
|
+
@swift_version = swift_version
|
|
25321
|
+
by_type = @specs.group_by(&:spec_type)
|
|
25322
|
+
@library_specs = by_type[:library] || []
|
|
25323
|
+
@test_specs = by_type[:test] || []
|
|
25324
|
+
@app_specs = by_type[:app] || []
|
|
25325
|
+
self.dependent_targets = []
|
|
25326
|
+
end
|
|
25327
|
+
def dependent_targets=(targets)
|
|
25328
|
+
@dependent_targets = targets
|
|
25329
|
+
@dependent_targets_by_config = { :debug => targets, :release => targets }
|
|
25330
|
+
end
|
|
25331
|
+
def dependent_targets_by_config=(by_config)
|
|
25332
|
+
@dependent_targets_by_config = by_config
|
|
25333
|
+
@dependent_targets = by_config.values.reduce([], &:|)
|
|
25334
|
+
end
|
|
25335
|
+
def label; root_spec.name; end
|
|
25336
|
+
def root_spec; @root_spec ||= specs.first.root; end
|
|
25337
|
+
def pod_name; root_spec.name; end
|
|
25338
|
+
def product_module_name; root_spec.module_name; end
|
|
25339
|
+
def podfile; target_definitions.first.podfile; end
|
|
25340
|
+
def spec_consumers; specs.map { |spec| spec.consumer(platform) }; end
|
|
25341
|
+
def dependencies
|
|
25342
|
+
spec_consumers.flat_map { |consumer| consumer.dependencies.map { |dep| Specification.root_name(dep.name) } }.uniq
|
|
25343
|
+
end
|
|
25344
|
+
def inhibit_warnings?
|
|
25345
|
+
answers = target_definitions.map { |td| td.inhibits_warnings_for_pod?(root_spec.name) }.uniq
|
|
25346
|
+
answers.size > 1 ? podfile.root_target_definitions.first.inhibits_warnings_for_pod?(root_spec.name) : answers.first || false
|
|
25347
|
+
end
|
|
25348
|
+
def build_pod_as_module?
|
|
25349
|
+
explicit = target_definitions.select { |td| td.dependencies.any? { |d| d.root_name == pod_name } }
|
|
25350
|
+
answers = explicit.group_by { |td| td.build_pod_as_module?(pod_name) }
|
|
25351
|
+
return false if answers.size > 1
|
|
25352
|
+
answers.keys.first == true || target_definitions.all? { |td| td.build_pod_as_module?(pod_name) }
|
|
25353
|
+
end
|
|
25354
|
+
end
|
|
25355
|
+
|
|
25356
|
+
class AggregateTarget < Target
|
|
25357
|
+
attr_reader :target_definition, :client_root, :user_project, :user_target_uuids, :pod_targets_for_build_configuration, :search_paths_aggregate_targets
|
|
25358
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform, target_definition, client_root, user_project, user_target_uuids, pod_targets_for_build_configuration)
|
|
25359
|
+
super(sandbox, build_type, user_build_configurations, archs, platform)
|
|
25360
|
+
@target_definition = target_definition
|
|
25361
|
+
@client_root = client_root
|
|
25362
|
+
@user_project = user_project
|
|
25363
|
+
@user_target_uuids = user_target_uuids
|
|
25364
|
+
@pod_targets_for_build_configuration = pod_targets_for_build_configuration
|
|
25365
|
+
@search_paths_aggregate_targets = []
|
|
25366
|
+
end
|
|
25367
|
+
def label; target_definition.label; end
|
|
25368
|
+
def podfile; target_definition.podfile; end
|
|
25369
|
+
def pod_targets; pod_targets_for_build_configuration.values.flatten.uniq; end
|
|
25370
|
+
def pod_targets_for_build_configuration(build_configuration = nil)
|
|
25371
|
+
build_configuration ? @pod_targets_for_build_configuration[build_configuration] || [] : @pod_targets_for_build_configuration
|
|
25372
|
+
end
|
|
25373
|
+
def user_targets
|
|
25374
|
+
user_target_uuids.map { |uuid| user_project.objects_by_uuid[uuid] }
|
|
25375
|
+
end
|
|
25376
|
+
end
|
|
25377
|
+
|
|
25378
|
+
class Installer
|
|
25379
|
+
# Installer::Analyzer#generate_targets for one variant of each pod, which
|
|
25380
|
+
# is every Podfile with one platform and no target-specific subspecs
|
|
25381
|
+
def peach_analyze(resolver, user_build_configurations, user_project, user_target_uuids, user_swift_version)
|
|
25382
|
+
if user_swift_version
|
|
25383
|
+
podfile.target_definition_list.each { |td| td.swift_version = user_swift_version unless td.abstract? }
|
|
25384
|
+
end
|
|
25385
|
+
specs_by_target = resolver.specs_by_target.reject { |td, _| td.abstract? && !td.platform }
|
|
25386
|
+
# keyed by names: a stored podspec is a copy whose subspecs still name the original root
|
|
25387
|
+
variants = {}
|
|
25388
|
+
specs_by_target.each do |td, resolver_specs|
|
|
25389
|
+
resolver_specs.group_by { |spec, _| spec.root.name }.each do |root_name, entries|
|
|
25390
|
+
all = entries.map(&:first)
|
|
25391
|
+
root = all.first.root
|
|
25392
|
+
unless all.all?(&:library_specification?)
|
|
25393
|
+
raise Informative, "Peach builds no test or app specifications (#{root_name} in #{td.label})"
|
|
25394
|
+
end
|
|
25395
|
+
build_type = td.build_type.framework? ? (root.static_framework ? BuildType.static_framework : td.build_type) : BuildType.static_library
|
|
25396
|
+
key = [all.map(&:name).sort, td.platform.to_s, build_type.to_s].join(' ')
|
|
25397
|
+
variants[root_name] ||= {}
|
|
25398
|
+
(variants[root_name][key] ||= [all, build_type, []])[2] << td
|
|
25399
|
+
end
|
|
25400
|
+
end
|
|
25401
|
+
@pod_targets = variants.map do |root_name, by_variant|
|
|
25402
|
+
if by_variant.size > 1
|
|
25403
|
+
raise Informative, "Peach builds one variant of each pod; #{root_name} differs between #{by_variant.values.map { |v| v[2].map(&:label) }.flatten.join(', ')}"
|
|
25404
|
+
end
|
|
25405
|
+
specs, build_type, target_definitions = by_variant.values.first
|
|
25406
|
+
root = specs.first.root
|
|
25407
|
+
target_definitions.reject!(&:abstract?) unless target_definitions.all?(&:abstract?)
|
|
25408
|
+
swift_version = peach_swift_version(root, target_definitions)
|
|
25409
|
+
PodTarget.new(sandbox, build_type, user_build_configurations, [], peach_platform(specs, target_definitions, build_type), specs, target_definitions, swift_version)
|
|
25410
|
+
end
|
|
25411
|
+
all_specs = specs_by_target.values.flatten(1).map(&:first).uniq.group_by(&:name)
|
|
25412
|
+
by_name = @pod_targets.group_by(&:pod_name)
|
|
25413
|
+
@pod_targets.each do |target|
|
|
25414
|
+
target.dependent_targets_by_config = Hash[[:debug, :release].map do |config|
|
|
25415
|
+
specs = {}
|
|
25416
|
+
target.library_specs.each do |s|
|
|
25417
|
+
s.dependencies(target.platform).each do |dep|
|
|
25418
|
+
all_specs[dep.name].each do |spec|
|
|
25419
|
+
raise Informative, "#{s} depends upon #{spec}, which is a #{spec.spec_type} spec." if spec.non_library_specification?
|
|
25420
|
+
specs[spec.name] ||= spec if s.dependency_whitelisted_for_configuration?(dep, config)
|
|
25421
|
+
end
|
|
25422
|
+
end
|
|
25423
|
+
end
|
|
25424
|
+
own = target.library_specs.map(&:name)
|
|
25425
|
+
[config, specs.values.reject { |spec| own.include?(spec.name) }.group_by { |spec| spec.root.name }.map do |root_name, deps|
|
|
25426
|
+
by_name[root_name].find { |t| t.build_as_framework? == target.build_as_framework? && deps.all? { |d| t.specs.map(&:name).include?(d.name) } }
|
|
25427
|
+
end]
|
|
25428
|
+
end]
|
|
25429
|
+
end
|
|
25430
|
+
@aggregate_targets = specs_by_target.keys.reject(&:abstract?).map do |td|
|
|
25431
|
+
configurations = user_build_configurations.keys.concat(td.all_whitelisted_configurations).uniq
|
|
25432
|
+
pods = @pod_targets.select { |t| t.target_definitions.include?(td) }
|
|
25433
|
+
named = specs_by_target[td].group_by { |spec, _| spec.root.name }.reject { |_, entries| entries.all? { |_, non_library_only| non_library_only } }
|
|
25434
|
+
pods.keep_if { |t| named.key?(t.pod_name) }
|
|
25435
|
+
dependencies = td.dependencies.group_by(&:root_name)
|
|
25436
|
+
by_configuration = Hash[configurations.map { |c| [c, []] }]
|
|
25437
|
+
pods.each do |t|
|
|
25438
|
+
configurations.each do |c|
|
|
25439
|
+
answers = (dependencies[t.pod_name] || []).map { |d| td.pod_whitelisted_for_configuration?(d.name, c) }.uniq
|
|
25440
|
+
raise Informative, "The subspecs of #{t.pod_name} are linked to different build configurations for #{td}" if answers.size > 1
|
|
25441
|
+
by_configuration[c] << t unless answers == [false]
|
|
25442
|
+
end
|
|
25443
|
+
end
|
|
25444
|
+
build_type = td.uses_frameworks? ? BuildType.static_framework : BuildType.static_library
|
|
25445
|
+
AggregateTarget.new(sandbox, build_type, user_build_configurations, [], td.platform, td, Config.instance.installation_root, user_project, user_target_uuids, by_configuration)
|
|
25446
|
+
end
|
|
25447
|
+
raise Informative, "Peach builds the pods of one application target, not #{@aggregate_targets.map(&:label).join(', ')}" unless @aggregate_targets.size == 1
|
|
25448
|
+
@aggregate_targets.each do |target|
|
|
25449
|
+
target.search_paths_aggregate_targets.concat(@aggregate_targets.select { |other| target.target_definition.targets_to_inherit_search_paths.include?(other.target_definition) })
|
|
25450
|
+
end
|
|
25451
|
+
run_podfile_pre_install_hooks
|
|
25452
|
+
end
|
|
25453
|
+
|
|
25454
|
+
private
|
|
25455
|
+
|
|
25456
|
+
def peach_platform(specs, target_definitions, build_type)
|
|
25457
|
+
name = target_definitions.first.platform.name
|
|
25458
|
+
defaults = { :ios => '4.3', :osx => '10.6', :tvos => '9.0', :visionos => '1.0', :watchos => '2.0' }
|
|
25459
|
+
target = specs.select(&:library_specification?).map { |s| Version.new(s.deployment_target(name) || defaults[name]) }.max
|
|
25460
|
+
target = [target, Version.new('8.0')].max if name == :ios && build_type.framework?
|
|
25461
|
+
Platform.new(name, target)
|
|
25462
|
+
end
|
|
25463
|
+
|
|
25464
|
+
def peach_swift_version(root, target_definitions)
|
|
25465
|
+
if root.swift_versions.empty?
|
|
25466
|
+
target_definitions.map(&:swift_version).compact.uniq.first
|
|
25467
|
+
else
|
|
25468
|
+
root.swift_versions.sort.reverse.find { |v| target_definitions.all? { |td| td.supports_swift_version?(v) } }.to_s
|
|
25469
|
+
end
|
|
25470
|
+
end
|
|
25471
|
+
end
|
|
25472
|
+
end
|
|
25473
|
+
`;
|
|
25474
|
+
var EXPORT = String.raw`
|
|
25475
|
+
lambda do |installer, attributes|
|
|
25476
|
+
spec_json = lambda do |spec, platform|
|
|
25477
|
+
consumer = spec.consumer(platform)
|
|
25478
|
+
values = attributes.each_with_object({}) { |a, h| h[a] = consumer.value_for_attribute(a.to_sym) }
|
|
25479
|
+
values['pod_target_xcconfig'] = consumer.pod_target_xcconfig
|
|
25480
|
+
values['user_target_xcconfig'] = consumer.user_target_xcconfig
|
|
25481
|
+
values['dependencies'] = consumer.dependencies.map(&:name)
|
|
25482
|
+
{ 'name' => spec.name, 'root' => spec.root?, 'deploymentTarget' => spec.deployment_target(platform.name), 'consumer' => values }
|
|
25483
|
+
end
|
|
25484
|
+
{
|
|
25485
|
+
'pods' => installer.pod_targets.map do |t|
|
|
25486
|
+
root = t.root_spec
|
|
25487
|
+
local = installer.sandbox.local_path(root.name)
|
|
25488
|
+
{
|
|
25489
|
+
'label' => t.label,
|
|
25490
|
+
'name' => t.pod_name,
|
|
25491
|
+
'version' => root.version.to_s,
|
|
25492
|
+
'moduleName' => t.product_module_name,
|
|
25493
|
+
'local' => local && local.to_s,
|
|
25494
|
+
'source' => root.source,
|
|
25495
|
+
'license' => root.attributes_hash['license'],
|
|
25496
|
+
'platform' => { 'name' => t.platform.name.to_s, 'deploymentTarget' => t.platform.deployment_target.to_s },
|
|
25497
|
+
'framework' => t.build_as_framework?,
|
|
25498
|
+
'dynamic' => t.build_as_dynamic?,
|
|
25499
|
+
'swiftVersion' => t.swift_version,
|
|
25500
|
+
'swiftVersions' => root.swift_versions.map(&:to_s),
|
|
25501
|
+
'targetDefinitions' => t.target_definitions.map(&:label),
|
|
25502
|
+
'dependencies' => { 'debug' => t.dependent_targets_by_config[:debug].map(&:label), 'release' => t.dependent_targets_by_config[:release].map(&:label) },
|
|
25503
|
+
'inhibitWarnings' => t.inhibit_warnings?,
|
|
25504
|
+
'buildPodAsModule' => t.build_pod_as_module?,
|
|
25505
|
+
'infoPlist' => root.info_plist,
|
|
25506
|
+
'specs' => t.specs.map { |s| spec_json.call(s, t.platform) },
|
|
25507
|
+
}
|
|
25508
|
+
end,
|
|
25509
|
+
'aggregates' => installer.aggregate_targets.map do |t|
|
|
25510
|
+
td = t.target_definition
|
|
25511
|
+
{
|
|
25512
|
+
'label' => t.label,
|
|
25513
|
+
'name' => td.name,
|
|
25514
|
+
'platform' => { 'name' => t.platform.name.to_s, 'deploymentTarget' => t.platform.deployment_target.to_s },
|
|
25515
|
+
'framework' => t.build_as_framework?,
|
|
25516
|
+
'userBuildConfigurations' => t.user_build_configurations.transform_values(&:to_s),
|
|
25517
|
+
'podsByConfiguration' => t.pod_targets_for_build_configuration.transform_values { |pods| pods.map(&:label) },
|
|
25518
|
+
'searchPathsAggregates' => t.search_paths_aggregate_targets.map(&:label),
|
|
25519
|
+
'inhibitAllWarnings' => td.inhibits_warnings_for_pod?(''),
|
|
25520
|
+
'swiftVersion' => td.swift_version.to_s,
|
|
25521
|
+
'setArcCompatibilityFlag' => td.podfile.set_arc_compatibility_flag? ? true : false,
|
|
25522
|
+
'userTargets' => t.user_target_uuids,
|
|
25523
|
+
'scriptPhases' => td.script_phases,
|
|
25524
|
+
}
|
|
25525
|
+
end,
|
|
25526
|
+
}
|
|
25527
|
+
end
|
|
25528
|
+
`;
|
|
25529
|
+
|
|
25530
|
+
// src/pods-files.ts
|
|
25531
|
+
init_is_record();
|
|
25532
|
+
init_plist_bytes();
|
|
25533
|
+
var HEADER_EXTENSIONS2 = [
|
|
25534
|
+
".h",
|
|
25535
|
+
".hh",
|
|
25536
|
+
".hpp",
|
|
25537
|
+
".ipp",
|
|
25538
|
+
".tpp",
|
|
25539
|
+
".hxx",
|
|
25540
|
+
".def",
|
|
25541
|
+
".inl",
|
|
25542
|
+
".inc"
|
|
25543
|
+
];
|
|
25544
|
+
var SOURCE_FILE_EXTENSIONS = [
|
|
25545
|
+
.../* @__PURE__ */ new Set([
|
|
25546
|
+
".m",
|
|
25547
|
+
".mm",
|
|
25548
|
+
".i",
|
|
25549
|
+
".c",
|
|
25550
|
+
".cc",
|
|
25551
|
+
".cxx",
|
|
25552
|
+
".cpp",
|
|
25553
|
+
".c++",
|
|
25554
|
+
".swift",
|
|
25555
|
+
...HEADER_EXTENSIONS2
|
|
25556
|
+
])
|
|
25557
|
+
];
|
|
25558
|
+
var GLOB_PATTERNS = {
|
|
25559
|
+
source_files: `*{${SOURCE_FILE_EXTENSIONS.join(",")}}`,
|
|
25560
|
+
public_header_files: `*{${HEADER_EXTENSIONS2.join(",")}}`
|
|
25561
|
+
};
|
|
25562
|
+
|
|
25563
|
+
// src/pods-post-install.ts
|
|
25564
|
+
init_openstep_plist();
|
|
25565
|
+
init_plist_bytes();
|
|
25566
|
+
init_podspec_cocoapods();
|
|
25567
|
+
init_podspec_ruby();
|
|
25568
|
+
init_podspec_ruby_stdlib();
|
|
25569
|
+
var XCODEPROJ = String.raw`
|
|
25570
|
+
module Xcodeproj
|
|
25571
|
+
module Constants
|
|
25572
|
+
INHERITED_KEYWORDS = ['$(inherited)', '$' + '{inherited}'].freeze
|
|
25573
|
+
PRODUCT_TYPE_UTI = Peach::Xcode.product_type_utis.freeze
|
|
25574
|
+
end
|
|
25575
|
+
|
|
25576
|
+
class Informative < StandardError; end
|
|
25577
|
+
|
|
25578
|
+
module Plist
|
|
25579
|
+
def self.read_from_path(path)
|
|
25580
|
+
path = path.to_s
|
|
25581
|
+
raise Informative, "The plist file at path '#{path}' doesn't exist." unless File.exist?(path)
|
|
25582
|
+
Peach::Xcode.plist_read(path)
|
|
25583
|
+
end
|
|
25584
|
+
|
|
25585
|
+
def self.write_to_path(hash, path)
|
|
25586
|
+
Peach::Xcode.plist_write(path.to_s, hash)
|
|
25587
|
+
end
|
|
25588
|
+
end
|
|
25589
|
+
|
|
25590
|
+
class Config
|
|
25591
|
+
attr_accessor :attributes, :other_linker_flags, :includes
|
|
25592
|
+
|
|
25593
|
+
def initialize(source = {})
|
|
25594
|
+
@attributes, @other_linker_flags, @includes =
|
|
25595
|
+
source.is_a?(Hash) ? Peach::Xcode.config_from_hash(source) : Peach::Xcode.config_parse(source.to_s)
|
|
25596
|
+
end
|
|
25597
|
+
|
|
25598
|
+
def ==(other)
|
|
25599
|
+
other.attributes == attributes && other.other_linker_flags == other_linker_flags && other.includes == includes
|
|
25600
|
+
end
|
|
25601
|
+
|
|
25602
|
+
def merge!(xcconfig)
|
|
25603
|
+
xcconfig = Config.new(xcconfig) if xcconfig.is_a?(Hash)
|
|
25604
|
+
@attributes, @other_linker_flags = Peach::Xcode.config_merge(self, xcconfig)
|
|
25605
|
+
self
|
|
25606
|
+
end
|
|
25607
|
+
alias_method :<<, :merge!
|
|
25608
|
+
|
|
25609
|
+
def merge(config)
|
|
25610
|
+
dup.tap { |copy| copy.merge!(config) }
|
|
25611
|
+
end
|
|
25612
|
+
|
|
25613
|
+
def dup
|
|
25614
|
+
Config.new(to_hash.dup)
|
|
25615
|
+
end
|
|
25616
|
+
|
|
25617
|
+
def to_hash(prefix = nil)
|
|
25618
|
+
raise ArgumentError, 'Peach writes no prefixed xcconfig' if prefix
|
|
25619
|
+
Peach::Xcode.config_hash(self)
|
|
25620
|
+
end
|
|
25621
|
+
alias_method :to_h, :to_hash
|
|
25622
|
+
|
|
25623
|
+
def to_s(prefix = nil)
|
|
25624
|
+
raise ArgumentError, 'Peach writes no prefixed xcconfig' if prefix
|
|
25625
|
+
Peach::Xcode.config_render(self)
|
|
25626
|
+
end
|
|
25627
|
+
|
|
25628
|
+
def save_as(pathname, prefix = nil)
|
|
25629
|
+
return if File.exist?(pathname) && Config.new(pathname) == self
|
|
25630
|
+
File.write(pathname.to_s, to_s(prefix))
|
|
25631
|
+
end
|
|
25632
|
+
end
|
|
25633
|
+
|
|
25634
|
+
class Project
|
|
25635
|
+
attr_reader :path, :root_object, :object_version, :generated_uuids
|
|
25636
|
+
|
|
25637
|
+
# keys whose values name objects without referring to them
|
|
25638
|
+
PEACH_PLAIN_KEYS = %w(isa remoteGlobalIDString containerPortal).freeze
|
|
25639
|
+
|
|
25640
|
+
def initialize(path, objects, root_uuid, object_version)
|
|
25641
|
+
@path = Pathname.new(path)
|
|
25642
|
+
@objects = objects
|
|
25643
|
+
@object_version = object_version
|
|
25644
|
+
@wrapped = {}
|
|
25645
|
+
@generated_uuids = []
|
|
25646
|
+
@available_uuids = []
|
|
25647
|
+
@dirty = false
|
|
25648
|
+
@root_object = object(root_uuid)
|
|
25649
|
+
end
|
|
25650
|
+
|
|
25651
|
+
def object(uuid)
|
|
25652
|
+
@wrapped[uuid] ||= begin
|
|
25653
|
+
attributes = @objects[uuid]
|
|
25654
|
+
raise ArgumentError, "#{path} has no object #{uuid}" unless attributes
|
|
25655
|
+
klass = Object::ISA[attributes['isa']]
|
|
25656
|
+
raise ArgumentError, "Peach models no #{attributes['isa']} (#{uuid} in #{path})" unless klass
|
|
25657
|
+
klass.new(self, uuid, attributes)
|
|
25658
|
+
end
|
|
25659
|
+
end
|
|
25660
|
+
|
|
25661
|
+
def objects_by_uuid
|
|
25662
|
+
@objects.keys.each_with_object({}) { |uuid, by_uuid| by_uuid[uuid] = object(uuid) }
|
|
25663
|
+
end
|
|
25664
|
+
|
|
25665
|
+
def objects
|
|
25666
|
+
@objects.keys.map { |uuid| object(uuid) }
|
|
25667
|
+
end
|
|
25668
|
+
|
|
25669
|
+
def uuids
|
|
25670
|
+
@objects.keys
|
|
25671
|
+
end
|
|
25672
|
+
|
|
25673
|
+
def new(klass)
|
|
25674
|
+
klass = Object.const_get(klass) if klass.is_a?(String)
|
|
25675
|
+
raise ArgumentError, "Peach creates no #{klass}" unless Object::ISA[klass.isa].equal?(klass)
|
|
25676
|
+
uuid = generate_uuid
|
|
25677
|
+
attributes = { 'isa' => klass.isa }
|
|
25678
|
+
klass.peach_defaults.each { |key, value| attributes[key] = value.dup }
|
|
25679
|
+
@objects[uuid] = attributes
|
|
25680
|
+
mark_dirty!
|
|
25681
|
+
object(uuid)
|
|
25682
|
+
end
|
|
25683
|
+
|
|
25684
|
+
def generate_uuid
|
|
25685
|
+
generate_available_uuid_list while @available_uuids.empty?
|
|
25686
|
+
@available_uuids.shift
|
|
25687
|
+
end
|
|
25688
|
+
|
|
25689
|
+
# Xcodeproj draws random ids; Peach derives them from the project and a counter
|
|
25690
|
+
def generate_available_uuid_list(count = 100)
|
|
25691
|
+
start = @generated_uuids.size
|
|
25692
|
+
candidates = Array.new(count) { |i| Digest::SHA1.hexdigest("#{path.basename}/#{start + i}")[0, 24].upcase }
|
|
25693
|
+
uniques = candidates - (@generated_uuids + uuids)
|
|
25694
|
+
@generated_uuids += uniques
|
|
25695
|
+
@available_uuids += uniques
|
|
25696
|
+
end
|
|
25697
|
+
|
|
25698
|
+
def mark_dirty!
|
|
25699
|
+
@dirty = true
|
|
25700
|
+
@referrers = nil
|
|
25701
|
+
end
|
|
25702
|
+
|
|
25703
|
+
def dirty?
|
|
25704
|
+
@dirty
|
|
25705
|
+
end
|
|
25706
|
+
|
|
25707
|
+
def peach_referrers(uuid)
|
|
25708
|
+
unless @referrers
|
|
25709
|
+
@referrers = {}
|
|
25710
|
+
@objects.each do |owner, attributes|
|
|
25711
|
+
attributes.each do |key, value|
|
|
25712
|
+
next if PEACH_PLAIN_KEYS.include?(key)
|
|
25713
|
+
refs = value.is_a?(Array) ? value : [value]
|
|
25714
|
+
refs.each { |ref| (@referrers[ref] ||= []) << owner if ref.is_a?(String) && @objects.key?(ref) }
|
|
25715
|
+
end
|
|
25716
|
+
end
|
|
25717
|
+
end
|
|
25718
|
+
(@referrers[uuid] || []).uniq.map { |owner| object(owner) }
|
|
25719
|
+
end
|
|
25720
|
+
|
|
25721
|
+
def peach_remove(uuid)
|
|
25722
|
+
@objects.each_value do |attributes|
|
|
25723
|
+
attributes.keys.each do |key|
|
|
25724
|
+
next if PEACH_PLAIN_KEYS.include?(key)
|
|
25725
|
+
value = attributes[key]
|
|
25726
|
+
if value == uuid
|
|
25727
|
+
attributes.delete(key)
|
|
25728
|
+
elsif value.is_a?(Array)
|
|
25729
|
+
value.delete(uuid)
|
|
25730
|
+
end
|
|
25731
|
+
end
|
|
25732
|
+
end
|
|
25733
|
+
@objects.delete(uuid)
|
|
25734
|
+
@wrapped.delete(uuid)
|
|
25735
|
+
mark_dirty!
|
|
25736
|
+
end
|
|
25737
|
+
|
|
25738
|
+
# the objects table after Peach's TypeScript integrator changed it
|
|
25739
|
+
def peach_reload(objects)
|
|
25740
|
+
@objects.keys.each do |uuid|
|
|
25741
|
+
next if objects.key?(uuid)
|
|
25742
|
+
@objects.delete(uuid)
|
|
25743
|
+
@wrapped.delete(uuid)
|
|
25744
|
+
end
|
|
25745
|
+
objects.each do |uuid, attributes|
|
|
25746
|
+
current = @objects[uuid]
|
|
25747
|
+
if current
|
|
25748
|
+
current.keys.each { |key| current.delete(key) unless attributes.key?(key) }
|
|
25749
|
+
attributes.each { |key, value| current[key] = value unless current[key] == value }
|
|
25750
|
+
else
|
|
25751
|
+
@objects[uuid] = attributes
|
|
25752
|
+
end
|
|
25753
|
+
end
|
|
25754
|
+
mark_dirty!
|
|
25755
|
+
end
|
|
25756
|
+
|
|
25757
|
+
def project_dir
|
|
25758
|
+
path.dirname
|
|
25759
|
+
end
|
|
25760
|
+
|
|
25761
|
+
def main_group
|
|
25762
|
+
root_object.main_group
|
|
25763
|
+
end
|
|
25764
|
+
|
|
25765
|
+
def [](group_name)
|
|
25766
|
+
main_group[group_name]
|
|
25767
|
+
end
|
|
25768
|
+
|
|
25769
|
+
def targets
|
|
25770
|
+
root_object.targets
|
|
25771
|
+
end
|
|
25772
|
+
|
|
25773
|
+
def native_targets
|
|
25774
|
+
targets.select { |o| o.is_a?(Object::PBXNativeTarget) }
|
|
25775
|
+
end
|
|
25776
|
+
|
|
25777
|
+
def build_configuration_list
|
|
25778
|
+
root_object.build_configuration_list
|
|
25779
|
+
end
|
|
25780
|
+
|
|
25781
|
+
def build_configurations
|
|
25782
|
+
root_object.build_configuration_list.build_configurations
|
|
25783
|
+
end
|
|
25784
|
+
|
|
25785
|
+
def build_settings(name)
|
|
25786
|
+
root_object.build_configuration_list.build_settings(name)
|
|
25787
|
+
end
|
|
25788
|
+
|
|
25789
|
+
def files
|
|
25790
|
+
objects.select { |o| o.is_a?(Object::PBXFileReference) }
|
|
25791
|
+
end
|
|
25792
|
+
|
|
25793
|
+
def groups
|
|
25794
|
+
main_group.groups
|
|
25795
|
+
end
|
|
25796
|
+
|
|
25797
|
+
def products_group
|
|
25798
|
+
root_object.product_ref_group
|
|
25799
|
+
end
|
|
25800
|
+
|
|
25801
|
+
def frameworks_group
|
|
25802
|
+
main_group['Frameworks'] || main_group.new_group('Frameworks')
|
|
25803
|
+
end
|
|
25804
|
+
|
|
25805
|
+
# the tables stay in memory, where Peach reads them
|
|
25806
|
+
def save(save_path = nil)
|
|
25807
|
+
raise ArgumentError, "Peach saves #{path} only in place" if save_path
|
|
25808
|
+
end
|
|
25809
|
+
|
|
25810
|
+
# Xcodeproj's to-many attribute: a live list of the uuids in the owner's table entry
|
|
25811
|
+
class ObjectList
|
|
25812
|
+
include Enumerable
|
|
25813
|
+
attr_reader :owner
|
|
25814
|
+
|
|
25815
|
+
def initialize(owner, key)
|
|
25816
|
+
@owner = owner
|
|
25817
|
+
@key = key
|
|
25818
|
+
end
|
|
25819
|
+
|
|
25820
|
+
def uuids
|
|
25821
|
+
@owner.peach_uuids(@key).dup
|
|
25822
|
+
end
|
|
25823
|
+
|
|
25824
|
+
def objects
|
|
25825
|
+
@owner.peach_uuids(@key).map { |uuid| @owner.project.object(uuid) }
|
|
25826
|
+
end
|
|
25827
|
+
alias_method :to_a, :objects
|
|
25828
|
+
alias_method :to_ary, :objects
|
|
25829
|
+
|
|
25830
|
+
def each(&block)
|
|
25831
|
+
objects.each(&block)
|
|
25832
|
+
self
|
|
25833
|
+
end
|
|
25834
|
+
|
|
25835
|
+
def size
|
|
25836
|
+
@owner.peach_uuids(@key).size
|
|
25837
|
+
end
|
|
25838
|
+
alias_method :length, :size
|
|
25839
|
+
|
|
25840
|
+
def empty?
|
|
25841
|
+
size.zero?
|
|
25842
|
+
end
|
|
25843
|
+
|
|
25844
|
+
def [](index)
|
|
25845
|
+
objects[index]
|
|
25846
|
+
end
|
|
25847
|
+
alias_method :at, :[]
|
|
25848
|
+
|
|
25849
|
+
def first
|
|
25850
|
+
objects.first
|
|
25851
|
+
end
|
|
25852
|
+
|
|
25853
|
+
def last
|
|
25854
|
+
objects.last
|
|
25855
|
+
end
|
|
25856
|
+
|
|
25857
|
+
def index(object = nil, &block)
|
|
25858
|
+
block ? objects.index(&block) : objects.index(object)
|
|
25859
|
+
end
|
|
25860
|
+
alias_method :find_index, :index
|
|
25861
|
+
|
|
25862
|
+
def include?(object)
|
|
25863
|
+
objects.include?(object)
|
|
25864
|
+
end
|
|
25865
|
+
|
|
25866
|
+
def ==(other)
|
|
25867
|
+
objects == (other.is_a?(ObjectList) ? other.objects : other)
|
|
25868
|
+
end
|
|
25869
|
+
|
|
25870
|
+
def inspect
|
|
25871
|
+
objects.inspect
|
|
25872
|
+
end
|
|
25873
|
+
|
|
25874
|
+
def <<(object)
|
|
25875
|
+
live << peach_uuid(object)
|
|
25876
|
+
self
|
|
25877
|
+
end
|
|
25878
|
+
alias_method :push, :<<
|
|
25879
|
+
|
|
25880
|
+
def concat(list)
|
|
25881
|
+
list.each { |object| self << object }
|
|
25882
|
+
self
|
|
25883
|
+
end
|
|
25884
|
+
|
|
25885
|
+
def insert(index, object)
|
|
25886
|
+
live.insert(index, peach_uuid(object))
|
|
25887
|
+
self
|
|
25888
|
+
end
|
|
25889
|
+
|
|
25890
|
+
def unshift(object)
|
|
25891
|
+
live.unshift(peach_uuid(object))
|
|
25892
|
+
self
|
|
25893
|
+
end
|
|
25894
|
+
|
|
25895
|
+
def delete(object)
|
|
25896
|
+
return nil unless object.is_a?(Object::AbstractObject) && live.include?(object.uuid)
|
|
25897
|
+
live.delete(object.uuid)
|
|
25898
|
+
@owner.project.mark_dirty!
|
|
25899
|
+
object
|
|
25900
|
+
end
|
|
25901
|
+
|
|
25902
|
+
def delete_at(index)
|
|
25903
|
+
uuid = live.delete_at(index)
|
|
25904
|
+
@owner.project.mark_dirty!
|
|
25905
|
+
uuid && @owner.project.object(uuid)
|
|
25906
|
+
end
|
|
25907
|
+
|
|
25908
|
+
def delete_if(&block)
|
|
25909
|
+
live.reject! { |uuid| block.call(@owner.project.object(uuid)) }
|
|
25910
|
+
@owner.project.mark_dirty!
|
|
25911
|
+
self
|
|
25912
|
+
end
|
|
25913
|
+
|
|
25914
|
+
def clear
|
|
25915
|
+
live.clear
|
|
25916
|
+
@owner.project.mark_dirty!
|
|
25917
|
+
self
|
|
25918
|
+
end
|
|
25919
|
+
|
|
25920
|
+
def uniq!
|
|
25921
|
+
result = live.uniq!
|
|
25922
|
+
@owner.project.mark_dirty!
|
|
25923
|
+
result && self
|
|
25924
|
+
end
|
|
25925
|
+
|
|
25926
|
+
def move(object, new_index)
|
|
25927
|
+
return if index(object) == new_index
|
|
25928
|
+
raise "Attempt to move object '#{object}' not present in the list '#{inspect}'" unless delete(object)
|
|
25929
|
+
insert(new_index, object)
|
|
25930
|
+
end
|
|
25931
|
+
|
|
25932
|
+
def move_from(current_index, new_index)
|
|
25933
|
+
return if current_index == new_index
|
|
25934
|
+
object = delete_at(current_index)
|
|
25935
|
+
raise "Attempt to move object from index '#{current_index}' which is beyond bounds of the list '#{inspect}'" unless object
|
|
25936
|
+
insert(new_index, object)
|
|
25937
|
+
end
|
|
25938
|
+
|
|
25939
|
+
private
|
|
25940
|
+
|
|
25941
|
+
def live
|
|
25942
|
+
@owner.peach_live_uuids(@key)
|
|
25943
|
+
end
|
|
25944
|
+
|
|
25945
|
+
def peach_uuid(object)
|
|
25946
|
+
unless object.is_a?(Object::AbstractObject) && object.project.equal?(@owner.project)
|
|
25947
|
+
raise ArgumentError, "#{@owner.inspect} lists objects of its own project, not #{object.inspect}"
|
|
25948
|
+
end
|
|
25949
|
+
@owner.project.mark_dirty!
|
|
25950
|
+
object.uuid
|
|
25951
|
+
end
|
|
25952
|
+
end
|
|
25953
|
+
|
|
25954
|
+
module Object
|
|
25955
|
+
class AbstractObject
|
|
25956
|
+
attr_reader :project, :uuid
|
|
25957
|
+
|
|
25958
|
+
def self.isa
|
|
25959
|
+
name.split('::').last
|
|
25960
|
+
end
|
|
25961
|
+
|
|
25962
|
+
def self.peach_defaults
|
|
25963
|
+
inherited = equal?(AbstractObject) ? {} : superclass.peach_defaults
|
|
25964
|
+
inherited.merge(@peach_defaults || {})
|
|
25965
|
+
end
|
|
25966
|
+
|
|
25967
|
+
def initialize(project, uuid, attributes)
|
|
25968
|
+
@project = project
|
|
25969
|
+
@uuid = uuid
|
|
25970
|
+
@attributes = attributes
|
|
25971
|
+
end
|
|
25972
|
+
|
|
25973
|
+
def self.attribute(name, key, default = nil)
|
|
25974
|
+
(@peach_defaults ||= {})[key] = default unless default.nil?
|
|
25975
|
+
define_method(name) { @attributes[key] }
|
|
25976
|
+
define_method("#{name}=") { |value| peach_set(key, value) }
|
|
25977
|
+
end
|
|
25978
|
+
|
|
25979
|
+
def self.has_one(name, key)
|
|
25980
|
+
define_method(name) { (uuid = @attributes[key]) && project.object(uuid) }
|
|
25981
|
+
define_method("#{name}=") { |object| peach_set(key, object) }
|
|
25982
|
+
end
|
|
25983
|
+
|
|
25984
|
+
def self.has_many(name, key)
|
|
25985
|
+
(@peach_defaults ||= {})[key] = []
|
|
25986
|
+
define_method(name) { Project::ObjectList.new(self, key) }
|
|
25987
|
+
end
|
|
25988
|
+
|
|
25989
|
+
def peach_uuid(key)
|
|
25990
|
+
@attributes[key]
|
|
25991
|
+
end
|
|
25992
|
+
|
|
25993
|
+
def peach_uuids(key)
|
|
25994
|
+
@attributes[key] || []
|
|
25995
|
+
end
|
|
25996
|
+
|
|
25997
|
+
def peach_live_uuids(key)
|
|
25998
|
+
@attributes[key] ||= []
|
|
25999
|
+
end
|
|
26000
|
+
|
|
26001
|
+
def peach_set(key, value)
|
|
26002
|
+
value = value.uuid if value.is_a?(AbstractObject)
|
|
26003
|
+
if value.nil?
|
|
26004
|
+
@attributes.delete(key)
|
|
26005
|
+
else
|
|
26006
|
+
@attributes[key] = value
|
|
26007
|
+
end
|
|
26008
|
+
project.mark_dirty!
|
|
26009
|
+
end
|
|
26010
|
+
|
|
26011
|
+
def isa
|
|
26012
|
+
@attributes['isa']
|
|
26013
|
+
end
|
|
26014
|
+
|
|
26015
|
+
def referrers
|
|
26016
|
+
project.peach_referrers(uuid)
|
|
26017
|
+
end
|
|
26018
|
+
|
|
26019
|
+
def mark_project_as_dirty!
|
|
26020
|
+
project.mark_dirty!
|
|
26021
|
+
end
|
|
26022
|
+
|
|
26023
|
+
def remove_from_project
|
|
26024
|
+
project.peach_remove(uuid)
|
|
26025
|
+
end
|
|
26026
|
+
|
|
26027
|
+
def display_name
|
|
26028
|
+
declared_name = name if respond_to?(:name)
|
|
26029
|
+
declared_name && !declared_name.empty? ? declared_name : isa.gsub(/^(PBX|XC)/, '')
|
|
26030
|
+
end
|
|
26031
|
+
alias_method :to_s, :display_name
|
|
26032
|
+
|
|
26033
|
+
def inspect
|
|
26034
|
+
"<#{isa} name=#{display_name.inspect} uuid=#{uuid}>"
|
|
26035
|
+
end
|
|
26036
|
+
end
|
|
26037
|
+
|
|
26038
|
+
module GroupableHelper
|
|
26039
|
+
SOURCE_TREES_BY_KEY = {
|
|
26040
|
+
:absolute => '<absolute>',
|
|
26041
|
+
:group => '<group>',
|
|
26042
|
+
:project => 'SOURCE_ROOT',
|
|
26043
|
+
:built_products => 'BUILT_PRODUCTS_DIR',
|
|
26044
|
+
:developer_dir => 'DEVELOPER_DIR',
|
|
26045
|
+
:sdk_root => 'SDKROOT',
|
|
26046
|
+
}.freeze
|
|
26047
|
+
|
|
26048
|
+
def self.normalize_source_tree(source_tree)
|
|
26049
|
+
source_tree = SOURCE_TREES_BY_KEY[source_tree] if source_tree.is_a?(Symbol)
|
|
26050
|
+
raise "[Xcodeproj] Unrecognized source tree option '#{source_tree}'" unless SOURCE_TREES_BY_KEY.values.include?(source_tree)
|
|
26051
|
+
source_tree
|
|
26052
|
+
end
|
|
26053
|
+
|
|
26054
|
+
def parent
|
|
26055
|
+
parents = referrers
|
|
26056
|
+
parents = parents.select { |o| o.is_a?(PBXGroup) } if parents.count > 1
|
|
26057
|
+
raise "[Xcodeproj] Consistency issue: no parent for object '#{display_name}'" if parents.empty?
|
|
26058
|
+
raise "[Xcodeproj] Consistency issue: unexpected multiple parents for object '#{display_name}'" if parents.count > 1
|
|
26059
|
+
parents.first
|
|
26060
|
+
end
|
|
26061
|
+
|
|
26062
|
+
def real_path
|
|
26063
|
+
source_tree_path = source_tree_real_path
|
|
26064
|
+
source_tree_path ? source_tree_path + (path || '') : Pathname(path || '')
|
|
26065
|
+
end
|
|
26066
|
+
|
|
26067
|
+
def source_tree_real_path
|
|
26068
|
+
case source_tree
|
|
26069
|
+
when '<group>'
|
|
26070
|
+
object_parent = parent
|
|
26071
|
+
if object_parent.isa == 'PBXProject'
|
|
26072
|
+
project.project_dir + project.root_object.project_dir_path
|
|
26073
|
+
else
|
|
26074
|
+
object_parent.real_path
|
|
26075
|
+
end
|
|
26076
|
+
when 'SOURCE_ROOT'
|
|
26077
|
+
project.project_dir
|
|
26078
|
+
when '<absolute>'
|
|
26079
|
+
nil
|
|
26080
|
+
else
|
|
26081
|
+
Pathname.new("$" + "{#{source_tree}}")
|
|
26082
|
+
end
|
|
26083
|
+
end
|
|
26084
|
+
|
|
26085
|
+
def set_source_tree(source_tree)
|
|
26086
|
+
self.source_tree = GroupableHelper.normalize_source_tree(source_tree)
|
|
26087
|
+
end
|
|
26088
|
+
|
|
26089
|
+
def peach_set_path_with_source_tree(new_path, source_tree)
|
|
26090
|
+
new_path = Pathname.new(new_path.to_s)
|
|
26091
|
+
source_tree = GroupableHelper.normalize_source_tree(source_tree)
|
|
26092
|
+
self.source_tree = source_tree
|
|
26093
|
+
if source_tree == '<absolute>'
|
|
26094
|
+
raise "[Xcodeproj] Attempt to set a relative path with an absolute source tree: '#{new_path}'" unless new_path.absolute?
|
|
26095
|
+
self.path = new_path.to_s
|
|
26096
|
+
elsif source_tree == '<group>' || source_tree == 'SOURCE_ROOT'
|
|
26097
|
+
tree_path = source_tree_real_path
|
|
26098
|
+
self.path = tree_path && tree_path.absolute? == new_path.absolute? ? new_path.relative_path_from(tree_path).to_s : new_path.to_s
|
|
26099
|
+
else
|
|
26100
|
+
self.path = new_path.to_s
|
|
26101
|
+
end
|
|
26102
|
+
end
|
|
26103
|
+
|
|
26104
|
+
def build_files
|
|
26105
|
+
referrers.select { |o| o.is_a?(PBXBuildFile) }
|
|
26106
|
+
end
|
|
26107
|
+
|
|
26108
|
+
def remove_from_project
|
|
26109
|
+
build_files.each(&:remove_from_project)
|
|
26110
|
+
super
|
|
26111
|
+
end
|
|
26112
|
+
end
|
|
26113
|
+
class XCBuildConfiguration < AbstractObject
|
|
26114
|
+
MUTUAL_RECURSION_SENTINEL = 'xcodeproj.mutual_recursion_sentinel'.freeze
|
|
26115
|
+
ARRAY_SETTINGS = %w(
|
|
26116
|
+
ALTERNATE_PERMISSIONS_FILES ARCHS BUILD_VARIANTS EXCLUDED_SOURCE_FILE_NAMES FRAMEWORK_SEARCH_PATHS
|
|
26117
|
+
GCC_PREPROCESSOR_DEFINITIONS GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS HEADER_SEARCH_PATHS
|
|
26118
|
+
INFOPLIST_PREPROCESSOR_DEFINITIONS LIBRARY_SEARCH_PATHS OTHER_CFLAGS OTHER_CPLUSPLUSFLAGS OTHER_LDFLAGS
|
|
26119
|
+
REZ_SEARCH_PATHS SECTORDER_FLAGS WARNING_CFLAGS WARNING_LDFLAGS
|
|
26120
|
+
).freeze
|
|
26121
|
+
ARRAY_SETTINGS_OBJECT_VERSION_50 = %w(
|
|
26122
|
+
ALTERNATE_PERMISSIONS_FILES ARCHS BUILD_VARIANTS EXCLUDED_SOURCE_FILE_NAMES FRAMEWORK_SEARCH_PATHS
|
|
26123
|
+
GCC_PREPROCESSOR_DEFINITIONS GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS HEADER_SEARCH_PATHS
|
|
26124
|
+
INCLUDED_SOURCE_FILE_NAMES INFOPLIST_PREPROCESSOR_DEFINITIONS LD_RUNPATH_SEARCH_PATHS LIBRARY_SEARCH_PATHS
|
|
26125
|
+
LOCALIZED_STRING_MACRO_NAMES OTHER_CFLAGS OTHER_CPLUSPLUSFLAGS OTHER_LDFLAGS REZ_SEARCH_PATHS SECTORDER_FLAGS
|
|
26126
|
+
SYSTEM_FRAMEWORK_SEARCH_PATHS SYSTEM_HEADER_SEARCH_PATHS USER_HEADER_SEARCH_PATHS WARNING_CFLAGS WARNING_LDFLAGS
|
|
26127
|
+
).freeze
|
|
26128
|
+
|
|
26129
|
+
attribute :name, 'name'
|
|
26130
|
+
has_one :base_configuration_reference, 'baseConfigurationReference'
|
|
26131
|
+
|
|
26132
|
+
def build_settings
|
|
26133
|
+
@attributes['buildSettings'] ||= {}
|
|
26134
|
+
end
|
|
26135
|
+
|
|
26136
|
+
def build_settings=(settings)
|
|
26137
|
+
peach_set('buildSettings', settings)
|
|
26138
|
+
end
|
|
26139
|
+
|
|
26140
|
+
def debug?
|
|
26141
|
+
gcc_preprocessor_definitions = resolve_build_setting('GCC_PREPROCESSOR_DEFINITIONS')
|
|
26142
|
+
gcc_preprocessor_definitions && gcc_preprocessor_definitions.include?('DEBUG=1')
|
|
26143
|
+
end
|
|
26144
|
+
|
|
26145
|
+
def type
|
|
26146
|
+
debug? ? :debug : :release
|
|
26147
|
+
end
|
|
26148
|
+
|
|
26149
|
+
def resolve_build_setting(key, root_target = nil, previous_key = nil)
|
|
26150
|
+
setting = build_settings[key]
|
|
26151
|
+
setting = resolve_variable_substitution(key, setting, root_target, previous_key)
|
|
26152
|
+
|
|
26153
|
+
config_setting = config[key]
|
|
26154
|
+
config_setting = resolve_variable_substitution(key, config_setting, root_target, previous_key)
|
|
26155
|
+
|
|
26156
|
+
project_setting = project.build_configuration_list[name]
|
|
26157
|
+
project_setting = nil if equal?(project_setting)
|
|
26158
|
+
project_setting &&= project_setting.resolve_build_setting(key, root_target)
|
|
26159
|
+
|
|
26160
|
+
defaults = {
|
|
26161
|
+
'CONFIGURATION' => name,
|
|
26162
|
+
'SRCROOT' => project.project_dir.to_s,
|
|
26163
|
+
}
|
|
26164
|
+
|
|
26165
|
+
if previous_key.nil? && setting == MUTUAL_RECURSION_SENTINEL
|
|
26166
|
+
setting = nil
|
|
26167
|
+
end
|
|
26168
|
+
|
|
26169
|
+
[defaults[key], project_setting, config_setting, setting, ENV[key]].compact.reduce(nil) do |inherited, value|
|
|
26170
|
+
expand_build_setting(value, inherited)
|
|
26171
|
+
end
|
|
26172
|
+
end
|
|
26173
|
+
|
|
26174
|
+
private
|
|
26175
|
+
|
|
26176
|
+
def expand_build_setting(build_setting_value, config_value)
|
|
26177
|
+
if build_setting_value.is_a?(Array) && config_value.is_a?(String)
|
|
26178
|
+
config_value = split_build_setting_array_to_string(config_value)
|
|
26179
|
+
elsif build_setting_value.is_a?(String) && config_value.is_a?(Array)
|
|
26180
|
+
build_setting_value = split_build_setting_array_to_string(build_setting_value)
|
|
26181
|
+
end
|
|
26182
|
+
|
|
26183
|
+
default = build_setting_value.is_a?(String) ? '' : []
|
|
26184
|
+
inherited = config_value || default
|
|
26185
|
+
|
|
26186
|
+
return build_setting_value.gsub(Regexp.union(Constants::INHERITED_KEYWORDS), inherited) if build_setting_value.is_a? String
|
|
26187
|
+
build_setting_value.flat_map { |value| Constants::INHERITED_KEYWORDS.include?(value) ? inherited : value }
|
|
26188
|
+
end
|
|
26189
|
+
|
|
26190
|
+
def resolve_variable_substitution(key, value, root_target, previous_key = nil)
|
|
26191
|
+
case value
|
|
26192
|
+
when Array
|
|
26193
|
+
return value.map { |v| resolve_variable_substitution(key, v, root_target) }
|
|
26194
|
+
when nil
|
|
26195
|
+
return
|
|
26196
|
+
when String
|
|
26197
|
+
nil
|
|
26198
|
+
else
|
|
26199
|
+
raise ArgumentError, "Settings values can only be nil, string, or array, got #{value.inspect} for #{key}"
|
|
26200
|
+
end
|
|
26201
|
+
|
|
26202
|
+
unless variable_match_data = value.match(/\$(?:[{]([_a-zA-Z0-9]+?)[}]|[(]([_a-zA-Z0-9]+?)[)])/)
|
|
26203
|
+
return value
|
|
26204
|
+
end
|
|
26205
|
+
variable_reference = variable_match_data[0]
|
|
26206
|
+
variable = variable_match_data[1] || variable_match_data[2]
|
|
26207
|
+
|
|
26208
|
+
case variable
|
|
26209
|
+
when 'inherited'
|
|
26210
|
+
value
|
|
26211
|
+
when key
|
|
26212
|
+
nil
|
|
26213
|
+
when previous_key
|
|
26214
|
+
MUTUAL_RECURSION_SENTINEL
|
|
26215
|
+
else
|
|
26216
|
+
configuration_to_resolve_against = root_target ? root_target.build_configuration_list[name] : self
|
|
26217
|
+
resolved_value_for_variable = configuration_to_resolve_against.resolve_build_setting(variable, root_target, key) || ''
|
|
26218
|
+
|
|
26219
|
+
if resolved_value_for_variable == MUTUAL_RECURSION_SENTINEL
|
|
26220
|
+
return MUTUAL_RECURSION_SENTINEL
|
|
26221
|
+
end
|
|
26222
|
+
|
|
26223
|
+
value = value.gsub(variable_reference, resolved_value_for_variable)
|
|
26224
|
+
resolve_variable_substitution(key, value, root_target)
|
|
26225
|
+
end
|
|
26226
|
+
end
|
|
26227
|
+
|
|
26228
|
+
def normalize_array_settings(settings)
|
|
26229
|
+
return unless settings
|
|
26230
|
+
|
|
26231
|
+
array_settings = project.object_version.to_i >= 50 ? ARRAY_SETTINGS_OBJECT_VERSION_50 : ARRAY_SETTINGS
|
|
26232
|
+
|
|
26233
|
+
settings.keys.each do |key|
|
|
26234
|
+
next unless value = settings[key]
|
|
26235
|
+
stripped_key = key.sub(/\[[^\]]+\]$/, '')
|
|
26236
|
+
case value
|
|
26237
|
+
when String
|
|
26238
|
+
next unless array_settings.include?(stripped_key)
|
|
26239
|
+
array_value = split_build_setting_array_to_string(value)
|
|
26240
|
+
next unless array_value.size > 1
|
|
26241
|
+
settings[key] = array_value
|
|
26242
|
+
when Array
|
|
26243
|
+
next if value.size > 1 && array_settings.include?(stripped_key)
|
|
26244
|
+
settings[key] = value.join(' ')
|
|
26245
|
+
end
|
|
26246
|
+
end
|
|
26247
|
+
end
|
|
26248
|
+
|
|
26249
|
+
def split_build_setting_array_to_string(string)
|
|
26250
|
+
regexp = / *((['"]?).*?[^\\]\2)(?=( |\z))/
|
|
26251
|
+
string.scan(regexp).map(&:first)
|
|
26252
|
+
end
|
|
26253
|
+
|
|
26254
|
+
def config
|
|
26255
|
+
return {} unless base_configuration_reference
|
|
26256
|
+
# integration sets the reference after hooks have read the settings
|
|
26257
|
+
@config = nil unless @config_reference == peach_uuid('baseConfigurationReference')
|
|
26258
|
+
@config_reference = peach_uuid('baseConfigurationReference')
|
|
26259
|
+
@config ||=
|
|
26260
|
+
if base_configuration_reference.real_path.exist?
|
|
26261
|
+
Xcodeproj::Config.new(base_configuration_reference.real_path).to_hash.tap do |hash|
|
|
26262
|
+
normalize_array_settings(hash)
|
|
26263
|
+
end
|
|
26264
|
+
else
|
|
26265
|
+
{}
|
|
26266
|
+
end
|
|
26267
|
+
end
|
|
26268
|
+
end
|
|
26269
|
+
|
|
26270
|
+
class XCConfigurationList < AbstractObject
|
|
26271
|
+
attribute :default_configuration_is_visible, 'defaultConfigurationIsVisible', '0'
|
|
26272
|
+
attribute :default_configuration_name, 'defaultConfigurationName'
|
|
26273
|
+
has_many :build_configurations, 'buildConfigurations'
|
|
26274
|
+
|
|
26275
|
+
def [](name)
|
|
26276
|
+
build_configurations.find { |bc| bc.name == name }
|
|
26277
|
+
end
|
|
26278
|
+
|
|
26279
|
+
def build_settings(build_configuration_name)
|
|
26280
|
+
configuration = self[build_configuration_name]
|
|
26281
|
+
configuration && configuration.build_settings
|
|
26282
|
+
end
|
|
26283
|
+
end
|
|
26284
|
+
|
|
26285
|
+
class PBXBuildFile < AbstractObject
|
|
26286
|
+
attribute :settings, 'settings'
|
|
26287
|
+
has_one :file_ref, 'fileRef'
|
|
26288
|
+
has_one :product_ref, 'productRef'
|
|
26289
|
+
|
|
26290
|
+
def display_name
|
|
26291
|
+
if product_ref
|
|
26292
|
+
product_ref.display_name
|
|
26293
|
+
elsif file_ref
|
|
26294
|
+
file_ref.display_name
|
|
26295
|
+
else
|
|
26296
|
+
super
|
|
26297
|
+
end
|
|
26298
|
+
end
|
|
26299
|
+
end
|
|
26300
|
+
|
|
26301
|
+
class AbstractBuildPhase < AbstractObject
|
|
26302
|
+
has_many :files, 'files'
|
|
26303
|
+
attribute :build_action_mask, 'buildActionMask', '2147483647'
|
|
26304
|
+
attribute :run_only_for_deployment_postprocessing, 'runOnlyForDeploymentPostprocessing', '0'
|
|
26305
|
+
attribute :always_out_of_date, 'alwaysOutOfDate'
|
|
26306
|
+
|
|
26307
|
+
def files_references
|
|
26308
|
+
files.map(&:file_ref)
|
|
26309
|
+
end
|
|
26310
|
+
|
|
26311
|
+
def file_display_names
|
|
26312
|
+
files.map(&:display_name)
|
|
26313
|
+
end
|
|
26314
|
+
|
|
26315
|
+
def build_file(file_ref)
|
|
26316
|
+
files.find { |build_file| build_file.peach_uuid('fileRef') == file_ref.uuid }
|
|
26317
|
+
end
|
|
26318
|
+
|
|
26319
|
+
def include?(file_ref)
|
|
26320
|
+
!build_file(file_ref).nil?
|
|
26321
|
+
end
|
|
26322
|
+
|
|
26323
|
+
def add_file_reference(file_ref, avoid_duplicates = false)
|
|
26324
|
+
existing = avoid_duplicates && build_file(file_ref)
|
|
26325
|
+
return existing if existing
|
|
26326
|
+
build_file = project.new(PBXBuildFile)
|
|
26327
|
+
build_file.file_ref = file_ref
|
|
26328
|
+
files << build_file
|
|
26329
|
+
build_file
|
|
26330
|
+
end
|
|
26331
|
+
|
|
26332
|
+
def remove_file_reference(file_ref)
|
|
26333
|
+
build_file = files.find { |bf| bf.file_ref == file_ref }
|
|
26334
|
+
remove_build_file(build_file) if build_file
|
|
26335
|
+
end
|
|
26336
|
+
|
|
26337
|
+
def remove_build_file(build_file)
|
|
26338
|
+
build_file.file_ref = nil
|
|
26339
|
+
build_file.remove_from_project
|
|
26340
|
+
end
|
|
26341
|
+
|
|
26342
|
+
def clear
|
|
26343
|
+
files.objects.each { |bf| remove_build_file(bf) }
|
|
26344
|
+
end
|
|
26345
|
+
alias_method :clear_build_files, :clear
|
|
26346
|
+
|
|
26347
|
+
def display_name
|
|
26348
|
+
super.gsub(/BuildPhase$/, '')
|
|
26349
|
+
end
|
|
26350
|
+
end
|
|
26351
|
+
|
|
26352
|
+
class PBXHeadersBuildPhase < AbstractBuildPhase; end
|
|
26353
|
+
class PBXSourcesBuildPhase < AbstractBuildPhase; end
|
|
26354
|
+
class PBXFrameworksBuildPhase < AbstractBuildPhase; end
|
|
26355
|
+
class PBXResourcesBuildPhase < AbstractBuildPhase; end
|
|
26356
|
+
|
|
26357
|
+
class PBXCopyFilesBuildPhase < AbstractBuildPhase
|
|
26358
|
+
attribute :name, 'name'
|
|
26359
|
+
attribute :dst_path, 'dstPath', ''
|
|
26360
|
+
attribute :dst_subfolder_spec, 'dstSubfolderSpec', '7'
|
|
26361
|
+
end
|
|
26362
|
+
|
|
26363
|
+
class PBXShellScriptBuildPhase < AbstractBuildPhase
|
|
26364
|
+
attribute :name, 'name'
|
|
26365
|
+
attribute :input_paths, 'inputPaths', []
|
|
26366
|
+
attribute :input_file_list_paths, 'inputFileListPaths', []
|
|
26367
|
+
attribute :output_paths, 'outputPaths', []
|
|
26368
|
+
attribute :output_file_list_paths, 'outputFileListPaths', []
|
|
26369
|
+
attribute :shell_path, 'shellPath', '/bin/sh'
|
|
26370
|
+
attribute :shell_script, 'shellScript', "# Type a script or drag a script file from your workspace to insert its path.\n"
|
|
26371
|
+
attribute :show_env_vars_in_log, 'showEnvVarsInLog'
|
|
26372
|
+
attribute :dependency_file, 'dependencyFile'
|
|
26373
|
+
end
|
|
26374
|
+
|
|
26375
|
+
class PBXFileReference < AbstractObject
|
|
26376
|
+
include GroupableHelper
|
|
26377
|
+
attribute :name, 'name'
|
|
26378
|
+
attribute :path, 'path'
|
|
26379
|
+
attribute :source_tree, 'sourceTree', 'SOURCE_ROOT'
|
|
26380
|
+
attribute :explicit_file_type, 'explicitFileType'
|
|
26381
|
+
attribute :last_known_file_type, 'lastKnownFileType'
|
|
26382
|
+
attribute :include_in_index, 'includeInIndex', '1'
|
|
26383
|
+
attribute :fileEncoding, 'fileEncoding'
|
|
26384
|
+
|
|
26385
|
+
def display_name
|
|
26386
|
+
if name
|
|
26387
|
+
name
|
|
26388
|
+
elsif source_tree == 'BUILT_PRODUCTS_DIR'
|
|
26389
|
+
path
|
|
26390
|
+
elsif path
|
|
26391
|
+
File.basename(path)
|
|
26392
|
+
end
|
|
26393
|
+
end
|
|
26394
|
+
|
|
26395
|
+
def set_path(new_path)
|
|
26396
|
+
if new_path
|
|
26397
|
+
peach_set_path_with_source_tree(new_path, source_tree)
|
|
26398
|
+
else
|
|
26399
|
+
self.path = nil
|
|
26400
|
+
end
|
|
26401
|
+
end
|
|
26402
|
+
|
|
26403
|
+
def set_last_known_file_type(type = nil)
|
|
26404
|
+
if type
|
|
26405
|
+
self.last_known_file_type = type
|
|
26406
|
+
elsif path
|
|
26407
|
+
self.last_known_file_type = Peach::Xcode.file_type(File.extname(path)[1..-1].to_s)
|
|
26408
|
+
end
|
|
26409
|
+
end
|
|
26410
|
+
|
|
26411
|
+
def set_explicit_file_type(type = nil)
|
|
26412
|
+
self.last_known_file_type = nil
|
|
26413
|
+
if type
|
|
26414
|
+
self.explicit_file_type = type
|
|
26415
|
+
elsif path
|
|
26416
|
+
self.explicit_file_type = Peach::Xcode.file_type(File.extname(path)[1..-1].to_s)
|
|
26417
|
+
end
|
|
26418
|
+
end
|
|
26419
|
+
end
|
|
26420
|
+
|
|
26421
|
+
class PBXReferenceProxy < AbstractObject
|
|
26422
|
+
include GroupableHelper
|
|
26423
|
+
attribute :name, 'name'
|
|
26424
|
+
attribute :path, 'path'
|
|
26425
|
+
attribute :file_type, 'fileType'
|
|
26426
|
+
attribute :source_tree, 'sourceTree'
|
|
26427
|
+
has_one :remote_ref, 'remoteRef'
|
|
26428
|
+
end
|
|
26429
|
+
|
|
26430
|
+
class PBXGroup < AbstractObject
|
|
26431
|
+
include GroupableHelper
|
|
26432
|
+
has_many :children, 'children'
|
|
26433
|
+
attribute :source_tree, 'sourceTree', '<group>'
|
|
26434
|
+
attribute :path, 'path'
|
|
26435
|
+
attribute :name, 'name'
|
|
26436
|
+
|
|
26437
|
+
def display_name
|
|
26438
|
+
if name
|
|
26439
|
+
name
|
|
26440
|
+
elsif path
|
|
26441
|
+
File.basename(path)
|
|
26442
|
+
elsif equal?(project.main_group)
|
|
26443
|
+
'Main Group'
|
|
26444
|
+
end
|
|
26445
|
+
end
|
|
26446
|
+
|
|
26447
|
+
def set_path(new_path)
|
|
26448
|
+
if new_path
|
|
26449
|
+
peach_set_path_with_source_tree(new_path, source_tree)
|
|
26450
|
+
else
|
|
26451
|
+
self.path = nil
|
|
26452
|
+
self.source_tree = '<group>'
|
|
26453
|
+
end
|
|
26454
|
+
end
|
|
26455
|
+
|
|
26456
|
+
def files
|
|
26457
|
+
children.select { |o| o.is_a?(PBXFileReference) }
|
|
26458
|
+
end
|
|
26459
|
+
|
|
26460
|
+
def find_file_by_path(file_path)
|
|
26461
|
+
files.find { |ref| ref.path == file_path }
|
|
26462
|
+
end
|
|
26463
|
+
|
|
26464
|
+
def groups
|
|
26465
|
+
children.select { |o| o.instance_of?(PBXGroup) }
|
|
26466
|
+
end
|
|
26467
|
+
|
|
26468
|
+
def recursive_children_groups
|
|
26469
|
+
groups.flat_map { |child| [child] + child.recursive_children_groups }
|
|
26470
|
+
end
|
|
26471
|
+
|
|
26472
|
+
def recursive_children
|
|
26473
|
+
children.flat_map { |child| child.is_a?(PBXGroup) ? [child] + child.recursive_children : [child] }
|
|
26474
|
+
end
|
|
26475
|
+
|
|
26476
|
+
def empty?
|
|
26477
|
+
children.count.zero?
|
|
26478
|
+
end
|
|
26479
|
+
|
|
26480
|
+
# FileReferencesFactory.new_reference for a plain file
|
|
26481
|
+
def new_reference(file_path, source_tree = :group)
|
|
26482
|
+
extension = File.extname(file_path.to_s).downcase
|
|
26483
|
+
raise ArgumentError, "Peach adds no #{extension} reference (#{file_path})" if %w(.xcdatamodeld .xcodeproj).include?(extension)
|
|
26484
|
+
ref = project.new(PBXFileReference)
|
|
26485
|
+
children << ref
|
|
26486
|
+
ref.peach_set_path_with_source_tree(file_path, source_tree)
|
|
26487
|
+
ref.set_last_known_file_type
|
|
26488
|
+
ref.name = ref.path.split('/').last if ref.path.include?('/')
|
|
26489
|
+
ref.include_in_index = nil if File.extname(ref.path).downcase == '.framework'
|
|
26490
|
+
ref
|
|
26491
|
+
end
|
|
26492
|
+
alias_method :new_file, :new_reference
|
|
26493
|
+
|
|
26494
|
+
def new_product_ref_for_target(product_basename, product_type)
|
|
26495
|
+
extension = Peach::Xcode.product_extension(product_type.to_s)
|
|
26496
|
+
product_path = "#{product_type == :static_library ? 'lib' : ''}#{product_basename}"
|
|
26497
|
+
product_path += ".#{extension}" if extension
|
|
26498
|
+
ref = new_reference(product_path, :built_products)
|
|
26499
|
+
ref.include_in_index = '0'
|
|
26500
|
+
ref.set_explicit_file_type
|
|
26501
|
+
ref
|
|
26502
|
+
end
|
|
26503
|
+
|
|
26504
|
+
def new_group(name, group_path = nil, source_tree = :group)
|
|
26505
|
+
group = project.new(PBXGroup)
|
|
26506
|
+
children << group
|
|
26507
|
+
group.name = name
|
|
26508
|
+
group.set_source_tree(source_tree)
|
|
26509
|
+
group.set_path(group_path)
|
|
26510
|
+
group
|
|
26511
|
+
end
|
|
26512
|
+
|
|
26513
|
+
def [](group_path)
|
|
26514
|
+
find_subpath(group_path, false)
|
|
26515
|
+
end
|
|
26516
|
+
|
|
26517
|
+
def <<(child)
|
|
26518
|
+
children << child
|
|
26519
|
+
end
|
|
26520
|
+
|
|
26521
|
+
def find_subpath(group_path, should_create = false)
|
|
26522
|
+
return self unless group_path
|
|
26523
|
+
group_path = group_path.split('/') unless group_path.is_a?(Array)
|
|
26524
|
+
child_name = group_path.first
|
|
26525
|
+
rest = group_path.drop(1)
|
|
26526
|
+
child = children.find { |c| c.display_name == child_name }
|
|
26527
|
+
if child.nil?
|
|
26528
|
+
return nil unless should_create
|
|
26529
|
+
child = new_group(child_name)
|
|
26530
|
+
end
|
|
26531
|
+
rest.empty? ? child : child.find_subpath(rest, should_create)
|
|
26532
|
+
end
|
|
26533
|
+
end
|
|
26534
|
+
|
|
26535
|
+
class PBXVariantGroup < PBXGroup
|
|
26536
|
+
attribute :last_known_file_type, 'lastKnownFileType'
|
|
26537
|
+
end
|
|
26538
|
+
|
|
26539
|
+
class XCVersionGroup < PBXGroup
|
|
26540
|
+
attribute :version_group_type, 'versionGroupType', 'wrapper.xcdatamodel'
|
|
26541
|
+
end
|
|
26542
|
+
|
|
26543
|
+
class PBXContainerItemProxy < AbstractObject
|
|
26544
|
+
attribute :container_portal, 'containerPortal'
|
|
26545
|
+
attribute :proxy_type, 'proxyType'
|
|
26546
|
+
attribute :remote_global_id_string, 'remoteGlobalIDString'
|
|
26547
|
+
attribute :remote_info, 'remoteInfo'
|
|
26548
|
+
end
|
|
26549
|
+
|
|
26550
|
+
class PBXTargetDependency < AbstractObject
|
|
26551
|
+
has_one :target, 'target'
|
|
26552
|
+
has_one :target_proxy, 'targetProxy'
|
|
26553
|
+
has_one :product_ref, 'productRef'
|
|
26554
|
+
attribute :name, 'name'
|
|
26555
|
+
|
|
26556
|
+
def display_name
|
|
26557
|
+
return name if name
|
|
26558
|
+
return target.name if target
|
|
26559
|
+
return target_proxy.remote_info if target_proxy
|
|
26560
|
+
return product_ref.product_name if product_ref
|
|
26561
|
+
end
|
|
26562
|
+
end
|
|
26563
|
+
|
|
26564
|
+
class XCSwiftPackageProductDependency < AbstractObject
|
|
26565
|
+
has_one :package, 'package'
|
|
26566
|
+
attribute :product_name, 'productName'
|
|
26567
|
+
|
|
26568
|
+
def display_name
|
|
26569
|
+
product_name || super
|
|
26570
|
+
end
|
|
26571
|
+
end
|
|
26572
|
+
|
|
26573
|
+
class XCRemoteSwiftPackageReference < AbstractObject
|
|
26574
|
+
attribute :repositoryURL, 'repositoryURL'
|
|
26575
|
+
attribute :requirement, 'requirement'
|
|
26576
|
+
|
|
26577
|
+
def display_name
|
|
26578
|
+
repositoryURL || super
|
|
26579
|
+
end
|
|
26580
|
+
end
|
|
26581
|
+
|
|
26582
|
+
class XCLocalSwiftPackageReference < AbstractObject
|
|
26583
|
+
attribute :path, 'path'
|
|
26584
|
+
attribute :relative_path, 'relativePath'
|
|
26585
|
+
end
|
|
26586
|
+
|
|
26587
|
+
class AbstractTarget < AbstractObject
|
|
26588
|
+
attribute :name, 'name'
|
|
26589
|
+
attribute :product_name, 'productName'
|
|
26590
|
+
has_one :build_configuration_list, 'buildConfigurationList'
|
|
26591
|
+
has_many :dependencies, 'dependencies'
|
|
26592
|
+
has_many :build_phases, 'buildPhases'
|
|
26593
|
+
|
|
26594
|
+
def build_configurations
|
|
26595
|
+
build_configuration_list.build_configurations
|
|
26596
|
+
end
|
|
26597
|
+
|
|
26598
|
+
def build_settings(build_configuration_name)
|
|
26599
|
+
build_configuration_list.build_settings(build_configuration_name)
|
|
26600
|
+
end
|
|
26601
|
+
|
|
26602
|
+
def common_resolved_build_setting(key)
|
|
26603
|
+
values = build_configurations.map { |config| config.resolve_build_setting(key, self) }.compact.uniq
|
|
26604
|
+
values.first if values.count <= 1
|
|
26605
|
+
end
|
|
26606
|
+
|
|
26607
|
+
def dependency_for_target(target)
|
|
26608
|
+
dependencies.find { |dep| dep.target ? dep.target.uuid == target.uuid : dep.target_proxy && dep.target_proxy.remote_global_id_string == target.uuid }
|
|
26609
|
+
end
|
|
26610
|
+
|
|
26611
|
+
def shell_script_build_phases
|
|
26612
|
+
build_phases.select { |o| o.is_a?(PBXShellScriptBuildPhase) }
|
|
26613
|
+
end
|
|
26614
|
+
|
|
26615
|
+
def copy_files_build_phases
|
|
26616
|
+
build_phases.select { |o| o.is_a?(PBXCopyFilesBuildPhase) }
|
|
26617
|
+
end
|
|
26618
|
+
|
|
26619
|
+
def new_shell_script_build_phase(name = nil)
|
|
26620
|
+
phase = project.new(PBXShellScriptBuildPhase)
|
|
26621
|
+
phase.name = name
|
|
26622
|
+
build_phases << phase
|
|
26623
|
+
phase
|
|
26624
|
+
end
|
|
26625
|
+
|
|
26626
|
+
def new_copy_files_build_phase(name = nil)
|
|
26627
|
+
phase = project.new(PBXCopyFilesBuildPhase)
|
|
26628
|
+
phase.name = name
|
|
26629
|
+
build_phases << phase
|
|
26630
|
+
phase
|
|
26631
|
+
end
|
|
26632
|
+
end
|
|
26633
|
+
|
|
26634
|
+
class PBXNativeTarget < AbstractTarget
|
|
26635
|
+
attribute :product_type, 'productType'
|
|
26636
|
+
attribute :product_install_path, 'productInstallPath'
|
|
26637
|
+
has_one :product_reference, 'productReference'
|
|
26638
|
+
has_many :package_product_dependencies, 'packageProductDependencies'
|
|
26639
|
+
|
|
26640
|
+
def symbol_type
|
|
26641
|
+
Constants::PRODUCT_TYPE_UTI.key(product_type)
|
|
26642
|
+
end
|
|
26643
|
+
|
|
26644
|
+
def test_target_type?
|
|
26645
|
+
%i(octest_bundle unit_test_bundle ui_test_bundle).include?(symbol_type)
|
|
26646
|
+
end
|
|
26647
|
+
|
|
26648
|
+
def extension_target_type?
|
|
26649
|
+
%i(app_extension watch_extension watch2_extension tv_extension messages_extension).include?(symbol_type)
|
|
26650
|
+
end
|
|
26651
|
+
|
|
26652
|
+
def launchable_target_type?
|
|
26653
|
+
%i(application command_line_tool).include?(symbol_type)
|
|
26654
|
+
end
|
|
26655
|
+
|
|
26656
|
+
def source_build_phase
|
|
26657
|
+
peach_phase(PBXSourcesBuildPhase)
|
|
26658
|
+
end
|
|
26659
|
+
|
|
26660
|
+
def headers_build_phase
|
|
26661
|
+
peach_phase(PBXHeadersBuildPhase)
|
|
26662
|
+
end
|
|
26663
|
+
|
|
26664
|
+
def frameworks_build_phase
|
|
26665
|
+
peach_phase(PBXFrameworksBuildPhase)
|
|
26666
|
+
end
|
|
26667
|
+
|
|
26668
|
+
def resources_build_phase
|
|
26669
|
+
peach_phase(PBXResourcesBuildPhase)
|
|
26670
|
+
end
|
|
26671
|
+
|
|
26672
|
+
def add_file_references(file_references, compiler_flags = {})
|
|
26673
|
+
file_references.map do |file|
|
|
26674
|
+
header = Peach::Xcode.header?(file.path)
|
|
26675
|
+
phase = header ? headers_build_phase : source_build_phase
|
|
26676
|
+
build_file = phase.build_file(file) || phase.add_file_reference(file)
|
|
26677
|
+
if compiler_flags && !compiler_flags.empty? && !header
|
|
26678
|
+
settings = build_file.settings || {}
|
|
26679
|
+
settings['COMPILER_FLAGS'] = [settings['COMPILER_FLAGS'], compiler_flags].compact.join(' ')
|
|
26680
|
+
build_file.settings = settings
|
|
26681
|
+
end
|
|
26682
|
+
yield build_file if block_given?
|
|
26683
|
+
build_file
|
|
26684
|
+
end
|
|
26685
|
+
end
|
|
26686
|
+
|
|
26687
|
+
def add_resources(resource_file_references)
|
|
26688
|
+
resource_file_references.each do |file|
|
|
26689
|
+
resources_build_phase.add_file_reference(file) unless resources_build_phase.include?(file)
|
|
26690
|
+
end
|
|
26691
|
+
end
|
|
26692
|
+
|
|
26693
|
+
private
|
|
26694
|
+
|
|
26695
|
+
def peach_phase(klass)
|
|
26696
|
+
build_phases.find { |phase| phase.instance_of?(klass) } || project.new(klass).tap { |phase| build_phases << phase }
|
|
26697
|
+
end
|
|
26698
|
+
end
|
|
26699
|
+
|
|
26700
|
+
class PBXAggregateTarget < AbstractTarget; end
|
|
26701
|
+
class PBXLegacyTarget < AbstractTarget; end
|
|
26702
|
+
|
|
26703
|
+
class PBXProject < AbstractObject
|
|
26704
|
+
has_many :targets, 'targets'
|
|
26705
|
+
attribute :attributes, 'attributes'
|
|
26706
|
+
has_one :build_configuration_list, 'buildConfigurationList'
|
|
26707
|
+
attribute :compatibility_version, 'compatibilityVersion'
|
|
26708
|
+
attribute :development_region, 'developmentRegion'
|
|
26709
|
+
attribute :known_regions, 'knownRegions'
|
|
26710
|
+
has_one :main_group, 'mainGroup'
|
|
26711
|
+
has_one :product_ref_group, 'productRefGroup'
|
|
26712
|
+
attribute :project_dir_path, 'projectDirPath', ''
|
|
26713
|
+
attribute :project_root, 'projectRoot', ''
|
|
26714
|
+
has_many :package_references, 'packageReferences'
|
|
26715
|
+
|
|
26716
|
+
def name
|
|
26717
|
+
project.path.basename('.xcodeproj').to_s
|
|
26718
|
+
end
|
|
26719
|
+
end
|
|
26720
|
+
|
|
26721
|
+
ISA = [
|
|
26722
|
+
XCBuildConfiguration, XCConfigurationList, PBXBuildFile, PBXHeadersBuildPhase, PBXSourcesBuildPhase,
|
|
26723
|
+
PBXFrameworksBuildPhase, PBXResourcesBuildPhase, PBXCopyFilesBuildPhase, PBXShellScriptBuildPhase,
|
|
26724
|
+
PBXFileReference, PBXReferenceProxy, PBXGroup, PBXVariantGroup, XCVersionGroup, PBXContainerItemProxy,
|
|
26725
|
+
PBXTargetDependency, XCSwiftPackageProductDependency, XCRemoteSwiftPackageReference,
|
|
26726
|
+
XCLocalSwiftPackageReference, PBXNativeTarget, PBXAggregateTarget, PBXLegacyTarget, PBXProject,
|
|
26727
|
+
].each_with_object({}) { |klass, by_isa| by_isa[klass.isa] = klass }.freeze
|
|
26728
|
+
end
|
|
26729
|
+
|
|
26730
|
+
include Object
|
|
26731
|
+
end
|
|
26732
|
+
end
|
|
26733
|
+
|
|
26734
|
+
module Pod
|
|
26735
|
+
class Project < Xcodeproj::Project
|
|
26736
|
+
def initialize(path, objects, root_uuid, object_version)
|
|
26737
|
+
@uuid_prefix = Digest::SHA256.hexdigest(File.basename(path)).upcase
|
|
26738
|
+
super
|
|
26739
|
+
end
|
|
26740
|
+
|
|
26741
|
+
def generate_available_uuid_list(count = 100)
|
|
26742
|
+
start = @generated_uuids.size
|
|
26743
|
+
uniques = Array.new(count) { |i| format('%.6s%07X0', @uuid_prefix, start + i) }
|
|
26744
|
+
@generated_uuids += uniques
|
|
26745
|
+
@available_uuids += uniques
|
|
26746
|
+
end
|
|
26747
|
+
|
|
26748
|
+
def pods
|
|
26749
|
+
main_group['Pods']
|
|
26750
|
+
end
|
|
26751
|
+
|
|
26752
|
+
def development_pods
|
|
26753
|
+
main_group['Development Pods']
|
|
26754
|
+
end
|
|
26755
|
+
|
|
26756
|
+
def pod_groups
|
|
26757
|
+
[pods, development_pods].compact.flat_map(&:children)
|
|
26758
|
+
end
|
|
26759
|
+
|
|
26760
|
+
def pod_group(pod_name)
|
|
26761
|
+
pod_groups.find { |group| group.name == pod_name }
|
|
26762
|
+
end
|
|
26763
|
+
end
|
|
26764
|
+
end
|
|
26765
|
+
`;
|
|
26766
|
+
var INSTALLER = String.raw`
|
|
26767
|
+
module Pod
|
|
26768
|
+
class Installer
|
|
26769
|
+
class Xcode
|
|
26770
|
+
class PodsProjectGenerator
|
|
26771
|
+
class TargetInstallationResult
|
|
26772
|
+
attr_reader :target, :native_target, :resource_bundle_targets, :test_native_targets,
|
|
26773
|
+
:test_resource_bundle_targets, :test_app_host_targets, :app_native_targets,
|
|
26774
|
+
:app_resource_bundle_targets
|
|
26775
|
+
|
|
26776
|
+
def initialize(target, native_target, resource_bundle_targets = [])
|
|
26777
|
+
@target = target
|
|
26778
|
+
@native_target = native_target
|
|
26779
|
+
@resource_bundle_targets = resource_bundle_targets
|
|
26780
|
+
@test_native_targets = []
|
|
26781
|
+
@test_resource_bundle_targets = {}
|
|
26782
|
+
@test_app_host_targets = []
|
|
26783
|
+
@app_native_targets = {}
|
|
26784
|
+
@app_resource_bundle_targets = {}
|
|
26785
|
+
end
|
|
26786
|
+
end
|
|
26787
|
+
|
|
26788
|
+
class InstallationResults
|
|
26789
|
+
attr_reader :pod_target_installation_results, :aggregate_target_installation_results
|
|
26790
|
+
|
|
26791
|
+
def initialize(pod_target_installation_results, aggregate_target_installation_results)
|
|
26792
|
+
@pod_target_installation_results = pod_target_installation_results
|
|
26793
|
+
@aggregate_target_installation_results = aggregate_target_installation_results
|
|
26794
|
+
end
|
|
26795
|
+
end
|
|
26796
|
+
end
|
|
26797
|
+
end
|
|
26798
|
+
|
|
26799
|
+
attr_reader :pods_project, :target_installation_results
|
|
26800
|
+
|
|
26801
|
+
def generated_projects
|
|
26802
|
+
[pods_project]
|
|
26803
|
+
end
|
|
26804
|
+
|
|
26805
|
+
def generated_pod_targets
|
|
26806
|
+
pod_targets
|
|
26807
|
+
end
|
|
26808
|
+
|
|
26809
|
+
def generated_aggregate_targets
|
|
26810
|
+
aggregate_targets
|
|
26811
|
+
end
|
|
26812
|
+
|
|
26813
|
+
# what pod install does once it has generated the Pods project
|
|
26814
|
+
def peach_install(pods_project, pod_results, aggregate_results, aggregate_xcconfigs, pod_xcconfigs, file_accessors)
|
|
26815
|
+
@pods_project = pods_project
|
|
26816
|
+
result_class = Xcode::PodsProjectGenerator::TargetInstallationResult
|
|
26817
|
+
by_label = pod_targets.each_with_object({}) { |t, h| h[t.label] = t }
|
|
26818
|
+
aggregates_by_label = aggregate_targets.each_with_object({}) { |t, h| h[t.label] = t }
|
|
26819
|
+
pods = pod_results.each_with_object({}) do |(label, (native_target, bundles)), h|
|
|
26820
|
+
h[label] = result_class.new(by_label.fetch(label), pods_project.object(native_target), bundles.map { |uuid| pods_project.object(uuid) })
|
|
26821
|
+
end
|
|
26822
|
+
aggregates = aggregate_results.each_with_object({}) do |(label, native_target), h|
|
|
26823
|
+
h[label] = result_class.new(aggregates_by_label.fetch(label), pods_project.object(native_target))
|
|
26824
|
+
end
|
|
26825
|
+
@target_installation_results = Xcode::PodsProjectGenerator::InstallationResults.new(pods, aggregates)
|
|
26826
|
+
aggregate_xcconfigs.each { |label, by_config| aggregates_by_label.fetch(label).peach_xcconfigs = by_config }
|
|
26827
|
+
pod_xcconfigs.each { |label, by_config| by_label.fetch(label).peach_xcconfigs = by_config }
|
|
26828
|
+
file_accessors.each { |label, accessors| by_label.fetch(label).peach_file_accessors = accessors }
|
|
26829
|
+
run_podfile_post_install_hooks
|
|
26830
|
+
integrate_user_project
|
|
26831
|
+
perform_post_install_actions
|
|
26832
|
+
end
|
|
26833
|
+
|
|
26834
|
+
def integrate_user_project
|
|
26835
|
+
UserProjectIntegrator.new(podfile, sandbox, Pod::Config.instance.installation_root, aggregate_targets,
|
|
26836
|
+
generated_aggregate_targets).integrate!
|
|
26837
|
+
run_podfile_post_integrate_hooks
|
|
26838
|
+
end
|
|
26839
|
+
end
|
|
26840
|
+
|
|
26841
|
+
class Target
|
|
26842
|
+
def support_files_dir
|
|
26843
|
+
sandbox.root + 'Target Support Files' + label
|
|
26844
|
+
end
|
|
26845
|
+
|
|
26846
|
+
def xcconfig_path(variant = nil)
|
|
26847
|
+
if variant
|
|
26848
|
+
support_files_dir + "#{label}.#{variant.to_s.gsub(File::SEPARATOR, '-').downcase}.xcconfig"
|
|
26849
|
+
else
|
|
26850
|
+
support_files_dir + "#{label}.xcconfig"
|
|
26851
|
+
end
|
|
26852
|
+
end
|
|
26853
|
+
end
|
|
26854
|
+
|
|
26855
|
+
class AggregateTarget
|
|
26856
|
+
attr_writer :peach_xcconfigs
|
|
26857
|
+
|
|
26858
|
+
def xcconfigs
|
|
26859
|
+
@peach_xcconfigs
|
|
26860
|
+
end
|
|
26861
|
+
|
|
26862
|
+
def build_settings(configuration_name = nil)
|
|
26863
|
+
@build_settings ||= @peach_xcconfigs.each_with_object({}) do |(name, xcconfig), by_name|
|
|
26864
|
+
by_name[name] = Target::BuildSettings::AggregateTargetSettings.new(xcconfig)
|
|
26865
|
+
end
|
|
26866
|
+
if configuration_name
|
|
26867
|
+
@build_settings[configuration_name] ||
|
|
26868
|
+
raise(ArgumentError, "#{self} does not contain a build setting for the #{configuration_name} configuration, only #{@build_settings.keys}")
|
|
26869
|
+
else
|
|
26870
|
+
@build_settings.each_value.first || raise(ArgumentError, "#{self} does not contain any build settings")
|
|
26871
|
+
end
|
|
26872
|
+
end
|
|
26873
|
+
end
|
|
26874
|
+
|
|
26875
|
+
class PodTarget
|
|
26876
|
+
attr_writer :peach_file_accessors, :peach_xcconfigs
|
|
26877
|
+
|
|
26878
|
+
def file_accessors
|
|
26879
|
+
@peach_file_accessors
|
|
26880
|
+
end
|
|
26881
|
+
|
|
26882
|
+
def build_settings
|
|
26883
|
+
@build_settings ||= @peach_xcconfigs.each_with_object({}) do |(name, xcconfig), by_name|
|
|
26884
|
+
by_name[name] = Target::BuildSettings::PodTargetSettings.new(xcconfig)
|
|
26885
|
+
end
|
|
26886
|
+
end
|
|
26887
|
+
end
|
|
26888
|
+
|
|
26889
|
+
class Target
|
|
26890
|
+
# the settings Peach computed, as the xcconfig CocoaPods writes for them
|
|
26891
|
+
class BuildSettings
|
|
26892
|
+
attr_reader :xcconfig
|
|
26893
|
+
|
|
26894
|
+
def initialize(xcconfig)
|
|
26895
|
+
@xcconfig = xcconfig
|
|
26896
|
+
end
|
|
26897
|
+
|
|
26898
|
+
class PodTargetSettings < BuildSettings; end
|
|
26899
|
+
class AggregateTargetSettings < BuildSettings; end
|
|
26900
|
+
end
|
|
26901
|
+
end
|
|
26902
|
+
|
|
26903
|
+
class Sandbox
|
|
26904
|
+
class FileAccessor
|
|
26905
|
+
attr_reader :spec, :resource_bundles
|
|
26906
|
+
|
|
26907
|
+
def initialize(spec, resource_bundles)
|
|
26908
|
+
@spec = spec
|
|
26909
|
+
@resource_bundles = resource_bundles
|
|
26910
|
+
end
|
|
26911
|
+
end
|
|
26912
|
+
end
|
|
26913
|
+
end
|
|
26914
|
+
`;
|
|
26915
|
+
|
|
26916
|
+
// src/pods-project.ts
|
|
26917
|
+
init_openstep_plist();
|
|
26918
|
+
var HEADERS = new Set(HEADER_EXTENSIONS2);
|
|
26919
|
+
var SOURCES = new Set(SOURCE_FILE_EXTENSIONS);
|
|
26920
|
+
|
|
26921
|
+
// src/pods-install.ts
|
|
26922
|
+
init_podspec_cocoapods();
|
|
26923
|
+
init_podspec_ruby();
|
|
26924
|
+
init_podspec_ruby_stdlib();
|
|
26925
|
+
var COCOAPODS_VERSION2 = "1.17.0";
|
|
26926
|
+
var INSTALL_INPUTS = String.raw`
|
|
26927
|
+
lambda do |podfile, sandbox, resolver|
|
|
26928
|
+
roots = resolver.specifications.map(&:root).uniq
|
|
26929
|
+
{
|
|
26930
|
+
'definitions' => podfile.target_definition_list.reject(&:abstract?).map do |td|
|
|
26931
|
+
{ 'name' => td.name.to_s, 'project' => td.user_project_path&.to_s, 'configurations' => (td.build_configurations || {}).map { |name, type| [name.to_s, type.to_s] }.to_h }
|
|
26932
|
+
end,
|
|
26933
|
+
'workspace' => podfile.workspace_path&.to_s,
|
|
26934
|
+
'downloads' => roots.reject { |spec| sandbox.local?(spec.name) }.map { |spec| [spec.name, spec.to_pretty_json] },
|
|
26935
|
+
'stored' => sandbox.stored_podspecs.map { |name, spec| [name, spec.to_pretty_json] },
|
|
26936
|
+
}
|
|
26937
|
+
end
|
|
26938
|
+
`;
|
|
26939
|
+
var LOCKFILE = String.raw`
|
|
26940
|
+
lambda do |podfile, sandbox, resolver|
|
|
26941
|
+
specs = resolver.specifications
|
|
26942
|
+
pods = specs.each_with_object({}) { |spec, result| (result[spec.to_s] ||= []).concat(spec.all_dependencies.map(&:to_s)) }
|
|
26943
|
+
trunk = specs.map(&:root).uniq.reject { |spec| sandbox.specification(spec.name) }.map(&:name)
|
|
26944
|
+
{
|
|
26945
|
+
'PODS' => pods.map { |name, deps| deps.empty? ? name : { name => deps.uniq } },
|
|
26946
|
+
'DEPENDENCIES' => podfile.dependencies.map(&:to_s),
|
|
26947
|
+
'SPEC REPOS' => trunk.empty? ? {} : { 'trunk' => trunk },
|
|
26948
|
+
'EXTERNAL SOURCES' => podfile.dependencies.select(&:external?).each_with_object({}) { |dep, result| result[dep.root_name] = dep.external_source },
|
|
26949
|
+
'SPEC CHECKSUMS' => specs.select(&:defined_in_file).each_with_object({}) { |spec, result| result[spec.root.name] = spec.checksum },
|
|
26950
|
+
'PODFILE CHECKSUM' => podfile.checksum,
|
|
26951
|
+
'COCOAPODS' => '${COCOAPODS_VERSION2}',
|
|
26952
|
+
}
|
|
26953
|
+
end
|
|
26954
|
+
`;
|
|
26955
|
+
|
|
26956
|
+
// src/expo-native-workspace.ts
|
|
26957
|
+
init_podspec_sources();
|
|
26958
|
+
|
|
26959
|
+
// src/portable-expo-workspace.ts
|
|
26960
|
+
init_is_record();
|
|
26961
|
+
|
|
26962
|
+
// src/native-firebase-config.ts
|
|
26963
|
+
var import_node_child_process14 = require("node:child_process");
|
|
26964
|
+
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
26965
|
+
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
26966
|
+
var import_node_path26 = __toESM(require("node:path"), 1);
|
|
26967
|
+
init_is_record();
|
|
26968
|
+
init_plist();
|
|
26969
|
+
init_xcode_project();
|
|
26970
|
+
var EXPO_CONFIG_SCRIPT = `const { createRequire } = require('node:module');
|
|
26971
|
+
const { writeFileSync } = require('node:fs');
|
|
26972
|
+
const { join } = require('node:path');
|
|
26973
|
+
const root = process.argv[1];
|
|
26974
|
+
const projectRequire = createRequire(join(root, 'package.json'));
|
|
26975
|
+
const expoRequire = createRequire(projectRequire.resolve('expo/package.json'));
|
|
26976
|
+
const { getConfig } = expoRequire('@expo/config');
|
|
26977
|
+
let expoEnv = null;
|
|
26978
|
+
try { expoEnv = createRequire(expoRequire.resolve('@expo/cli/package.json'))('@expo/env'); } catch {}
|
|
26979
|
+
if (expoEnv) {
|
|
26980
|
+
process.env.NODE_ENV ||= 'development';
|
|
26981
|
+
expoEnv.load(root, { silent: true });
|
|
26982
|
+
}
|
|
26983
|
+
const result = JSON.stringify(getConfig(root, { skipSDKVersionRequirement: true }).exp);
|
|
26984
|
+
if (Buffer.byteLength(result) > 1024 * 1024) throw new Error('Expo native configuration exceeds 1 MiB.');
|
|
26985
|
+
writeFileSync(process.argv[2], result, { mode: 0o600 });`;
|
|
26986
|
+
function hasExpoConfig(projectRoot) {
|
|
26987
|
+
const packagePath = import_node_path26.default.join(projectRoot, "package.json");
|
|
26988
|
+
const manifest = import_node_fs24.default.existsSync(packagePath) ? JSON.parse(import_node_fs24.default.readFileSync(packagePath, "utf8")) : null;
|
|
26989
|
+
if (isRecord(manifest)) {
|
|
26990
|
+
const dependencies = [manifest.dependencies, manifest.devDependencies].filter(
|
|
26991
|
+
isRecord
|
|
26992
|
+
);
|
|
26993
|
+
if (dependencies.some((deps) => "one" in deps) && !dependencies.some((deps) => "expo" in deps))
|
|
26994
|
+
return false;
|
|
26995
|
+
}
|
|
26996
|
+
const appJsonPath = import_node_path26.default.join(projectRoot, "app.json");
|
|
26997
|
+
const appJson = import_node_fs24.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs24.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
26998
|
+
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
26999
|
+
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
27000
|
+
));
|
|
27001
|
+
return staticExpo || ["app.config.js", "app.config.ts", "app.config.cjs", "app.config.mjs"].some(
|
|
27002
|
+
(name2) => import_node_fs24.default.existsSync(import_node_path26.default.join(projectRoot, name2))
|
|
27003
|
+
);
|
|
27004
|
+
}
|
|
27005
|
+
function expoConfigArgs(projectRoot, resultPath) {
|
|
27006
|
+
return [
|
|
27007
|
+
"--input-type=commonjs",
|
|
27008
|
+
"-e",
|
|
27009
|
+
EXPO_CONFIG_SCRIPT,
|
|
27010
|
+
import_node_path26.default.resolve(projectRoot),
|
|
27011
|
+
resultPath
|
|
27012
|
+
];
|
|
27013
|
+
}
|
|
27014
|
+
var EXPO_CONFIG_TIMEOUT_MS = 3e4;
|
|
27015
|
+
function readExpoConfigResult(resultPath, status, signal, stderr) {
|
|
27016
|
+
if (signal === "SIGTERM")
|
|
27017
|
+
throw new Error(
|
|
27018
|
+
`Expo native configuration evaluation did not finish within ${EXPO_CONFIG_TIMEOUT_MS / 1e3}s.`
|
|
27019
|
+
);
|
|
27020
|
+
if (status !== 0)
|
|
27021
|
+
throw new Error(
|
|
27022
|
+
stderr || (signal ? `Expo native configuration evaluation was killed by ${signal}.` : "Expo native configuration evaluation failed.")
|
|
27023
|
+
);
|
|
27024
|
+
const resolved = JSON.parse(import_node_fs24.default.readFileSync(resultPath, "utf8"));
|
|
27025
|
+
if (!isRecord(resolved)) throw new Error("Expo native configuration is unavailable.");
|
|
27026
|
+
return resolved;
|
|
27027
|
+
}
|
|
27028
|
+
var resultDirectory = () => import_node_fs24.default.mkdtempSync(import_node_path26.default.join(import_node_os7.default.tmpdir(), "peach-expo-config-"));
|
|
27029
|
+
function readExpoConfig(projectRoot) {
|
|
27030
|
+
if (!hasExpoConfig(projectRoot)) return {};
|
|
27031
|
+
const directory = resultDirectory();
|
|
27032
|
+
const resultPath = import_node_path26.default.join(directory, "config.json");
|
|
27033
|
+
try {
|
|
27034
|
+
const child = (0, import_node_child_process14.spawnSync)("node", expoConfigArgs(projectRoot, resultPath), {
|
|
27035
|
+
cwd: projectRoot,
|
|
27036
|
+
encoding: "utf8",
|
|
27037
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
27038
|
+
timeout: EXPO_CONFIG_TIMEOUT_MS,
|
|
27039
|
+
maxBuffer: 1024 * 1024
|
|
27040
|
+
});
|
|
27041
|
+
if (child.error) throw child.error;
|
|
27042
|
+
return readExpoConfigResult(resultPath, child.status, child.signal, child.stderr);
|
|
27043
|
+
} finally {
|
|
27044
|
+
import_node_fs24.default.rmSync(directory, { recursive: true, force: true });
|
|
27045
|
+
}
|
|
27046
|
+
}
|
|
27047
|
+
var HELPER_DEPTH = 3;
|
|
27048
|
+
var stripComments = (raw) => raw.replace(
|
|
27049
|
+
/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
|
|
27050
|
+
(token) => token.startsWith('"') ? token : token.replace(/[^\n]/g, " ")
|
|
27051
|
+
);
|
|
27052
|
+
function splitStatements(raw) {
|
|
27053
|
+
const clean = stripComments(raw);
|
|
27054
|
+
const blank = blankSwiftObjcLiterals(raw);
|
|
27055
|
+
const statements = [];
|
|
27056
|
+
let depth = 0;
|
|
27057
|
+
let start = 0;
|
|
27058
|
+
for (let index = 0; index < blank.length; index++) {
|
|
27059
|
+
const char = blank[index];
|
|
27060
|
+
if (char === "{" || char === "(" || char === "[") depth += 1;
|
|
27061
|
+
if (char === "}" || char === ")" || char === "]") depth -= 1;
|
|
27062
|
+
if (char === ";" && depth === 0 || char === "}" && depth === 0) {
|
|
27063
|
+
statements.push(clean.slice(start, index + (char === "}" ? 1 : 0)).trim());
|
|
27064
|
+
start = index + 1;
|
|
27065
|
+
}
|
|
27066
|
+
}
|
|
27067
|
+
statements.push(clean.slice(start).trim());
|
|
27068
|
+
return statements.filter(Boolean);
|
|
27069
|
+
}
|
|
27070
|
+
function splitClauses(condition) {
|
|
27071
|
+
const clauses = [];
|
|
27072
|
+
let depth = 0;
|
|
27073
|
+
let start = 0;
|
|
27074
|
+
let quoted = false;
|
|
27075
|
+
for (let index = 0; index < condition.length; index++) {
|
|
27076
|
+
const char = condition[index];
|
|
27077
|
+
if (char === '"') quoted = !quoted;
|
|
27078
|
+
if (quoted) continue;
|
|
27079
|
+
if (char === "(" || char === "[") depth += 1;
|
|
27080
|
+
if (char === ")" || char === "]") depth -= 1;
|
|
27081
|
+
if (char === "," && depth === 0) {
|
|
27082
|
+
clauses.push(condition.slice(start, index).trim());
|
|
27083
|
+
start = index + 1;
|
|
27084
|
+
}
|
|
27085
|
+
}
|
|
27086
|
+
clauses.push(condition.slice(start).trim());
|
|
27087
|
+
return clauses;
|
|
27088
|
+
}
|
|
27089
|
+
function findHelper(type, name2, label, sources) {
|
|
27090
|
+
const found = [];
|
|
27091
|
+
for (const file of sources) {
|
|
27092
|
+
const raw = import_node_fs24.default.readFileSync(file, "utf8");
|
|
27093
|
+
const blank = blankSwiftObjcLiterals(raw);
|
|
27094
|
+
if (file.endsWith(".swift") && label === void 0) {
|
|
27095
|
+
const owners = type ? [
|
|
27096
|
+
...blank.matchAll(
|
|
27097
|
+
new RegExp(`\\b(?:enum|struct|class|extension)\\s+${type}\\b[^{]*\\{`, "g")
|
|
27098
|
+
)
|
|
27099
|
+
].flatMap((match) => {
|
|
27100
|
+
const owner = braceBlock(blank, match.index + match[0].length - 1);
|
|
27101
|
+
return owner ? [{ text: owner.body, offset: match.index + match[0].length }] : [];
|
|
27102
|
+
}) : [{ text: blank, offset: 0 }];
|
|
27103
|
+
for (const owner of owners) {
|
|
27104
|
+
const declaration = new RegExp(
|
|
27105
|
+
`${type ? "\\b(?:static|class)\\s+" : ""}func\\s+${name2}\\s*\\(\\s*\\)\\s*->\\s*Bool\\s*\\{`
|
|
27106
|
+
).exec(owner.text);
|
|
27107
|
+
const block = declaration ? braceBlock(
|
|
27108
|
+
blank,
|
|
27109
|
+
owner.offset + declaration.index + declaration[0].length - 1
|
|
27110
|
+
) : null;
|
|
27111
|
+
if (block)
|
|
27112
|
+
found.push({
|
|
27113
|
+
body: raw.slice(
|
|
27114
|
+
owner.offset + declaration.index + declaration[0].length,
|
|
27115
|
+
block.end - 1
|
|
27116
|
+
),
|
|
27117
|
+
language: "swift",
|
|
27118
|
+
parameter: null,
|
|
27119
|
+
constants: /* @__PURE__ */ new Map()
|
|
27120
|
+
});
|
|
27121
|
+
}
|
|
27122
|
+
}
|
|
27123
|
+
if (/\.mm?$/.test(file) && type) {
|
|
27124
|
+
const implementation = new RegExp(`@implementation\\s+${type}\\b`).exec(blank);
|
|
27125
|
+
const end = implementation ? blank.indexOf("@end", implementation.index) : -1;
|
|
27126
|
+
if (!implementation || end < 0) continue;
|
|
27127
|
+
const suffix = label === void 0 ? "" : `${label[0].toUpperCase()}${label.slice(1)}\\w*`;
|
|
27128
|
+
const declaration = new RegExp(
|
|
27129
|
+
label === void 0 ? `^\\s*\\+\\s*\\(\\s*BOOL\\s*\\)\\s*${name2}\\s*\\{` : `^\\s*\\+\\s*\\(\\s*BOOL\\s*\\)\\s*${name2}${suffix}\\s*:\\s*\\(\\s*NSBundle\\s*\\*\\s*\\)\\s*(\\w+)\\s*\\{`,
|
|
27130
|
+
"m"
|
|
27131
|
+
).exec(blank.slice(implementation.index, end));
|
|
27132
|
+
if (!declaration) continue;
|
|
27133
|
+
const open = implementation.index + declaration.index + declaration[0].length - 1;
|
|
27134
|
+
const block = braceBlock(blank, open);
|
|
27135
|
+
if (!block) continue;
|
|
27136
|
+
const constants = /* @__PURE__ */ new Map();
|
|
27137
|
+
for (const constant of stripComments(raw).matchAll(
|
|
27138
|
+
/\bNSString\s*\*\s*const\s+(\w+)\s*=\s*@"([^"]*)"\s*;/g
|
|
27139
|
+
))
|
|
27140
|
+
constants.set(constant[1], constant[2]);
|
|
27141
|
+
found.push({
|
|
27142
|
+
body: raw.slice(open + 1, block.end - 1),
|
|
27143
|
+
language: "objc",
|
|
27144
|
+
parameter: declaration[1] ?? null,
|
|
27145
|
+
constants
|
|
27146
|
+
});
|
|
27147
|
+
}
|
|
27148
|
+
}
|
|
27149
|
+
return found.length === 1 ? found[0] : null;
|
|
27150
|
+
}
|
|
27151
|
+
function evaluateHelperCall(expression, scope, depth) {
|
|
27152
|
+
if (depth >= HELPER_DEPTH) return null;
|
|
27153
|
+
const call = /^(?:self\s*\.\s*)?(?:([A-Z]\w*)\s*\.\s*)?(\w+)\s*\(\s*(?:(\w+)\s*:\s*Bundle\.main)?\s*\)$/.exec(
|
|
27154
|
+
expression
|
|
27155
|
+
);
|
|
27156
|
+
if (!call) return null;
|
|
27157
|
+
const helper = findHelper(call[1], call[2], call[3], scope.sources);
|
|
27158
|
+
if (!helper) return null;
|
|
27159
|
+
return helper.language === "swift" ? evaluateSwiftBody(helper.body, scope, depth + 1) : evaluateObjcBody(helper.body, helper.parameter, helper.constants, scope);
|
|
27160
|
+
}
|
|
27161
|
+
function evaluateSwiftBody(body, scope, depth) {
|
|
27162
|
+
const bound = /* @__PURE__ */ new Map();
|
|
27163
|
+
for (const statement of splitStatements(body)) {
|
|
27164
|
+
const result = /^return\s+([\s\S]+)$/.exec(statement);
|
|
27165
|
+
if (result) return evaluateClauses([result[1].trim()], scope, bound, depth);
|
|
27166
|
+
const branch = /^(if|guard)\b([\s\S]*?)(?:\belse\b)?\s*\{\s*return\s+(true|false)\s*\}$/.exec(
|
|
27167
|
+
statement
|
|
27168
|
+
);
|
|
27169
|
+
if (!branch) return null;
|
|
27170
|
+
const holds = evaluateClauses(splitClauses(branch[2]), scope, bound, depth);
|
|
27171
|
+
if (holds === null) return null;
|
|
27172
|
+
if (holds === (branch[1] === "if")) return branch[3] === "true";
|
|
27173
|
+
}
|
|
27174
|
+
return null;
|
|
27175
|
+
}
|
|
27176
|
+
function evaluateObjcBody(body, bundle, constants, scope) {
|
|
27177
|
+
const plists = scope.resources.filter(
|
|
27178
|
+
(file) => import_node_path26.default.basename(file) === "GoogleService-Info.plist"
|
|
27179
|
+
);
|
|
27180
|
+
const variables = /* @__PURE__ */ new Map();
|
|
27181
|
+
const literal3 = (text3) => {
|
|
27182
|
+
const quoted = /^@"([^"]*)"$/.exec(text3.trim());
|
|
27183
|
+
return quoted ? quoted[1] : constants.get(text3.trim());
|
|
27184
|
+
};
|
|
27185
|
+
const truthy2 = (name2) => {
|
|
27186
|
+
const value = variables.get(name2);
|
|
27187
|
+
return typeof value === "string" ? value.length > 0 : value !== void 0;
|
|
27188
|
+
};
|
|
27189
|
+
for (const statement of splitStatements(body)) {
|
|
27190
|
+
if (/^return\s+YES$/.test(statement)) return true;
|
|
27191
|
+
if (/^return\s+NO$/.test(statement)) return false;
|
|
27192
|
+
const early = /^if\s*\(\s*(!?)\s*(\w+)(\.length)?\s*\)\s*\{?\s*return\s+(YES|NO)\s*;?\s*\}?$/.exec(
|
|
27193
|
+
statement
|
|
27194
|
+
);
|
|
27195
|
+
if (early) {
|
|
24044
27196
|
if (!variables.has(early[2])) return null;
|
|
24045
27197
|
if (early[1] === "!" === !truthy2(early[2])) return early[4] === "YES";
|
|
24046
27198
|
continue;
|
|
@@ -24401,7 +27553,6 @@ init_swift_root_lock();
|
|
|
24401
27553
|
init_swift_toolchain();
|
|
24402
27554
|
init_workspace_root();
|
|
24403
27555
|
init_xcode_project();
|
|
24404
|
-
var utf8Env = { ...process.env, LANG: "en_US.UTF-8", LC_ALL: "en_US.UTF-8" };
|
|
24405
27556
|
var ABANDONED_WORKSPACE_MS = 24 * 36e5;
|
|
24406
27557
|
|
|
24407
27558
|
// src/expoSwiftContract.ts
|
|
@@ -24422,8 +27573,8 @@ var IDENTITY_SOURCE_SKIPS = 1 | 4 | 8 | 16 | 32 | 64 | 128 | 4096;
|
|
|
24422
27573
|
|
|
24423
27574
|
// src/expo-swift-host.ts
|
|
24424
27575
|
var import_node_async_hooks4 = require("node:async_hooks");
|
|
24425
|
-
var
|
|
24426
|
-
var
|
|
27576
|
+
var import_node_child_process17 = require("node:child_process");
|
|
27577
|
+
var import_node_util8 = require("node:util");
|
|
24427
27578
|
init_app_project();
|
|
24428
27579
|
init_answeredNativePackages();
|
|
24429
27580
|
init_app_config();
|
|
@@ -24498,7 +27649,7 @@ init_swift_standins();
|
|
|
24498
27649
|
init_swift_submit();
|
|
24499
27650
|
init_swift_toolchain();
|
|
24500
27651
|
init_turbo_source();
|
|
24501
|
-
var run5 = (0,
|
|
27652
|
+
var run5 = (0, import_node_util8.promisify)(import_node_child_process17.execFile);
|
|
24502
27653
|
var scriptEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" };
|
|
24503
27654
|
var traceStore = new import_node_async_hooks4.AsyncLocalStorage();
|
|
24504
27655
|
var openPreparations = new NativePreparationReceipts();
|
|
@@ -29222,17 +32373,17 @@ function readOneNativeAppCatalog(entryConfig, root) {
|
|
|
29222
32373
|
}
|
|
29223
32374
|
|
|
29224
32375
|
// src/one-widget-metadata.ts
|
|
29225
|
-
var
|
|
32376
|
+
var import_node_child_process18 = require("node:child_process");
|
|
29226
32377
|
var import_node_crypto12 = require("node:crypto");
|
|
29227
32378
|
var import_node_fs29 = __toESM(require("node:fs"), 1);
|
|
29228
32379
|
var import_node_module4 = require("node:module");
|
|
29229
32380
|
var import_node_path35 = __toESM(require("node:path"), 1);
|
|
29230
|
-
var
|
|
32381
|
+
var import_node_util9 = require("node:util");
|
|
29231
32382
|
init_forked_script_contract();
|
|
29232
32383
|
init_is_record();
|
|
29233
32384
|
init_swift_source_file();
|
|
29234
32385
|
init_swift_submit();
|
|
29235
|
-
var run6 = (0,
|
|
32386
|
+
var run6 = (0, import_node_util9.promisify)(import_node_child_process18.execFile);
|
|
29236
32387
|
var configs = /* @__PURE__ */ new Map();
|
|
29237
32388
|
var reads = /* @__PURE__ */ new Map();
|
|
29238
32389
|
var CONFIG_CHILD = `
|