peachsim 0.1.2430 → 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 +15765 -5973
- 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 -4888
- 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 +15464 -5754
- package/dist-lib/host/fetch-proxy-handler.cjs +3204 -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 +3541 -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 +3437 -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 +172 -79
- 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 +16786 -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 +74 -6
- package/dist-lib/vite.cjs +3331 -181
- 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/metro.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;
|
|
@@ -1892,7 +1892,7 @@ var STANDIN_SOURCE_DIGEST;
|
|
|
1892
1892
|
var init_swift_standin_digest = __esm({
|
|
1893
1893
|
"src/swift-standin-digest.ts"() {
|
|
1894
1894
|
"use strict";
|
|
1895
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
1895
|
+
STANDIN_SOURCE_DIGEST = true ? "3475ca483b1e5005a2c76ec887310c0d0f44c91ea427496b33acbb5bf6188684" : standinSourceDigest();
|
|
1896
1896
|
}
|
|
1897
1897
|
});
|
|
1898
1898
|
|
|
@@ -6104,6 +6104,150 @@ var init_swiftContract = __esm({
|
|
|
6104
6104
|
}
|
|
6105
6105
|
});
|
|
6106
6106
|
|
|
6107
|
+
// src/openstep-plist.ts
|
|
6108
|
+
function parseOpenStepPlist(text3) {
|
|
6109
|
+
let i = 0;
|
|
6110
|
+
const fail = (message) => {
|
|
6111
|
+
const line = text3.slice(0, i).split("\n").length;
|
|
6112
|
+
throw new Error(`project.pbxproj line ${line}: ${message}`);
|
|
6113
|
+
};
|
|
6114
|
+
const skip = () => {
|
|
6115
|
+
for (; ; ) {
|
|
6116
|
+
const ch = text3[i];
|
|
6117
|
+
if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
|
|
6118
|
+
else if (ch === "/" && text3[i + 1] === "*") {
|
|
6119
|
+
const end = text3.indexOf("*/", i + 2);
|
|
6120
|
+
if (end < 0) fail("unterminated comment");
|
|
6121
|
+
i = end + 2;
|
|
6122
|
+
} else if (ch === "/" && text3[i + 1] === "/") {
|
|
6123
|
+
const end = text3.indexOf("\n", i);
|
|
6124
|
+
i = end < 0 ? text3.length : end + 1;
|
|
6125
|
+
} else return;
|
|
6126
|
+
}
|
|
6127
|
+
};
|
|
6128
|
+
const quoted = () => {
|
|
6129
|
+
i++;
|
|
6130
|
+
let out = "";
|
|
6131
|
+
for (; ; ) {
|
|
6132
|
+
const ch = text3[i++];
|
|
6133
|
+
if (ch === void 0) fail("unterminated string");
|
|
6134
|
+
if (ch === '"') return out;
|
|
6135
|
+
if (ch !== "\\") {
|
|
6136
|
+
out += ch;
|
|
6137
|
+
continue;
|
|
6138
|
+
}
|
|
6139
|
+
const next = text3[i++];
|
|
6140
|
+
if (next === "n") out += "\n";
|
|
6141
|
+
else if (next === "t") out += " ";
|
|
6142
|
+
else if (next === "r") out += "\r";
|
|
6143
|
+
else if (next === "U") {
|
|
6144
|
+
out += String.fromCharCode(parseInt(text3.slice(i, i + 4), 16));
|
|
6145
|
+
i += 4;
|
|
6146
|
+
} else out += next;
|
|
6147
|
+
}
|
|
6148
|
+
};
|
|
6149
|
+
const value = () => {
|
|
6150
|
+
skip();
|
|
6151
|
+
const ch = text3[i];
|
|
6152
|
+
if (ch === "{") {
|
|
6153
|
+
i++;
|
|
6154
|
+
const dict = {};
|
|
6155
|
+
for (; ; ) {
|
|
6156
|
+
skip();
|
|
6157
|
+
if (text3[i] === "}") {
|
|
6158
|
+
i++;
|
|
6159
|
+
return dict;
|
|
6160
|
+
}
|
|
6161
|
+
const key = value();
|
|
6162
|
+
if (typeof key !== "string") fail("dictionary key is not a string");
|
|
6163
|
+
skip();
|
|
6164
|
+
if (text3[i++] !== "=") fail("expected =");
|
|
6165
|
+
if (Object.hasOwn(dict, key)) fail(`duplicate key ${key}`);
|
|
6166
|
+
dict[key] = value();
|
|
6167
|
+
skip();
|
|
6168
|
+
if (text3[i++] !== ";") fail("expected ;");
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
if (ch === "(") {
|
|
6172
|
+
i++;
|
|
6173
|
+
const list2 = [];
|
|
6174
|
+
for (; ; ) {
|
|
6175
|
+
skip();
|
|
6176
|
+
if (text3[i] === ")") {
|
|
6177
|
+
i++;
|
|
6178
|
+
return list2;
|
|
6179
|
+
}
|
|
6180
|
+
list2.push(value());
|
|
6181
|
+
skip();
|
|
6182
|
+
if (text3[i] === ",") i++;
|
|
6183
|
+
else if (text3[i] !== ")") fail("expected , or )");
|
|
6184
|
+
}
|
|
6185
|
+
}
|
|
6186
|
+
if (ch === '"') return quoted();
|
|
6187
|
+
const start = i;
|
|
6188
|
+
while (i < text3.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text3[i])) i++;
|
|
6189
|
+
if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
|
|
6190
|
+
return text3.slice(start, i);
|
|
6191
|
+
};
|
|
6192
|
+
if (text3.startsWith("// !$*UTF8*$!")) i = text3.indexOf("\n") + 1;
|
|
6193
|
+
const root = value();
|
|
6194
|
+
skip();
|
|
6195
|
+
if (i !== text3.length) fail("trailing content");
|
|
6196
|
+
return root;
|
|
6197
|
+
}
|
|
6198
|
+
var isDict, str, list;
|
|
6199
|
+
var init_openstep_plist = __esm({
|
|
6200
|
+
"src/openstep-plist.ts"() {
|
|
6201
|
+
"use strict";
|
|
6202
|
+
isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6203
|
+
str = (value) => typeof value === "string" ? value : void 0;
|
|
6204
|
+
list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
6205
|
+
}
|
|
6206
|
+
});
|
|
6207
|
+
|
|
6208
|
+
// src/pod-sources.ts
|
|
6209
|
+
var COCOAPODS_VERSION, USER_AGENT, HEADER_EXTENSIONS, SOURCE_EXTENSIONS, SOURCE_FILES_PATTERN;
|
|
6210
|
+
var init_pod_sources = __esm({
|
|
6211
|
+
"src/pod-sources.ts"() {
|
|
6212
|
+
"use strict";
|
|
6213
|
+
init_home_paths();
|
|
6214
|
+
COCOAPODS_VERSION = "1.17.0";
|
|
6215
|
+
USER_AGENT = `'CocoaPods/${COCOAPODS_VERSION} cocoapods-downloader/2.1'`;
|
|
6216
|
+
HEADER_EXTENSIONS = [
|
|
6217
|
+
".h",
|
|
6218
|
+
".hh",
|
|
6219
|
+
".hpp",
|
|
6220
|
+
".ipp",
|
|
6221
|
+
".tpp",
|
|
6222
|
+
".hxx",
|
|
6223
|
+
".def",
|
|
6224
|
+
".inl",
|
|
6225
|
+
".inc"
|
|
6226
|
+
];
|
|
6227
|
+
SOURCE_EXTENSIONS = [
|
|
6228
|
+
".m",
|
|
6229
|
+
".mm",
|
|
6230
|
+
".i",
|
|
6231
|
+
".c",
|
|
6232
|
+
".cc",
|
|
6233
|
+
".cxx",
|
|
6234
|
+
".cpp",
|
|
6235
|
+
".c++",
|
|
6236
|
+
".swift",
|
|
6237
|
+
...HEADER_EXTENSIONS
|
|
6238
|
+
];
|
|
6239
|
+
SOURCE_FILES_PATTERN = `*{${SOURCE_EXTENSIONS.join(",")}}`;
|
|
6240
|
+
}
|
|
6241
|
+
});
|
|
6242
|
+
|
|
6243
|
+
// src/cocoapods-trunk.ts
|
|
6244
|
+
var init_cocoapods_trunk = __esm({
|
|
6245
|
+
"src/cocoapods-trunk.ts"() {
|
|
6246
|
+
"use strict";
|
|
6247
|
+
init_home_paths();
|
|
6248
|
+
}
|
|
6249
|
+
});
|
|
6250
|
+
|
|
6107
6251
|
// src/podspec-prism.ts
|
|
6108
6252
|
var import_parsePrism;
|
|
6109
6253
|
var init_podspec_prism = __esm({
|
|
@@ -6996,8 +7140,16 @@ module Pod
|
|
|
6996
7140
|
end
|
|
6997
7141
|
|
|
6998
7142
|
def module_name
|
|
6999
|
-
attributes_hash['module_name'] ||
|
|
7143
|
+
attributes_hash['module_name'] ||
|
|
7144
|
+
c99ext_identifier(attributes_hash['header_dir']) ||
|
|
7145
|
+
c99ext_identifier(attributes_hash['name'])
|
|
7146
|
+
end
|
|
7147
|
+
|
|
7148
|
+
def c99ext_identifier(name)
|
|
7149
|
+
return nil if name.nil?
|
|
7150
|
+
name.gsub(/^([0-9])/, '_\1').gsub(/[^a-zA-Z0-9_]/, '_').gsub(/_+/, '_')
|
|
7000
7151
|
end
|
|
7152
|
+
private :c99ext_identifier
|
|
7001
7153
|
|
|
7002
7154
|
def homepage
|
|
7003
7155
|
attributes_hash['homepage']
|
|
@@ -7300,11 +7452,35 @@ end
|
|
|
7300
7452
|
`],
|
|
7301
7453
|
["xcodebuild -version", `Xcode ${NATIVE_GRAPH_SDK_VERSION}
|
|
7302
7454
|
`],
|
|
7303
|
-
["/usr/sbin/sysctl -n hw.optional.arm64 2>&1", "1\n"]
|
|
7455
|
+
["/usr/sbin/sysctl -n hw.optional.arm64 2>&1", "1\n"],
|
|
7456
|
+
// peach compiles without ccache
|
|
7457
|
+
["command -v ccache", ""]
|
|
7304
7458
|
]);
|
|
7305
7459
|
}
|
|
7306
7460
|
});
|
|
7307
7461
|
|
|
7462
|
+
// src/plist.ts
|
|
7463
|
+
function parsePlistSource(source) {
|
|
7464
|
+
return import_plist.default.parse(source);
|
|
7465
|
+
}
|
|
7466
|
+
var import_plist;
|
|
7467
|
+
var init_plist = __esm({
|
|
7468
|
+
"src/plist.ts"() {
|
|
7469
|
+
"use strict";
|
|
7470
|
+
import_plist = __toESM(require("plist"), 1);
|
|
7471
|
+
}
|
|
7472
|
+
});
|
|
7473
|
+
|
|
7474
|
+
// src/plist-bytes.ts
|
|
7475
|
+
var import_bplist_parser;
|
|
7476
|
+
var init_plist_bytes = __esm({
|
|
7477
|
+
"src/plist-bytes.ts"() {
|
|
7478
|
+
"use strict";
|
|
7479
|
+
import_bplist_parser = __toESM(require("bplist-parser"), 1);
|
|
7480
|
+
init_plist();
|
|
7481
|
+
}
|
|
7482
|
+
});
|
|
7483
|
+
|
|
7308
7484
|
// src/workspace-root.ts
|
|
7309
7485
|
var init_workspace_root = __esm({
|
|
7310
7486
|
"src/workspace-root.ts"() {
|
|
@@ -7352,18 +7528,6 @@ var init_podspec_sources = __esm({
|
|
|
7352
7528
|
}
|
|
7353
7529
|
});
|
|
7354
7530
|
|
|
7355
|
-
// src/plist.ts
|
|
7356
|
-
function parsePlistSource(source) {
|
|
7357
|
-
return import_plist.default.parse(source);
|
|
7358
|
-
}
|
|
7359
|
-
var import_plist;
|
|
7360
|
-
var init_plist = __esm({
|
|
7361
|
-
"src/plist.ts"() {
|
|
7362
|
-
"use strict";
|
|
7363
|
-
import_plist = __toESM(require("plist"), 1);
|
|
7364
|
-
}
|
|
7365
|
-
});
|
|
7366
|
-
|
|
7367
7531
|
// src/bazel-project.ts
|
|
7368
7532
|
function isBazelPackage(input) {
|
|
7369
7533
|
return /^BUILD(?:\.bazel)?$/.test(import_node_path10.default.basename(input)) && import_node_fs13.default.statSync(input).isFile();
|
|
@@ -7976,7 +8140,7 @@ ${published.map(
|
|
|
7976
8140
|
const contents = new Map([
|
|
7977
8141
|
[
|
|
7978
8142
|
"Info.plist",
|
|
7979
|
-
|
|
8143
|
+
import_plist3.default.build({
|
|
7980
8144
|
AvailableLibraries: [
|
|
7981
8145
|
{
|
|
7982
8146
|
LibraryIdentifier: "ios-arm64-simulator",
|
|
@@ -8056,7 +8220,7 @@ ${published.map(
|
|
|
8056
8220
|
const infoPlistReady = infoPlistFiles.every((file) => import_node_fs13.default.existsSync(file));
|
|
8057
8221
|
const info = {};
|
|
8058
8222
|
for (const file of infoPlistReady ? infoPlistFiles : []) {
|
|
8059
|
-
const fragment =
|
|
8223
|
+
const fragment = import_plist3.default.parse(import_node_fs13.default.readFileSync(file, "utf8"));
|
|
8060
8224
|
if (!fragment || typeof fragment !== "object" || Array.isArray(fragment) || fragment instanceof Date || Buffer.isBuffer(fragment))
|
|
8061
8225
|
throw new Error(`${file} is not a plist dictionary`);
|
|
8062
8226
|
for (const [key, value] of Object.entries(fragment)) {
|
|
@@ -8125,7 +8289,7 @@ ${published.map(
|
|
|
8125
8289
|
rootDir: root,
|
|
8126
8290
|
projectFiles: buildFiles.sort(),
|
|
8127
8291
|
projectDirs: [root],
|
|
8128
|
-
infoPlist: infoPlistReady ?
|
|
8292
|
+
infoPlist: infoPlistReady ? import_plist3.default.build(info) : null,
|
|
8129
8293
|
infoPlistFile: null,
|
|
8130
8294
|
postBundleScripts: [],
|
|
8131
8295
|
appIconName: "",
|
|
@@ -8177,7 +8341,7 @@ function shellTokens(options) {
|
|
|
8177
8341
|
return words;
|
|
8178
8342
|
});
|
|
8179
8343
|
}
|
|
8180
|
-
var import_node_child_process5, import_node_crypto4, import_node_fs13, import_node_os5, import_node_path10,
|
|
8344
|
+
var import_node_child_process5, import_node_crypto4, import_node_fs13, import_node_os5, import_node_path10, import_plist3, LIBRARY_RULES, QUERIED_RULES, NATIVE_SOURCE, HEADER, PRODUCTS, graphs, GRAPH_FORMAT, BazelFiles, CXX_STANDARD;
|
|
8181
8345
|
var init_bazel_project = __esm({
|
|
8182
8346
|
"src/bazel-project.ts"() {
|
|
8183
8347
|
"use strict";
|
|
@@ -8186,7 +8350,7 @@ var init_bazel_project = __esm({
|
|
|
8186
8350
|
import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
8187
8351
|
import_node_os5 = __toESM(require("node:os"), 1);
|
|
8188
8352
|
import_node_path10 = __toESM(require("node:path"), 1);
|
|
8189
|
-
|
|
8353
|
+
import_plist3 = __toESM(require("plist"), 1);
|
|
8190
8354
|
init_is_record();
|
|
8191
8355
|
LIBRARY_RULES = /* @__PURE__ */ new Set(["swift_library", "objc_library", "cc_library"]);
|
|
8192
8356
|
QUERIED_RULES = [
|
|
@@ -8812,152 +8976,51 @@ var init_nativeAppIconContract = __esm({
|
|
|
8812
8976
|
}
|
|
8813
8977
|
});
|
|
8814
8978
|
|
|
8815
|
-
// src/
|
|
8816
|
-
function
|
|
8817
|
-
let
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
const ch = text3[i];
|
|
8825
|
-
if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
|
|
8826
|
-
else if (ch === "/" && text3[i + 1] === "*") {
|
|
8827
|
-
const end = text3.indexOf("*/", i + 2);
|
|
8828
|
-
if (end < 0) fail("unterminated comment");
|
|
8829
|
-
i = end + 2;
|
|
8830
|
-
} else if (ch === "/" && text3[i + 1] === "/") {
|
|
8831
|
-
const end = text3.indexOf("\n", i);
|
|
8832
|
-
i = end < 0 ? text3.length : end + 1;
|
|
8833
|
-
} else return;
|
|
8979
|
+
// src/xcode-target-members.ts
|
|
8980
|
+
function groupParentsOf(objects) {
|
|
8981
|
+
let parents = groupParents.get(objects);
|
|
8982
|
+
if (parents) return parents;
|
|
8983
|
+
parents = /* @__PURE__ */ new Map();
|
|
8984
|
+
for (const [id, entry] of Object.entries(objects)) {
|
|
8985
|
+
if (!isDict(entry)) continue;
|
|
8986
|
+
if (entry.isa === "PBXGroup" || entry.isa === "PBXVariantGroup") {
|
|
8987
|
+
for (const child of list(entry.children)) parents.set(child, id);
|
|
8834
8988
|
}
|
|
8835
|
-
}
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8989
|
+
}
|
|
8990
|
+
groupParents.set(objects, parents);
|
|
8991
|
+
return parents;
|
|
8992
|
+
}
|
|
8993
|
+
function xcodePathResolver(objects, projectDir, join7, sourceTreeRoot) {
|
|
8994
|
+
const parents = groupParentsOf(objects);
|
|
8995
|
+
const paths = /* @__PURE__ */ new Map();
|
|
8996
|
+
const resolve4 = (id) => {
|
|
8997
|
+
if (paths.has(id)) return paths.get(id);
|
|
8998
|
+
paths.set(id, null);
|
|
8999
|
+
const entry = objects[id];
|
|
9000
|
+
let result = null;
|
|
9001
|
+
if (isDict(entry)) {
|
|
9002
|
+
const own = str(entry.path) ?? "";
|
|
9003
|
+
const tree = str(entry.sourceTree) ?? "<group>";
|
|
9004
|
+
if (tree === "<absolute>") result = own;
|
|
9005
|
+
else if (tree === "SOURCE_ROOT") result = join7(projectDir, own);
|
|
9006
|
+
else if (tree === "<group>") {
|
|
9007
|
+
const parent = parents.get(id);
|
|
9008
|
+
const base = parent ? resolve4(parent) : projectDir;
|
|
9009
|
+
if (base !== null) result = join7(base, own);
|
|
9010
|
+
} else {
|
|
9011
|
+
const base = sourceTreeRoot?.(tree);
|
|
9012
|
+
if (base) result = join7(base, own);
|
|
8846
9013
|
}
|
|
8847
|
-
const next = text3[i++];
|
|
8848
|
-
if (next === "n") out += "\n";
|
|
8849
|
-
else if (next === "t") out += " ";
|
|
8850
|
-
else if (next === "r") out += "\r";
|
|
8851
|
-
else if (next === "U") {
|
|
8852
|
-
out += String.fromCharCode(parseInt(text3.slice(i, i + 4), 16));
|
|
8853
|
-
i += 4;
|
|
8854
|
-
} else out += next;
|
|
8855
9014
|
}
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
skip();
|
|
8859
|
-
const ch = text3[i];
|
|
8860
|
-
if (ch === "{") {
|
|
8861
|
-
i++;
|
|
8862
|
-
const dict = {};
|
|
8863
|
-
for (; ; ) {
|
|
8864
|
-
skip();
|
|
8865
|
-
if (text3[i] === "}") {
|
|
8866
|
-
i++;
|
|
8867
|
-
return dict;
|
|
8868
|
-
}
|
|
8869
|
-
const key = value();
|
|
8870
|
-
if (typeof key !== "string") fail("dictionary key is not a string");
|
|
8871
|
-
skip();
|
|
8872
|
-
if (text3[i++] !== "=") fail("expected =");
|
|
8873
|
-
if (Object.hasOwn(dict, key)) fail(`duplicate key ${key}`);
|
|
8874
|
-
dict[key] = value();
|
|
8875
|
-
skip();
|
|
8876
|
-
if (text3[i++] !== ";") fail("expected ;");
|
|
8877
|
-
}
|
|
8878
|
-
}
|
|
8879
|
-
if (ch === "(") {
|
|
8880
|
-
i++;
|
|
8881
|
-
const list2 = [];
|
|
8882
|
-
for (; ; ) {
|
|
8883
|
-
skip();
|
|
8884
|
-
if (text3[i] === ")") {
|
|
8885
|
-
i++;
|
|
8886
|
-
return list2;
|
|
8887
|
-
}
|
|
8888
|
-
list2.push(value());
|
|
8889
|
-
skip();
|
|
8890
|
-
if (text3[i] === ",") i++;
|
|
8891
|
-
else if (text3[i] !== ")") fail("expected , or )");
|
|
8892
|
-
}
|
|
8893
|
-
}
|
|
8894
|
-
if (ch === '"') return quoted();
|
|
8895
|
-
const start = i;
|
|
8896
|
-
while (i < text3.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text3[i])) i++;
|
|
8897
|
-
if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
|
|
8898
|
-
return text3.slice(start, i);
|
|
8899
|
-
};
|
|
8900
|
-
if (text3.startsWith("// !$*UTF8*$!")) i = text3.indexOf("\n") + 1;
|
|
8901
|
-
const root = value();
|
|
8902
|
-
skip();
|
|
8903
|
-
if (i !== text3.length) fail("trailing content");
|
|
8904
|
-
return root;
|
|
8905
|
-
}
|
|
8906
|
-
var isDict, str2, list;
|
|
8907
|
-
var init_openstep_plist = __esm({
|
|
8908
|
-
"src/openstep-plist.ts"() {
|
|
8909
|
-
"use strict";
|
|
8910
|
-
isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8911
|
-
str2 = (value) => typeof value === "string" ? value : void 0;
|
|
8912
|
-
list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
8913
|
-
}
|
|
8914
|
-
});
|
|
8915
|
-
|
|
8916
|
-
// src/xcode-target-members.ts
|
|
8917
|
-
function groupParentsOf(objects) {
|
|
8918
|
-
let parents = groupParents.get(objects);
|
|
8919
|
-
if (parents) return parents;
|
|
8920
|
-
parents = /* @__PURE__ */ new Map();
|
|
8921
|
-
for (const [id, entry] of Object.entries(objects)) {
|
|
8922
|
-
if (!isDict(entry)) continue;
|
|
8923
|
-
if (entry.isa === "PBXGroup" || entry.isa === "PBXVariantGroup") {
|
|
8924
|
-
for (const child of list(entry.children)) parents.set(child, id);
|
|
8925
|
-
}
|
|
8926
|
-
}
|
|
8927
|
-
groupParents.set(objects, parents);
|
|
8928
|
-
return parents;
|
|
8929
|
-
}
|
|
8930
|
-
function xcodePathResolver(objects, projectDir, join7, sourceTreeRoot) {
|
|
8931
|
-
const parents = groupParentsOf(objects);
|
|
8932
|
-
const paths = /* @__PURE__ */ new Map();
|
|
8933
|
-
const resolve4 = (id) => {
|
|
8934
|
-
if (paths.has(id)) return paths.get(id);
|
|
8935
|
-
paths.set(id, null);
|
|
8936
|
-
const entry = objects[id];
|
|
8937
|
-
let result = null;
|
|
8938
|
-
if (isDict(entry)) {
|
|
8939
|
-
const own = str2(entry.path) ?? "";
|
|
8940
|
-
const tree = str2(entry.sourceTree) ?? "<group>";
|
|
8941
|
-
if (tree === "<absolute>") result = own;
|
|
8942
|
-
else if (tree === "SOURCE_ROOT") result = join7(projectDir, own);
|
|
8943
|
-
else if (tree === "<group>") {
|
|
8944
|
-
const parent = parents.get(id);
|
|
8945
|
-
const base = parent ? resolve4(parent) : projectDir;
|
|
8946
|
-
if (base !== null) result = join7(base, own);
|
|
8947
|
-
} else {
|
|
8948
|
-
const base = sourceTreeRoot?.(tree);
|
|
8949
|
-
if (base) result = join7(base, own);
|
|
8950
|
-
}
|
|
8951
|
-
}
|
|
8952
|
-
paths.set(id, result);
|
|
8953
|
-
return result;
|
|
9015
|
+
paths.set(id, result);
|
|
9016
|
+
return result;
|
|
8954
9017
|
};
|
|
8955
9018
|
return resolve4;
|
|
8956
9019
|
}
|
|
8957
9020
|
function xcodeBuildFileBuildsForIos(buildFile) {
|
|
8958
9021
|
const filters = [
|
|
8959
9022
|
...list(buildFile.platformFilters),
|
|
8960
|
-
|
|
9023
|
+
str(buildFile.platformFilter)
|
|
8961
9024
|
].filter((filter) => !!filter);
|
|
8962
9025
|
return !filters.length || filters.includes("ios");
|
|
8963
9026
|
}
|
|
@@ -8979,7 +9042,7 @@ function xcodeTargetMemberVisitor(objects) {
|
|
|
8979
9042
|
for (const buildFileId of list(phase.files)) {
|
|
8980
9043
|
const buildFile = objects[buildFileId];
|
|
8981
9044
|
if (!isDict(buildFile) || !xcodeBuildFileBuildsForIos(buildFile)) continue;
|
|
8982
|
-
const refId =
|
|
9045
|
+
const refId = str(buildFile.fileRef);
|
|
8983
9046
|
if (!refId) continue;
|
|
8984
9047
|
const entry = objects[refId];
|
|
8985
9048
|
const refs = isDict(entry) && entry.isa === "PBXVariantGroup" ? list(entry.children) : [refId];
|
|
@@ -8991,7 +9054,7 @@ function xcodeTargetMemberVisitor(objects) {
|
|
|
8991
9054
|
continue;
|
|
8992
9055
|
}
|
|
8993
9056
|
const ref = objects[id];
|
|
8994
|
-
const type = isDict(ref) ?
|
|
9057
|
+
const type = isDict(ref) ? str(ref.lastKnownFileType) ?? str(ref.explicitFileType) ?? "" : "";
|
|
8995
9058
|
const root = file.replace(/[\\/]+$/, "");
|
|
8996
9059
|
const folder = FOLDER_REFERENCE.test(type) ? root.split(/[\\/]/).pop() : void 0;
|
|
8997
9060
|
for (const inner of filesUnder(file))
|
|
@@ -10661,7 +10724,7 @@ var init_swift_compile = __esm({
|
|
|
10661
10724
|
FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
10662
10725
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
10663
10726
|
).join("");
|
|
10664
|
-
compilerSourceDigest = true ? "
|
|
10727
|
+
compilerSourceDigest = true ? "da253e49615973dfc65a40000574546cbf7dc4c9d44a36295773bd33442d8c1d" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
10665
10728
|
C_WORDS = new Set(
|
|
10666
10729
|
"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(
|
|
10667
10730
|
" "
|
|
@@ -11377,12 +11440,12 @@ function workspaceReferences(workspace) {
|
|
|
11377
11440
|
return references;
|
|
11378
11441
|
}
|
|
11379
11442
|
function versionRequirement(url, requirement) {
|
|
11380
|
-
const kind =
|
|
11381
|
-
const minimum =
|
|
11382
|
-
const maximum =
|
|
11383
|
-
const version =
|
|
11384
|
-
const branch =
|
|
11385
|
-
const revision =
|
|
11443
|
+
const kind = str(requirement.kind);
|
|
11444
|
+
const minimum = str(requirement.minimumVersion);
|
|
11445
|
+
const maximum = str(requirement.maximumVersion);
|
|
11446
|
+
const version = str(requirement.version);
|
|
11447
|
+
const branch = str(requirement.branch);
|
|
11448
|
+
const revision = str(requirement.revision);
|
|
11386
11449
|
if (kind === "upToNextMajorVersion" && minimum)
|
|
11387
11450
|
return { kind: "upToNextMajorVersion", minimumVersion: minimum };
|
|
11388
11451
|
if (kind === "upToNextMinorVersion" && minimum)
|
|
@@ -11402,7 +11465,7 @@ function remotePackageRequirements(projects) {
|
|
|
11402
11465
|
for (const id of list(project.project.packageReferences)) {
|
|
11403
11466
|
const reference = project.object(id);
|
|
11404
11467
|
if (reference?.isa !== "XCRemoteSwiftPackageReference") continue;
|
|
11405
|
-
const url =
|
|
11468
|
+
const url = str(reference.repositoryURL);
|
|
11406
11469
|
if (!url) continue;
|
|
11407
11470
|
const requirement = reference.requirement;
|
|
11408
11471
|
if (!isDict(requirement)) throw new Error(`${url} has no version requirement`);
|
|
@@ -11435,12 +11498,12 @@ function loadProject(xcodeproj) {
|
|
|
11435
11498
|
const found = id === void 0 ? void 0 : objects[id];
|
|
11436
11499
|
return isDict(found) ? found : void 0;
|
|
11437
11500
|
};
|
|
11438
|
-
const project = object5(
|
|
11501
|
+
const project = object5(str(root.rootObject));
|
|
11439
11502
|
if (!project || project.isa !== "PBXProject") {
|
|
11440
11503
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
11441
11504
|
}
|
|
11442
11505
|
const projectDir = import_node_fs16.default.realpathSync.native(
|
|
11443
|
-
import_node_path15.default.resolve(import_node_path15.default.dirname(xcodeproj),
|
|
11506
|
+
import_node_path15.default.resolve(import_node_path15.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
11444
11507
|
);
|
|
11445
11508
|
const resolvePath = xcodePathResolver(objects, projectDir, import_node_path15.default.join);
|
|
11446
11509
|
const result = {
|
|
@@ -11467,11 +11530,11 @@ function selectedDeveloperDir() {
|
|
|
11467
11530
|
return developerDir;
|
|
11468
11531
|
}
|
|
11469
11532
|
function defaultConfiguration(project) {
|
|
11470
|
-
const configList = project.object(
|
|
11533
|
+
const configList = project.object(str(project.project.buildConfigurationList));
|
|
11471
11534
|
const names = list(configList?.buildConfigurations).flatMap(
|
|
11472
|
-
(id) =>
|
|
11535
|
+
(id) => str(project.object(id)?.name) ?? []
|
|
11473
11536
|
);
|
|
11474
|
-
return names.includes("Debug") ? "Debug" :
|
|
11537
|
+
return names.includes("Debug") ? "Debug" : str(configList?.defaultConfigurationName) ?? names[0] ?? "Debug";
|
|
11475
11538
|
}
|
|
11476
11539
|
function targetSettings(ref, configuration, builtins, options = {}, overrides = {}) {
|
|
11477
11540
|
const { project, target } = ref;
|
|
@@ -11479,14 +11542,14 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
11479
11542
|
const selected = (listId) => {
|
|
11480
11543
|
const configList = project.object(listId);
|
|
11481
11544
|
const configs = list(configList?.buildConfigurations).map(project.object);
|
|
11482
|
-
return configs.find((entry) => entry?.name === configuration) ?? configs.find((entry) => entry?.name ===
|
|
11545
|
+
return configs.find((entry) => entry?.name === configuration) ?? configs.find((entry) => entry?.name === str(configList?.defaultConfigurationName));
|
|
11483
11546
|
};
|
|
11484
11547
|
const level = (config) => {
|
|
11485
11548
|
if (!config) return [];
|
|
11486
|
-
const name2 =
|
|
11487
|
-
const base =
|
|
11488
|
-
const anchor =
|
|
11489
|
-
const relative3 =
|
|
11549
|
+
const name2 = str(config.name) ?? configuration;
|
|
11550
|
+
const base = str(config.baseConfigurationReference);
|
|
11551
|
+
const anchor = str(config.baseConfigurationReferenceAnchor);
|
|
11552
|
+
const relative3 = str(config.baseConfigurationReferenceRelativePath);
|
|
11490
11553
|
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
11491
11554
|
const directory = anchor ? project.resolvePath(anchor) : null;
|
|
11492
11555
|
const baseFile = base ? project.resolvePath(base) : directory && relative3 ? import_node_path15.default.resolve(directory, relative3) : null;
|
|
@@ -11509,10 +11572,10 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
11509
11572
|
)
|
|
11510
11573
|
];
|
|
11511
11574
|
};
|
|
11512
|
-
const targetConfig = selected(
|
|
11575
|
+
const targetConfig = selected(str(target.buildConfigurationList));
|
|
11513
11576
|
const levels = [
|
|
11514
|
-
{ ...builtins, CONFIGURATION:
|
|
11515
|
-
...level(selected(
|
|
11577
|
+
{ ...builtins, CONFIGURATION: str(targetConfig?.name) ?? configuration },
|
|
11578
|
+
...level(selected(str(project.project.buildConfigurationList))),
|
|
11516
11579
|
...level(targetConfig),
|
|
11517
11580
|
overrides
|
|
11518
11581
|
];
|
|
@@ -11523,7 +11586,7 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
11523
11586
|
if (at < 0) return derived(key);
|
|
11524
11587
|
const marker = `${key}@${at}`;
|
|
11525
11588
|
if (resolving2.has(marker))
|
|
11526
|
-
throw new Error(`${
|
|
11589
|
+
throw new Error(`${str(target.name)} has a cyclic build setting ${key}`);
|
|
11527
11590
|
resolving2.add(marker);
|
|
11528
11591
|
const value = expand(
|
|
11529
11592
|
levels[at][key],
|
|
@@ -11537,9 +11600,9 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
11537
11600
|
PRODUCT_NAME: () => get("TARGET_NAME"),
|
|
11538
11601
|
PRODUCT_MODULE_NAME: () => applyOperator(get("PRODUCT_NAME"), "c99extidentifier"),
|
|
11539
11602
|
EXECUTABLE_NAME: () => get("PRODUCT_NAME"),
|
|
11540
|
-
MACH_O_TYPE: () => PRODUCT_MACH_O_TYPES[
|
|
11603
|
+
MACH_O_TYPE: () => PRODUCT_MACH_O_TYPES[str(target.productType) ?? ""] ?? "",
|
|
11541
11604
|
// the native defaults of CoreBuildSystem.xcspec for a dynamic framework
|
|
11542
|
-
EXECUTABLE_PATH: () => FRAMEWORK_PRODUCTS.has(
|
|
11605
|
+
EXECUTABLE_PATH: () => FRAMEWORK_PRODUCTS.has(str(target.productType) ?? "") ? `${get("PRODUCT_NAME")}.framework/${get("EXECUTABLE_NAME")}` : get("EXECUTABLE_NAME"),
|
|
11543
11606
|
DYLIB_INSTALL_NAME_BASE: () => "/Library/Frameworks",
|
|
11544
11607
|
LD_DYLIB_INSTALL_NAME: () => get("MACH_O_TYPE") === "mh_dylib" ? `${get("DYLIB_INSTALL_NAME_BASE")}/${get("EXECUTABLE_PATH")}` : "",
|
|
11545
11608
|
// the native default of CoreBuildSystem.xcspec
|
|
@@ -11746,7 +11809,7 @@ function fileListEntries(file, absolute) {
|
|
|
11746
11809
|
}
|
|
11747
11810
|
function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
11748
11811
|
const { project, target, id: targetId } = ref;
|
|
11749
|
-
const targetName =
|
|
11812
|
+
const targetName = str(target.name) ?? targetId;
|
|
11750
11813
|
const sources = /* @__PURE__ */ new Set();
|
|
11751
11814
|
const allSources = /* @__PURE__ */ new Set();
|
|
11752
11815
|
const headers = /* @__PURE__ */ new Set();
|
|
@@ -11761,15 +11824,15 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
11761
11824
|
for (const phaseId of list(target.buildPhases)) {
|
|
11762
11825
|
const phase = project.object(phaseId);
|
|
11763
11826
|
if (phase?.isa !== "PBXShellScriptBuildPhase") continue;
|
|
11764
|
-
const script =
|
|
11827
|
+
const script = str(phase.name) ?? phaseId;
|
|
11765
11828
|
for (const catalog of shellAssetCatalogs(
|
|
11766
|
-
|
|
11829
|
+
str(phase.shellScript) ?? "",
|
|
11767
11830
|
settings,
|
|
11768
11831
|
project.projectDir
|
|
11769
11832
|
))
|
|
11770
11833
|
for (const file of walkFiles(catalog)) resources.add(file);
|
|
11771
11834
|
copiedFiles.push(
|
|
11772
|
-
...shellCopies(
|
|
11835
|
+
...shellCopies(str(phase.shellScript) ?? "", settings, project.projectDir)
|
|
11773
11836
|
);
|
|
11774
11837
|
const absolute = (raw) => import_node_path15.default.resolve(project.projectDir, expand(raw, settings));
|
|
11775
11838
|
const inputs = list(phase.inputPaths).map(absolute);
|
|
@@ -11878,7 +11941,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
11878
11941
|
`
|
|
11879
11942
|
);
|
|
11880
11943
|
});
|
|
11881
|
-
const rawScript =
|
|
11944
|
+
const rawScript = str(phase.shellScript) ?? "";
|
|
11882
11945
|
if (rawScript.includes("generate-modules-provider")) {
|
|
11883
11946
|
const preloadPath = import_node_path15.default.join(phaseDir, "expo-scan-timeout.cjs");
|
|
11884
11947
|
import_node_fs16.default.mkdirSync(phaseDir, { recursive: true });
|
|
@@ -11901,7 +11964,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
11901
11964
|
}
|
|
11902
11965
|
try {
|
|
11903
11966
|
const [shell, ...args] = scriptCommand(
|
|
11904
|
-
|
|
11967
|
+
str(phase.shellPath) ?? "/bin/sh",
|
|
11905
11968
|
rawScript
|
|
11906
11969
|
);
|
|
11907
11970
|
(0, import_node_child_process9.execFileSync)(shell, args, {
|
|
@@ -11970,7 +12033,7 @@ ${output2}`
|
|
|
11970
12033
|
if (process.platform !== "darwin") {
|
|
11971
12034
|
let launchName = settings("INFOPLIST_KEY_UILaunchStoryboardName");
|
|
11972
12035
|
if (!launchName && infoPlistOutput && import_node_fs16.default.existsSync(infoPlistOutput)) {
|
|
11973
|
-
const info =
|
|
12036
|
+
const info = import_plist4.default.parse(import_node_fs16.default.readFileSync(infoPlistOutput, "utf8"));
|
|
11974
12037
|
const declared = isRecord(info) ? info.UILaunchStoryboardName : void 0;
|
|
11975
12038
|
if (typeof declared === "string") launchName = expand(declared, settings);
|
|
11976
12039
|
}
|
|
@@ -12175,7 +12238,7 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
12175
12238
|
const nested = project.project.projectReferences;
|
|
12176
12239
|
if (Array.isArray(nested)) {
|
|
12177
12240
|
for (const entry of nested) {
|
|
12178
|
-
const ref = isDict(entry) ?
|
|
12241
|
+
const ref = isDict(entry) ? str(entry.ProjectRef) : void 0;
|
|
12179
12242
|
const resolved = ref ? project.resolvePath(ref) : null;
|
|
12180
12243
|
if (resolved) addProject(resolved);
|
|
12181
12244
|
}
|
|
@@ -12210,7 +12273,7 @@ function isIosAppTarget(ref, options = {}) {
|
|
|
12210
12273
|
ref,
|
|
12211
12274
|
defaultConfiguration(ref.project),
|
|
12212
12275
|
{
|
|
12213
|
-
TARGET_NAME:
|
|
12276
|
+
TARGET_NAME: str(ref.target.name) ?? ref.id
|
|
12214
12277
|
},
|
|
12215
12278
|
options
|
|
12216
12279
|
);
|
|
@@ -12223,14 +12286,14 @@ function isIosPlatform(name2) {
|
|
|
12223
12286
|
return name2.startsWith("iphoneos") || name2.startsWith("iphonesimulator");
|
|
12224
12287
|
}
|
|
12225
12288
|
function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
|
|
12226
|
-
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(projectTargets).filter((ref) => isIosAppTarget(ref, options)).map((ref) =>
|
|
12289
|
+
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(projectTargets).filter((ref) => isIosAppTarget(ref, options)).map((ref) => str(ref.target.name) ?? ref.id);
|
|
12227
12290
|
}
|
|
12228
12291
|
function defaultXcodeAppTarget(xcodeproj) {
|
|
12229
12292
|
const project = loadProject(import_node_fs16.default.realpathSync.native(xcodeproj));
|
|
12230
12293
|
for (const [id, target] of Object.entries(project.objects)) {
|
|
12231
12294
|
if (!isDict(target) || target.isa !== "PBXNativeTarget") continue;
|
|
12232
12295
|
if (isIosAppTarget({ project, id, target }, { requireSources: false }))
|
|
12233
|
-
return
|
|
12296
|
+
return str(target.name);
|
|
12234
12297
|
}
|
|
12235
12298
|
}
|
|
12236
12299
|
function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
|
|
@@ -12278,11 +12341,11 @@ function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
|
|
|
12278
12341
|
(candidate) => import_node_fs16.default.existsSync(projectPath) && candidate.xcodeproj === import_node_fs16.default.realpathSync.native(projectPath)
|
|
12279
12342
|
);
|
|
12280
12343
|
const target = project && projectTargets(project).find((ref) => ref.id === blueprint);
|
|
12281
|
-
const name2 = target &&
|
|
12344
|
+
const name2 = target && str(target.target.name);
|
|
12282
12345
|
if (!name2) {
|
|
12283
12346
|
const declared = (project ? [project] : projects).flatMap(
|
|
12284
12347
|
(candidate) => projectTargets(candidate).flatMap((ref) => {
|
|
12285
|
-
const targetName =
|
|
12348
|
+
const targetName = str(ref.target.name);
|
|
12286
12349
|
return targetName ? [targetName] : [];
|
|
12287
12350
|
})
|
|
12288
12351
|
);
|
|
@@ -12379,9 +12442,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12379
12442
|
);
|
|
12380
12443
|
const allTargets = projects.flatMap(projectTargets);
|
|
12381
12444
|
const appTargets = allTargets.filter(
|
|
12382
|
-
(ref) => options.frameworkMachOType ? ref.target.name === targetName && FRAMEWORK_PRODUCTS.has(
|
|
12445
|
+
(ref) => options.frameworkMachOType ? ref.target.name === targetName && FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "") : isIosAppTarget(ref, options) || targetName !== void 0 && ref.target.name === targetName && ref.target.productType === APP_EXTENSION
|
|
12383
12446
|
);
|
|
12384
|
-
const appTargetNames = appTargets.map((ref) =>
|
|
12447
|
+
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
12385
12448
|
const container = import_node_path15.default.basename(xcodeprojOrWorkspace);
|
|
12386
12449
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
12387
12450
|
if (named.length !== 1) {
|
|
@@ -12398,28 +12461,28 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12398
12461
|
);
|
|
12399
12462
|
}
|
|
12400
12463
|
const app = named[0];
|
|
12401
|
-
const appConfigs = app.project.object(
|
|
12464
|
+
const appConfigs = app.project.object(str(app.target.buildConfigurationList));
|
|
12402
12465
|
const appConfigNames = list(appConfigs?.buildConfigurations).flatMap(
|
|
12403
|
-
(id) =>
|
|
12466
|
+
(id) => str(app.project.object(id)?.name) ?? []
|
|
12404
12467
|
);
|
|
12405
|
-
const configuration = configurationName === void 0 ? defaultConfiguration(app.project) : appConfigNames.includes(configurationName) ? configurationName :
|
|
12468
|
+
const configuration = configurationName === void 0 ? defaultConfiguration(app.project) : appConfigNames.includes(configurationName) ? configurationName : str(appConfigs?.defaultConfigurationName) ?? configurationName;
|
|
12406
12469
|
const byProduct = /* @__PURE__ */ new Map();
|
|
12407
12470
|
for (const ref of allTargets) {
|
|
12408
|
-
const product = ref.project.object(
|
|
12409
|
-
const file =
|
|
12471
|
+
const product = ref.project.object(str(ref.target.productReference));
|
|
12472
|
+
const file = str(product?.path);
|
|
12410
12473
|
if (file && !byProduct.has(import_node_path15.default.basename(file)))
|
|
12411
12474
|
byProduct.set(import_node_path15.default.basename(file), ref);
|
|
12412
12475
|
}
|
|
12413
12476
|
const proxied = (project, proxyId) => {
|
|
12414
12477
|
const proxy = project.object(proxyId);
|
|
12415
12478
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
12416
|
-
const portal =
|
|
12479
|
+
const portal = str(proxy.containerPortal);
|
|
12417
12480
|
const portalPath = project.resolvePath(portal ?? "");
|
|
12418
12481
|
const owner = project.object(portal)?.isa === "PBXProject" ? project : portalPath && import_node_fs16.default.existsSync(portalPath) ? projectAt.get(import_node_fs16.default.realpathSync.native(portalPath)) : void 0;
|
|
12419
|
-
const remote =
|
|
12482
|
+
const remote = str(proxy.remoteGlobalIDString);
|
|
12420
12483
|
if (!owner || !remote) return void 0;
|
|
12421
12484
|
return projectTargets(owner).find(
|
|
12422
|
-
(ref) => ref.id === remote ||
|
|
12485
|
+
(ref) => ref.id === remote || str(ref.target.productReference) === remote
|
|
12423
12486
|
);
|
|
12424
12487
|
};
|
|
12425
12488
|
const linkedTargets = (ref) => {
|
|
@@ -12431,8 +12494,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12431
12494
|
for (const buildFileId of list(phase.files)) {
|
|
12432
12495
|
const buildFile = project.object(buildFileId);
|
|
12433
12496
|
if (!buildFile || !xcodeBuildFileBuildsForIos(buildFile)) continue;
|
|
12434
|
-
const file = project.object(
|
|
12435
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project,
|
|
12497
|
+
const file = project.object(str(buildFile.fileRef));
|
|
12498
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path15.default.basename(str(file.path) ?? "")) : void 0;
|
|
12436
12499
|
if (resolved)
|
|
12437
12500
|
found.push({
|
|
12438
12501
|
target: resolved,
|
|
@@ -12460,12 +12523,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12460
12523
|
const found = list(target.dependencies).flatMap((dependencyId) => {
|
|
12461
12524
|
const dependency = project.object(dependencyId);
|
|
12462
12525
|
if (!dependency || !xcodeBuildFileBuildsForIos(dependency)) return [];
|
|
12463
|
-
const direct =
|
|
12464
|
-
const resolved = direct ? projectTargets(project).find((candidate) => candidate.id === direct) : proxied(project,
|
|
12526
|
+
const direct = str(dependency.target);
|
|
12527
|
+
const resolved = direct ? projectTargets(project).find((candidate) => candidate.id === direct) : proxied(project, str(dependency.targetProxy));
|
|
12465
12528
|
return resolved ? [resolved] : [];
|
|
12466
12529
|
});
|
|
12467
12530
|
return [...found, ...linkedTargets(ref).map((link) => link.target)].filter(
|
|
12468
|
-
(candidate) => candidate.target.isa === "PBXAggregateTarget" || candidate.target.productType === RESOURCE_BUNDLE || MODULE_PRODUCTS.has(
|
|
12531
|
+
(candidate) => candidate.target.isa === "PBXAggregateTarget" || candidate.target.productType === RESOURCE_BUNDLE || MODULE_PRODUCTS.has(str(candidate.target.productType) ?? "")
|
|
12469
12532
|
);
|
|
12470
12533
|
};
|
|
12471
12534
|
const order = [];
|
|
@@ -12492,7 +12555,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12492
12555
|
return list(phase.files).flatMap((id) => {
|
|
12493
12556
|
const file = ref.project.object(id);
|
|
12494
12557
|
if (!file || !xcodeBuildFileBuildsForIos(file)) return [];
|
|
12495
|
-
const resolved = ref.project.resolvePath(
|
|
12558
|
+
const resolved = ref.project.resolvePath(str(file.fileRef) ?? "");
|
|
12496
12559
|
const attributes = isDict(file.settings) ? list(file.settings.ATTRIBUTES) : [];
|
|
12497
12560
|
if (!resolved) return [];
|
|
12498
12561
|
return [
|
|
@@ -12509,7 +12572,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12509
12572
|
if (cached) return cached;
|
|
12510
12573
|
const headers = /* @__PURE__ */ new Map();
|
|
12511
12574
|
for (const other of projectTargets(project)) {
|
|
12512
|
-
if (FRAMEWORK_PRODUCTS.has(
|
|
12575
|
+
if (FRAMEWORK_PRODUCTS.has(str(other.target.productType) ?? "")) continue;
|
|
12513
12576
|
const otherProduct = productName(other);
|
|
12514
12577
|
for (const { file, visibility } of headerPhase(other)) {
|
|
12515
12578
|
if (visibility === "Project") continue;
|
|
@@ -12528,7 +12591,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12528
12591
|
const product = targetSettings(
|
|
12529
12592
|
ref,
|
|
12530
12593
|
configuration,
|
|
12531
|
-
{ TARGET_NAME:
|
|
12594
|
+
{ TARGET_NAME: str(ref.target.name) ?? ref.id },
|
|
12532
12595
|
options
|
|
12533
12596
|
).get("PRODUCT_NAME");
|
|
12534
12597
|
productNames.set(key, product);
|
|
@@ -12597,7 +12660,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12597
12660
|
OBJROOT: import_node_path15.default.join(buildDir(app.project), "Intermediates.noindex")
|
|
12598
12661
|
};
|
|
12599
12662
|
const moduleTarget = (ref) => {
|
|
12600
|
-
const name2 =
|
|
12663
|
+
const name2 = str(ref.target.name) ?? ref.id;
|
|
12601
12664
|
const {
|
|
12602
12665
|
get: settings2,
|
|
12603
12666
|
keys,
|
|
@@ -12610,7 +12673,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12610
12673
|
TARGETNAME: "$(TARGET_NAME)",
|
|
12611
12674
|
PROJECT: "$(PROJECT_NAME)",
|
|
12612
12675
|
PROJECT_NAME: import_node_path15.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
12613
|
-
PROJECT_CLASS_PREFIX: isDict(ref.project.project.attributes) ?
|
|
12676
|
+
PROJECT_CLASS_PREFIX: isDict(ref.project.project.attributes) ? str(ref.project.project.attributes.CLASSPREFIX) ?? "" : "",
|
|
12614
12677
|
PROJECT_FILE_PATH: ref.project.xcodeproj,
|
|
12615
12678
|
SRCROOT: ref.project.projectDir,
|
|
12616
12679
|
SOURCE_ROOT: ref.project.projectDir,
|
|
@@ -12624,7 +12687,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12624
12687
|
TARGET_BUILD_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
12625
12688
|
DWARF_DSYM_FOLDER_PATH: "$(CONFIGURATION_BUILD_DIR)",
|
|
12626
12689
|
DWARF_DSYM_FILE_NAME: "$(FULL_PRODUCT_NAME).dSYM",
|
|
12627
|
-
FULL_PRODUCT_NAME:
|
|
12690
|
+
FULL_PRODUCT_NAME: str(ref.project.object(str(ref.target.productReference))?.path) ?? "",
|
|
12628
12691
|
UNLOCALIZED_RESOURCES_FOLDER_PATH: "$(FULL_PRODUCT_NAME)",
|
|
12629
12692
|
CONTENTS_FOLDER_PATH: "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)",
|
|
12630
12693
|
FRAMEWORKS_FOLDER_PATH: "$(CONTENTS_FOLDER_PATH)/Frameworks",
|
|
@@ -12648,7 +12711,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12648
12711
|
CURRENT_ARCH: "arm64",
|
|
12649
12712
|
ARCHS: "arm64",
|
|
12650
12713
|
ACTION: "build",
|
|
12651
|
-
DEVELOPMENT_LANGUAGE:
|
|
12714
|
+
DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
|
|
12652
12715
|
},
|
|
12653
12716
|
options,
|
|
12654
12717
|
ref === app && options.frameworkMachOType ? {
|
|
@@ -12668,12 +12731,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12668
12731
|
);
|
|
12669
12732
|
const searchRules = recursiveSearchRules(settings2);
|
|
12670
12733
|
const absolute = (file) => import_node_path15.default.resolve(ref.project.projectDir, file);
|
|
12671
|
-
const framework = FRAMEWORK_PRODUCTS.has(
|
|
12734
|
+
const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
|
|
12672
12735
|
const product = settings2("PRODUCT_NAME");
|
|
12673
12736
|
const moduleName = applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier");
|
|
12674
12737
|
const compatibilityPhases = list(ref.target.buildPhases).flatMap((id) => {
|
|
12675
12738
|
const phase = ref.project.object(id);
|
|
12676
|
-
if (phase?.isa !== "PBXShellScriptBuildPhase" ||
|
|
12739
|
+
if (phase?.isa !== "PBXShellScriptBuildPhase" || str(phase.name) !== "Copy generated compatibility header")
|
|
12677
12740
|
return [];
|
|
12678
12741
|
const inputs = list(phase.inputPaths).map(
|
|
12679
12742
|
(file) => absolute(expand(file, settings2))
|
|
@@ -12798,11 +12861,11 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12798
12861
|
if (phase?.isa !== "PBXSourcesBuildPhase") continue;
|
|
12799
12862
|
for (const id of list(phase.files)) {
|
|
12800
12863
|
const file = ref.project.object(id);
|
|
12801
|
-
const resolved = ref.project.resolvePath(
|
|
12864
|
+
const resolved = ref.project.resolvePath(str(file?.fileRef) ?? "");
|
|
12802
12865
|
if (resolved && implementations.includes(resolved))
|
|
12803
12866
|
fileFlags[resolved] = settingList(
|
|
12804
12867
|
expand(
|
|
12805
|
-
|
|
12868
|
+
str(isDict(file?.settings) ? file.settings.COMPILER_FLAGS : void 0) ?? "",
|
|
12806
12869
|
settings2
|
|
12807
12870
|
)
|
|
12808
12871
|
);
|
|
@@ -12942,15 +13005,15 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12942
13005
|
// cocoapods writes for each header_mappings_dir folder.
|
|
12943
13006
|
...list(ref.target.buildPhases).flatMap((phaseId) => {
|
|
12944
13007
|
const phase = ref.project.object(phaseId);
|
|
12945
|
-
if (phase?.isa !== "PBXCopyFilesBuildPhase" ||
|
|
13008
|
+
if (phase?.isa !== "PBXCopyFilesBuildPhase" || str(phase.dstSubfolderSpec) !== "16")
|
|
12946
13009
|
return [];
|
|
12947
13010
|
const destination = expand(
|
|
12948
|
-
|
|
13011
|
+
str(phase.dstPath) ?? "",
|
|
12949
13012
|
(name3) => name3 === "PUBLIC_HEADERS_FOLDER_PATH" ? import_node_path15.default.join(wrapper, "Headers") : name3 === "PRIVATE_HEADERS_FOLDER_PATH" ? import_node_path15.default.join(wrapper, "PrivateHeaders") : settings2(name3)
|
|
12950
13013
|
);
|
|
12951
13014
|
return list(phase.files).flatMap((id) => {
|
|
12952
13015
|
const file = ref.project.resolvePath(
|
|
12953
|
-
|
|
13016
|
+
str(ref.project.object(id)?.fileRef) ?? ""
|
|
12954
13017
|
);
|
|
12955
13018
|
return file && HEADER_FILE.test(file) ? [
|
|
12956
13019
|
[
|
|
@@ -12998,7 +13061,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
12998
13061
|
))
|
|
12999
13062
|
includeNativeTarget(ref);
|
|
13000
13063
|
const selectedTargets = options.nativeModules ? builtTargets.filter((target) => nativeTargets.has(target.ref)) : builtTargets;
|
|
13001
|
-
const frameworkTargets = selectedTargets.filter((target) => target !== builtTargets.at(-1)).filter(({ ref }) => MODULE_PRODUCTS.has(
|
|
13064
|
+
const frameworkTargets = selectedTargets.filter((target) => target !== builtTargets.at(-1)).filter(({ ref }) => MODULE_PRODUCTS.has(str(ref.target.productType) ?? "")).map(({ ref, module: module3 }) => ({ ref, framework: module3 }));
|
|
13002
13065
|
const frameworks = frameworkTargets.map(({ framework }) => framework);
|
|
13003
13066
|
const podSourceDirs = builtTargets.slice(0, -1).flatMap(
|
|
13004
13067
|
({ ref, module: module3 }) => isPodsProject(ref.project.xcodeproj) ? [...module3.allSources, ...module3.objc?.headers ?? []].map((file) => import_node_path15.default.dirname(file)).filter((dir) => import_node_fs16.default.existsSync(dir)) : []
|
|
@@ -13020,7 +13083,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13020
13083
|
for (const owner of options.installedPods ? builtTargets : []) {
|
|
13021
13084
|
for (const phaseId of list(owner.ref.target.buildPhases)) {
|
|
13022
13085
|
const phase = owner.ref.project.object(phaseId);
|
|
13023
|
-
if (phase?.isa !== "PBXShellScriptBuildPhase" ||
|
|
13086
|
+
if (phase?.isa !== "PBXShellScriptBuildPhase" || str(phase.name) !== "[CP] Copy Pods Resources")
|
|
13024
13087
|
continue;
|
|
13025
13088
|
const absolute = (raw) => import_node_path15.default.resolve(owner.ref.project.projectDir, expand(raw, owner.settings));
|
|
13026
13089
|
const entries = (paths) => paths.flatMap((raw) => {
|
|
@@ -13044,8 +13107,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13044
13107
|
);
|
|
13045
13108
|
for (const [index, input2] of inputs.entries()) {
|
|
13046
13109
|
const product = bundleTargets.find((target) => {
|
|
13047
|
-
const file =
|
|
13048
|
-
target.ref.project.object(
|
|
13110
|
+
const file = str(
|
|
13111
|
+
target.ref.project.object(str(target.ref.target.productReference))?.path
|
|
13049
13112
|
);
|
|
13050
13113
|
return file && import_node_path15.default.join(target.settings("TARGET_BUILD_DIR"), file) === input2;
|
|
13051
13114
|
});
|
|
@@ -13073,9 +13136,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13073
13136
|
path: bundlePath,
|
|
13074
13137
|
...product ? {
|
|
13075
13138
|
resources: product.module.resources,
|
|
13076
|
-
infoPlist:
|
|
13139
|
+
infoPlist: import_plist4.default.build(
|
|
13077
13140
|
expandValue(
|
|
13078
|
-
|
|
13141
|
+
import_plist4.default.parse(import_node_fs16.default.readFileSync(infoFile, "utf8")),
|
|
13079
13142
|
product.settings
|
|
13080
13143
|
)
|
|
13081
13144
|
)
|
|
@@ -13090,7 +13153,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13090
13153
|
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path15.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
13091
13154
|
const entitlementsFile = settings("CODE_SIGN_ENTITLEMENTS") ? import_node_path15.default.resolve(app.project.projectDir, settings("CODE_SIGN_ENTITLEMENTS")) : null;
|
|
13092
13155
|
const infoPlistPending = module2.generatedInfoPlist && !options.prepareGeneratedSources;
|
|
13093
|
-
const sourceInfo = infoPlistFile && !infoPlistPending ?
|
|
13156
|
+
const sourceInfo = infoPlistFile && !infoPlistPending ? import_plist4.default.parse(import_node_fs16.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
13094
13157
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
13095
13158
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
13096
13159
|
}
|
|
@@ -13115,7 +13178,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13115
13178
|
}
|
|
13116
13179
|
const bundleIdentifier = settings("PRODUCT_BUNDLE_IDENTIFIER") || (typeof info.CFBundleIdentifier === "string" ? info.CFBundleIdentifier : "");
|
|
13117
13180
|
const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
|
|
13118
|
-
|
|
13181
|
+
import_plist4.default.parse(import_node_fs16.default.readFileSync(entitlementsFile, "utf8")),
|
|
13119
13182
|
(value) => expand(value, (key) => {
|
|
13120
13183
|
if (key === "AppIdentifierPrefix") return "FAKETEAMID.";
|
|
13121
13184
|
if (key === "TeamIdentifierPrefix") return "";
|
|
@@ -13133,10 +13196,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13133
13196
|
if (phase?.isa !== "PBXShellScriptBuildPhase" || list(phase.outputPaths).length || list(phase.outputFileListPaths).length)
|
|
13134
13197
|
break;
|
|
13135
13198
|
postBundleScripts.unshift({
|
|
13136
|
-
name:
|
|
13199
|
+
name: str(phase.name) ?? id,
|
|
13137
13200
|
command: scriptCommand(
|
|
13138
|
-
|
|
13139
|
-
|
|
13201
|
+
str(phase.shellPath) ?? "/bin/sh",
|
|
13202
|
+
str(phase.shellScript) ?? ""
|
|
13140
13203
|
),
|
|
13141
13204
|
directory: app.project.projectDir,
|
|
13142
13205
|
inputPaths: list(phase.inputPaths),
|
|
@@ -13174,7 +13237,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13174
13237
|
}
|
|
13175
13238
|
return packages;
|
|
13176
13239
|
}
|
|
13177
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path15.default.resolve(project.projectDir,
|
|
13240
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path15.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
13178
13241
|
return candidate && import_node_fs16.default.existsSync(import_node_path15.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
13179
13242
|
})
|
|
13180
13243
|
)
|
|
@@ -13184,7 +13247,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13184
13247
|
projects.flatMap(
|
|
13185
13248
|
(project) => list(project.project.packageReferences).flatMap((id) => {
|
|
13186
13249
|
const reference = project.object(id);
|
|
13187
|
-
const url =
|
|
13250
|
+
const url = str(reference?.repositoryURL);
|
|
13188
13251
|
return reference?.isa === "XCRemoteSwiftPackageReference" && url ? [url] : [];
|
|
13189
13252
|
})
|
|
13190
13253
|
)
|
|
@@ -13259,7 +13322,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13259
13322
|
const productPlatforms = /* @__PURE__ */ new Map();
|
|
13260
13323
|
const productRef = (id) => {
|
|
13261
13324
|
const entry = project.object(id);
|
|
13262
|
-
const ref2 =
|
|
13325
|
+
const ref2 = str(entry?.productRef);
|
|
13263
13326
|
if (!entry || !ref2) return [];
|
|
13264
13327
|
const builds = xcodeBuildFileBuildsForIos(entry);
|
|
13265
13328
|
productPlatforms.set(ref2, productPlatforms.get(ref2) === true || builds);
|
|
@@ -13271,7 +13334,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13271
13334
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
13272
13335
|
for (const id of list(phase.files)) {
|
|
13273
13336
|
const file = project.object(id);
|
|
13274
|
-
const product =
|
|
13337
|
+
const product = str(file?.productRef);
|
|
13275
13338
|
if (file && product && xcodeBuildFileBuildsForIos(file))
|
|
13276
13339
|
productAttributes.set(
|
|
13277
13340
|
product,
|
|
@@ -13297,20 +13360,20 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13297
13360
|
const ownKeys = /* @__PURE__ */ new Set();
|
|
13298
13361
|
for (const dependencyId of new Set(productDependencies)) {
|
|
13299
13362
|
const dependency = project.object(dependencyId);
|
|
13300
|
-
const product =
|
|
13363
|
+
const product = str(dependency?.productName)?.replace(/^plugin:/, "");
|
|
13301
13364
|
if (!dependency || !product)
|
|
13302
13365
|
throw new Error(
|
|
13303
|
-
`${
|
|
13366
|
+
`${str(target.name) ?? "target"}: package product dependency ${dependencyId} has no productName in ${project.projectFile}`
|
|
13304
13367
|
);
|
|
13305
|
-
const reference = project.object(
|
|
13368
|
+
const reference = project.object(str(dependency.package));
|
|
13306
13369
|
const linked = {
|
|
13307
13370
|
product,
|
|
13308
13371
|
...productAttributes.get(dependencyId)?.length ? { attributes: productAttributes.get(dependencyId) } : {},
|
|
13309
|
-
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url:
|
|
13372
|
+
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
13310
13373
|
kind: "local",
|
|
13311
13374
|
dir: import_node_path15.default.resolve(
|
|
13312
13375
|
project.projectDir,
|
|
13313
|
-
|
|
13376
|
+
str(reference.relativePath) ?? ""
|
|
13314
13377
|
)
|
|
13315
13378
|
} : { kind: "unnamed", remoteUrls: remotePackageUrls }
|
|
13316
13379
|
};
|
|
@@ -13331,10 +13394,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13331
13394
|
for (const buildFileId of list(phase.files)) {
|
|
13332
13395
|
const buildFile = project.object(buildFileId);
|
|
13333
13396
|
if (!buildFile || !xcodeBuildFileBuildsForIos(buildFile)) continue;
|
|
13334
|
-
const fileId =
|
|
13397
|
+
const fileId = str(buildFile.fileRef);
|
|
13335
13398
|
const file = project.object(fileId);
|
|
13336
|
-
const tree =
|
|
13337
|
-
const rawPath =
|
|
13399
|
+
const tree = str(file?.sourceTree);
|
|
13400
|
+
const rawPath = str(file?.path) ?? "";
|
|
13338
13401
|
const name2 = /([^/]+)\.(xc)?framework$/.exec(rawPath)?.[1];
|
|
13339
13402
|
if (file?.isa !== "PBXFileReference" || !name2) continue;
|
|
13340
13403
|
if (tree === "SDKROOT" || /\/System\/Library\/Frameworks\/[^/]+$/.test(`/${rawPath}`)) {
|
|
@@ -13348,7 +13411,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13348
13411
|
if (fileId && resolved !== null && !import_node_fs16.default.existsSync(resolved)) {
|
|
13349
13412
|
if (!ios_sdk_frameworks_default.frameworks.includes(name2))
|
|
13350
13413
|
throw new Error(
|
|
13351
|
-
`${
|
|
13414
|
+
`${str(target.name) ?? "target"}: linked framework ${name2} (${fileId}) points at missing ${resolved} in ${project.projectFile}`
|
|
13352
13415
|
);
|
|
13353
13416
|
sdkFrameworks.add(name2);
|
|
13354
13417
|
continue;
|
|
@@ -13386,12 +13449,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13386
13449
|
sourceLinkGraph: {
|
|
13387
13450
|
entry: module2.id,
|
|
13388
13451
|
targets: builtTargets.filter(
|
|
13389
|
-
({ ref }) => ref === app || MODULE_PRODUCTS.has(
|
|
13452
|
+
({ ref }) => ref === app || MODULE_PRODUCTS.has(str(ref.target.productType) ?? "")
|
|
13390
13453
|
).map(({ ref, module: module3, settings: settings2 }) => ({
|
|
13391
13454
|
id: module3.id,
|
|
13392
13455
|
sourceTarget: module3.allSources.length > 0 ? module3.moduleName : null,
|
|
13393
|
-
productName: settings2("FULL_PRODUCT_NAME") ||
|
|
13394
|
-
productType:
|
|
13456
|
+
productName: settings2("FULL_PRODUCT_NAME") || str(ref.project.object(str(ref.target.productReference))?.path) || settings2("PRODUCT_NAME"),
|
|
13457
|
+
productType: str(ref.target.productType),
|
|
13395
13458
|
installName: settings2("LD_DYLIB_INSTALL_NAME") || null,
|
|
13396
13459
|
buildVersion: {
|
|
13397
13460
|
platform: settings2("PLATFORM_NAME") || null,
|
|
@@ -13401,7 +13464,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13401
13464
|
machOType: settings2("MACH_O_TYPE") || null,
|
|
13402
13465
|
linkerFlags: settingList(settings2("OTHER_LDFLAGS")),
|
|
13403
13466
|
dependencies: linkedTargets(ref).concat(frameworkFlagLinks(ref, settings2("OTHER_LDFLAGS"))).filter(
|
|
13404
|
-
(dependency) => MODULE_PRODUCTS.has(
|
|
13467
|
+
(dependency) => MODULE_PRODUCTS.has(str(dependency.target.target.productType) ?? "")
|
|
13405
13468
|
).map(({ target, attributes }) => ({
|
|
13406
13469
|
target: `${target.project.projectFile}#${target.id}`,
|
|
13407
13470
|
attributes
|
|
@@ -13447,11 +13510,11 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13447
13510
|
].sort(),
|
|
13448
13511
|
projectDirs: [...new Set(used.map((project) => project.projectDir))].sort(),
|
|
13449
13512
|
appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
|
|
13450
|
-
infoPlist: infoPlistPending ? null :
|
|
13513
|
+
infoPlist: infoPlistPending ? null : import_plist4.default.build(info),
|
|
13451
13514
|
infoPlistFile,
|
|
13452
13515
|
...keychainAccessGroups === void 0 ? {} : { keychainAccessGroups },
|
|
13453
13516
|
postBundleScripts,
|
|
13454
|
-
developmentRegion:
|
|
13517
|
+
developmentRegion: str(app.project.project.developmentRegion) ?? "en",
|
|
13455
13518
|
frameworks,
|
|
13456
13519
|
resourceProducts,
|
|
13457
13520
|
linkedProducts,
|
|
@@ -13469,7 +13532,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
13469
13532
|
cocoapods
|
|
13470
13533
|
};
|
|
13471
13534
|
}
|
|
13472
|
-
var import_node_child_process9, import_node_crypto6, import_node_fs16, import_node_path15,
|
|
13535
|
+
var import_node_child_process9, import_node_crypto6, import_node_fs16, import_node_path15, 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, loaded, developerDir, preparedSourcePhases, isPodsProject, targetRefs, NativeAppTargetSelectionError, workspaceResolvedFile, SwiftPackageResolutionRequired;
|
|
13473
13536
|
var init_xcode_project = __esm({
|
|
13474
13537
|
"src/xcode-project.ts"() {
|
|
13475
13538
|
"use strict";
|
|
@@ -13477,7 +13540,7 @@ var init_xcode_project = __esm({
|
|
|
13477
13540
|
import_node_crypto6 = require("node:crypto");
|
|
13478
13541
|
import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
13479
13542
|
import_node_path15 = __toESM(require("node:path"), 1);
|
|
13480
|
-
|
|
13543
|
+
import_plist4 = __toESM(require("plist"), 1);
|
|
13481
13544
|
init_bazel_project();
|
|
13482
13545
|
init_ios_sdk_frameworks();
|
|
13483
13546
|
init_is_record();
|
|
@@ -17046,16 +17109,6 @@ var init_app_config = __esm({
|
|
|
17046
17109
|
}
|
|
17047
17110
|
});
|
|
17048
17111
|
|
|
17049
|
-
// src/plist-bytes.ts
|
|
17050
|
-
var import_bplist_parser;
|
|
17051
|
-
var init_plist_bytes = __esm({
|
|
17052
|
-
"src/plist-bytes.ts"() {
|
|
17053
|
-
"use strict";
|
|
17054
|
-
import_bplist_parser = __toESM(require("bplist-parser"), 1);
|
|
17055
|
-
init_plist();
|
|
17056
|
-
}
|
|
17057
|
-
});
|
|
17058
|
-
|
|
17059
17112
|
// src/swift-xcframework.ts
|
|
17060
17113
|
var init_swift_xcframework = __esm({
|
|
17061
17114
|
"src/swift-xcframework.ts"() {
|
|
@@ -17309,7 +17362,7 @@ var init_react_native_core = __esm({
|
|
|
17309
17362
|
init_swift_distribution();
|
|
17310
17363
|
init_swift_package();
|
|
17311
17364
|
init_swiftContract();
|
|
17312
|
-
recipe = true ? "
|
|
17365
|
+
recipe = true ? "f850b012b3ddd1d19a158d194b24b05cb032a23ccf2e459caa45620c0a5a823a" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
|
|
17313
17366
|
}
|
|
17314
17367
|
});
|
|
17315
17368
|
|
|
@@ -17354,6 +17407,16 @@ var init_core_data_model = __esm({
|
|
|
17354
17407
|
}
|
|
17355
17408
|
});
|
|
17356
17409
|
|
|
17410
|
+
// src/swift-catalog-png.ts
|
|
17411
|
+
var import_pngjs, pngSignature;
|
|
17412
|
+
var init_swift_catalog_png = __esm({
|
|
17413
|
+
"src/swift-catalog-png.ts"() {
|
|
17414
|
+
"use strict";
|
|
17415
|
+
import_pngjs = require("pngjs");
|
|
17416
|
+
pngSignature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
17417
|
+
}
|
|
17418
|
+
});
|
|
17419
|
+
|
|
17357
17420
|
// src/swift-cxx-reachable.ts
|
|
17358
17421
|
var init_swift_cxx_reachable = __esm({
|
|
17359
17422
|
"src/swift-cxx-reachable.ts"() {
|
|
@@ -17428,6 +17491,7 @@ var init_swift_host = __esm({
|
|
|
17428
17491
|
init_plist();
|
|
17429
17492
|
init_prepared_xcode_phases();
|
|
17430
17493
|
init_swift_binary_modules();
|
|
17494
|
+
init_swift_catalog_png();
|
|
17431
17495
|
init_swift_compile();
|
|
17432
17496
|
init_xcode_assets();
|
|
17433
17497
|
init_swift_cxx_reachable();
|
|
@@ -17453,14 +17517,6 @@ var init_swift_host = __esm({
|
|
|
17453
17517
|
}
|
|
17454
17518
|
});
|
|
17455
17519
|
|
|
17456
|
-
// src/cocoapods-trunk.ts
|
|
17457
|
-
var init_cocoapods_trunk = __esm({
|
|
17458
|
-
"src/cocoapods-trunk.ts"() {
|
|
17459
|
-
"use strict";
|
|
17460
|
-
init_home_paths();
|
|
17461
|
-
}
|
|
17462
|
-
});
|
|
17463
|
-
|
|
17464
17520
|
// src/installed-native-libraries.ts
|
|
17465
17521
|
var init_installed_native_libraries = __esm({
|
|
17466
17522
|
"src/installed-native-libraries.ts"() {
|
|
@@ -17489,15 +17545,12 @@ var init_turbo_codegen_intake = __esm({
|
|
|
17489
17545
|
});
|
|
17490
17546
|
|
|
17491
17547
|
// src/turbo-source.ts
|
|
17492
|
-
var import_node_child_process15, import_node_util8, execFileAsync3;
|
|
17493
17548
|
var init_turbo_source = __esm({
|
|
17494
17549
|
"src/turbo-source.ts"() {
|
|
17495
17550
|
"use strict";
|
|
17496
|
-
import_node_child_process15 = require("node:child_process");
|
|
17497
|
-
import_node_util8 = require("node:util");
|
|
17498
17551
|
init_cocoapods_trunk();
|
|
17499
|
-
init_home_paths();
|
|
17500
17552
|
init_installed_native_libraries();
|
|
17553
|
+
init_pod_sources();
|
|
17501
17554
|
init_answeredNativePackages();
|
|
17502
17555
|
init_expo_autolinking();
|
|
17503
17556
|
init_nitro_dependencies();
|
|
@@ -17508,7 +17561,6 @@ var init_turbo_source = __esm({
|
|
|
17508
17561
|
init_swiftContract();
|
|
17509
17562
|
init_turbo_codegen_intake();
|
|
17510
17563
|
init_xcode_project();
|
|
17511
|
-
execFileAsync3 = (0, import_node_util8.promisify)(import_node_child_process15.execFile);
|
|
17512
17564
|
}
|
|
17513
17565
|
});
|
|
17514
17566
|
|
|
@@ -18877,7 +18929,7 @@ init_answeredNativePackages();
|
|
|
18877
18929
|
init_expo_autolinking();
|
|
18878
18930
|
|
|
18879
18931
|
// src/expo-native-prebuilt.ts
|
|
18880
|
-
var
|
|
18932
|
+
var import_plist7 = __toESM(require("plist"), 1);
|
|
18881
18933
|
init_answeredNativePackages();
|
|
18882
18934
|
|
|
18883
18935
|
// src/expo-native-compiler-digest.ts
|
|
@@ -18912,6 +18964,3105 @@ init_bundle_global_footer();
|
|
|
18912
18964
|
init_is_record();
|
|
18913
18965
|
init_swiftContract();
|
|
18914
18966
|
|
|
18967
|
+
// src/pods-install.ts
|
|
18968
|
+
init_openstep_plist();
|
|
18969
|
+
|
|
18970
|
+
// src/pbx-table.ts
|
|
18971
|
+
init_openstep_plist();
|
|
18972
|
+
var ARRAY_SETTINGS = /* @__PURE__ */ new Set([
|
|
18973
|
+
"ALTERNATE_PERMISSIONS_FILES",
|
|
18974
|
+
"ARCHS",
|
|
18975
|
+
"BUILD_VARIANTS",
|
|
18976
|
+
"EXCLUDED_SOURCE_FILE_NAMES",
|
|
18977
|
+
"FRAMEWORK_SEARCH_PATHS",
|
|
18978
|
+
"GCC_PREPROCESSOR_DEFINITIONS",
|
|
18979
|
+
"GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS",
|
|
18980
|
+
"HEADER_SEARCH_PATHS",
|
|
18981
|
+
"INCLUDED_SOURCE_FILE_NAMES",
|
|
18982
|
+
"INFOPLIST_PREPROCESSOR_DEFINITIONS",
|
|
18983
|
+
"LD_RUNPATH_SEARCH_PATHS",
|
|
18984
|
+
"LIBRARY_SEARCH_PATHS",
|
|
18985
|
+
"LOCALIZED_STRING_MACRO_NAMES",
|
|
18986
|
+
"OTHER_CFLAGS",
|
|
18987
|
+
"OTHER_CPLUSPLUSFLAGS",
|
|
18988
|
+
"OTHER_LDFLAGS",
|
|
18989
|
+
"REZ_SEARCH_PATHS",
|
|
18990
|
+
"SECTORDER_FLAGS",
|
|
18991
|
+
"SYSTEM_FRAMEWORK_SEARCH_PATHS",
|
|
18992
|
+
"SYSTEM_HEADER_SEARCH_PATHS",
|
|
18993
|
+
"USER_HEADER_SEARCH_PATHS",
|
|
18994
|
+
"WARNING_CFLAGS",
|
|
18995
|
+
"WARNING_LDFLAGS"
|
|
18996
|
+
]);
|
|
18997
|
+
var LEGACY_ARRAY_SETTINGS = new Set(
|
|
18998
|
+
[...ARRAY_SETTINGS].filter(
|
|
18999
|
+
(key) => ![
|
|
19000
|
+
"INCLUDED_SOURCE_FILE_NAMES",
|
|
19001
|
+
"LD_RUNPATH_SEARCH_PATHS",
|
|
19002
|
+
"LOCALIZED_STRING_MACRO_NAMES",
|
|
19003
|
+
"SYSTEM_FRAMEWORK_SEARCH_PATHS",
|
|
19004
|
+
"SYSTEM_HEADER_SEARCH_PATHS",
|
|
19005
|
+
"USER_HEADER_SEARCH_PATHS"
|
|
19006
|
+
].includes(key)
|
|
19007
|
+
)
|
|
19008
|
+
);
|
|
19009
|
+
|
|
19010
|
+
// src/pods-install.ts
|
|
19011
|
+
init_pod_sources();
|
|
19012
|
+
|
|
19013
|
+
// src/podfile-cocoapods.ts
|
|
19014
|
+
init_cocoapods_trunk();
|
|
19015
|
+
init_podspec_cocoapods();
|
|
19016
|
+
init_podspec_ruby();
|
|
19017
|
+
init_podspec_ruby_stdlib();
|
|
19018
|
+
var PODFILE = String.raw`
|
|
19019
|
+
module Pod
|
|
19020
|
+
class BuildType
|
|
19021
|
+
KNOWN_PACKAGING_OPTIONS = { :library => [:static, :dynamic], :framework => [:static, :dynamic] }.freeze
|
|
19022
|
+
attr_reader :packaging, :linkage
|
|
19023
|
+
def initialize(linkage: :static, packaging: :library)
|
|
19024
|
+
raise ArgumentError, "Invalid linkage option #{linkage.inspect}, valid options are #{KNOWN_PACKAGING_OPTIONS[packaging].inspect}" unless KNOWN_PACKAGING_OPTIONS[packaging].include?(linkage)
|
|
19025
|
+
@packaging = packaging
|
|
19026
|
+
@linkage = linkage
|
|
19027
|
+
end
|
|
19028
|
+
def self.dynamic_library; new(:linkage => :dynamic, :packaging => :library); end
|
|
19029
|
+
def self.static_library; new(:linkage => :static, :packaging => :library); end
|
|
19030
|
+
def self.dynamic_framework; new(:linkage => :dynamic, :packaging => :framework); end
|
|
19031
|
+
def self.static_framework; new(:linkage => :static, :packaging => :framework); end
|
|
19032
|
+
def dynamic?; linkage == :dynamic; end
|
|
19033
|
+
def static?; linkage == :static; end
|
|
19034
|
+
def framework?; packaging == :framework; end
|
|
19035
|
+
def library?; packaging == :library; end
|
|
19036
|
+
def dynamic_framework?; dynamic? && framework?; end
|
|
19037
|
+
def dynamic_library?; dynamic? && library?; end
|
|
19038
|
+
def static_framework?; static? && framework?; end
|
|
19039
|
+
def static_library?; static? && library?; end
|
|
19040
|
+
def to_s
|
|
19041
|
+
"#{linkage} #{packaging}"
|
|
19042
|
+
end
|
|
19043
|
+
def to_hash
|
|
19044
|
+
{ :linkage => linkage, :packaging => packaging }
|
|
19045
|
+
end
|
|
19046
|
+
def ==(other)
|
|
19047
|
+
linkage == other.linkage && packaging == other.packaging
|
|
19048
|
+
end
|
|
19049
|
+
end
|
|
19050
|
+
|
|
19051
|
+
class Sandbox
|
|
19052
|
+
attr_reader :root, :stored_podspecs
|
|
19053
|
+
def initialize(root)
|
|
19054
|
+
@root = Pathname.new(root)
|
|
19055
|
+
@stored_podspecs = {}
|
|
19056
|
+
@local_paths = {}
|
|
19057
|
+
end
|
|
19058
|
+
def specifications_root
|
|
19059
|
+
root + 'Local Podspecs'
|
|
19060
|
+
end
|
|
19061
|
+
def specification(name)
|
|
19062
|
+
@stored_podspecs[Specification.root_name(name)]
|
|
19063
|
+
end
|
|
19064
|
+
def store_local_path(name, path, was_absolute = false)
|
|
19065
|
+
@local_paths[Specification.root_name(name)] = [path.dirname, was_absolute]
|
|
19066
|
+
end
|
|
19067
|
+
def local_path(name)
|
|
19068
|
+
@local_paths[Specification.root_name(name)]&.first
|
|
19069
|
+
end
|
|
19070
|
+
def local?(name)
|
|
19071
|
+
@local_paths.key?(Specification.root_name(name))
|
|
19072
|
+
end
|
|
19073
|
+
def development_pods
|
|
19074
|
+
@local_paths.transform_values(&:first)
|
|
19075
|
+
end
|
|
19076
|
+
def store_podspec(name, podspec, _external_source = false, json = false)
|
|
19077
|
+
file_name = json ? "#{name}.podspec.json" : "#{name}.podspec"
|
|
19078
|
+
output_path = specifications_root + file_name
|
|
19079
|
+
spec = case podspec
|
|
19080
|
+
when Specification
|
|
19081
|
+
raise ArgumentError, 'can only store Specification objects as json' unless json
|
|
19082
|
+
# the checksum of the JSON CocoaPods writes to output_path
|
|
19083
|
+
podspec.dup.tap { |stored| stored.instance_variable_set(:@checksum, Digest::SHA1.hexdigest(podspec.to_pretty_json)) }
|
|
19084
|
+
else
|
|
19085
|
+
raise ArgumentError, "Peach stores only evaluated podspecs, not #{podspec.inspect}"
|
|
19086
|
+
end
|
|
19087
|
+
spec.defined_in_file = output_path
|
|
19088
|
+
unless spec.name == name
|
|
19089
|
+
raise Informative, "The name of the given podspec '#{spec.name}' doesn't match the expected one '#{name}'"
|
|
19090
|
+
end
|
|
19091
|
+
@stored_podspecs[spec.name] = spec
|
|
19092
|
+
end
|
|
19093
|
+
end
|
|
19094
|
+
|
|
19095
|
+
class Installer
|
|
19096
|
+
attr_reader :sandbox, :podfile, :lockfile
|
|
19097
|
+
attr_accessor :pod_targets, :aggregate_targets
|
|
19098
|
+
def initialize(sandbox, podfile, lockfile = nil)
|
|
19099
|
+
@sandbox = sandbox
|
|
19100
|
+
@podfile = podfile
|
|
19101
|
+
@lockfile = lockfile
|
|
19102
|
+
@pod_targets = []
|
|
19103
|
+
@aggregate_targets = []
|
|
19104
|
+
end
|
|
19105
|
+
|
|
19106
|
+
private
|
|
19107
|
+
|
|
19108
|
+
def run_podfile_pre_install_hooks
|
|
19109
|
+
podfile.pre_install!(self)
|
|
19110
|
+
end
|
|
19111
|
+
|
|
19112
|
+
def run_podfile_post_install_hooks
|
|
19113
|
+
podfile.post_install!(self)
|
|
19114
|
+
end
|
|
19115
|
+
|
|
19116
|
+
def run_podfile_post_integrate_hooks
|
|
19117
|
+
podfile.post_integrate!(self)
|
|
19118
|
+
end
|
|
19119
|
+
|
|
19120
|
+
# upstream runs plugin hooks and prints warnings here; Peach loads no plugins
|
|
19121
|
+
def perform_post_install_actions
|
|
19122
|
+
end
|
|
19123
|
+
|
|
19124
|
+
# the workspace, deintegration of targets the Podfile dropped and the
|
|
19125
|
+
# override warnings are left out: Peach builds from the projects in memory
|
|
19126
|
+
class UserProjectIntegrator
|
|
19127
|
+
attr_reader :podfile, :sandbox, :installation_root, :targets, :targets_to_integrate, :use_input_output_paths
|
|
19128
|
+
alias use_input_output_paths? use_input_output_paths
|
|
19129
|
+
|
|
19130
|
+
def initialize(podfile, sandbox, installation_root, targets, targets_to_integrate, use_input_output_paths: true)
|
|
19131
|
+
@podfile = podfile
|
|
19132
|
+
@sandbox = sandbox
|
|
19133
|
+
@installation_root = installation_root
|
|
19134
|
+
@targets = targets
|
|
19135
|
+
@targets_to_integrate = targets_to_integrate
|
|
19136
|
+
@use_input_output_paths = use_input_output_paths
|
|
19137
|
+
end
|
|
19138
|
+
|
|
19139
|
+
def integrate!
|
|
19140
|
+
integrate_user_targets
|
|
19141
|
+
save_projects(user_projects_to_integrate)
|
|
19142
|
+
end
|
|
19143
|
+
|
|
19144
|
+
private
|
|
19145
|
+
|
|
19146
|
+
def integrate_user_targets
|
|
19147
|
+
Peach::Pods.integrate_user_targets(targets_to_integrate.sort_by(&:name).map(&:label))
|
|
19148
|
+
end
|
|
19149
|
+
|
|
19150
|
+
def user_projects_to_integrate
|
|
19151
|
+
targets_to_integrate.map(&:user_project).compact.uniq
|
|
19152
|
+
end
|
|
19153
|
+
|
|
19154
|
+
def save_projects(projects)
|
|
19155
|
+
projects.each(&:save)
|
|
19156
|
+
end
|
|
19157
|
+
end
|
|
19158
|
+
end
|
|
19159
|
+
|
|
19160
|
+
class Specification
|
|
19161
|
+
SCRIPT_PHASE_REQUIRED_KEYS = [:name, :script].freeze
|
|
19162
|
+
SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :input_file_lists, :output_file_lists,
|
|
19163
|
+
:show_env_vars_in_log, :execution_position, :dependency_file, :always_out_of_date].freeze
|
|
19164
|
+
EXECUTION_POSITION_KEYS = [:before_compile, :after_compile, :before_headers, :after_headers, :any].freeze
|
|
19165
|
+
ALL_SCRIPT_PHASE_KEYS = (SCRIPT_PHASE_REQUIRED_KEYS + SCRIPT_PHASE_OPTIONAL_KEYS).freeze
|
|
19166
|
+
|
|
19167
|
+
def defined_in_file
|
|
19168
|
+
root? ? @defined_in_file : root.defined_in_file
|
|
19169
|
+
end
|
|
19170
|
+
|
|
19171
|
+
def defined_in_file=(file)
|
|
19172
|
+
raise StandardError, 'Defined in file can be set only for root specs.' unless root?
|
|
19173
|
+
@defined_in_file = file
|
|
19174
|
+
end
|
|
19175
|
+
|
|
19176
|
+
def self.root_name(full_name)
|
|
19177
|
+
if full_name[0] == '/'
|
|
19178
|
+
full_name.split('/', 3).first(2).join('/')
|
|
19179
|
+
else
|
|
19180
|
+
full_name.split('/', 2).first
|
|
19181
|
+
end
|
|
19182
|
+
end
|
|
19183
|
+
|
|
19184
|
+
def self.from_json(json, path = nil)
|
|
19185
|
+
from_hash(JSON.parse(json)).tap { |spec| spec.defined_in_file = path }
|
|
19186
|
+
end
|
|
19187
|
+
|
|
19188
|
+
def ==(other)
|
|
19189
|
+
other.is_a?(self.class) && name == other.name && version == other.version
|
|
19190
|
+
end
|
|
19191
|
+
alias_method :eql?, :==
|
|
19192
|
+
|
|
19193
|
+
def hash
|
|
19194
|
+
(name.hash * 53) ^ version.hash
|
|
19195
|
+
end
|
|
19196
|
+
|
|
19197
|
+
def test_specs
|
|
19198
|
+
subspecs.select(&:test_specification?)
|
|
19199
|
+
end
|
|
19200
|
+
|
|
19201
|
+
def app_specs
|
|
19202
|
+
subspecs.select(&:app_specification?)
|
|
19203
|
+
end
|
|
19204
|
+
|
|
19205
|
+
def recursive_subspecs
|
|
19206
|
+
mapper = lambda do |spec|
|
|
19207
|
+
spec.subspecs.map do |subspec|
|
|
19208
|
+
[subspec, *mapper.call(subspec)]
|
|
19209
|
+
end.flatten
|
|
19210
|
+
end
|
|
19211
|
+
mapper.call(self)
|
|
19212
|
+
end
|
|
19213
|
+
|
|
19214
|
+
def all_dependencies(platform = nil)
|
|
19215
|
+
dependencies(platform) + subspec_dependencies(platform)
|
|
19216
|
+
end
|
|
19217
|
+
|
|
19218
|
+
def subspec_dependencies(platform = nil)
|
|
19219
|
+
specs = if default_subspecs.empty?
|
|
19220
|
+
subspecs.compact.reject(&:non_library_specification?)
|
|
19221
|
+
else
|
|
19222
|
+
default_subspecs.map do |subspec_name|
|
|
19223
|
+
root.subspec_by_name("#{name}/#{subspec_name}")
|
|
19224
|
+
end
|
|
19225
|
+
end
|
|
19226
|
+
if platform
|
|
19227
|
+
specs = specs.select { |s| s.supported_on_platform?(platform) }
|
|
19228
|
+
end
|
|
19229
|
+
specs.map { |s| Dependency.new(s.name, version) }
|
|
19230
|
+
end
|
|
19231
|
+
|
|
19232
|
+
def supported_on_platform?(platform, target = nil)
|
|
19233
|
+
platform = Platform.new(platform, target) unless platform.is_a?(Platform)
|
|
19234
|
+
available_platforms.any? { |available| platform.supports?(available) }
|
|
19235
|
+
end
|
|
19236
|
+
|
|
19237
|
+
def to_pretty_json(*a)
|
|
19238
|
+
JSON.pretty_generate(to_hash, *a) << "\n"
|
|
19239
|
+
end
|
|
19240
|
+
|
|
19241
|
+
def checksum
|
|
19242
|
+
@checksum ||= begin
|
|
19243
|
+
if root?
|
|
19244
|
+
unless defined_in_file.nil?
|
|
19245
|
+
require 'digest'
|
|
19246
|
+
checksum = Digest::SHA1.hexdigest(File.read(defined_in_file))
|
|
19247
|
+
checksum = checksum.encode('UTF-8') if checksum.respond_to?(:encode)
|
|
19248
|
+
checksum
|
|
19249
|
+
end
|
|
19250
|
+
else
|
|
19251
|
+
root.checksum
|
|
19252
|
+
end
|
|
19253
|
+
end
|
|
19254
|
+
end
|
|
19255
|
+
end
|
|
19256
|
+
|
|
19257
|
+
class Podfile
|
|
19258
|
+
class StandardError < ::StandardError; end
|
|
19259
|
+
|
|
19260
|
+
module DSL
|
|
19261
|
+
def install!(installation_method, options = {})
|
|
19262
|
+
unless current_target_definition.root?
|
|
19263
|
+
raise Informative, 'The installation method can only be set at the root level of the Podfile.'
|
|
19264
|
+
end
|
|
19265
|
+
set_hash_value('installation_method', 'name' => installation_method, 'options' => options)
|
|
19266
|
+
end
|
|
19267
|
+
|
|
19268
|
+
# checks the Bundler running CocoaPods; Peach runs neither
|
|
19269
|
+
def ensure_bundler!(version = '>= 0')
|
|
19270
|
+
end
|
|
19271
|
+
|
|
19272
|
+
def pod(name = nil, *requirements)
|
|
19273
|
+
unless name
|
|
19274
|
+
raise StandardError, 'A dependency requires a name.'
|
|
19275
|
+
end
|
|
19276
|
+
if block_given?
|
|
19277
|
+
raise StandardError, "A block was passed to pod #{name}, which is not supported."
|
|
19278
|
+
end
|
|
19279
|
+
current_target_definition.store_pod(name, *requirements)
|
|
19280
|
+
end
|
|
19281
|
+
|
|
19282
|
+
def podspec(options = nil)
|
|
19283
|
+
current_target_definition.store_podspec(options)
|
|
19284
|
+
end
|
|
19285
|
+
|
|
19286
|
+
def target(name, options = nil)
|
|
19287
|
+
if options
|
|
19288
|
+
raise Informative, "Unsupported options #{options} for target #{name}."
|
|
19289
|
+
end
|
|
19290
|
+
parent = current_target_definition
|
|
19291
|
+
definition = TargetDefinition.new(name, parent)
|
|
19292
|
+
self.current_target_definition = definition
|
|
19293
|
+
yield if block_given?
|
|
19294
|
+
ensure
|
|
19295
|
+
self.current_target_definition = parent
|
|
19296
|
+
end
|
|
19297
|
+
|
|
19298
|
+
def script_phase(options)
|
|
19299
|
+
raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?
|
|
19300
|
+
raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?
|
|
19301
|
+
current_target_definition.store_script_phase(options)
|
|
19302
|
+
end
|
|
19303
|
+
|
|
19304
|
+
def abstract_target(name)
|
|
19305
|
+
target(name) do
|
|
19306
|
+
abstract!
|
|
19307
|
+
yield if block_given?
|
|
19308
|
+
end
|
|
19309
|
+
end
|
|
19310
|
+
|
|
19311
|
+
def abstract!(abstract = true)
|
|
19312
|
+
current_target_definition.abstract = abstract
|
|
19313
|
+
end
|
|
19314
|
+
|
|
19315
|
+
def inherit!(inheritance)
|
|
19316
|
+
current_target_definition.inheritance = inheritance
|
|
19317
|
+
end
|
|
19318
|
+
|
|
19319
|
+
def platform(name, target = nil)
|
|
19320
|
+
current_target_definition.set_platform!(name, target)
|
|
19321
|
+
end
|
|
19322
|
+
|
|
19323
|
+
def project(path, build_configurations = {})
|
|
19324
|
+
current_target_definition.user_project_path = path
|
|
19325
|
+
current_target_definition.build_configurations = build_configurations
|
|
19326
|
+
end
|
|
19327
|
+
|
|
19328
|
+
def inhibit_all_warnings!
|
|
19329
|
+
current_target_definition.inhibit_all_warnings = true
|
|
19330
|
+
end
|
|
19331
|
+
|
|
19332
|
+
def use_modular_headers!
|
|
19333
|
+
current_target_definition.use_modular_headers_for_all_pods = true
|
|
19334
|
+
end
|
|
19335
|
+
|
|
19336
|
+
def use_frameworks!(option = true)
|
|
19337
|
+
current_target_definition.use_frameworks!(option)
|
|
19338
|
+
end
|
|
19339
|
+
|
|
19340
|
+
def supports_swift_versions(*requirements)
|
|
19341
|
+
current_target_definition.store_swift_version_requirements(*requirements)
|
|
19342
|
+
end
|
|
19343
|
+
|
|
19344
|
+
def workspace(path)
|
|
19345
|
+
set_hash_value('workspace', path)
|
|
19346
|
+
end
|
|
19347
|
+
|
|
19348
|
+
def generate_bridge_support!
|
|
19349
|
+
set_hash_value('generate_bridge_support', true)
|
|
19350
|
+
end
|
|
19351
|
+
|
|
19352
|
+
def set_arc_compatibility_flag!
|
|
19353
|
+
set_hash_value('set_arc_compatibility_flag', true)
|
|
19354
|
+
end
|
|
19355
|
+
|
|
19356
|
+
def source(source)
|
|
19357
|
+
hash_sources = get_hash_value('sources') || []
|
|
19358
|
+
hash_sources << source
|
|
19359
|
+
set_hash_value('sources', hash_sources.uniq)
|
|
19360
|
+
end
|
|
19361
|
+
|
|
19362
|
+
def plugin(name, options = {})
|
|
19363
|
+
hash_plugins = get_hash_value('plugins') || {}
|
|
19364
|
+
(hash_plugins[name] ||= {}).merge!(options)
|
|
19365
|
+
set_hash_value('plugins', hash_plugins)
|
|
19366
|
+
end
|
|
19367
|
+
|
|
19368
|
+
def pre_install(&block)
|
|
19369
|
+
@pre_install_callback = block
|
|
19370
|
+
end
|
|
19371
|
+
|
|
19372
|
+
def pre_integrate(&block)
|
|
19373
|
+
@pre_integrate_callback = block
|
|
19374
|
+
end
|
|
19375
|
+
|
|
19376
|
+
def post_install(&block)
|
|
19377
|
+
@post_install_callback = block
|
|
19378
|
+
end
|
|
19379
|
+
|
|
19380
|
+
def post_integrate(&block)
|
|
19381
|
+
@post_integrate_callback = block
|
|
19382
|
+
end
|
|
19383
|
+
end
|
|
19384
|
+
|
|
19385
|
+
include DSL
|
|
19386
|
+
|
|
19387
|
+
HASH_KEYS = %w(installation_method workspace sources plugins set_arc_compatibility_flag generate_bridge_support target_definitions).freeze
|
|
19388
|
+
|
|
19389
|
+
attr_accessor :defined_in_file
|
|
19390
|
+
attr_accessor :current_target_definition
|
|
19391
|
+
attr_reader :internal_hash
|
|
19392
|
+
|
|
19393
|
+
def initialize(defined_in_file = nil, internal_hash = {})
|
|
19394
|
+
@defined_in_file = defined_in_file
|
|
19395
|
+
@internal_hash = internal_hash
|
|
19396
|
+
default_target_def = TargetDefinition.new('Pods', self)
|
|
19397
|
+
default_target_def.abstract = true
|
|
19398
|
+
@root_target_definitions = [default_target_def]
|
|
19399
|
+
@current_target_definition = default_target_def
|
|
19400
|
+
end
|
|
19401
|
+
|
|
19402
|
+
def to_s
|
|
19403
|
+
'Podfile'
|
|
19404
|
+
end
|
|
19405
|
+
|
|
19406
|
+
def target_definitions
|
|
19407
|
+
Hash[target_definition_list.map { |td| [td.name, td] }]
|
|
19408
|
+
end
|
|
19409
|
+
|
|
19410
|
+
def target_definition_list
|
|
19411
|
+
root_target_definitions.map { |td| [td, td.recursive_children] }.flatten
|
|
19412
|
+
end
|
|
19413
|
+
|
|
19414
|
+
attr_accessor :root_target_definitions
|
|
19415
|
+
|
|
19416
|
+
def dependencies
|
|
19417
|
+
target_definition_list.map(&:dependencies).flatten.uniq
|
|
19418
|
+
end
|
|
19419
|
+
|
|
19420
|
+
def checksum
|
|
19421
|
+
@checksum ||= Digest::SHA1.hexdigest(File.read(defined_in_file)) unless defined_in_file.nil?
|
|
19422
|
+
end
|
|
19423
|
+
|
|
19424
|
+
def workspace_path
|
|
19425
|
+
path = get_hash_value('workspace')
|
|
19426
|
+
if path
|
|
19427
|
+
if File.extname(path) == '.xcworkspace'
|
|
19428
|
+
path
|
|
19429
|
+
else
|
|
19430
|
+
"#{path}.xcworkspace"
|
|
19431
|
+
end
|
|
19432
|
+
end
|
|
19433
|
+
end
|
|
19434
|
+
|
|
19435
|
+
def generate_bridge_support?
|
|
19436
|
+
get_hash_value('generate_bridge_support')
|
|
19437
|
+
end
|
|
19438
|
+
|
|
19439
|
+
def set_arc_compatibility_flag?
|
|
19440
|
+
get_hash_value('set_arc_compatibility_flag')
|
|
19441
|
+
end
|
|
19442
|
+
|
|
19443
|
+
def installation_method
|
|
19444
|
+
get_hash_value('installation_method', 'name' => 'cocoapods', 'options' => {}).values_at('name', 'options')
|
|
19445
|
+
end
|
|
19446
|
+
|
|
19447
|
+
def sources
|
|
19448
|
+
get_hash_value('sources') || []
|
|
19449
|
+
end
|
|
19450
|
+
|
|
19451
|
+
def plugins
|
|
19452
|
+
get_hash_value('plugins') || {}
|
|
19453
|
+
end
|
|
19454
|
+
|
|
19455
|
+
def to_hash
|
|
19456
|
+
hash = {}
|
|
19457
|
+
hash['target_definitions'] = root_target_definitions.map(&:to_hash)
|
|
19458
|
+
hash.merge!(internal_hash)
|
|
19459
|
+
hash
|
|
19460
|
+
end
|
|
19461
|
+
|
|
19462
|
+
def pre_install!(installer)
|
|
19463
|
+
@pre_install_callback ? @pre_install_callback.call(installer) || true : false
|
|
19464
|
+
end
|
|
19465
|
+
|
|
19466
|
+
def post_install!(installer)
|
|
19467
|
+
@post_install_callback ? @post_install_callback.call(installer) || true : false
|
|
19468
|
+
end
|
|
19469
|
+
|
|
19470
|
+
def post_integrate!(installer)
|
|
19471
|
+
@post_integrate_callback ? @post_integrate_callback.call(installer) || true : false
|
|
19472
|
+
end
|
|
19473
|
+
|
|
19474
|
+
def set_hash_value(key, value)
|
|
19475
|
+
raise StandardError, "Unsupported hash key '#{key}'" unless HASH_KEYS.include?(key)
|
|
19476
|
+
internal_hash[key] = value
|
|
19477
|
+
end
|
|
19478
|
+
|
|
19479
|
+
def get_hash_value(key, default = nil)
|
|
19480
|
+
raise StandardError, "Unsupported hash key '#{key}'" unless HASH_KEYS.include?(key)
|
|
19481
|
+
internal_hash.fetch(key, default)
|
|
19482
|
+
end
|
|
19483
|
+
|
|
19484
|
+
class TargetDefinition
|
|
19485
|
+
attr_reader :parent
|
|
19486
|
+
attr_reader :internal_hash
|
|
19487
|
+
attr_accessor :children
|
|
19488
|
+
|
|
19489
|
+
HASH_KEYS = %w(
|
|
19490
|
+
name platform podspecs exclusive link_with link_with_first_target inhibit_warnings use_modular_headers
|
|
19491
|
+
user_project_path build_configurations project_names dependencies script_phases children
|
|
19492
|
+
configuration_pod_whitelist uses_frameworks swift_version_requirements inheritance abstract swift_version
|
|
19493
|
+
).freeze
|
|
19494
|
+
|
|
19495
|
+
def initialize(name, parent, internal_hash = nil)
|
|
19496
|
+
@internal_hash = internal_hash || {}
|
|
19497
|
+
@parent = parent
|
|
19498
|
+
@children = []
|
|
19499
|
+
@label = nil
|
|
19500
|
+
self.name ||= name
|
|
19501
|
+
if parent.is_a?(TargetDefinition)
|
|
19502
|
+
parent.children << self
|
|
19503
|
+
end
|
|
19504
|
+
end
|
|
19505
|
+
|
|
19506
|
+
def recursive_children
|
|
19507
|
+
(children + children.map(&:recursive_children)).flatten
|
|
19508
|
+
end
|
|
19509
|
+
|
|
19510
|
+
def root?
|
|
19511
|
+
parent.is_a?(Podfile) || parent.nil?
|
|
19512
|
+
end
|
|
19513
|
+
|
|
19514
|
+
def root
|
|
19515
|
+
if root?
|
|
19516
|
+
self
|
|
19517
|
+
else
|
|
19518
|
+
parent.root
|
|
19519
|
+
end
|
|
19520
|
+
end
|
|
19521
|
+
|
|
19522
|
+
def podfile
|
|
19523
|
+
root.parent
|
|
19524
|
+
end
|
|
19525
|
+
|
|
19526
|
+
def dependencies
|
|
19527
|
+
if exclusive?
|
|
19528
|
+
non_inherited_dependencies
|
|
19529
|
+
else
|
|
19530
|
+
non_inherited_dependencies + parent.dependencies
|
|
19531
|
+
end
|
|
19532
|
+
end
|
|
19533
|
+
|
|
19534
|
+
def targets_to_inherit_search_paths
|
|
19535
|
+
return [] unless inheritance == 'search_paths'
|
|
19536
|
+
if root? || !matches_platform?(parent)
|
|
19537
|
+
raise StandardError, "Non-root target definitions (#{label}) need a parent target definition with the same platform."
|
|
19538
|
+
elsif parent.inheritance == 'search_paths'
|
|
19539
|
+
parent.targets_to_inherit_search_paths << parent
|
|
19540
|
+
else
|
|
19541
|
+
[parent]
|
|
19542
|
+
end
|
|
19543
|
+
end
|
|
19544
|
+
|
|
19545
|
+
def non_inherited_dependencies
|
|
19546
|
+
pod_dependencies.concat(podspec_dependencies)
|
|
19547
|
+
end
|
|
19548
|
+
|
|
19549
|
+
def empty?
|
|
19550
|
+
non_inherited_dependencies.empty?
|
|
19551
|
+
end
|
|
19552
|
+
|
|
19553
|
+
def label
|
|
19554
|
+
@label ||= if root? && name == 'Pods'
|
|
19555
|
+
'Pods'
|
|
19556
|
+
elsif exclusive? || parent.nil?
|
|
19557
|
+
"Pods-#{name}"
|
|
19558
|
+
else
|
|
19559
|
+
"#{parent.label}-#{name}"
|
|
19560
|
+
end
|
|
19561
|
+
end
|
|
19562
|
+
|
|
19563
|
+
alias_method :to_s, :label
|
|
19564
|
+
|
|
19565
|
+
def inspect
|
|
19566
|
+
"#<#{self.class} label=#{label}>"
|
|
19567
|
+
end
|
|
19568
|
+
|
|
19569
|
+
def name
|
|
19570
|
+
get_hash_value('name')
|
|
19571
|
+
end
|
|
19572
|
+
|
|
19573
|
+
def name=(name)
|
|
19574
|
+
@label = nil
|
|
19575
|
+
set_hash_value('name', name)
|
|
19576
|
+
end
|
|
19577
|
+
|
|
19578
|
+
def abstract?
|
|
19579
|
+
get_hash_value('abstract', root?)
|
|
19580
|
+
end
|
|
19581
|
+
|
|
19582
|
+
def abstract=(abstract)
|
|
19583
|
+
set_hash_value('abstract', abstract)
|
|
19584
|
+
end
|
|
19585
|
+
|
|
19586
|
+
def swift_version
|
|
19587
|
+
get_hash_value('swift_version')
|
|
19588
|
+
end
|
|
19589
|
+
|
|
19590
|
+
def swift_version=(version)
|
|
19591
|
+
set_hash_value('swift_version', version)
|
|
19592
|
+
end
|
|
19593
|
+
|
|
19594
|
+
def swift_version_requirements
|
|
19595
|
+
get_hash_value('swift_version_requirements')
|
|
19596
|
+
end
|
|
19597
|
+
|
|
19598
|
+
def store_swift_version_requirements(*requirements)
|
|
19599
|
+
set_hash_value('swift_version_requirements', requirements.flatten.map(&:to_s))
|
|
19600
|
+
end
|
|
19601
|
+
|
|
19602
|
+
def inheritance
|
|
19603
|
+
get_hash_value('inheritance', 'complete')
|
|
19604
|
+
end
|
|
19605
|
+
|
|
19606
|
+
def inheritance=(inheritance)
|
|
19607
|
+
inheritance = inheritance.to_s
|
|
19608
|
+
unless %w(none search_paths complete).include?(inheritance)
|
|
19609
|
+
raise Informative, "Unrecognized inheritance option '#{inheritance}' specified for target '#{name}'."
|
|
19610
|
+
end
|
|
19611
|
+
if root?
|
|
19612
|
+
raise Informative, 'Cannot set inheritance for the root target definition.'
|
|
19613
|
+
end
|
|
19614
|
+
if abstract?
|
|
19615
|
+
raise Informative, 'Cannot set inheritance for abstract target definition.'
|
|
19616
|
+
end
|
|
19617
|
+
set_hash_value('inheritance', inheritance)
|
|
19618
|
+
end
|
|
19619
|
+
|
|
19620
|
+
def exclusive?
|
|
19621
|
+
if root?
|
|
19622
|
+
true
|
|
19623
|
+
else
|
|
19624
|
+
!matches_platform?(parent) || (inheritance != 'complete')
|
|
19625
|
+
end
|
|
19626
|
+
end
|
|
19627
|
+
|
|
19628
|
+
def matches_platform?(target_definition)
|
|
19629
|
+
return false unless target_definition
|
|
19630
|
+
return true if target_definition.platform == platform
|
|
19631
|
+
!target_definition.platform && target_definition.abstract?
|
|
19632
|
+
end
|
|
19633
|
+
|
|
19634
|
+
def user_project_path
|
|
19635
|
+
path = get_hash_value('user_project_path')
|
|
19636
|
+
if path
|
|
19637
|
+
Pathname(path).sub_ext('.xcodeproj').to_path
|
|
19638
|
+
else
|
|
19639
|
+
parent.user_project_path unless root?
|
|
19640
|
+
end
|
|
19641
|
+
end
|
|
19642
|
+
|
|
19643
|
+
def user_project_path=(path)
|
|
19644
|
+
set_hash_value('user_project_path', path)
|
|
19645
|
+
end
|
|
19646
|
+
|
|
19647
|
+
def build_configurations
|
|
19648
|
+
if root?
|
|
19649
|
+
get_hash_value('build_configurations')
|
|
19650
|
+
else
|
|
19651
|
+
get_hash_value('build_configurations') || parent.build_configurations
|
|
19652
|
+
end
|
|
19653
|
+
end
|
|
19654
|
+
|
|
19655
|
+
def build_configurations=(hash)
|
|
19656
|
+
set_hash_value('build_configurations', hash) unless hash.empty?
|
|
19657
|
+
end
|
|
19658
|
+
|
|
19659
|
+
def script_phases
|
|
19660
|
+
script_phases_hashes = get_hash_value('script_phases', [])
|
|
19661
|
+
script_phases_hashes.map do |script_phase_hash|
|
|
19662
|
+
Specification.convert_keys_to_symbol(script_phase_hash)
|
|
19663
|
+
end
|
|
19664
|
+
end
|
|
19665
|
+
|
|
19666
|
+
def project_name_for_pod(pod_name)
|
|
19667
|
+
if root?
|
|
19668
|
+
raw_project_names_hash[pod_name]
|
|
19669
|
+
else
|
|
19670
|
+
raw_project_names_hash[pod_name] || parent.project_name_for_pod(pod_name)
|
|
19671
|
+
end
|
|
19672
|
+
end
|
|
19673
|
+
|
|
19674
|
+
def inhibits_warnings_for_pod?(pod_name)
|
|
19675
|
+
if Array(inhibit_warnings_hash['not_for_pods']).include?(pod_name)
|
|
19676
|
+
false
|
|
19677
|
+
elsif Array(inhibit_warnings_hash['for_pods']).include?(pod_name)
|
|
19678
|
+
true
|
|
19679
|
+
elsif inhibit_warnings_hash['all']
|
|
19680
|
+
true
|
|
19681
|
+
elsif !root? && parent.inhibits_warnings_for_pod?(pod_name)
|
|
19682
|
+
true
|
|
19683
|
+
else
|
|
19684
|
+
false
|
|
19685
|
+
end
|
|
19686
|
+
end
|
|
19687
|
+
|
|
19688
|
+
def inhibit_all_warnings=(flag)
|
|
19689
|
+
raw_inhibit_warnings_hash['all'] = flag
|
|
19690
|
+
end
|
|
19691
|
+
|
|
19692
|
+
def set_inhibit_warnings_for_pod(pod_name, should_inhibit)
|
|
19693
|
+
hash_key = case should_inhibit
|
|
19694
|
+
when true
|
|
19695
|
+
'for_pods'
|
|
19696
|
+
when false
|
|
19697
|
+
'not_for_pods'
|
|
19698
|
+
when nil
|
|
19699
|
+
return
|
|
19700
|
+
else
|
|
19701
|
+
raise ArgumentError, "Got '#{should_inhibit.inspect}', should be a boolean"
|
|
19702
|
+
end
|
|
19703
|
+
raw_inhibit_warnings_hash[hash_key] ||= []
|
|
19704
|
+
raw_inhibit_warnings_hash[hash_key] << pod_name
|
|
19705
|
+
end
|
|
19706
|
+
|
|
19707
|
+
def build_pod_as_module?(pod_name)
|
|
19708
|
+
if Array(use_modular_headers_hash['not_for_pods']).include?(pod_name)
|
|
19709
|
+
false
|
|
19710
|
+
elsif Array(use_modular_headers_hash['for_pods']).include?(pod_name)
|
|
19711
|
+
true
|
|
19712
|
+
elsif use_modular_headers_hash['all']
|
|
19713
|
+
true
|
|
19714
|
+
elsif !root? && parent.build_pod_as_module?(pod_name)
|
|
19715
|
+
true
|
|
19716
|
+
else
|
|
19717
|
+
false
|
|
19718
|
+
end
|
|
19719
|
+
end
|
|
19720
|
+
|
|
19721
|
+
def use_modular_headers_for_all_pods=(flag)
|
|
19722
|
+
raw_use_modular_headers_hash['all'] = flag
|
|
19723
|
+
end
|
|
19724
|
+
|
|
19725
|
+
def set_use_modular_headers_for_pod(pod_name, flag)
|
|
19726
|
+
hash_key = case flag
|
|
19727
|
+
when true
|
|
19728
|
+
'for_pods'
|
|
19729
|
+
when false
|
|
19730
|
+
'not_for_pods'
|
|
19731
|
+
when nil
|
|
19732
|
+
return
|
|
19733
|
+
else
|
|
19734
|
+
raise ArgumentError, "Got '#{flag.inspect}', should be a boolean"
|
|
19735
|
+
end
|
|
19736
|
+
raw_use_modular_headers_hash[hash_key] ||= []
|
|
19737
|
+
raw_use_modular_headers_hash[hash_key] << pod_name
|
|
19738
|
+
end
|
|
19739
|
+
|
|
19740
|
+
def use_frameworks!(option = true)
|
|
19741
|
+
value = case option
|
|
19742
|
+
when true, false
|
|
19743
|
+
option ? BuildType.dynamic_framework : BuildType.static_library
|
|
19744
|
+
when Hash
|
|
19745
|
+
BuildType.new(:linkage => option.fetch(:linkage), :packaging => :framework)
|
|
19746
|
+
else
|
|
19747
|
+
raise ArgumentError, "Got '#{option.inspect}', should be a boolean or hash."
|
|
19748
|
+
end
|
|
19749
|
+
set_hash_value('uses_frameworks', value.to_hash)
|
|
19750
|
+
end
|
|
19751
|
+
|
|
19752
|
+
def build_type
|
|
19753
|
+
value = get_hash_value('uses_frameworks', root? ? BuildType.static_library.to_hash : parent.build_type.to_hash)
|
|
19754
|
+
case value
|
|
19755
|
+
when true, false
|
|
19756
|
+
value ? BuildType.dynamic_framework : BuildType.static_library
|
|
19757
|
+
when Hash
|
|
19758
|
+
BuildType.new(:linkage => value.fetch(:linkage), :packaging => value.fetch(:packaging))
|
|
19759
|
+
when BuildType
|
|
19760
|
+
value
|
|
19761
|
+
else
|
|
19762
|
+
raise ArgumentError, "Got '#{value.inspect}', should be a boolean, hash or BuildType."
|
|
19763
|
+
end
|
|
19764
|
+
end
|
|
19765
|
+
|
|
19766
|
+
def uses_frameworks?
|
|
19767
|
+
if internal_hash['uses_frameworks'].nil?
|
|
19768
|
+
root? ? false : parent.uses_frameworks?
|
|
19769
|
+
else
|
|
19770
|
+
build_type.framework?
|
|
19771
|
+
end
|
|
19772
|
+
end
|
|
19773
|
+
|
|
19774
|
+
def whitelist_pod_for_configuration(pod_name, configuration_name)
|
|
19775
|
+
found = raw_configuration_pod_whitelist.find { |configuration, _| configuration.casecmp(configuration_name.to_s).zero? }
|
|
19776
|
+
configuration_name = found.nil? ? configuration_name.to_s : found.first
|
|
19777
|
+
list = raw_configuration_pod_whitelist[configuration_name] ||= []
|
|
19778
|
+
list << pod_name
|
|
19779
|
+
end
|
|
19780
|
+
|
|
19781
|
+
def pod_whitelisted_for_configuration?(pod_name, configuration_name)
|
|
19782
|
+
found = false
|
|
19783
|
+
configuration_pod_whitelist.each do |configuration, pods|
|
|
19784
|
+
if pods.include?(pod_name)
|
|
19785
|
+
found = true
|
|
19786
|
+
if configuration.casecmp(configuration_name.to_s).zero?
|
|
19787
|
+
return true
|
|
19788
|
+
end
|
|
19789
|
+
end
|
|
19790
|
+
end
|
|
19791
|
+
!found && (root? || (inheritance != 'none' && parent.pod_whitelisted_for_configuration?(pod_name, configuration_name)))
|
|
19792
|
+
end
|
|
19793
|
+
|
|
19794
|
+
def all_whitelisted_configurations
|
|
19795
|
+
parent_configurations = (root? || inheritance == 'none') ? [] : parent.all_whitelisted_configurations
|
|
19796
|
+
(configuration_pod_whitelist.keys + parent_configurations).uniq
|
|
19797
|
+
end
|
|
19798
|
+
|
|
19799
|
+
def platform
|
|
19800
|
+
name_or_hash = get_hash_value('platform')
|
|
19801
|
+
if name_or_hash
|
|
19802
|
+
if name_or_hash.is_a?(Hash)
|
|
19803
|
+
name = name_or_hash.keys.first.to_sym
|
|
19804
|
+
target = name_or_hash.values.first
|
|
19805
|
+
else
|
|
19806
|
+
name = name_or_hash.to_sym
|
|
19807
|
+
end
|
|
19808
|
+
target ||= (name == :ios ? '4.3' : '10.6')
|
|
19809
|
+
Platform.new(name, target)
|
|
19810
|
+
else
|
|
19811
|
+
parent.platform unless root?
|
|
19812
|
+
end
|
|
19813
|
+
end
|
|
19814
|
+
|
|
19815
|
+
def set_platform(name, target = nil)
|
|
19816
|
+
name = :osx if name == :macos
|
|
19817
|
+
unless [:ios, :osx, :tvos, :visionos, :watchos].include?(name)
|
|
19818
|
+
raise StandardError, "Unsupported platform '#{name}'. Platform must be ':ios', ':osx', ':macos', ':tvos', :visionos, or ':watchos'."
|
|
19819
|
+
end
|
|
19820
|
+
if target
|
|
19821
|
+
value = { name.to_s => target }
|
|
19822
|
+
else
|
|
19823
|
+
value = name.to_s
|
|
19824
|
+
end
|
|
19825
|
+
set_hash_value('platform', value)
|
|
19826
|
+
end
|
|
19827
|
+
|
|
19828
|
+
def set_platform!(name, target = nil)
|
|
19829
|
+
raise StandardError, "The target '#{label}' already has a platform set." if get_hash_value('platform')
|
|
19830
|
+
set_platform(name, target)
|
|
19831
|
+
end
|
|
19832
|
+
|
|
19833
|
+
def store_pod(name, *requirements)
|
|
19834
|
+
return if parse_subspecs(name, requirements)
|
|
19835
|
+
parse_inhibit_warnings(name, requirements)
|
|
19836
|
+
parse_modular_headers(name, requirements)
|
|
19837
|
+
parse_configuration_whitelist(name, requirements)
|
|
19838
|
+
parse_project_name(name, requirements)
|
|
19839
|
+
if requirements && !requirements.empty?
|
|
19840
|
+
pod = { name => requirements }
|
|
19841
|
+
else
|
|
19842
|
+
pod = name
|
|
19843
|
+
end
|
|
19844
|
+
get_hash_value('dependencies', []) << pod
|
|
19845
|
+
nil
|
|
19846
|
+
end
|
|
19847
|
+
|
|
19848
|
+
def store_podspec(options = nil)
|
|
19849
|
+
options ||= {}
|
|
19850
|
+
unless options.keys.all? { |key| [:autodetect, :path, :name, :subspecs, :subspec].include?(key) }
|
|
19851
|
+
raise StandardError, "Unrecognized options for the podspec method '#{options}'"
|
|
19852
|
+
end
|
|
19853
|
+
if subspec_name = options[:subspec]
|
|
19854
|
+
options[:subspecs] = [subspec_name]
|
|
19855
|
+
end
|
|
19856
|
+
options[:autodetect] = true if !options.include?(:name) && !options.include?(:path)
|
|
19857
|
+
get_hash_value('podspecs', []) << options
|
|
19858
|
+
end
|
|
19859
|
+
|
|
19860
|
+
def store_script_phase(options)
|
|
19861
|
+
option_keys = options.keys
|
|
19862
|
+
unrecognized_keys = option_keys - Specification::ALL_SCRIPT_PHASE_KEYS
|
|
19863
|
+
unless unrecognized_keys.empty?
|
|
19864
|
+
raise StandardError, "Unrecognized options '#{unrecognized_keys}' in shell script '#{options[:name]}' within '#{name}' target. Available options are '#{Specification::ALL_SCRIPT_PHASE_KEYS}'."
|
|
19865
|
+
end
|
|
19866
|
+
missing_required_keys = Specification::SCRIPT_PHASE_REQUIRED_KEYS - option_keys
|
|
19867
|
+
unless missing_required_keys.empty?
|
|
19868
|
+
raise StandardError, "Missing required shell script phase options '#{missing_required_keys.join(', ')}'"
|
|
19869
|
+
end
|
|
19870
|
+
script_phases_hash = get_hash_value('script_phases', [])
|
|
19871
|
+
if script_phases_hash.map { |script_phase_options| script_phase_options[:name] }.include?(options[:name])
|
|
19872
|
+
raise StandardError, "Script phase with name '#{options[:name]}' name already present for target '#{name}'."
|
|
19873
|
+
end
|
|
19874
|
+
options[:execution_position] = :any unless options.key?(:execution_position)
|
|
19875
|
+
unless Specification::EXECUTION_POSITION_KEYS.include?(options[:execution_position])
|
|
19876
|
+
raise StandardError, "Invalid execution position value '#{options[:execution_position]}' in shell script '#{options[:name]}' within '#{name}' target. Available options are '#{Specification::EXECUTION_POSITION_KEYS}'."
|
|
19877
|
+
end
|
|
19878
|
+
script_phases_hash << options
|
|
19879
|
+
end
|
|
19880
|
+
|
|
19881
|
+
def to_hash
|
|
19882
|
+
hash = internal_hash.dup
|
|
19883
|
+
unless children.empty?
|
|
19884
|
+
hash['children'] = children.map(&:to_hash)
|
|
19885
|
+
end
|
|
19886
|
+
hash
|
|
19887
|
+
end
|
|
19888
|
+
|
|
19889
|
+
private
|
|
19890
|
+
|
|
19891
|
+
def set_hash_value(key, value)
|
|
19892
|
+
unless HASH_KEYS.include?(key)
|
|
19893
|
+
raise StandardError, "Unsupported hash key '#{key}'"
|
|
19894
|
+
end
|
|
19895
|
+
internal_hash[key] = value
|
|
19896
|
+
end
|
|
19897
|
+
|
|
19898
|
+
def get_hash_value(key, base_value = nil)
|
|
19899
|
+
unless HASH_KEYS.include?(key)
|
|
19900
|
+
raise StandardError, "Unsupported hash key '#{key}'"
|
|
19901
|
+
end
|
|
19902
|
+
internal_hash[key] = base_value if internal_hash[key].nil?
|
|
19903
|
+
internal_hash[key]
|
|
19904
|
+
end
|
|
19905
|
+
|
|
19906
|
+
def raw_inhibit_warnings_hash
|
|
19907
|
+
get_hash_value('inhibit_warnings', {})
|
|
19908
|
+
end
|
|
19909
|
+
|
|
19910
|
+
def inhibit_warnings_hash
|
|
19911
|
+
inhibit_hash = raw_inhibit_warnings_hash
|
|
19912
|
+
if exclusive?
|
|
19913
|
+
inhibit_hash
|
|
19914
|
+
else
|
|
19915
|
+
parent_hash = parent.send(:inhibit_warnings_hash).dup
|
|
19916
|
+
if parent_hash['not_for_pods']
|
|
19917
|
+
parent_hash['not_for_pods'] -= Array(inhibit_hash['for_pods'])
|
|
19918
|
+
end
|
|
19919
|
+
if parent_hash['for_pods']
|
|
19920
|
+
parent_hash['for_pods'] -= Array(inhibit_hash['not_for_pods'])
|
|
19921
|
+
end
|
|
19922
|
+
if inhibit_hash['all']
|
|
19923
|
+
parent_hash['all'] = true
|
|
19924
|
+
end
|
|
19925
|
+
parent_hash.merge(inhibit_hash) do |_, l, r|
|
|
19926
|
+
Array(l).concat(r).uniq
|
|
19927
|
+
end
|
|
19928
|
+
end
|
|
19929
|
+
end
|
|
19930
|
+
|
|
19931
|
+
def raw_use_modular_headers_hash
|
|
19932
|
+
get_hash_value('use_modular_headers', {})
|
|
19933
|
+
end
|
|
19934
|
+
|
|
19935
|
+
def use_modular_headers_hash
|
|
19936
|
+
raw_hash = raw_use_modular_headers_hash
|
|
19937
|
+
if exclusive?
|
|
19938
|
+
raw_hash
|
|
19939
|
+
else
|
|
19940
|
+
parent_hash = parent.send(:use_modular_headers_hash).dup
|
|
19941
|
+
if parent_hash['not_for_pods']
|
|
19942
|
+
parent_hash['not_for_pods'] -= Array(raw_hash['for_pods'])
|
|
19943
|
+
end
|
|
19944
|
+
if parent_hash['for_pods']
|
|
19945
|
+
parent_hash['for_pods'] -= Array(raw_hash['not_for_pods'])
|
|
19946
|
+
end
|
|
19947
|
+
if raw_hash['all']
|
|
19948
|
+
parent_hash['all'] = true
|
|
19949
|
+
end
|
|
19950
|
+
parent_hash.merge(raw_hash) do |_, l, r|
|
|
19951
|
+
Array(l).concat(r).uniq
|
|
19952
|
+
end
|
|
19953
|
+
end
|
|
19954
|
+
end
|
|
19955
|
+
|
|
19956
|
+
def raw_project_names_hash
|
|
19957
|
+
get_hash_value('project_names', {})
|
|
19958
|
+
end
|
|
19959
|
+
|
|
19960
|
+
def raw_configuration_pod_whitelist
|
|
19961
|
+
get_hash_value('configuration_pod_whitelist', {})
|
|
19962
|
+
end
|
|
19963
|
+
|
|
19964
|
+
def configuration_pod_whitelist
|
|
19965
|
+
raw_configuration_pod_whitelist
|
|
19966
|
+
end
|
|
19967
|
+
|
|
19968
|
+
def pod_dependencies
|
|
19969
|
+
pods = get_hash_value('dependencies') || []
|
|
19970
|
+
pods.map do |name_or_hash|
|
|
19971
|
+
if name_or_hash.is_a?(Hash)
|
|
19972
|
+
name = name_or_hash.keys.first
|
|
19973
|
+
requirements = name_or_hash.values.first
|
|
19974
|
+
else
|
|
19975
|
+
name = name_or_hash
|
|
19976
|
+
requirements = []
|
|
19977
|
+
end
|
|
19978
|
+
Dependency.new(name, *requirements)
|
|
19979
|
+
end
|
|
19980
|
+
end
|
|
19981
|
+
|
|
19982
|
+
def podspec_dependencies
|
|
19983
|
+
podspecs = get_hash_value('podspecs') || []
|
|
19984
|
+
podspecs.map do |options|
|
|
19985
|
+
file = podspec_path_from_options(options)
|
|
19986
|
+
spec = Specification.from_file(file)
|
|
19987
|
+
subspec_names = options[:subspecs] || options[:subspec]
|
|
19988
|
+
specs = if subspec_names.blank?
|
|
19989
|
+
[spec]
|
|
19990
|
+
else
|
|
19991
|
+
subspec_names = [subspec_names] if subspec_names.is_a?(String)
|
|
19992
|
+
subspec_names.map { |subspec_name| spec.subspec_by_name("#{spec.name}/#{subspec_name}") }
|
|
19993
|
+
end
|
|
19994
|
+
specs.map do |subspec|
|
|
19995
|
+
all_specs = [subspec, *subspec.recursive_subspecs]
|
|
19996
|
+
all_deps = all_specs.map { |s| s.dependencies(platform) }.flatten
|
|
19997
|
+
all_deps.reject { |dep| dep.root_name == subspec.root.name }
|
|
19998
|
+
end.flatten
|
|
19999
|
+
end.flatten.uniq
|
|
20000
|
+
end
|
|
20001
|
+
|
|
20002
|
+
def podspec_path_from_options(options)
|
|
20003
|
+
if path = options[:path]
|
|
20004
|
+
if File.basename(path).include?('.podspec')
|
|
20005
|
+
path_with_ext = path
|
|
20006
|
+
else
|
|
20007
|
+
path_with_ext = "#{path}.podspec"
|
|
20008
|
+
end
|
|
20009
|
+
path_without_tilde = path_with_ext.gsub('~', ENV['HOME'])
|
|
20010
|
+
podfile.defined_in_file.dirname + path_without_tilde
|
|
20011
|
+
elsif name = options[:name]
|
|
20012
|
+
name = File.basename(name).include?('.podspec') ? name : "#{name}.podspec"
|
|
20013
|
+
podfile.defined_in_file.dirname + name
|
|
20014
|
+
elsif options[:autodetect]
|
|
20015
|
+
glob_pattern = podfile.defined_in_file.dirname + '*.podspec{,.json}'
|
|
20016
|
+
path = Pathname.glob(glob_pattern).first
|
|
20017
|
+
unless path
|
|
20018
|
+
raise Informative, 'Could not locate a podspec in the current directory. ' \
|
|
20019
|
+
'You can specify the path via the path option.'
|
|
20020
|
+
end
|
|
20021
|
+
path
|
|
20022
|
+
end
|
|
20023
|
+
end
|
|
20024
|
+
|
|
20025
|
+
def parse_inhibit_warnings(name, requirements)
|
|
20026
|
+
options = requirements.last
|
|
20027
|
+
return requirements unless options.is_a?(Hash)
|
|
20028
|
+
should_inhibit = options.delete(:inhibit_warnings)
|
|
20029
|
+
pod_name = Specification.root_name(name)
|
|
20030
|
+
set_inhibit_warnings_for_pod(pod_name, should_inhibit)
|
|
20031
|
+
requirements.pop if options.empty?
|
|
20032
|
+
end
|
|
20033
|
+
|
|
20034
|
+
def parse_modular_headers(name, requirements)
|
|
20035
|
+
options = requirements.last
|
|
20036
|
+
return requirements unless options.is_a?(Hash)
|
|
20037
|
+
defines_module = options.delete(:modular_headers)
|
|
20038
|
+
pod_name = Specification.root_name(name)
|
|
20039
|
+
set_use_modular_headers_for_pod(pod_name, defines_module)
|
|
20040
|
+
requirements.pop if options.empty?
|
|
20041
|
+
end
|
|
20042
|
+
|
|
20043
|
+
def parse_project_name(name, requirements)
|
|
20044
|
+
options = requirements.last
|
|
20045
|
+
return requirements unless options.is_a?(Hash)
|
|
20046
|
+
project_name = options.delete(:project_name)
|
|
20047
|
+
pod_name = Specification.root_name(name)
|
|
20048
|
+
raw_project_names_hash[pod_name] = project_name if project_name
|
|
20049
|
+
requirements.pop if options.empty?
|
|
20050
|
+
end
|
|
20051
|
+
|
|
20052
|
+
def parse_configuration_whitelist(name, requirements)
|
|
20053
|
+
options = requirements.last
|
|
20054
|
+
return requirements unless options.is_a?(Hash)
|
|
20055
|
+
configurations = options.delete(:configurations)
|
|
20056
|
+
configurations ||= options.delete(:configuration)
|
|
20057
|
+
Array(configurations).each do |configuration|
|
|
20058
|
+
whitelist_pod_for_configuration(name, configuration)
|
|
20059
|
+
end
|
|
20060
|
+
requirements.pop if options.empty?
|
|
20061
|
+
end
|
|
20062
|
+
|
|
20063
|
+
def parse_subspecs(name, requirements)
|
|
20064
|
+
options = requirements.last
|
|
20065
|
+
return false unless options.is_a?(Hash)
|
|
20066
|
+
subspecs = options.delete(:subspecs)
|
|
20067
|
+
test_specs = options.delete(:testspecs)
|
|
20068
|
+
app_specs = options.delete(:appspecs)
|
|
20069
|
+
if subspecs && subspecs.empty?
|
|
20070
|
+
raise StandardError, 'Empty subspecs list.'
|
|
20071
|
+
end
|
|
20072
|
+
subspecs.each do |ss|
|
|
20073
|
+
store_pod("#{name}/#{ss}", *requirements.dup)
|
|
20074
|
+
end if subspecs
|
|
20075
|
+
requirements.pop if options.empty?
|
|
20076
|
+
if test_specs || app_specs
|
|
20077
|
+
options[:testspecs] = test_specs.uniq if test_specs
|
|
20078
|
+
options[:appspecs] = app_specs.uniq if app_specs
|
|
20079
|
+
requirements.push(options)
|
|
20080
|
+
end
|
|
20081
|
+
!subspecs.nil?
|
|
20082
|
+
end
|
|
20083
|
+
end
|
|
20084
|
+
end
|
|
20085
|
+
end
|
|
20086
|
+
`;
|
|
20087
|
+
var RESOLVER = String.raw`
|
|
20088
|
+
module Pod
|
|
20089
|
+
module ExternalSources
|
|
20090
|
+
def self.from_dependency(dependency, podfile_path)
|
|
20091
|
+
params = dependency.external_source
|
|
20092
|
+
name = dependency.root_name
|
|
20093
|
+
if params.key?(:podspec)
|
|
20094
|
+
PodspecSource.new(name, params, podfile_path)
|
|
20095
|
+
elsif params.key?(:path)
|
|
20096
|
+
PathSource.new(name, params, podfile_path)
|
|
20097
|
+
else
|
|
20098
|
+
raise Informative, "Peach does not fetch the external source of '#{name}': #{params}"
|
|
20099
|
+
end
|
|
20100
|
+
end
|
|
20101
|
+
|
|
20102
|
+
class AbstractExternalSource
|
|
20103
|
+
attr_reader :name, :params, :podfile_path
|
|
20104
|
+
def initialize(name, params, podfile_path)
|
|
20105
|
+
@name = name
|
|
20106
|
+
@params = params
|
|
20107
|
+
@podfile_path = podfile_path
|
|
20108
|
+
end
|
|
20109
|
+
|
|
20110
|
+
def normalized_podspec_path(declared_path)
|
|
20111
|
+
extension = File.extname(declared_path)
|
|
20112
|
+
if extension == '.podspec' || extension == '.json'
|
|
20113
|
+
path_with_ext = declared_path
|
|
20114
|
+
else
|
|
20115
|
+
path_with_ext = "#{declared_path}/#{name}.podspec"
|
|
20116
|
+
end
|
|
20117
|
+
podfile_dir = File.dirname(podfile_path || '')
|
|
20118
|
+
File.expand_path(path_with_ext, podfile_dir)
|
|
20119
|
+
end
|
|
20120
|
+
|
|
20121
|
+
private
|
|
20122
|
+
|
|
20123
|
+
def store_podspec(sandbox, spec, json = false)
|
|
20124
|
+
sandbox.store_podspec(name, Specification.from_file(spec), true, true)
|
|
20125
|
+
end
|
|
20126
|
+
end
|
|
20127
|
+
|
|
20128
|
+
class PathSource < AbstractExternalSource
|
|
20129
|
+
def fetch(sandbox)
|
|
20130
|
+
podspec = podspec_path
|
|
20131
|
+
raise Informative, "No podspec found for '#{name}' in '#{declared_path}'" unless podspec.exist?
|
|
20132
|
+
store_podspec(sandbox, podspec, podspec.extname == '.json')
|
|
20133
|
+
sandbox.store_local_path(name, podspec, Pathname(declared_path).absolute? || declared_path.start_with?('~'))
|
|
20134
|
+
end
|
|
20135
|
+
|
|
20136
|
+
def declared_path
|
|
20137
|
+
result = params[:path]
|
|
20138
|
+
result.to_s if result
|
|
20139
|
+
end
|
|
20140
|
+
|
|
20141
|
+
def podspec_path
|
|
20142
|
+
path = Pathname(normalized_podspec_path(declared_path))
|
|
20143
|
+
path.exist? ? path : Pathname("#{path}.json")
|
|
20144
|
+
end
|
|
20145
|
+
end
|
|
20146
|
+
|
|
20147
|
+
class PodspecSource < AbstractExternalSource
|
|
20148
|
+
def fetch(sandbox)
|
|
20149
|
+
podspec_path = Pathname(podspec_uri)
|
|
20150
|
+
raise Informative, "Peach does not download the podspec of '#{name}' from #{podspec_uri}" unless podspec_path.exist?
|
|
20151
|
+
store_podspec(sandbox, podspec_path, podspec_path.extname == '.json')
|
|
20152
|
+
end
|
|
20153
|
+
|
|
20154
|
+
def podspec_uri
|
|
20155
|
+
declared_path = params[:podspec].to_s
|
|
20156
|
+
declared_path =~ %r{^.+://} ? declared_path : normalized_podspec_path(declared_path)
|
|
20157
|
+
end
|
|
20158
|
+
end
|
|
20159
|
+
end
|
|
20160
|
+
|
|
20161
|
+
class Resolver
|
|
20162
|
+
class Vertex
|
|
20163
|
+
attr_reader :name, :requirements, :origins
|
|
20164
|
+
attr_accessor :spec, :platforms
|
|
20165
|
+
def initialize(name)
|
|
20166
|
+
@name = name
|
|
20167
|
+
@requirements = []
|
|
20168
|
+
@origins = []
|
|
20169
|
+
@platforms = []
|
|
20170
|
+
end
|
|
20171
|
+
end
|
|
20172
|
+
|
|
20173
|
+
attr_reader :vertices, :trunk_roots
|
|
20174
|
+
|
|
20175
|
+
# trunk answers versions(name) with its published version strings and
|
|
20176
|
+
# specification(name, version) with the Specification, or nil until fetched
|
|
20177
|
+
def initialize(sandbox, podfile, trunk)
|
|
20178
|
+
@sandbox = sandbox
|
|
20179
|
+
@podfile = podfile
|
|
20180
|
+
@trunk = trunk
|
|
20181
|
+
@chosen = {}
|
|
20182
|
+
@learned = Hash.new { |h, k| h[k] = [] }
|
|
20183
|
+
@excluded = Hash.new { |h, k| h[k] = [] }
|
|
20184
|
+
end
|
|
20185
|
+
|
|
20186
|
+
def fetch_external_sources
|
|
20187
|
+
@podfile.dependencies.select(&:external_source).uniq(&:root_name).sort.each do |dependency|
|
|
20188
|
+
ExternalSources.from_dependency(dependency, @podfile.defined_in_file).fetch(@sandbox)
|
|
20189
|
+
end
|
|
20190
|
+
end
|
|
20191
|
+
|
|
20192
|
+
# the trunk names and versions still to fetch, empty once resolved
|
|
20193
|
+
def resolve
|
|
20194
|
+
@platforms_by_dependency = Hash.new { |h, k| h[k] = [] }
|
|
20195
|
+
explicit = []
|
|
20196
|
+
@podfile.target_definition_list.each do |target|
|
|
20197
|
+
target.dependencies.each do |dep|
|
|
20198
|
+
explicit << dep
|
|
20199
|
+
@platforms_by_dependency[dep.to_s].push(target.platform) if target.platform
|
|
20200
|
+
end
|
|
20201
|
+
end
|
|
20202
|
+
explicit.uniq!
|
|
20203
|
+
@platforms_by_dependency.each_value(&:uniq!)
|
|
20204
|
+
@podfile_requirements = @podfile.dependencies.group_by(&:root_name)
|
|
20205
|
+
100.times do
|
|
20206
|
+
@missing = []
|
|
20207
|
+
activate(explicit)
|
|
20208
|
+
return @missing.uniq unless @missing.empty?
|
|
20209
|
+
return [] if consistent?
|
|
20210
|
+
end
|
|
20211
|
+
raise Informative, 'CocoaPods dependency resolution did not settle'
|
|
20212
|
+
end
|
|
20213
|
+
|
|
20214
|
+
def specs_by_target
|
|
20215
|
+
@podfile.target_definition_list.each_with_object({}) do |target, result|
|
|
20216
|
+
next if target.abstract? && !target.platform
|
|
20217
|
+
explicit = target.dependencies.map(&:name)
|
|
20218
|
+
used = {}
|
|
20219
|
+
loop do
|
|
20220
|
+
added = @vertices.values.select do |v|
|
|
20221
|
+
v.spec && !used[v.name] && (explicit.include?(v.name) || v.origins.any? { |origin, dep| used[origin] && edge_valid?(origin, dep, target.platform) })
|
|
20222
|
+
end
|
|
20223
|
+
break if added.empty?
|
|
20224
|
+
added.each { |v| used[v.name] = true }
|
|
20225
|
+
end
|
|
20226
|
+
aggregate = {}
|
|
20227
|
+
loop do
|
|
20228
|
+
added = used.keys.select do |name|
|
|
20229
|
+
!aggregate[name] && @vertices[name].spec.library_specification? &&
|
|
20230
|
+
(explicit.include?(name) || @vertices[name].origins.any? { |origin, _| aggregate[origin] })
|
|
20231
|
+
end
|
|
20232
|
+
break if added.empty?
|
|
20233
|
+
added.each { |name| aggregate[name] = true }
|
|
20234
|
+
end
|
|
20235
|
+
result[target] = used.keys.map { |name| [@vertices[name].spec, !aggregate[name]] }.sort_by { |spec, _| spec.name }
|
|
20236
|
+
end
|
|
20237
|
+
end
|
|
20238
|
+
|
|
20239
|
+
def specifications
|
|
20240
|
+
specs_by_target.values.flatten(1).map(&:first).uniq
|
|
20241
|
+
end
|
|
20242
|
+
|
|
20243
|
+
private
|
|
20244
|
+
|
|
20245
|
+
def activate(explicit)
|
|
20246
|
+
@vertices = {}
|
|
20247
|
+
@requirements = Hash.new { |h, k| h[k] = [] }
|
|
20248
|
+
@trunk_roots = []
|
|
20249
|
+
queue = explicit.map { |dep| [dep, nil] }
|
|
20250
|
+
until queue.empty?
|
|
20251
|
+
dep, origin = queue.shift
|
|
20252
|
+
vertex = (@vertices[dep.name] ||= Vertex.new(dep.name))
|
|
20253
|
+
vertex.requirements << dep
|
|
20254
|
+
vertex.origins << [origin, dep] if origin
|
|
20255
|
+
@requirements[dep.root_name] << dep
|
|
20256
|
+
next if vertex.requirements.size > 1
|
|
20257
|
+
root_spec = root_specification(dep)
|
|
20258
|
+
next unless root_spec
|
|
20259
|
+
spec = root_spec.subspec_by_name(dep.name, false, true)
|
|
20260
|
+
raise Informative, "Unable to find a specification for '#{dep}'" unless spec
|
|
20261
|
+
vertex.spec = spec
|
|
20262
|
+
dependencies_for(spec).each { |d| queue << [d, dep.name] }
|
|
20263
|
+
end
|
|
20264
|
+
end
|
|
20265
|
+
|
|
20266
|
+
def dependencies_for(spec)
|
|
20267
|
+
root_name = Specification.root_name(spec.name)
|
|
20268
|
+
spec.all_dependencies.map do |dependency|
|
|
20269
|
+
dependency.root_name == root_name ? dependency.dup.tap { |d| d.specific_version = spec.version } : dependency
|
|
20270
|
+
end
|
|
20271
|
+
end
|
|
20272
|
+
|
|
20273
|
+
def root_specification(dep)
|
|
20274
|
+
root = dep.root_name
|
|
20275
|
+
stored = @sandbox.specification(root)
|
|
20276
|
+
return stored if stored
|
|
20277
|
+
raise Informative, "Unable to find a specification for '#{dep}'" if dep.external_source
|
|
20278
|
+
@trunk_roots << root unless @trunk_roots.include?(root)
|
|
20279
|
+
version = (@chosen[root] ||= choose(root))
|
|
20280
|
+
return nil unless version
|
|
20281
|
+
spec = @trunk.specification(root, version.to_s)
|
|
20282
|
+
@missing << [root, version.to_s] unless spec
|
|
20283
|
+
spec
|
|
20284
|
+
end
|
|
20285
|
+
|
|
20286
|
+
def choose(root)
|
|
20287
|
+
versions = @trunk.versions(root)
|
|
20288
|
+
unless versions
|
|
20289
|
+
@missing << [root, nil]
|
|
20290
|
+
return nil
|
|
20291
|
+
end
|
|
20292
|
+
deps = @requirements[root] + Array(@podfile_requirements[root])
|
|
20293
|
+
requirements = deps.map(&:requirement) + @learned[root]
|
|
20294
|
+
prerelease = deps.any? { |d| d.prerelease? || d.external_source }
|
|
20295
|
+
candidates = versions.map { |v| Version.new(v) }.sort.reverse.reject { |v| @excluded[root].include?(v) }
|
|
20296
|
+
chosen = candidates.find { |v| requirements.all? { |r| r.satisfied_by?(v) } && (prerelease || !v.prerelease?) }
|
|
20297
|
+
raise Informative, "CocoaPods could not find compatible versions for pod '#{root}': #{requirements.map(&:to_s).uniq.join(', ')}" unless chosen
|
|
20298
|
+
chosen
|
|
20299
|
+
end
|
|
20300
|
+
|
|
20301
|
+
# the version each pod took satisfies every requirement on it and the
|
|
20302
|
+
# platforms of every target that reaches it; otherwise the pass repeats
|
|
20303
|
+
def consistent?
|
|
20304
|
+
platforms
|
|
20305
|
+
settled = true
|
|
20306
|
+
@vertices.each_value do |vertex|
|
|
20307
|
+
spec = vertex.spec
|
|
20308
|
+
root = Specification.root_name(vertex.name)
|
|
20309
|
+
unsatisfied = @requirements[root].map(&:requirement).reject { |r| r.satisfied_by?(spec.version) }
|
|
20310
|
+
unless unsatisfied.empty?
|
|
20311
|
+
raise Informative, "CocoaPods could not satisfy #{unsatisfied.map(&:to_s).join(', ')} with '#{root}' (#{spec.version})" unless @chosen.key?(root)
|
|
20312
|
+
@learned[root] |= unsatisfied
|
|
20313
|
+
@chosen.delete(root)
|
|
20314
|
+
settled = false
|
|
20315
|
+
next
|
|
20316
|
+
end
|
|
20317
|
+
next if platform_compatible?(vertex)
|
|
20318
|
+
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)
|
|
20319
|
+
@excluded[root] << spec.version
|
|
20320
|
+
@chosen.delete(root)
|
|
20321
|
+
settled = false
|
|
20322
|
+
end
|
|
20323
|
+
settled
|
|
20324
|
+
end
|
|
20325
|
+
|
|
20326
|
+
def platforms
|
|
20327
|
+
@vertices.each_value do |vertex|
|
|
20328
|
+
vertex.platforms = vertex.requirements.reject { |dep| vertex.origins.any? { |_, d| d.equal?(dep) } }.flat_map { |dep| @platforms_by_dependency[dep.to_s] }.uniq
|
|
20329
|
+
end
|
|
20330
|
+
loop do
|
|
20331
|
+
grew = false
|
|
20332
|
+
@vertices.each_value do |vertex|
|
|
20333
|
+
inherited = vertex.origins.flat_map { |origin, _| @vertices[origin].platforms } - vertex.platforms
|
|
20334
|
+
next if inherited.empty?
|
|
20335
|
+
vertex.platforms |= inherited
|
|
20336
|
+
grew = true
|
|
20337
|
+
end
|
|
20338
|
+
break unless grew
|
|
20339
|
+
end
|
|
20340
|
+
end
|
|
20341
|
+
|
|
20342
|
+
def platform_compatible?(vertex)
|
|
20343
|
+
spec = vertex.spec
|
|
20344
|
+
vertex.platforms.all? do |platform|
|
|
20345
|
+
spec.available_platforms.all? do |spec_platform|
|
|
20346
|
+
spec_platform.name != platform.name || spec.non_library_specification? || platform.supports?(spec_platform)
|
|
20347
|
+
end
|
|
20348
|
+
end
|
|
20349
|
+
end
|
|
20350
|
+
|
|
20351
|
+
def edge_valid?(origin, dep, platform)
|
|
20352
|
+
@vertices[origin].spec.all_dependencies(platform).any? { |d| d.name == dep.name }
|
|
20353
|
+
end
|
|
20354
|
+
end
|
|
20355
|
+
end
|
|
20356
|
+
`;
|
|
20357
|
+
|
|
20358
|
+
// src/pods-analysis.ts
|
|
20359
|
+
init_podspec_cocoapods();
|
|
20360
|
+
init_podspec_ruby();
|
|
20361
|
+
init_podspec_ruby_stdlib();
|
|
20362
|
+
var ANALYSIS = String.raw`
|
|
20363
|
+
module Pod
|
|
20364
|
+
class Podfile
|
|
20365
|
+
class TargetDefinition
|
|
20366
|
+
def supports_swift_version?(swift_version)
|
|
20367
|
+
if swift_version_requirements.nil?
|
|
20368
|
+
root? || parent.supports_swift_version?(swift_version)
|
|
20369
|
+
else
|
|
20370
|
+
Requirement.create(swift_version_requirements).satisfied_by?(swift_version)
|
|
20371
|
+
end
|
|
20372
|
+
end
|
|
20373
|
+
end
|
|
20374
|
+
end
|
|
20375
|
+
|
|
20376
|
+
class Sandbox
|
|
20377
|
+
def pod_dir(name)
|
|
20378
|
+
root_name = Specification.root_name(name)
|
|
20379
|
+
local?(root_name) ? Pathname.new(local_path(root_name)) : root + root_name
|
|
20380
|
+
end
|
|
20381
|
+
end
|
|
20382
|
+
|
|
20383
|
+
class Specification
|
|
20384
|
+
def static_framework
|
|
20385
|
+
attributes_hash['static_framework']
|
|
20386
|
+
end
|
|
20387
|
+
|
|
20388
|
+
def info_plist
|
|
20389
|
+
attributes_hash['info_plist'] || {}
|
|
20390
|
+
end
|
|
20391
|
+
|
|
20392
|
+
def dependency_whitelisted_for_configuration?(dependency, configuration)
|
|
20393
|
+
inherited = -> { root? ? true : parent.dependency_whitelisted_for_configuration?(dependency, configuration) }
|
|
20394
|
+
return inherited[] unless configuration_whitelist = attributes_hash['configuration_pod_whitelist']
|
|
20395
|
+
return inherited[] unless whitelist_for_pod = configuration_whitelist[dependency.name]
|
|
20396
|
+
whitelist_for_pod.include?(configuration.to_s.downcase)
|
|
20397
|
+
end
|
|
20398
|
+
end
|
|
20399
|
+
|
|
20400
|
+
class Target
|
|
20401
|
+
DEFAULT_BUILD_CONFIGURATIONS = { 'Release' => :release, 'Debug' => :debug }.freeze
|
|
20402
|
+
attr_reader :sandbox, :user_build_configurations, :archs, :platform, :build_type
|
|
20403
|
+
private :build_type
|
|
20404
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform)
|
|
20405
|
+
@sandbox = sandbox
|
|
20406
|
+
@user_build_configurations = user_build_configurations
|
|
20407
|
+
@archs = archs
|
|
20408
|
+
@platform = platform
|
|
20409
|
+
@build_type = build_type
|
|
20410
|
+
end
|
|
20411
|
+
def name; label; end
|
|
20412
|
+
alias to_s name
|
|
20413
|
+
def build_as_dynamic?; build_type.dynamic?; end
|
|
20414
|
+
def build_as_dynamic_framework?; build_type.dynamic_framework?; end
|
|
20415
|
+
def build_as_framework?; build_type.framework?; end
|
|
20416
|
+
def build_as_library?; build_type.library?; end
|
|
20417
|
+
def build_as_static?; build_type.static?; end
|
|
20418
|
+
def build_as_static_framework?; build_type.static_framework?; end
|
|
20419
|
+
def build_as_static_library?; build_type.static_library?; end
|
|
20420
|
+
def requires_frameworks?; build_as_framework?; end
|
|
20421
|
+
def inspect; "#<#{self.class} name=#{name}>"; end
|
|
20422
|
+
end
|
|
20423
|
+
|
|
20424
|
+
class PodTarget < Target
|
|
20425
|
+
attr_reader :specs, :library_specs, :test_specs, :app_specs, :target_definitions, :swift_version, :dependent_targets, :dependent_targets_by_config
|
|
20426
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform, specs, target_definitions, swift_version)
|
|
20427
|
+
super(sandbox, build_type, user_build_configurations, archs, platform)
|
|
20428
|
+
@specs = specs.dup.freeze
|
|
20429
|
+
@target_definitions = target_definitions
|
|
20430
|
+
@swift_version = swift_version
|
|
20431
|
+
by_type = @specs.group_by(&:spec_type)
|
|
20432
|
+
@library_specs = by_type[:library] || []
|
|
20433
|
+
@test_specs = by_type[:test] || []
|
|
20434
|
+
@app_specs = by_type[:app] || []
|
|
20435
|
+
self.dependent_targets = []
|
|
20436
|
+
end
|
|
20437
|
+
def dependent_targets=(targets)
|
|
20438
|
+
@dependent_targets = targets
|
|
20439
|
+
@dependent_targets_by_config = { :debug => targets, :release => targets }
|
|
20440
|
+
end
|
|
20441
|
+
def dependent_targets_by_config=(by_config)
|
|
20442
|
+
@dependent_targets_by_config = by_config
|
|
20443
|
+
@dependent_targets = by_config.values.reduce([], &:|)
|
|
20444
|
+
end
|
|
20445
|
+
def label; root_spec.name; end
|
|
20446
|
+
def root_spec; @root_spec ||= specs.first.root; end
|
|
20447
|
+
def pod_name; root_spec.name; end
|
|
20448
|
+
def product_module_name; root_spec.module_name; end
|
|
20449
|
+
def podfile; target_definitions.first.podfile; end
|
|
20450
|
+
def spec_consumers; specs.map { |spec| spec.consumer(platform) }; end
|
|
20451
|
+
def dependencies
|
|
20452
|
+
spec_consumers.flat_map { |consumer| consumer.dependencies.map { |dep| Specification.root_name(dep.name) } }.uniq
|
|
20453
|
+
end
|
|
20454
|
+
def inhibit_warnings?
|
|
20455
|
+
answers = target_definitions.map { |td| td.inhibits_warnings_for_pod?(root_spec.name) }.uniq
|
|
20456
|
+
answers.size > 1 ? podfile.root_target_definitions.first.inhibits_warnings_for_pod?(root_spec.name) : answers.first || false
|
|
20457
|
+
end
|
|
20458
|
+
def build_pod_as_module?
|
|
20459
|
+
explicit = target_definitions.select { |td| td.dependencies.any? { |d| d.root_name == pod_name } }
|
|
20460
|
+
answers = explicit.group_by { |td| td.build_pod_as_module?(pod_name) }
|
|
20461
|
+
return false if answers.size > 1
|
|
20462
|
+
answers.keys.first == true || target_definitions.all? { |td| td.build_pod_as_module?(pod_name) }
|
|
20463
|
+
end
|
|
20464
|
+
end
|
|
20465
|
+
|
|
20466
|
+
class AggregateTarget < Target
|
|
20467
|
+
attr_reader :target_definition, :client_root, :user_project, :user_target_uuids, :pod_targets_for_build_configuration, :search_paths_aggregate_targets
|
|
20468
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform, target_definition, client_root, user_project, user_target_uuids, pod_targets_for_build_configuration)
|
|
20469
|
+
super(sandbox, build_type, user_build_configurations, archs, platform)
|
|
20470
|
+
@target_definition = target_definition
|
|
20471
|
+
@client_root = client_root
|
|
20472
|
+
@user_project = user_project
|
|
20473
|
+
@user_target_uuids = user_target_uuids
|
|
20474
|
+
@pod_targets_for_build_configuration = pod_targets_for_build_configuration
|
|
20475
|
+
@search_paths_aggregate_targets = []
|
|
20476
|
+
end
|
|
20477
|
+
def label; target_definition.label; end
|
|
20478
|
+
def podfile; target_definition.podfile; end
|
|
20479
|
+
def pod_targets; pod_targets_for_build_configuration.values.flatten.uniq; end
|
|
20480
|
+
def pod_targets_for_build_configuration(build_configuration = nil)
|
|
20481
|
+
build_configuration ? @pod_targets_for_build_configuration[build_configuration] || [] : @pod_targets_for_build_configuration
|
|
20482
|
+
end
|
|
20483
|
+
def user_targets
|
|
20484
|
+
user_target_uuids.map { |uuid| user_project.objects_by_uuid[uuid] }
|
|
20485
|
+
end
|
|
20486
|
+
end
|
|
20487
|
+
|
|
20488
|
+
class Installer
|
|
20489
|
+
# Installer::Analyzer#generate_targets for one variant of each pod, which
|
|
20490
|
+
# is every Podfile with one platform and no target-specific subspecs
|
|
20491
|
+
def peach_analyze(resolver, user_build_configurations, user_project, user_target_uuids, user_swift_version)
|
|
20492
|
+
if user_swift_version
|
|
20493
|
+
podfile.target_definition_list.each { |td| td.swift_version = user_swift_version unless td.abstract? }
|
|
20494
|
+
end
|
|
20495
|
+
specs_by_target = resolver.specs_by_target.reject { |td, _| td.abstract? && !td.platform }
|
|
20496
|
+
# keyed by names: a stored podspec is a copy whose subspecs still name the original root
|
|
20497
|
+
variants = {}
|
|
20498
|
+
specs_by_target.each do |td, resolver_specs|
|
|
20499
|
+
resolver_specs.group_by { |spec, _| spec.root.name }.each do |root_name, entries|
|
|
20500
|
+
all = entries.map(&:first)
|
|
20501
|
+
root = all.first.root
|
|
20502
|
+
unless all.all?(&:library_specification?)
|
|
20503
|
+
raise Informative, "Peach builds no test or app specifications (#{root_name} in #{td.label})"
|
|
20504
|
+
end
|
|
20505
|
+
build_type = td.build_type.framework? ? (root.static_framework ? BuildType.static_framework : td.build_type) : BuildType.static_library
|
|
20506
|
+
key = [all.map(&:name).sort, td.platform.to_s, build_type.to_s].join(' ')
|
|
20507
|
+
variants[root_name] ||= {}
|
|
20508
|
+
(variants[root_name][key] ||= [all, build_type, []])[2] << td
|
|
20509
|
+
end
|
|
20510
|
+
end
|
|
20511
|
+
@pod_targets = variants.map do |root_name, by_variant|
|
|
20512
|
+
if by_variant.size > 1
|
|
20513
|
+
raise Informative, "Peach builds one variant of each pod; #{root_name} differs between #{by_variant.values.map { |v| v[2].map(&:label) }.flatten.join(', ')}"
|
|
20514
|
+
end
|
|
20515
|
+
specs, build_type, target_definitions = by_variant.values.first
|
|
20516
|
+
root = specs.first.root
|
|
20517
|
+
target_definitions.reject!(&:abstract?) unless target_definitions.all?(&:abstract?)
|
|
20518
|
+
swift_version = peach_swift_version(root, target_definitions)
|
|
20519
|
+
PodTarget.new(sandbox, build_type, user_build_configurations, [], peach_platform(specs, target_definitions, build_type), specs, target_definitions, swift_version)
|
|
20520
|
+
end
|
|
20521
|
+
all_specs = specs_by_target.values.flatten(1).map(&:first).uniq.group_by(&:name)
|
|
20522
|
+
by_name = @pod_targets.group_by(&:pod_name)
|
|
20523
|
+
@pod_targets.each do |target|
|
|
20524
|
+
target.dependent_targets_by_config = Hash[[:debug, :release].map do |config|
|
|
20525
|
+
specs = {}
|
|
20526
|
+
target.library_specs.each do |s|
|
|
20527
|
+
s.dependencies(target.platform).each do |dep|
|
|
20528
|
+
all_specs[dep.name].each do |spec|
|
|
20529
|
+
raise Informative, "#{s} depends upon #{spec}, which is a #{spec.spec_type} spec." if spec.non_library_specification?
|
|
20530
|
+
specs[spec.name] ||= spec if s.dependency_whitelisted_for_configuration?(dep, config)
|
|
20531
|
+
end
|
|
20532
|
+
end
|
|
20533
|
+
end
|
|
20534
|
+
own = target.library_specs.map(&:name)
|
|
20535
|
+
[config, specs.values.reject { |spec| own.include?(spec.name) }.group_by { |spec| spec.root.name }.map do |root_name, deps|
|
|
20536
|
+
by_name[root_name].find { |t| t.build_as_framework? == target.build_as_framework? && deps.all? { |d| t.specs.map(&:name).include?(d.name) } }
|
|
20537
|
+
end]
|
|
20538
|
+
end]
|
|
20539
|
+
end
|
|
20540
|
+
@aggregate_targets = specs_by_target.keys.reject(&:abstract?).map do |td|
|
|
20541
|
+
configurations = user_build_configurations.keys.concat(td.all_whitelisted_configurations).uniq
|
|
20542
|
+
pods = @pod_targets.select { |t| t.target_definitions.include?(td) }
|
|
20543
|
+
named = specs_by_target[td].group_by { |spec, _| spec.root.name }.reject { |_, entries| entries.all? { |_, non_library_only| non_library_only } }
|
|
20544
|
+
pods.keep_if { |t| named.key?(t.pod_name) }
|
|
20545
|
+
dependencies = td.dependencies.group_by(&:root_name)
|
|
20546
|
+
by_configuration = Hash[configurations.map { |c| [c, []] }]
|
|
20547
|
+
pods.each do |t|
|
|
20548
|
+
configurations.each do |c|
|
|
20549
|
+
answers = (dependencies[t.pod_name] || []).map { |d| td.pod_whitelisted_for_configuration?(d.name, c) }.uniq
|
|
20550
|
+
raise Informative, "The subspecs of #{t.pod_name} are linked to different build configurations for #{td}" if answers.size > 1
|
|
20551
|
+
by_configuration[c] << t unless answers == [false]
|
|
20552
|
+
end
|
|
20553
|
+
end
|
|
20554
|
+
build_type = td.uses_frameworks? ? BuildType.static_framework : BuildType.static_library
|
|
20555
|
+
AggregateTarget.new(sandbox, build_type, user_build_configurations, [], td.platform, td, Config.instance.installation_root, user_project, user_target_uuids, by_configuration)
|
|
20556
|
+
end
|
|
20557
|
+
raise Informative, "Peach builds the pods of one application target, not #{@aggregate_targets.map(&:label).join(', ')}" unless @aggregate_targets.size == 1
|
|
20558
|
+
@aggregate_targets.each do |target|
|
|
20559
|
+
target.search_paths_aggregate_targets.concat(@aggregate_targets.select { |other| target.target_definition.targets_to_inherit_search_paths.include?(other.target_definition) })
|
|
20560
|
+
end
|
|
20561
|
+
run_podfile_pre_install_hooks
|
|
20562
|
+
end
|
|
20563
|
+
|
|
20564
|
+
private
|
|
20565
|
+
|
|
20566
|
+
def peach_platform(specs, target_definitions, build_type)
|
|
20567
|
+
name = target_definitions.first.platform.name
|
|
20568
|
+
defaults = { :ios => '4.3', :osx => '10.6', :tvos => '9.0', :visionos => '1.0', :watchos => '2.0' }
|
|
20569
|
+
target = specs.select(&:library_specification?).map { |s| Version.new(s.deployment_target(name) || defaults[name]) }.max
|
|
20570
|
+
target = [target, Version.new('8.0')].max if name == :ios && build_type.framework?
|
|
20571
|
+
Platform.new(name, target)
|
|
20572
|
+
end
|
|
20573
|
+
|
|
20574
|
+
def peach_swift_version(root, target_definitions)
|
|
20575
|
+
if root.swift_versions.empty?
|
|
20576
|
+
target_definitions.map(&:swift_version).compact.uniq.first
|
|
20577
|
+
else
|
|
20578
|
+
root.swift_versions.sort.reverse.find { |v| target_definitions.all? { |td| td.supports_swift_version?(v) } }.to_s
|
|
20579
|
+
end
|
|
20580
|
+
end
|
|
20581
|
+
end
|
|
20582
|
+
end
|
|
20583
|
+
`;
|
|
20584
|
+
var EXPORT = String.raw`
|
|
20585
|
+
lambda do |installer, attributes|
|
|
20586
|
+
spec_json = lambda do |spec, platform|
|
|
20587
|
+
consumer = spec.consumer(platform)
|
|
20588
|
+
values = attributes.each_with_object({}) { |a, h| h[a] = consumer.value_for_attribute(a.to_sym) }
|
|
20589
|
+
values['pod_target_xcconfig'] = consumer.pod_target_xcconfig
|
|
20590
|
+
values['user_target_xcconfig'] = consumer.user_target_xcconfig
|
|
20591
|
+
values['dependencies'] = consumer.dependencies.map(&:name)
|
|
20592
|
+
{ 'name' => spec.name, 'root' => spec.root?, 'deploymentTarget' => spec.deployment_target(platform.name), 'consumer' => values }
|
|
20593
|
+
end
|
|
20594
|
+
{
|
|
20595
|
+
'pods' => installer.pod_targets.map do |t|
|
|
20596
|
+
root = t.root_spec
|
|
20597
|
+
local = installer.sandbox.local_path(root.name)
|
|
20598
|
+
{
|
|
20599
|
+
'label' => t.label,
|
|
20600
|
+
'name' => t.pod_name,
|
|
20601
|
+
'version' => root.version.to_s,
|
|
20602
|
+
'moduleName' => t.product_module_name,
|
|
20603
|
+
'local' => local && local.to_s,
|
|
20604
|
+
'source' => root.source,
|
|
20605
|
+
'license' => root.attributes_hash['license'],
|
|
20606
|
+
'platform' => { 'name' => t.platform.name.to_s, 'deploymentTarget' => t.platform.deployment_target.to_s },
|
|
20607
|
+
'framework' => t.build_as_framework?,
|
|
20608
|
+
'dynamic' => t.build_as_dynamic?,
|
|
20609
|
+
'swiftVersion' => t.swift_version,
|
|
20610
|
+
'swiftVersions' => root.swift_versions.map(&:to_s),
|
|
20611
|
+
'targetDefinitions' => t.target_definitions.map(&:label),
|
|
20612
|
+
'dependencies' => { 'debug' => t.dependent_targets_by_config[:debug].map(&:label), 'release' => t.dependent_targets_by_config[:release].map(&:label) },
|
|
20613
|
+
'inhibitWarnings' => t.inhibit_warnings?,
|
|
20614
|
+
'buildPodAsModule' => t.build_pod_as_module?,
|
|
20615
|
+
'infoPlist' => root.info_plist,
|
|
20616
|
+
'specs' => t.specs.map { |s| spec_json.call(s, t.platform) },
|
|
20617
|
+
}
|
|
20618
|
+
end,
|
|
20619
|
+
'aggregates' => installer.aggregate_targets.map do |t|
|
|
20620
|
+
td = t.target_definition
|
|
20621
|
+
{
|
|
20622
|
+
'label' => t.label,
|
|
20623
|
+
'name' => td.name,
|
|
20624
|
+
'platform' => { 'name' => t.platform.name.to_s, 'deploymentTarget' => t.platform.deployment_target.to_s },
|
|
20625
|
+
'framework' => t.build_as_framework?,
|
|
20626
|
+
'userBuildConfigurations' => t.user_build_configurations.transform_values(&:to_s),
|
|
20627
|
+
'podsByConfiguration' => t.pod_targets_for_build_configuration.transform_values { |pods| pods.map(&:label) },
|
|
20628
|
+
'searchPathsAggregates' => t.search_paths_aggregate_targets.map(&:label),
|
|
20629
|
+
'inhibitAllWarnings' => td.inhibits_warnings_for_pod?(''),
|
|
20630
|
+
'swiftVersion' => td.swift_version.to_s,
|
|
20631
|
+
'setArcCompatibilityFlag' => td.podfile.set_arc_compatibility_flag? ? true : false,
|
|
20632
|
+
'userTargets' => t.user_target_uuids,
|
|
20633
|
+
'scriptPhases' => td.script_phases,
|
|
20634
|
+
}
|
|
20635
|
+
end,
|
|
20636
|
+
}
|
|
20637
|
+
end
|
|
20638
|
+
`;
|
|
20639
|
+
|
|
20640
|
+
// src/pods-files.ts
|
|
20641
|
+
init_is_record();
|
|
20642
|
+
init_plist_bytes();
|
|
20643
|
+
var HEADER_EXTENSIONS2 = [
|
|
20644
|
+
".h",
|
|
20645
|
+
".hh",
|
|
20646
|
+
".hpp",
|
|
20647
|
+
".ipp",
|
|
20648
|
+
".tpp",
|
|
20649
|
+
".hxx",
|
|
20650
|
+
".def",
|
|
20651
|
+
".inl",
|
|
20652
|
+
".inc"
|
|
20653
|
+
];
|
|
20654
|
+
var SOURCE_FILE_EXTENSIONS = [
|
|
20655
|
+
.../* @__PURE__ */ new Set([
|
|
20656
|
+
".m",
|
|
20657
|
+
".mm",
|
|
20658
|
+
".i",
|
|
20659
|
+
".c",
|
|
20660
|
+
".cc",
|
|
20661
|
+
".cxx",
|
|
20662
|
+
".cpp",
|
|
20663
|
+
".c++",
|
|
20664
|
+
".swift",
|
|
20665
|
+
...HEADER_EXTENSIONS2
|
|
20666
|
+
])
|
|
20667
|
+
];
|
|
20668
|
+
var GLOB_PATTERNS = {
|
|
20669
|
+
source_files: `*{${SOURCE_FILE_EXTENSIONS.join(",")}}`,
|
|
20670
|
+
public_header_files: `*{${HEADER_EXTENSIONS2.join(",")}}`
|
|
20671
|
+
};
|
|
20672
|
+
|
|
20673
|
+
// src/pods-post-install.ts
|
|
20674
|
+
init_openstep_plist();
|
|
20675
|
+
init_plist_bytes();
|
|
20676
|
+
init_podspec_cocoapods();
|
|
20677
|
+
init_podspec_ruby();
|
|
20678
|
+
init_podspec_ruby_stdlib();
|
|
20679
|
+
var XCODEPROJ = String.raw`
|
|
20680
|
+
module Xcodeproj
|
|
20681
|
+
module Constants
|
|
20682
|
+
INHERITED_KEYWORDS = ['$(inherited)', '$' + '{inherited}'].freeze
|
|
20683
|
+
PRODUCT_TYPE_UTI = Peach::Xcode.product_type_utis.freeze
|
|
20684
|
+
end
|
|
20685
|
+
|
|
20686
|
+
class Informative < StandardError; end
|
|
20687
|
+
|
|
20688
|
+
module Plist
|
|
20689
|
+
def self.read_from_path(path)
|
|
20690
|
+
path = path.to_s
|
|
20691
|
+
raise Informative, "The plist file at path '#{path}' doesn't exist." unless File.exist?(path)
|
|
20692
|
+
Peach::Xcode.plist_read(path)
|
|
20693
|
+
end
|
|
20694
|
+
|
|
20695
|
+
def self.write_to_path(hash, path)
|
|
20696
|
+
Peach::Xcode.plist_write(path.to_s, hash)
|
|
20697
|
+
end
|
|
20698
|
+
end
|
|
20699
|
+
|
|
20700
|
+
class Config
|
|
20701
|
+
attr_accessor :attributes, :other_linker_flags, :includes
|
|
20702
|
+
|
|
20703
|
+
def initialize(source = {})
|
|
20704
|
+
@attributes, @other_linker_flags, @includes =
|
|
20705
|
+
source.is_a?(Hash) ? Peach::Xcode.config_from_hash(source) : Peach::Xcode.config_parse(source.to_s)
|
|
20706
|
+
end
|
|
20707
|
+
|
|
20708
|
+
def ==(other)
|
|
20709
|
+
other.attributes == attributes && other.other_linker_flags == other_linker_flags && other.includes == includes
|
|
20710
|
+
end
|
|
20711
|
+
|
|
20712
|
+
def merge!(xcconfig)
|
|
20713
|
+
xcconfig = Config.new(xcconfig) if xcconfig.is_a?(Hash)
|
|
20714
|
+
@attributes, @other_linker_flags = Peach::Xcode.config_merge(self, xcconfig)
|
|
20715
|
+
self
|
|
20716
|
+
end
|
|
20717
|
+
alias_method :<<, :merge!
|
|
20718
|
+
|
|
20719
|
+
def merge(config)
|
|
20720
|
+
dup.tap { |copy| copy.merge!(config) }
|
|
20721
|
+
end
|
|
20722
|
+
|
|
20723
|
+
def dup
|
|
20724
|
+
Config.new(to_hash.dup)
|
|
20725
|
+
end
|
|
20726
|
+
|
|
20727
|
+
def to_hash(prefix = nil)
|
|
20728
|
+
raise ArgumentError, 'Peach writes no prefixed xcconfig' if prefix
|
|
20729
|
+
Peach::Xcode.config_hash(self)
|
|
20730
|
+
end
|
|
20731
|
+
alias_method :to_h, :to_hash
|
|
20732
|
+
|
|
20733
|
+
def to_s(prefix = nil)
|
|
20734
|
+
raise ArgumentError, 'Peach writes no prefixed xcconfig' if prefix
|
|
20735
|
+
Peach::Xcode.config_render(self)
|
|
20736
|
+
end
|
|
20737
|
+
|
|
20738
|
+
def save_as(pathname, prefix = nil)
|
|
20739
|
+
return if File.exist?(pathname) && Config.new(pathname) == self
|
|
20740
|
+
File.write(pathname.to_s, to_s(prefix))
|
|
20741
|
+
end
|
|
20742
|
+
end
|
|
20743
|
+
|
|
20744
|
+
class Project
|
|
20745
|
+
attr_reader :path, :root_object, :object_version, :generated_uuids
|
|
20746
|
+
|
|
20747
|
+
# keys whose values name objects without referring to them
|
|
20748
|
+
PEACH_PLAIN_KEYS = %w(isa remoteGlobalIDString containerPortal).freeze
|
|
20749
|
+
|
|
20750
|
+
def initialize(path, objects, root_uuid, object_version)
|
|
20751
|
+
@path = Pathname.new(path)
|
|
20752
|
+
@objects = objects
|
|
20753
|
+
@object_version = object_version
|
|
20754
|
+
@wrapped = {}
|
|
20755
|
+
@generated_uuids = []
|
|
20756
|
+
@available_uuids = []
|
|
20757
|
+
@dirty = false
|
|
20758
|
+
@root_object = object(root_uuid)
|
|
20759
|
+
end
|
|
20760
|
+
|
|
20761
|
+
def object(uuid)
|
|
20762
|
+
@wrapped[uuid] ||= begin
|
|
20763
|
+
attributes = @objects[uuid]
|
|
20764
|
+
raise ArgumentError, "#{path} has no object #{uuid}" unless attributes
|
|
20765
|
+
klass = Object::ISA[attributes['isa']]
|
|
20766
|
+
raise ArgumentError, "Peach models no #{attributes['isa']} (#{uuid} in #{path})" unless klass
|
|
20767
|
+
klass.new(self, uuid, attributes)
|
|
20768
|
+
end
|
|
20769
|
+
end
|
|
20770
|
+
|
|
20771
|
+
def objects_by_uuid
|
|
20772
|
+
@objects.keys.each_with_object({}) { |uuid, by_uuid| by_uuid[uuid] = object(uuid) }
|
|
20773
|
+
end
|
|
20774
|
+
|
|
20775
|
+
def objects
|
|
20776
|
+
@objects.keys.map { |uuid| object(uuid) }
|
|
20777
|
+
end
|
|
20778
|
+
|
|
20779
|
+
def uuids
|
|
20780
|
+
@objects.keys
|
|
20781
|
+
end
|
|
20782
|
+
|
|
20783
|
+
def new(klass)
|
|
20784
|
+
klass = Object.const_get(klass) if klass.is_a?(String)
|
|
20785
|
+
raise ArgumentError, "Peach creates no #{klass}" unless Object::ISA[klass.isa].equal?(klass)
|
|
20786
|
+
uuid = generate_uuid
|
|
20787
|
+
attributes = { 'isa' => klass.isa }
|
|
20788
|
+
klass.peach_defaults.each { |key, value| attributes[key] = value.dup }
|
|
20789
|
+
@objects[uuid] = attributes
|
|
20790
|
+
mark_dirty!
|
|
20791
|
+
object(uuid)
|
|
20792
|
+
end
|
|
20793
|
+
|
|
20794
|
+
def generate_uuid
|
|
20795
|
+
generate_available_uuid_list while @available_uuids.empty?
|
|
20796
|
+
@available_uuids.shift
|
|
20797
|
+
end
|
|
20798
|
+
|
|
20799
|
+
# Xcodeproj draws random ids; Peach derives them from the project and a counter
|
|
20800
|
+
def generate_available_uuid_list(count = 100)
|
|
20801
|
+
start = @generated_uuids.size
|
|
20802
|
+
candidates = Array.new(count) { |i| Digest::SHA1.hexdigest("#{path.basename}/#{start + i}")[0, 24].upcase }
|
|
20803
|
+
uniques = candidates - (@generated_uuids + uuids)
|
|
20804
|
+
@generated_uuids += uniques
|
|
20805
|
+
@available_uuids += uniques
|
|
20806
|
+
end
|
|
20807
|
+
|
|
20808
|
+
def mark_dirty!
|
|
20809
|
+
@dirty = true
|
|
20810
|
+
@referrers = nil
|
|
20811
|
+
end
|
|
20812
|
+
|
|
20813
|
+
def dirty?
|
|
20814
|
+
@dirty
|
|
20815
|
+
end
|
|
20816
|
+
|
|
20817
|
+
def peach_referrers(uuid)
|
|
20818
|
+
unless @referrers
|
|
20819
|
+
@referrers = {}
|
|
20820
|
+
@objects.each do |owner, attributes|
|
|
20821
|
+
attributes.each do |key, value|
|
|
20822
|
+
next if PEACH_PLAIN_KEYS.include?(key)
|
|
20823
|
+
refs = value.is_a?(Array) ? value : [value]
|
|
20824
|
+
refs.each { |ref| (@referrers[ref] ||= []) << owner if ref.is_a?(String) && @objects.key?(ref) }
|
|
20825
|
+
end
|
|
20826
|
+
end
|
|
20827
|
+
end
|
|
20828
|
+
(@referrers[uuid] || []).uniq.map { |owner| object(owner) }
|
|
20829
|
+
end
|
|
20830
|
+
|
|
20831
|
+
def peach_remove(uuid)
|
|
20832
|
+
@objects.each_value do |attributes|
|
|
20833
|
+
attributes.keys.each do |key|
|
|
20834
|
+
next if PEACH_PLAIN_KEYS.include?(key)
|
|
20835
|
+
value = attributes[key]
|
|
20836
|
+
if value == uuid
|
|
20837
|
+
attributes.delete(key)
|
|
20838
|
+
elsif value.is_a?(Array)
|
|
20839
|
+
value.delete(uuid)
|
|
20840
|
+
end
|
|
20841
|
+
end
|
|
20842
|
+
end
|
|
20843
|
+
@objects.delete(uuid)
|
|
20844
|
+
@wrapped.delete(uuid)
|
|
20845
|
+
mark_dirty!
|
|
20846
|
+
end
|
|
20847
|
+
|
|
20848
|
+
# the objects table after Peach's TypeScript integrator changed it
|
|
20849
|
+
def peach_reload(objects)
|
|
20850
|
+
@objects.keys.each do |uuid|
|
|
20851
|
+
next if objects.key?(uuid)
|
|
20852
|
+
@objects.delete(uuid)
|
|
20853
|
+
@wrapped.delete(uuid)
|
|
20854
|
+
end
|
|
20855
|
+
objects.each do |uuid, attributes|
|
|
20856
|
+
current = @objects[uuid]
|
|
20857
|
+
if current
|
|
20858
|
+
current.keys.each { |key| current.delete(key) unless attributes.key?(key) }
|
|
20859
|
+
attributes.each { |key, value| current[key] = value unless current[key] == value }
|
|
20860
|
+
else
|
|
20861
|
+
@objects[uuid] = attributes
|
|
20862
|
+
end
|
|
20863
|
+
end
|
|
20864
|
+
mark_dirty!
|
|
20865
|
+
end
|
|
20866
|
+
|
|
20867
|
+
def project_dir
|
|
20868
|
+
path.dirname
|
|
20869
|
+
end
|
|
20870
|
+
|
|
20871
|
+
def main_group
|
|
20872
|
+
root_object.main_group
|
|
20873
|
+
end
|
|
20874
|
+
|
|
20875
|
+
def [](group_name)
|
|
20876
|
+
main_group[group_name]
|
|
20877
|
+
end
|
|
20878
|
+
|
|
20879
|
+
def targets
|
|
20880
|
+
root_object.targets
|
|
20881
|
+
end
|
|
20882
|
+
|
|
20883
|
+
def native_targets
|
|
20884
|
+
targets.select { |o| o.is_a?(Object::PBXNativeTarget) }
|
|
20885
|
+
end
|
|
20886
|
+
|
|
20887
|
+
def build_configuration_list
|
|
20888
|
+
root_object.build_configuration_list
|
|
20889
|
+
end
|
|
20890
|
+
|
|
20891
|
+
def build_configurations
|
|
20892
|
+
root_object.build_configuration_list.build_configurations
|
|
20893
|
+
end
|
|
20894
|
+
|
|
20895
|
+
def build_settings(name)
|
|
20896
|
+
root_object.build_configuration_list.build_settings(name)
|
|
20897
|
+
end
|
|
20898
|
+
|
|
20899
|
+
def files
|
|
20900
|
+
objects.select { |o| o.is_a?(Object::PBXFileReference) }
|
|
20901
|
+
end
|
|
20902
|
+
|
|
20903
|
+
def groups
|
|
20904
|
+
main_group.groups
|
|
20905
|
+
end
|
|
20906
|
+
|
|
20907
|
+
def products_group
|
|
20908
|
+
root_object.product_ref_group
|
|
20909
|
+
end
|
|
20910
|
+
|
|
20911
|
+
def frameworks_group
|
|
20912
|
+
main_group['Frameworks'] || main_group.new_group('Frameworks')
|
|
20913
|
+
end
|
|
20914
|
+
|
|
20915
|
+
# the tables stay in memory, where Peach reads them
|
|
20916
|
+
def save(save_path = nil)
|
|
20917
|
+
raise ArgumentError, "Peach saves #{path} only in place" if save_path
|
|
20918
|
+
end
|
|
20919
|
+
|
|
20920
|
+
# Xcodeproj's to-many attribute: a live list of the uuids in the owner's table entry
|
|
20921
|
+
class ObjectList
|
|
20922
|
+
include Enumerable
|
|
20923
|
+
attr_reader :owner
|
|
20924
|
+
|
|
20925
|
+
def initialize(owner, key)
|
|
20926
|
+
@owner = owner
|
|
20927
|
+
@key = key
|
|
20928
|
+
end
|
|
20929
|
+
|
|
20930
|
+
def uuids
|
|
20931
|
+
@owner.peach_uuids(@key).dup
|
|
20932
|
+
end
|
|
20933
|
+
|
|
20934
|
+
def objects
|
|
20935
|
+
@owner.peach_uuids(@key).map { |uuid| @owner.project.object(uuid) }
|
|
20936
|
+
end
|
|
20937
|
+
alias_method :to_a, :objects
|
|
20938
|
+
alias_method :to_ary, :objects
|
|
20939
|
+
|
|
20940
|
+
def each(&block)
|
|
20941
|
+
objects.each(&block)
|
|
20942
|
+
self
|
|
20943
|
+
end
|
|
20944
|
+
|
|
20945
|
+
def size
|
|
20946
|
+
@owner.peach_uuids(@key).size
|
|
20947
|
+
end
|
|
20948
|
+
alias_method :length, :size
|
|
20949
|
+
|
|
20950
|
+
def empty?
|
|
20951
|
+
size.zero?
|
|
20952
|
+
end
|
|
20953
|
+
|
|
20954
|
+
def [](index)
|
|
20955
|
+
objects[index]
|
|
20956
|
+
end
|
|
20957
|
+
alias_method :at, :[]
|
|
20958
|
+
|
|
20959
|
+
def first
|
|
20960
|
+
objects.first
|
|
20961
|
+
end
|
|
20962
|
+
|
|
20963
|
+
def last
|
|
20964
|
+
objects.last
|
|
20965
|
+
end
|
|
20966
|
+
|
|
20967
|
+
def index(object = nil, &block)
|
|
20968
|
+
block ? objects.index(&block) : objects.index(object)
|
|
20969
|
+
end
|
|
20970
|
+
alias_method :find_index, :index
|
|
20971
|
+
|
|
20972
|
+
def include?(object)
|
|
20973
|
+
objects.include?(object)
|
|
20974
|
+
end
|
|
20975
|
+
|
|
20976
|
+
def ==(other)
|
|
20977
|
+
objects == (other.is_a?(ObjectList) ? other.objects : other)
|
|
20978
|
+
end
|
|
20979
|
+
|
|
20980
|
+
def inspect
|
|
20981
|
+
objects.inspect
|
|
20982
|
+
end
|
|
20983
|
+
|
|
20984
|
+
def <<(object)
|
|
20985
|
+
live << peach_uuid(object)
|
|
20986
|
+
self
|
|
20987
|
+
end
|
|
20988
|
+
alias_method :push, :<<
|
|
20989
|
+
|
|
20990
|
+
def concat(list)
|
|
20991
|
+
list.each { |object| self << object }
|
|
20992
|
+
self
|
|
20993
|
+
end
|
|
20994
|
+
|
|
20995
|
+
def insert(index, object)
|
|
20996
|
+
live.insert(index, peach_uuid(object))
|
|
20997
|
+
self
|
|
20998
|
+
end
|
|
20999
|
+
|
|
21000
|
+
def unshift(object)
|
|
21001
|
+
live.unshift(peach_uuid(object))
|
|
21002
|
+
self
|
|
21003
|
+
end
|
|
21004
|
+
|
|
21005
|
+
def delete(object)
|
|
21006
|
+
return nil unless object.is_a?(Object::AbstractObject) && live.include?(object.uuid)
|
|
21007
|
+
live.delete(object.uuid)
|
|
21008
|
+
@owner.project.mark_dirty!
|
|
21009
|
+
object
|
|
21010
|
+
end
|
|
21011
|
+
|
|
21012
|
+
def delete_at(index)
|
|
21013
|
+
uuid = live.delete_at(index)
|
|
21014
|
+
@owner.project.mark_dirty!
|
|
21015
|
+
uuid && @owner.project.object(uuid)
|
|
21016
|
+
end
|
|
21017
|
+
|
|
21018
|
+
def delete_if(&block)
|
|
21019
|
+
live.reject! { |uuid| block.call(@owner.project.object(uuid)) }
|
|
21020
|
+
@owner.project.mark_dirty!
|
|
21021
|
+
self
|
|
21022
|
+
end
|
|
21023
|
+
|
|
21024
|
+
def clear
|
|
21025
|
+
live.clear
|
|
21026
|
+
@owner.project.mark_dirty!
|
|
21027
|
+
self
|
|
21028
|
+
end
|
|
21029
|
+
|
|
21030
|
+
def uniq!
|
|
21031
|
+
result = live.uniq!
|
|
21032
|
+
@owner.project.mark_dirty!
|
|
21033
|
+
result && self
|
|
21034
|
+
end
|
|
21035
|
+
|
|
21036
|
+
def move(object, new_index)
|
|
21037
|
+
return if index(object) == new_index
|
|
21038
|
+
raise "Attempt to move object '#{object}' not present in the list '#{inspect}'" unless delete(object)
|
|
21039
|
+
insert(new_index, object)
|
|
21040
|
+
end
|
|
21041
|
+
|
|
21042
|
+
def move_from(current_index, new_index)
|
|
21043
|
+
return if current_index == new_index
|
|
21044
|
+
object = delete_at(current_index)
|
|
21045
|
+
raise "Attempt to move object from index '#{current_index}' which is beyond bounds of the list '#{inspect}'" unless object
|
|
21046
|
+
insert(new_index, object)
|
|
21047
|
+
end
|
|
21048
|
+
|
|
21049
|
+
private
|
|
21050
|
+
|
|
21051
|
+
def live
|
|
21052
|
+
@owner.peach_live_uuids(@key)
|
|
21053
|
+
end
|
|
21054
|
+
|
|
21055
|
+
def peach_uuid(object)
|
|
21056
|
+
unless object.is_a?(Object::AbstractObject) && object.project.equal?(@owner.project)
|
|
21057
|
+
raise ArgumentError, "#{@owner.inspect} lists objects of its own project, not #{object.inspect}"
|
|
21058
|
+
end
|
|
21059
|
+
@owner.project.mark_dirty!
|
|
21060
|
+
object.uuid
|
|
21061
|
+
end
|
|
21062
|
+
end
|
|
21063
|
+
|
|
21064
|
+
module Object
|
|
21065
|
+
class AbstractObject
|
|
21066
|
+
attr_reader :project, :uuid
|
|
21067
|
+
|
|
21068
|
+
def self.isa
|
|
21069
|
+
name.split('::').last
|
|
21070
|
+
end
|
|
21071
|
+
|
|
21072
|
+
def self.peach_defaults
|
|
21073
|
+
inherited = equal?(AbstractObject) ? {} : superclass.peach_defaults
|
|
21074
|
+
inherited.merge(@peach_defaults || {})
|
|
21075
|
+
end
|
|
21076
|
+
|
|
21077
|
+
def initialize(project, uuid, attributes)
|
|
21078
|
+
@project = project
|
|
21079
|
+
@uuid = uuid
|
|
21080
|
+
@attributes = attributes
|
|
21081
|
+
end
|
|
21082
|
+
|
|
21083
|
+
def self.attribute(name, key, default = nil)
|
|
21084
|
+
(@peach_defaults ||= {})[key] = default unless default.nil?
|
|
21085
|
+
define_method(name) { @attributes[key] }
|
|
21086
|
+
define_method("#{name}=") { |value| peach_set(key, value) }
|
|
21087
|
+
end
|
|
21088
|
+
|
|
21089
|
+
def self.has_one(name, key)
|
|
21090
|
+
define_method(name) { (uuid = @attributes[key]) && project.object(uuid) }
|
|
21091
|
+
define_method("#{name}=") { |object| peach_set(key, object) }
|
|
21092
|
+
end
|
|
21093
|
+
|
|
21094
|
+
def self.has_many(name, key)
|
|
21095
|
+
(@peach_defaults ||= {})[key] = []
|
|
21096
|
+
define_method(name) { Project::ObjectList.new(self, key) }
|
|
21097
|
+
end
|
|
21098
|
+
|
|
21099
|
+
def peach_uuid(key)
|
|
21100
|
+
@attributes[key]
|
|
21101
|
+
end
|
|
21102
|
+
|
|
21103
|
+
def peach_uuids(key)
|
|
21104
|
+
@attributes[key] || []
|
|
21105
|
+
end
|
|
21106
|
+
|
|
21107
|
+
def peach_live_uuids(key)
|
|
21108
|
+
@attributes[key] ||= []
|
|
21109
|
+
end
|
|
21110
|
+
|
|
21111
|
+
def peach_set(key, value)
|
|
21112
|
+
value = value.uuid if value.is_a?(AbstractObject)
|
|
21113
|
+
if value.nil?
|
|
21114
|
+
@attributes.delete(key)
|
|
21115
|
+
else
|
|
21116
|
+
@attributes[key] = value
|
|
21117
|
+
end
|
|
21118
|
+
project.mark_dirty!
|
|
21119
|
+
end
|
|
21120
|
+
|
|
21121
|
+
def isa
|
|
21122
|
+
@attributes['isa']
|
|
21123
|
+
end
|
|
21124
|
+
|
|
21125
|
+
def referrers
|
|
21126
|
+
project.peach_referrers(uuid)
|
|
21127
|
+
end
|
|
21128
|
+
|
|
21129
|
+
def mark_project_as_dirty!
|
|
21130
|
+
project.mark_dirty!
|
|
21131
|
+
end
|
|
21132
|
+
|
|
21133
|
+
def remove_from_project
|
|
21134
|
+
project.peach_remove(uuid)
|
|
21135
|
+
end
|
|
21136
|
+
|
|
21137
|
+
def display_name
|
|
21138
|
+
declared_name = name if respond_to?(:name)
|
|
21139
|
+
declared_name && !declared_name.empty? ? declared_name : isa.gsub(/^(PBX|XC)/, '')
|
|
21140
|
+
end
|
|
21141
|
+
alias_method :to_s, :display_name
|
|
21142
|
+
|
|
21143
|
+
def inspect
|
|
21144
|
+
"<#{isa} name=#{display_name.inspect} uuid=#{uuid}>"
|
|
21145
|
+
end
|
|
21146
|
+
end
|
|
21147
|
+
|
|
21148
|
+
module GroupableHelper
|
|
21149
|
+
SOURCE_TREES_BY_KEY = {
|
|
21150
|
+
:absolute => '<absolute>',
|
|
21151
|
+
:group => '<group>',
|
|
21152
|
+
:project => 'SOURCE_ROOT',
|
|
21153
|
+
:built_products => 'BUILT_PRODUCTS_DIR',
|
|
21154
|
+
:developer_dir => 'DEVELOPER_DIR',
|
|
21155
|
+
:sdk_root => 'SDKROOT',
|
|
21156
|
+
}.freeze
|
|
21157
|
+
|
|
21158
|
+
def self.normalize_source_tree(source_tree)
|
|
21159
|
+
source_tree = SOURCE_TREES_BY_KEY[source_tree] if source_tree.is_a?(Symbol)
|
|
21160
|
+
raise "[Xcodeproj] Unrecognized source tree option '#{source_tree}'" unless SOURCE_TREES_BY_KEY.values.include?(source_tree)
|
|
21161
|
+
source_tree
|
|
21162
|
+
end
|
|
21163
|
+
|
|
21164
|
+
def parent
|
|
21165
|
+
parents = referrers
|
|
21166
|
+
parents = parents.select { |o| o.is_a?(PBXGroup) } if parents.count > 1
|
|
21167
|
+
raise "[Xcodeproj] Consistency issue: no parent for object '#{display_name}'" if parents.empty?
|
|
21168
|
+
raise "[Xcodeproj] Consistency issue: unexpected multiple parents for object '#{display_name}'" if parents.count > 1
|
|
21169
|
+
parents.first
|
|
21170
|
+
end
|
|
21171
|
+
|
|
21172
|
+
def real_path
|
|
21173
|
+
source_tree_path = source_tree_real_path
|
|
21174
|
+
source_tree_path ? source_tree_path + (path || '') : Pathname(path || '')
|
|
21175
|
+
end
|
|
21176
|
+
|
|
21177
|
+
def source_tree_real_path
|
|
21178
|
+
case source_tree
|
|
21179
|
+
when '<group>'
|
|
21180
|
+
object_parent = parent
|
|
21181
|
+
if object_parent.isa == 'PBXProject'
|
|
21182
|
+
project.project_dir + project.root_object.project_dir_path
|
|
21183
|
+
else
|
|
21184
|
+
object_parent.real_path
|
|
21185
|
+
end
|
|
21186
|
+
when 'SOURCE_ROOT'
|
|
21187
|
+
project.project_dir
|
|
21188
|
+
when '<absolute>'
|
|
21189
|
+
nil
|
|
21190
|
+
else
|
|
21191
|
+
Pathname.new("$" + "{#{source_tree}}")
|
|
21192
|
+
end
|
|
21193
|
+
end
|
|
21194
|
+
|
|
21195
|
+
def set_source_tree(source_tree)
|
|
21196
|
+
self.source_tree = GroupableHelper.normalize_source_tree(source_tree)
|
|
21197
|
+
end
|
|
21198
|
+
|
|
21199
|
+
def peach_set_path_with_source_tree(new_path, source_tree)
|
|
21200
|
+
new_path = Pathname.new(new_path.to_s)
|
|
21201
|
+
source_tree = GroupableHelper.normalize_source_tree(source_tree)
|
|
21202
|
+
self.source_tree = source_tree
|
|
21203
|
+
if source_tree == '<absolute>'
|
|
21204
|
+
raise "[Xcodeproj] Attempt to set a relative path with an absolute source tree: '#{new_path}'" unless new_path.absolute?
|
|
21205
|
+
self.path = new_path.to_s
|
|
21206
|
+
elsif source_tree == '<group>' || source_tree == 'SOURCE_ROOT'
|
|
21207
|
+
tree_path = source_tree_real_path
|
|
21208
|
+
self.path = tree_path && tree_path.absolute? == new_path.absolute? ? new_path.relative_path_from(tree_path).to_s : new_path.to_s
|
|
21209
|
+
else
|
|
21210
|
+
self.path = new_path.to_s
|
|
21211
|
+
end
|
|
21212
|
+
end
|
|
21213
|
+
|
|
21214
|
+
def build_files
|
|
21215
|
+
referrers.select { |o| o.is_a?(PBXBuildFile) }
|
|
21216
|
+
end
|
|
21217
|
+
|
|
21218
|
+
def remove_from_project
|
|
21219
|
+
build_files.each(&:remove_from_project)
|
|
21220
|
+
super
|
|
21221
|
+
end
|
|
21222
|
+
end
|
|
21223
|
+
class XCBuildConfiguration < AbstractObject
|
|
21224
|
+
MUTUAL_RECURSION_SENTINEL = 'xcodeproj.mutual_recursion_sentinel'.freeze
|
|
21225
|
+
ARRAY_SETTINGS = %w(
|
|
21226
|
+
ALTERNATE_PERMISSIONS_FILES ARCHS BUILD_VARIANTS EXCLUDED_SOURCE_FILE_NAMES FRAMEWORK_SEARCH_PATHS
|
|
21227
|
+
GCC_PREPROCESSOR_DEFINITIONS GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS HEADER_SEARCH_PATHS
|
|
21228
|
+
INFOPLIST_PREPROCESSOR_DEFINITIONS LIBRARY_SEARCH_PATHS OTHER_CFLAGS OTHER_CPLUSPLUSFLAGS OTHER_LDFLAGS
|
|
21229
|
+
REZ_SEARCH_PATHS SECTORDER_FLAGS WARNING_CFLAGS WARNING_LDFLAGS
|
|
21230
|
+
).freeze
|
|
21231
|
+
ARRAY_SETTINGS_OBJECT_VERSION_50 = %w(
|
|
21232
|
+
ALTERNATE_PERMISSIONS_FILES ARCHS BUILD_VARIANTS EXCLUDED_SOURCE_FILE_NAMES FRAMEWORK_SEARCH_PATHS
|
|
21233
|
+
GCC_PREPROCESSOR_DEFINITIONS GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS HEADER_SEARCH_PATHS
|
|
21234
|
+
INCLUDED_SOURCE_FILE_NAMES INFOPLIST_PREPROCESSOR_DEFINITIONS LD_RUNPATH_SEARCH_PATHS LIBRARY_SEARCH_PATHS
|
|
21235
|
+
LOCALIZED_STRING_MACRO_NAMES OTHER_CFLAGS OTHER_CPLUSPLUSFLAGS OTHER_LDFLAGS REZ_SEARCH_PATHS SECTORDER_FLAGS
|
|
21236
|
+
SYSTEM_FRAMEWORK_SEARCH_PATHS SYSTEM_HEADER_SEARCH_PATHS USER_HEADER_SEARCH_PATHS WARNING_CFLAGS WARNING_LDFLAGS
|
|
21237
|
+
).freeze
|
|
21238
|
+
|
|
21239
|
+
attribute :name, 'name'
|
|
21240
|
+
has_one :base_configuration_reference, 'baseConfigurationReference'
|
|
21241
|
+
|
|
21242
|
+
def build_settings
|
|
21243
|
+
@attributes['buildSettings'] ||= {}
|
|
21244
|
+
end
|
|
21245
|
+
|
|
21246
|
+
def build_settings=(settings)
|
|
21247
|
+
peach_set('buildSettings', settings)
|
|
21248
|
+
end
|
|
21249
|
+
|
|
21250
|
+
def debug?
|
|
21251
|
+
gcc_preprocessor_definitions = resolve_build_setting('GCC_PREPROCESSOR_DEFINITIONS')
|
|
21252
|
+
gcc_preprocessor_definitions && gcc_preprocessor_definitions.include?('DEBUG=1')
|
|
21253
|
+
end
|
|
21254
|
+
|
|
21255
|
+
def type
|
|
21256
|
+
debug? ? :debug : :release
|
|
21257
|
+
end
|
|
21258
|
+
|
|
21259
|
+
def resolve_build_setting(key, root_target = nil, previous_key = nil)
|
|
21260
|
+
setting = build_settings[key]
|
|
21261
|
+
setting = resolve_variable_substitution(key, setting, root_target, previous_key)
|
|
21262
|
+
|
|
21263
|
+
config_setting = config[key]
|
|
21264
|
+
config_setting = resolve_variable_substitution(key, config_setting, root_target, previous_key)
|
|
21265
|
+
|
|
21266
|
+
project_setting = project.build_configuration_list[name]
|
|
21267
|
+
project_setting = nil if equal?(project_setting)
|
|
21268
|
+
project_setting &&= project_setting.resolve_build_setting(key, root_target)
|
|
21269
|
+
|
|
21270
|
+
defaults = {
|
|
21271
|
+
'CONFIGURATION' => name,
|
|
21272
|
+
'SRCROOT' => project.project_dir.to_s,
|
|
21273
|
+
}
|
|
21274
|
+
|
|
21275
|
+
if previous_key.nil? && setting == MUTUAL_RECURSION_SENTINEL
|
|
21276
|
+
setting = nil
|
|
21277
|
+
end
|
|
21278
|
+
|
|
21279
|
+
[defaults[key], project_setting, config_setting, setting, ENV[key]].compact.reduce(nil) do |inherited, value|
|
|
21280
|
+
expand_build_setting(value, inherited)
|
|
21281
|
+
end
|
|
21282
|
+
end
|
|
21283
|
+
|
|
21284
|
+
private
|
|
21285
|
+
|
|
21286
|
+
def expand_build_setting(build_setting_value, config_value)
|
|
21287
|
+
if build_setting_value.is_a?(Array) && config_value.is_a?(String)
|
|
21288
|
+
config_value = split_build_setting_array_to_string(config_value)
|
|
21289
|
+
elsif build_setting_value.is_a?(String) && config_value.is_a?(Array)
|
|
21290
|
+
build_setting_value = split_build_setting_array_to_string(build_setting_value)
|
|
21291
|
+
end
|
|
21292
|
+
|
|
21293
|
+
default = build_setting_value.is_a?(String) ? '' : []
|
|
21294
|
+
inherited = config_value || default
|
|
21295
|
+
|
|
21296
|
+
return build_setting_value.gsub(Regexp.union(Constants::INHERITED_KEYWORDS), inherited) if build_setting_value.is_a? String
|
|
21297
|
+
build_setting_value.flat_map { |value| Constants::INHERITED_KEYWORDS.include?(value) ? inherited : value }
|
|
21298
|
+
end
|
|
21299
|
+
|
|
21300
|
+
def resolve_variable_substitution(key, value, root_target, previous_key = nil)
|
|
21301
|
+
case value
|
|
21302
|
+
when Array
|
|
21303
|
+
return value.map { |v| resolve_variable_substitution(key, v, root_target) }
|
|
21304
|
+
when nil
|
|
21305
|
+
return
|
|
21306
|
+
when String
|
|
21307
|
+
nil
|
|
21308
|
+
else
|
|
21309
|
+
raise ArgumentError, "Settings values can only be nil, string, or array, got #{value.inspect} for #{key}"
|
|
21310
|
+
end
|
|
21311
|
+
|
|
21312
|
+
unless variable_match_data = value.match(/\$(?:[{]([_a-zA-Z0-9]+?)[}]|[(]([_a-zA-Z0-9]+?)[)])/)
|
|
21313
|
+
return value
|
|
21314
|
+
end
|
|
21315
|
+
variable_reference = variable_match_data[0]
|
|
21316
|
+
variable = variable_match_data[1] || variable_match_data[2]
|
|
21317
|
+
|
|
21318
|
+
case variable
|
|
21319
|
+
when 'inherited'
|
|
21320
|
+
value
|
|
21321
|
+
when key
|
|
21322
|
+
nil
|
|
21323
|
+
when previous_key
|
|
21324
|
+
MUTUAL_RECURSION_SENTINEL
|
|
21325
|
+
else
|
|
21326
|
+
configuration_to_resolve_against = root_target ? root_target.build_configuration_list[name] : self
|
|
21327
|
+
resolved_value_for_variable = configuration_to_resolve_against.resolve_build_setting(variable, root_target, key) || ''
|
|
21328
|
+
|
|
21329
|
+
if resolved_value_for_variable == MUTUAL_RECURSION_SENTINEL
|
|
21330
|
+
return MUTUAL_RECURSION_SENTINEL
|
|
21331
|
+
end
|
|
21332
|
+
|
|
21333
|
+
value = value.gsub(variable_reference, resolved_value_for_variable)
|
|
21334
|
+
resolve_variable_substitution(key, value, root_target)
|
|
21335
|
+
end
|
|
21336
|
+
end
|
|
21337
|
+
|
|
21338
|
+
def normalize_array_settings(settings)
|
|
21339
|
+
return unless settings
|
|
21340
|
+
|
|
21341
|
+
array_settings = project.object_version.to_i >= 50 ? ARRAY_SETTINGS_OBJECT_VERSION_50 : ARRAY_SETTINGS
|
|
21342
|
+
|
|
21343
|
+
settings.keys.each do |key|
|
|
21344
|
+
next unless value = settings[key]
|
|
21345
|
+
stripped_key = key.sub(/\[[^\]]+\]$/, '')
|
|
21346
|
+
case value
|
|
21347
|
+
when String
|
|
21348
|
+
next unless array_settings.include?(stripped_key)
|
|
21349
|
+
array_value = split_build_setting_array_to_string(value)
|
|
21350
|
+
next unless array_value.size > 1
|
|
21351
|
+
settings[key] = array_value
|
|
21352
|
+
when Array
|
|
21353
|
+
next if value.size > 1 && array_settings.include?(stripped_key)
|
|
21354
|
+
settings[key] = value.join(' ')
|
|
21355
|
+
end
|
|
21356
|
+
end
|
|
21357
|
+
end
|
|
21358
|
+
|
|
21359
|
+
def split_build_setting_array_to_string(string)
|
|
21360
|
+
regexp = / *((['"]?).*?[^\\]\2)(?=( |\z))/
|
|
21361
|
+
string.scan(regexp).map(&:first)
|
|
21362
|
+
end
|
|
21363
|
+
|
|
21364
|
+
def config
|
|
21365
|
+
return {} unless base_configuration_reference
|
|
21366
|
+
# integration sets the reference after hooks have read the settings
|
|
21367
|
+
@config = nil unless @config_reference == peach_uuid('baseConfigurationReference')
|
|
21368
|
+
@config_reference = peach_uuid('baseConfigurationReference')
|
|
21369
|
+
@config ||=
|
|
21370
|
+
if base_configuration_reference.real_path.exist?
|
|
21371
|
+
Xcodeproj::Config.new(base_configuration_reference.real_path).to_hash.tap do |hash|
|
|
21372
|
+
normalize_array_settings(hash)
|
|
21373
|
+
end
|
|
21374
|
+
else
|
|
21375
|
+
{}
|
|
21376
|
+
end
|
|
21377
|
+
end
|
|
21378
|
+
end
|
|
21379
|
+
|
|
21380
|
+
class XCConfigurationList < AbstractObject
|
|
21381
|
+
attribute :default_configuration_is_visible, 'defaultConfigurationIsVisible', '0'
|
|
21382
|
+
attribute :default_configuration_name, 'defaultConfigurationName'
|
|
21383
|
+
has_many :build_configurations, 'buildConfigurations'
|
|
21384
|
+
|
|
21385
|
+
def [](name)
|
|
21386
|
+
build_configurations.find { |bc| bc.name == name }
|
|
21387
|
+
end
|
|
21388
|
+
|
|
21389
|
+
def build_settings(build_configuration_name)
|
|
21390
|
+
configuration = self[build_configuration_name]
|
|
21391
|
+
configuration && configuration.build_settings
|
|
21392
|
+
end
|
|
21393
|
+
end
|
|
21394
|
+
|
|
21395
|
+
class PBXBuildFile < AbstractObject
|
|
21396
|
+
attribute :settings, 'settings'
|
|
21397
|
+
has_one :file_ref, 'fileRef'
|
|
21398
|
+
has_one :product_ref, 'productRef'
|
|
21399
|
+
|
|
21400
|
+
def display_name
|
|
21401
|
+
if product_ref
|
|
21402
|
+
product_ref.display_name
|
|
21403
|
+
elsif file_ref
|
|
21404
|
+
file_ref.display_name
|
|
21405
|
+
else
|
|
21406
|
+
super
|
|
21407
|
+
end
|
|
21408
|
+
end
|
|
21409
|
+
end
|
|
21410
|
+
|
|
21411
|
+
class AbstractBuildPhase < AbstractObject
|
|
21412
|
+
has_many :files, 'files'
|
|
21413
|
+
attribute :build_action_mask, 'buildActionMask', '2147483647'
|
|
21414
|
+
attribute :run_only_for_deployment_postprocessing, 'runOnlyForDeploymentPostprocessing', '0'
|
|
21415
|
+
attribute :always_out_of_date, 'alwaysOutOfDate'
|
|
21416
|
+
|
|
21417
|
+
def files_references
|
|
21418
|
+
files.map(&:file_ref)
|
|
21419
|
+
end
|
|
21420
|
+
|
|
21421
|
+
def file_display_names
|
|
21422
|
+
files.map(&:display_name)
|
|
21423
|
+
end
|
|
21424
|
+
|
|
21425
|
+
def build_file(file_ref)
|
|
21426
|
+
files.find { |build_file| build_file.peach_uuid('fileRef') == file_ref.uuid }
|
|
21427
|
+
end
|
|
21428
|
+
|
|
21429
|
+
def include?(file_ref)
|
|
21430
|
+
!build_file(file_ref).nil?
|
|
21431
|
+
end
|
|
21432
|
+
|
|
21433
|
+
def add_file_reference(file_ref, avoid_duplicates = false)
|
|
21434
|
+
existing = avoid_duplicates && build_file(file_ref)
|
|
21435
|
+
return existing if existing
|
|
21436
|
+
build_file = project.new(PBXBuildFile)
|
|
21437
|
+
build_file.file_ref = file_ref
|
|
21438
|
+
files << build_file
|
|
21439
|
+
build_file
|
|
21440
|
+
end
|
|
21441
|
+
|
|
21442
|
+
def remove_file_reference(file_ref)
|
|
21443
|
+
build_file = files.find { |bf| bf.file_ref == file_ref }
|
|
21444
|
+
remove_build_file(build_file) if build_file
|
|
21445
|
+
end
|
|
21446
|
+
|
|
21447
|
+
def remove_build_file(build_file)
|
|
21448
|
+
build_file.file_ref = nil
|
|
21449
|
+
build_file.remove_from_project
|
|
21450
|
+
end
|
|
21451
|
+
|
|
21452
|
+
def clear
|
|
21453
|
+
files.objects.each { |bf| remove_build_file(bf) }
|
|
21454
|
+
end
|
|
21455
|
+
alias_method :clear_build_files, :clear
|
|
21456
|
+
|
|
21457
|
+
def display_name
|
|
21458
|
+
super.gsub(/BuildPhase$/, '')
|
|
21459
|
+
end
|
|
21460
|
+
end
|
|
21461
|
+
|
|
21462
|
+
class PBXHeadersBuildPhase < AbstractBuildPhase; end
|
|
21463
|
+
class PBXSourcesBuildPhase < AbstractBuildPhase; end
|
|
21464
|
+
class PBXFrameworksBuildPhase < AbstractBuildPhase; end
|
|
21465
|
+
class PBXResourcesBuildPhase < AbstractBuildPhase; end
|
|
21466
|
+
|
|
21467
|
+
class PBXCopyFilesBuildPhase < AbstractBuildPhase
|
|
21468
|
+
attribute :name, 'name'
|
|
21469
|
+
attribute :dst_path, 'dstPath', ''
|
|
21470
|
+
attribute :dst_subfolder_spec, 'dstSubfolderSpec', '7'
|
|
21471
|
+
end
|
|
21472
|
+
|
|
21473
|
+
class PBXShellScriptBuildPhase < AbstractBuildPhase
|
|
21474
|
+
attribute :name, 'name'
|
|
21475
|
+
attribute :input_paths, 'inputPaths', []
|
|
21476
|
+
attribute :input_file_list_paths, 'inputFileListPaths', []
|
|
21477
|
+
attribute :output_paths, 'outputPaths', []
|
|
21478
|
+
attribute :output_file_list_paths, 'outputFileListPaths', []
|
|
21479
|
+
attribute :shell_path, 'shellPath', '/bin/sh'
|
|
21480
|
+
attribute :shell_script, 'shellScript', "# Type a script or drag a script file from your workspace to insert its path.\n"
|
|
21481
|
+
attribute :show_env_vars_in_log, 'showEnvVarsInLog'
|
|
21482
|
+
attribute :dependency_file, 'dependencyFile'
|
|
21483
|
+
end
|
|
21484
|
+
|
|
21485
|
+
class PBXFileReference < AbstractObject
|
|
21486
|
+
include GroupableHelper
|
|
21487
|
+
attribute :name, 'name'
|
|
21488
|
+
attribute :path, 'path'
|
|
21489
|
+
attribute :source_tree, 'sourceTree', 'SOURCE_ROOT'
|
|
21490
|
+
attribute :explicit_file_type, 'explicitFileType'
|
|
21491
|
+
attribute :last_known_file_type, 'lastKnownFileType'
|
|
21492
|
+
attribute :include_in_index, 'includeInIndex', '1'
|
|
21493
|
+
attribute :fileEncoding, 'fileEncoding'
|
|
21494
|
+
|
|
21495
|
+
def display_name
|
|
21496
|
+
if name
|
|
21497
|
+
name
|
|
21498
|
+
elsif source_tree == 'BUILT_PRODUCTS_DIR'
|
|
21499
|
+
path
|
|
21500
|
+
elsif path
|
|
21501
|
+
File.basename(path)
|
|
21502
|
+
end
|
|
21503
|
+
end
|
|
21504
|
+
|
|
21505
|
+
def set_path(new_path)
|
|
21506
|
+
if new_path
|
|
21507
|
+
peach_set_path_with_source_tree(new_path, source_tree)
|
|
21508
|
+
else
|
|
21509
|
+
self.path = nil
|
|
21510
|
+
end
|
|
21511
|
+
end
|
|
21512
|
+
|
|
21513
|
+
def set_last_known_file_type(type = nil)
|
|
21514
|
+
if type
|
|
21515
|
+
self.last_known_file_type = type
|
|
21516
|
+
elsif path
|
|
21517
|
+
self.last_known_file_type = Peach::Xcode.file_type(File.extname(path)[1..-1].to_s)
|
|
21518
|
+
end
|
|
21519
|
+
end
|
|
21520
|
+
|
|
21521
|
+
def set_explicit_file_type(type = nil)
|
|
21522
|
+
self.last_known_file_type = nil
|
|
21523
|
+
if type
|
|
21524
|
+
self.explicit_file_type = type
|
|
21525
|
+
elsif path
|
|
21526
|
+
self.explicit_file_type = Peach::Xcode.file_type(File.extname(path)[1..-1].to_s)
|
|
21527
|
+
end
|
|
21528
|
+
end
|
|
21529
|
+
end
|
|
21530
|
+
|
|
21531
|
+
class PBXReferenceProxy < AbstractObject
|
|
21532
|
+
include GroupableHelper
|
|
21533
|
+
attribute :name, 'name'
|
|
21534
|
+
attribute :path, 'path'
|
|
21535
|
+
attribute :file_type, 'fileType'
|
|
21536
|
+
attribute :source_tree, 'sourceTree'
|
|
21537
|
+
has_one :remote_ref, 'remoteRef'
|
|
21538
|
+
end
|
|
21539
|
+
|
|
21540
|
+
class PBXGroup < AbstractObject
|
|
21541
|
+
include GroupableHelper
|
|
21542
|
+
has_many :children, 'children'
|
|
21543
|
+
attribute :source_tree, 'sourceTree', '<group>'
|
|
21544
|
+
attribute :path, 'path'
|
|
21545
|
+
attribute :name, 'name'
|
|
21546
|
+
|
|
21547
|
+
def display_name
|
|
21548
|
+
if name
|
|
21549
|
+
name
|
|
21550
|
+
elsif path
|
|
21551
|
+
File.basename(path)
|
|
21552
|
+
elsif equal?(project.main_group)
|
|
21553
|
+
'Main Group'
|
|
21554
|
+
end
|
|
21555
|
+
end
|
|
21556
|
+
|
|
21557
|
+
def set_path(new_path)
|
|
21558
|
+
if new_path
|
|
21559
|
+
peach_set_path_with_source_tree(new_path, source_tree)
|
|
21560
|
+
else
|
|
21561
|
+
self.path = nil
|
|
21562
|
+
self.source_tree = '<group>'
|
|
21563
|
+
end
|
|
21564
|
+
end
|
|
21565
|
+
|
|
21566
|
+
def files
|
|
21567
|
+
children.select { |o| o.is_a?(PBXFileReference) }
|
|
21568
|
+
end
|
|
21569
|
+
|
|
21570
|
+
def find_file_by_path(file_path)
|
|
21571
|
+
files.find { |ref| ref.path == file_path }
|
|
21572
|
+
end
|
|
21573
|
+
|
|
21574
|
+
def groups
|
|
21575
|
+
children.select { |o| o.instance_of?(PBXGroup) }
|
|
21576
|
+
end
|
|
21577
|
+
|
|
21578
|
+
def recursive_children_groups
|
|
21579
|
+
groups.flat_map { |child| [child] + child.recursive_children_groups }
|
|
21580
|
+
end
|
|
21581
|
+
|
|
21582
|
+
def recursive_children
|
|
21583
|
+
children.flat_map { |child| child.is_a?(PBXGroup) ? [child] + child.recursive_children : [child] }
|
|
21584
|
+
end
|
|
21585
|
+
|
|
21586
|
+
def empty?
|
|
21587
|
+
children.count.zero?
|
|
21588
|
+
end
|
|
21589
|
+
|
|
21590
|
+
# FileReferencesFactory.new_reference for a plain file
|
|
21591
|
+
def new_reference(file_path, source_tree = :group)
|
|
21592
|
+
extension = File.extname(file_path.to_s).downcase
|
|
21593
|
+
raise ArgumentError, "Peach adds no #{extension} reference (#{file_path})" if %w(.xcdatamodeld .xcodeproj).include?(extension)
|
|
21594
|
+
ref = project.new(PBXFileReference)
|
|
21595
|
+
children << ref
|
|
21596
|
+
ref.peach_set_path_with_source_tree(file_path, source_tree)
|
|
21597
|
+
ref.set_last_known_file_type
|
|
21598
|
+
ref.name = ref.path.split('/').last if ref.path.include?('/')
|
|
21599
|
+
ref.include_in_index = nil if File.extname(ref.path).downcase == '.framework'
|
|
21600
|
+
ref
|
|
21601
|
+
end
|
|
21602
|
+
alias_method :new_file, :new_reference
|
|
21603
|
+
|
|
21604
|
+
def new_product_ref_for_target(product_basename, product_type)
|
|
21605
|
+
extension = Peach::Xcode.product_extension(product_type.to_s)
|
|
21606
|
+
product_path = "#{product_type == :static_library ? 'lib' : ''}#{product_basename}"
|
|
21607
|
+
product_path += ".#{extension}" if extension
|
|
21608
|
+
ref = new_reference(product_path, :built_products)
|
|
21609
|
+
ref.include_in_index = '0'
|
|
21610
|
+
ref.set_explicit_file_type
|
|
21611
|
+
ref
|
|
21612
|
+
end
|
|
21613
|
+
|
|
21614
|
+
def new_group(name, group_path = nil, source_tree = :group)
|
|
21615
|
+
group = project.new(PBXGroup)
|
|
21616
|
+
children << group
|
|
21617
|
+
group.name = name
|
|
21618
|
+
group.set_source_tree(source_tree)
|
|
21619
|
+
group.set_path(group_path)
|
|
21620
|
+
group
|
|
21621
|
+
end
|
|
21622
|
+
|
|
21623
|
+
def [](group_path)
|
|
21624
|
+
find_subpath(group_path, false)
|
|
21625
|
+
end
|
|
21626
|
+
|
|
21627
|
+
def <<(child)
|
|
21628
|
+
children << child
|
|
21629
|
+
end
|
|
21630
|
+
|
|
21631
|
+
def find_subpath(group_path, should_create = false)
|
|
21632
|
+
return self unless group_path
|
|
21633
|
+
group_path = group_path.split('/') unless group_path.is_a?(Array)
|
|
21634
|
+
child_name = group_path.first
|
|
21635
|
+
rest = group_path.drop(1)
|
|
21636
|
+
child = children.find { |c| c.display_name == child_name }
|
|
21637
|
+
if child.nil?
|
|
21638
|
+
return nil unless should_create
|
|
21639
|
+
child = new_group(child_name)
|
|
21640
|
+
end
|
|
21641
|
+
rest.empty? ? child : child.find_subpath(rest, should_create)
|
|
21642
|
+
end
|
|
21643
|
+
end
|
|
21644
|
+
|
|
21645
|
+
class PBXVariantGroup < PBXGroup
|
|
21646
|
+
attribute :last_known_file_type, 'lastKnownFileType'
|
|
21647
|
+
end
|
|
21648
|
+
|
|
21649
|
+
class XCVersionGroup < PBXGroup
|
|
21650
|
+
attribute :version_group_type, 'versionGroupType', 'wrapper.xcdatamodel'
|
|
21651
|
+
end
|
|
21652
|
+
|
|
21653
|
+
class PBXContainerItemProxy < AbstractObject
|
|
21654
|
+
attribute :container_portal, 'containerPortal'
|
|
21655
|
+
attribute :proxy_type, 'proxyType'
|
|
21656
|
+
attribute :remote_global_id_string, 'remoteGlobalIDString'
|
|
21657
|
+
attribute :remote_info, 'remoteInfo'
|
|
21658
|
+
end
|
|
21659
|
+
|
|
21660
|
+
class PBXTargetDependency < AbstractObject
|
|
21661
|
+
has_one :target, 'target'
|
|
21662
|
+
has_one :target_proxy, 'targetProxy'
|
|
21663
|
+
has_one :product_ref, 'productRef'
|
|
21664
|
+
attribute :name, 'name'
|
|
21665
|
+
|
|
21666
|
+
def display_name
|
|
21667
|
+
return name if name
|
|
21668
|
+
return target.name if target
|
|
21669
|
+
return target_proxy.remote_info if target_proxy
|
|
21670
|
+
return product_ref.product_name if product_ref
|
|
21671
|
+
end
|
|
21672
|
+
end
|
|
21673
|
+
|
|
21674
|
+
class XCSwiftPackageProductDependency < AbstractObject
|
|
21675
|
+
has_one :package, 'package'
|
|
21676
|
+
attribute :product_name, 'productName'
|
|
21677
|
+
|
|
21678
|
+
def display_name
|
|
21679
|
+
product_name || super
|
|
21680
|
+
end
|
|
21681
|
+
end
|
|
21682
|
+
|
|
21683
|
+
class XCRemoteSwiftPackageReference < AbstractObject
|
|
21684
|
+
attribute :repositoryURL, 'repositoryURL'
|
|
21685
|
+
attribute :requirement, 'requirement'
|
|
21686
|
+
|
|
21687
|
+
def display_name
|
|
21688
|
+
repositoryURL || super
|
|
21689
|
+
end
|
|
21690
|
+
end
|
|
21691
|
+
|
|
21692
|
+
class XCLocalSwiftPackageReference < AbstractObject
|
|
21693
|
+
attribute :path, 'path'
|
|
21694
|
+
attribute :relative_path, 'relativePath'
|
|
21695
|
+
end
|
|
21696
|
+
|
|
21697
|
+
class AbstractTarget < AbstractObject
|
|
21698
|
+
attribute :name, 'name'
|
|
21699
|
+
attribute :product_name, 'productName'
|
|
21700
|
+
has_one :build_configuration_list, 'buildConfigurationList'
|
|
21701
|
+
has_many :dependencies, 'dependencies'
|
|
21702
|
+
has_many :build_phases, 'buildPhases'
|
|
21703
|
+
|
|
21704
|
+
def build_configurations
|
|
21705
|
+
build_configuration_list.build_configurations
|
|
21706
|
+
end
|
|
21707
|
+
|
|
21708
|
+
def build_settings(build_configuration_name)
|
|
21709
|
+
build_configuration_list.build_settings(build_configuration_name)
|
|
21710
|
+
end
|
|
21711
|
+
|
|
21712
|
+
def common_resolved_build_setting(key)
|
|
21713
|
+
values = build_configurations.map { |config| config.resolve_build_setting(key, self) }.compact.uniq
|
|
21714
|
+
values.first if values.count <= 1
|
|
21715
|
+
end
|
|
21716
|
+
|
|
21717
|
+
def dependency_for_target(target)
|
|
21718
|
+
dependencies.find { |dep| dep.target ? dep.target.uuid == target.uuid : dep.target_proxy && dep.target_proxy.remote_global_id_string == target.uuid }
|
|
21719
|
+
end
|
|
21720
|
+
|
|
21721
|
+
def shell_script_build_phases
|
|
21722
|
+
build_phases.select { |o| o.is_a?(PBXShellScriptBuildPhase) }
|
|
21723
|
+
end
|
|
21724
|
+
|
|
21725
|
+
def copy_files_build_phases
|
|
21726
|
+
build_phases.select { |o| o.is_a?(PBXCopyFilesBuildPhase) }
|
|
21727
|
+
end
|
|
21728
|
+
|
|
21729
|
+
def new_shell_script_build_phase(name = nil)
|
|
21730
|
+
phase = project.new(PBXShellScriptBuildPhase)
|
|
21731
|
+
phase.name = name
|
|
21732
|
+
build_phases << phase
|
|
21733
|
+
phase
|
|
21734
|
+
end
|
|
21735
|
+
|
|
21736
|
+
def new_copy_files_build_phase(name = nil)
|
|
21737
|
+
phase = project.new(PBXCopyFilesBuildPhase)
|
|
21738
|
+
phase.name = name
|
|
21739
|
+
build_phases << phase
|
|
21740
|
+
phase
|
|
21741
|
+
end
|
|
21742
|
+
end
|
|
21743
|
+
|
|
21744
|
+
class PBXNativeTarget < AbstractTarget
|
|
21745
|
+
attribute :product_type, 'productType'
|
|
21746
|
+
attribute :product_install_path, 'productInstallPath'
|
|
21747
|
+
has_one :product_reference, 'productReference'
|
|
21748
|
+
has_many :package_product_dependencies, 'packageProductDependencies'
|
|
21749
|
+
|
|
21750
|
+
def symbol_type
|
|
21751
|
+
Constants::PRODUCT_TYPE_UTI.key(product_type)
|
|
21752
|
+
end
|
|
21753
|
+
|
|
21754
|
+
def test_target_type?
|
|
21755
|
+
%i(octest_bundle unit_test_bundle ui_test_bundle).include?(symbol_type)
|
|
21756
|
+
end
|
|
21757
|
+
|
|
21758
|
+
def extension_target_type?
|
|
21759
|
+
%i(app_extension watch_extension watch2_extension tv_extension messages_extension).include?(symbol_type)
|
|
21760
|
+
end
|
|
21761
|
+
|
|
21762
|
+
def launchable_target_type?
|
|
21763
|
+
%i(application command_line_tool).include?(symbol_type)
|
|
21764
|
+
end
|
|
21765
|
+
|
|
21766
|
+
def source_build_phase
|
|
21767
|
+
peach_phase(PBXSourcesBuildPhase)
|
|
21768
|
+
end
|
|
21769
|
+
|
|
21770
|
+
def headers_build_phase
|
|
21771
|
+
peach_phase(PBXHeadersBuildPhase)
|
|
21772
|
+
end
|
|
21773
|
+
|
|
21774
|
+
def frameworks_build_phase
|
|
21775
|
+
peach_phase(PBXFrameworksBuildPhase)
|
|
21776
|
+
end
|
|
21777
|
+
|
|
21778
|
+
def resources_build_phase
|
|
21779
|
+
peach_phase(PBXResourcesBuildPhase)
|
|
21780
|
+
end
|
|
21781
|
+
|
|
21782
|
+
def add_file_references(file_references, compiler_flags = {})
|
|
21783
|
+
file_references.map do |file|
|
|
21784
|
+
header = Peach::Xcode.header?(file.path)
|
|
21785
|
+
phase = header ? headers_build_phase : source_build_phase
|
|
21786
|
+
build_file = phase.build_file(file) || phase.add_file_reference(file)
|
|
21787
|
+
if compiler_flags && !compiler_flags.empty? && !header
|
|
21788
|
+
settings = build_file.settings || {}
|
|
21789
|
+
settings['COMPILER_FLAGS'] = [settings['COMPILER_FLAGS'], compiler_flags].compact.join(' ')
|
|
21790
|
+
build_file.settings = settings
|
|
21791
|
+
end
|
|
21792
|
+
yield build_file if block_given?
|
|
21793
|
+
build_file
|
|
21794
|
+
end
|
|
21795
|
+
end
|
|
21796
|
+
|
|
21797
|
+
def add_resources(resource_file_references)
|
|
21798
|
+
resource_file_references.each do |file|
|
|
21799
|
+
resources_build_phase.add_file_reference(file) unless resources_build_phase.include?(file)
|
|
21800
|
+
end
|
|
21801
|
+
end
|
|
21802
|
+
|
|
21803
|
+
private
|
|
21804
|
+
|
|
21805
|
+
def peach_phase(klass)
|
|
21806
|
+
build_phases.find { |phase| phase.instance_of?(klass) } || project.new(klass).tap { |phase| build_phases << phase }
|
|
21807
|
+
end
|
|
21808
|
+
end
|
|
21809
|
+
|
|
21810
|
+
class PBXAggregateTarget < AbstractTarget; end
|
|
21811
|
+
class PBXLegacyTarget < AbstractTarget; end
|
|
21812
|
+
|
|
21813
|
+
class PBXProject < AbstractObject
|
|
21814
|
+
has_many :targets, 'targets'
|
|
21815
|
+
attribute :attributes, 'attributes'
|
|
21816
|
+
has_one :build_configuration_list, 'buildConfigurationList'
|
|
21817
|
+
attribute :compatibility_version, 'compatibilityVersion'
|
|
21818
|
+
attribute :development_region, 'developmentRegion'
|
|
21819
|
+
attribute :known_regions, 'knownRegions'
|
|
21820
|
+
has_one :main_group, 'mainGroup'
|
|
21821
|
+
has_one :product_ref_group, 'productRefGroup'
|
|
21822
|
+
attribute :project_dir_path, 'projectDirPath', ''
|
|
21823
|
+
attribute :project_root, 'projectRoot', ''
|
|
21824
|
+
has_many :package_references, 'packageReferences'
|
|
21825
|
+
|
|
21826
|
+
def name
|
|
21827
|
+
project.path.basename('.xcodeproj').to_s
|
|
21828
|
+
end
|
|
21829
|
+
end
|
|
21830
|
+
|
|
21831
|
+
ISA = [
|
|
21832
|
+
XCBuildConfiguration, XCConfigurationList, PBXBuildFile, PBXHeadersBuildPhase, PBXSourcesBuildPhase,
|
|
21833
|
+
PBXFrameworksBuildPhase, PBXResourcesBuildPhase, PBXCopyFilesBuildPhase, PBXShellScriptBuildPhase,
|
|
21834
|
+
PBXFileReference, PBXReferenceProxy, PBXGroup, PBXVariantGroup, XCVersionGroup, PBXContainerItemProxy,
|
|
21835
|
+
PBXTargetDependency, XCSwiftPackageProductDependency, XCRemoteSwiftPackageReference,
|
|
21836
|
+
XCLocalSwiftPackageReference, PBXNativeTarget, PBXAggregateTarget, PBXLegacyTarget, PBXProject,
|
|
21837
|
+
].each_with_object({}) { |klass, by_isa| by_isa[klass.isa] = klass }.freeze
|
|
21838
|
+
end
|
|
21839
|
+
|
|
21840
|
+
include Object
|
|
21841
|
+
end
|
|
21842
|
+
end
|
|
21843
|
+
|
|
21844
|
+
module Pod
|
|
21845
|
+
class Project < Xcodeproj::Project
|
|
21846
|
+
def initialize(path, objects, root_uuid, object_version)
|
|
21847
|
+
@uuid_prefix = Digest::SHA256.hexdigest(File.basename(path)).upcase
|
|
21848
|
+
super
|
|
21849
|
+
end
|
|
21850
|
+
|
|
21851
|
+
def generate_available_uuid_list(count = 100)
|
|
21852
|
+
start = @generated_uuids.size
|
|
21853
|
+
uniques = Array.new(count) { |i| format('%.6s%07X0', @uuid_prefix, start + i) }
|
|
21854
|
+
@generated_uuids += uniques
|
|
21855
|
+
@available_uuids += uniques
|
|
21856
|
+
end
|
|
21857
|
+
|
|
21858
|
+
def pods
|
|
21859
|
+
main_group['Pods']
|
|
21860
|
+
end
|
|
21861
|
+
|
|
21862
|
+
def development_pods
|
|
21863
|
+
main_group['Development Pods']
|
|
21864
|
+
end
|
|
21865
|
+
|
|
21866
|
+
def pod_groups
|
|
21867
|
+
[pods, development_pods].compact.flat_map(&:children)
|
|
21868
|
+
end
|
|
21869
|
+
|
|
21870
|
+
def pod_group(pod_name)
|
|
21871
|
+
pod_groups.find { |group| group.name == pod_name }
|
|
21872
|
+
end
|
|
21873
|
+
end
|
|
21874
|
+
end
|
|
21875
|
+
`;
|
|
21876
|
+
var INSTALLER = String.raw`
|
|
21877
|
+
module Pod
|
|
21878
|
+
class Installer
|
|
21879
|
+
class Xcode
|
|
21880
|
+
class PodsProjectGenerator
|
|
21881
|
+
class TargetInstallationResult
|
|
21882
|
+
attr_reader :target, :native_target, :resource_bundle_targets, :test_native_targets,
|
|
21883
|
+
:test_resource_bundle_targets, :test_app_host_targets, :app_native_targets,
|
|
21884
|
+
:app_resource_bundle_targets
|
|
21885
|
+
|
|
21886
|
+
def initialize(target, native_target, resource_bundle_targets = [])
|
|
21887
|
+
@target = target
|
|
21888
|
+
@native_target = native_target
|
|
21889
|
+
@resource_bundle_targets = resource_bundle_targets
|
|
21890
|
+
@test_native_targets = []
|
|
21891
|
+
@test_resource_bundle_targets = {}
|
|
21892
|
+
@test_app_host_targets = []
|
|
21893
|
+
@app_native_targets = {}
|
|
21894
|
+
@app_resource_bundle_targets = {}
|
|
21895
|
+
end
|
|
21896
|
+
end
|
|
21897
|
+
|
|
21898
|
+
class InstallationResults
|
|
21899
|
+
attr_reader :pod_target_installation_results, :aggregate_target_installation_results
|
|
21900
|
+
|
|
21901
|
+
def initialize(pod_target_installation_results, aggregate_target_installation_results)
|
|
21902
|
+
@pod_target_installation_results = pod_target_installation_results
|
|
21903
|
+
@aggregate_target_installation_results = aggregate_target_installation_results
|
|
21904
|
+
end
|
|
21905
|
+
end
|
|
21906
|
+
end
|
|
21907
|
+
end
|
|
21908
|
+
|
|
21909
|
+
attr_reader :pods_project, :target_installation_results
|
|
21910
|
+
|
|
21911
|
+
def generated_projects
|
|
21912
|
+
[pods_project]
|
|
21913
|
+
end
|
|
21914
|
+
|
|
21915
|
+
def generated_pod_targets
|
|
21916
|
+
pod_targets
|
|
21917
|
+
end
|
|
21918
|
+
|
|
21919
|
+
def generated_aggregate_targets
|
|
21920
|
+
aggregate_targets
|
|
21921
|
+
end
|
|
21922
|
+
|
|
21923
|
+
# what pod install does once it has generated the Pods project
|
|
21924
|
+
def peach_install(pods_project, pod_results, aggregate_results, aggregate_xcconfigs, pod_xcconfigs, file_accessors)
|
|
21925
|
+
@pods_project = pods_project
|
|
21926
|
+
result_class = Xcode::PodsProjectGenerator::TargetInstallationResult
|
|
21927
|
+
by_label = pod_targets.each_with_object({}) { |t, h| h[t.label] = t }
|
|
21928
|
+
aggregates_by_label = aggregate_targets.each_with_object({}) { |t, h| h[t.label] = t }
|
|
21929
|
+
pods = pod_results.each_with_object({}) do |(label, (native_target, bundles)), h|
|
|
21930
|
+
h[label] = result_class.new(by_label.fetch(label), pods_project.object(native_target), bundles.map { |uuid| pods_project.object(uuid) })
|
|
21931
|
+
end
|
|
21932
|
+
aggregates = aggregate_results.each_with_object({}) do |(label, native_target), h|
|
|
21933
|
+
h[label] = result_class.new(aggregates_by_label.fetch(label), pods_project.object(native_target))
|
|
21934
|
+
end
|
|
21935
|
+
@target_installation_results = Xcode::PodsProjectGenerator::InstallationResults.new(pods, aggregates)
|
|
21936
|
+
aggregate_xcconfigs.each { |label, by_config| aggregates_by_label.fetch(label).peach_xcconfigs = by_config }
|
|
21937
|
+
pod_xcconfigs.each { |label, by_config| by_label.fetch(label).peach_xcconfigs = by_config }
|
|
21938
|
+
file_accessors.each { |label, accessors| by_label.fetch(label).peach_file_accessors = accessors }
|
|
21939
|
+
run_podfile_post_install_hooks
|
|
21940
|
+
integrate_user_project
|
|
21941
|
+
perform_post_install_actions
|
|
21942
|
+
end
|
|
21943
|
+
|
|
21944
|
+
def integrate_user_project
|
|
21945
|
+
UserProjectIntegrator.new(podfile, sandbox, Pod::Config.instance.installation_root, aggregate_targets,
|
|
21946
|
+
generated_aggregate_targets).integrate!
|
|
21947
|
+
run_podfile_post_integrate_hooks
|
|
21948
|
+
end
|
|
21949
|
+
end
|
|
21950
|
+
|
|
21951
|
+
class Target
|
|
21952
|
+
def support_files_dir
|
|
21953
|
+
sandbox.root + 'Target Support Files' + label
|
|
21954
|
+
end
|
|
21955
|
+
|
|
21956
|
+
def xcconfig_path(variant = nil)
|
|
21957
|
+
if variant
|
|
21958
|
+
support_files_dir + "#{label}.#{variant.to_s.gsub(File::SEPARATOR, '-').downcase}.xcconfig"
|
|
21959
|
+
else
|
|
21960
|
+
support_files_dir + "#{label}.xcconfig"
|
|
21961
|
+
end
|
|
21962
|
+
end
|
|
21963
|
+
end
|
|
21964
|
+
|
|
21965
|
+
class AggregateTarget
|
|
21966
|
+
attr_writer :peach_xcconfigs
|
|
21967
|
+
|
|
21968
|
+
def xcconfigs
|
|
21969
|
+
@peach_xcconfigs
|
|
21970
|
+
end
|
|
21971
|
+
|
|
21972
|
+
def build_settings(configuration_name = nil)
|
|
21973
|
+
@build_settings ||= @peach_xcconfigs.each_with_object({}) do |(name, xcconfig), by_name|
|
|
21974
|
+
by_name[name] = Target::BuildSettings::AggregateTargetSettings.new(xcconfig)
|
|
21975
|
+
end
|
|
21976
|
+
if configuration_name
|
|
21977
|
+
@build_settings[configuration_name] ||
|
|
21978
|
+
raise(ArgumentError, "#{self} does not contain a build setting for the #{configuration_name} configuration, only #{@build_settings.keys}")
|
|
21979
|
+
else
|
|
21980
|
+
@build_settings.each_value.first || raise(ArgumentError, "#{self} does not contain any build settings")
|
|
21981
|
+
end
|
|
21982
|
+
end
|
|
21983
|
+
end
|
|
21984
|
+
|
|
21985
|
+
class PodTarget
|
|
21986
|
+
attr_writer :peach_file_accessors, :peach_xcconfigs
|
|
21987
|
+
|
|
21988
|
+
def file_accessors
|
|
21989
|
+
@peach_file_accessors
|
|
21990
|
+
end
|
|
21991
|
+
|
|
21992
|
+
def build_settings
|
|
21993
|
+
@build_settings ||= @peach_xcconfigs.each_with_object({}) do |(name, xcconfig), by_name|
|
|
21994
|
+
by_name[name] = Target::BuildSettings::PodTargetSettings.new(xcconfig)
|
|
21995
|
+
end
|
|
21996
|
+
end
|
|
21997
|
+
end
|
|
21998
|
+
|
|
21999
|
+
class Target
|
|
22000
|
+
# the settings Peach computed, as the xcconfig CocoaPods writes for them
|
|
22001
|
+
class BuildSettings
|
|
22002
|
+
attr_reader :xcconfig
|
|
22003
|
+
|
|
22004
|
+
def initialize(xcconfig)
|
|
22005
|
+
@xcconfig = xcconfig
|
|
22006
|
+
end
|
|
22007
|
+
|
|
22008
|
+
class PodTargetSettings < BuildSettings; end
|
|
22009
|
+
class AggregateTargetSettings < BuildSettings; end
|
|
22010
|
+
end
|
|
22011
|
+
end
|
|
22012
|
+
|
|
22013
|
+
class Sandbox
|
|
22014
|
+
class FileAccessor
|
|
22015
|
+
attr_reader :spec, :resource_bundles
|
|
22016
|
+
|
|
22017
|
+
def initialize(spec, resource_bundles)
|
|
22018
|
+
@spec = spec
|
|
22019
|
+
@resource_bundles = resource_bundles
|
|
22020
|
+
end
|
|
22021
|
+
end
|
|
22022
|
+
end
|
|
22023
|
+
end
|
|
22024
|
+
`;
|
|
22025
|
+
|
|
22026
|
+
// src/pods-project.ts
|
|
22027
|
+
init_openstep_plist();
|
|
22028
|
+
var HEADERS = new Set(HEADER_EXTENSIONS2);
|
|
22029
|
+
var SOURCES = new Set(SOURCE_FILE_EXTENSIONS);
|
|
22030
|
+
|
|
22031
|
+
// src/pods-install.ts
|
|
22032
|
+
init_podspec_cocoapods();
|
|
22033
|
+
init_podspec_ruby();
|
|
22034
|
+
init_podspec_ruby_stdlib();
|
|
22035
|
+
var COCOAPODS_VERSION2 = "1.17.0";
|
|
22036
|
+
var INSTALL_INPUTS = String.raw`
|
|
22037
|
+
lambda do |podfile, sandbox, resolver|
|
|
22038
|
+
roots = resolver.specifications.map(&:root).uniq
|
|
22039
|
+
{
|
|
22040
|
+
'definitions' => podfile.target_definition_list.reject(&:abstract?).map do |td|
|
|
22041
|
+
{ '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 }
|
|
22042
|
+
end,
|
|
22043
|
+
'workspace' => podfile.workspace_path&.to_s,
|
|
22044
|
+
'downloads' => roots.reject { |spec| sandbox.local?(spec.name) }.map { |spec| [spec.name, spec.to_pretty_json] },
|
|
22045
|
+
'stored' => sandbox.stored_podspecs.map { |name, spec| [name, spec.to_pretty_json] },
|
|
22046
|
+
}
|
|
22047
|
+
end
|
|
22048
|
+
`;
|
|
22049
|
+
var LOCKFILE = String.raw`
|
|
22050
|
+
lambda do |podfile, sandbox, resolver|
|
|
22051
|
+
specs = resolver.specifications
|
|
22052
|
+
pods = specs.each_with_object({}) { |spec, result| (result[spec.to_s] ||= []).concat(spec.all_dependencies.map(&:to_s)) }
|
|
22053
|
+
trunk = specs.map(&:root).uniq.reject { |spec| sandbox.specification(spec.name) }.map(&:name)
|
|
22054
|
+
{
|
|
22055
|
+
'PODS' => pods.map { |name, deps| deps.empty? ? name : { name => deps.uniq } },
|
|
22056
|
+
'DEPENDENCIES' => podfile.dependencies.map(&:to_s),
|
|
22057
|
+
'SPEC REPOS' => trunk.empty? ? {} : { 'trunk' => trunk },
|
|
22058
|
+
'EXTERNAL SOURCES' => podfile.dependencies.select(&:external?).each_with_object({}) { |dep, result| result[dep.root_name] = dep.external_source },
|
|
22059
|
+
'SPEC CHECKSUMS' => specs.select(&:defined_in_file).each_with_object({}) { |spec, result| result[spec.root.name] = spec.checksum },
|
|
22060
|
+
'PODFILE CHECKSUM' => podfile.checksum,
|
|
22061
|
+
'COCOAPODS' => '${COCOAPODS_VERSION2}',
|
|
22062
|
+
}
|
|
22063
|
+
end
|
|
22064
|
+
`;
|
|
22065
|
+
|
|
18915
22066
|
// src/expo-native-workspace.ts
|
|
18916
22067
|
init_podspec_sources();
|
|
18917
22068
|
|
|
@@ -19512,7 +22663,6 @@ init_swift_root_lock();
|
|
|
19512
22663
|
init_swift_toolchain();
|
|
19513
22664
|
init_workspace_root();
|
|
19514
22665
|
init_xcode_project();
|
|
19515
|
-
var utf8Env = { ...process.env, LANG: "en_US.UTF-8", LC_ALL: "en_US.UTF-8" };
|
|
19516
22666
|
var ABANDONED_WORKSPACE_MS = 24 * 36e5;
|
|
19517
22667
|
|
|
19518
22668
|
// src/expoSwiftContract.ts
|
|
@@ -19533,8 +22683,8 @@ var IDENTITY_SOURCE_SKIPS = 1 | 4 | 8 | 16 | 32 | 64 | 128 | 4096;
|
|
|
19533
22683
|
|
|
19534
22684
|
// src/expo-swift-host.ts
|
|
19535
22685
|
var import_node_async_hooks3 = require("node:async_hooks");
|
|
19536
|
-
var
|
|
19537
|
-
var
|
|
22686
|
+
var import_node_child_process15 = require("node:child_process");
|
|
22687
|
+
var import_node_util8 = require("node:util");
|
|
19538
22688
|
init_app_project();
|
|
19539
22689
|
init_answeredNativePackages();
|
|
19540
22690
|
init_app_config();
|
|
@@ -19609,7 +22759,7 @@ init_swift_standins();
|
|
|
19609
22759
|
init_swift_submit();
|
|
19610
22760
|
init_swift_toolchain();
|
|
19611
22761
|
init_turbo_source();
|
|
19612
|
-
var run5 = (0,
|
|
22762
|
+
var run5 = (0, import_node_util8.promisify)(import_node_child_process15.execFile);
|
|
19613
22763
|
var scriptEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" };
|
|
19614
22764
|
var traceStore = new import_node_async_hooks3.AsyncLocalStorage();
|
|
19615
22765
|
var openPreparations = new NativePreparationReceipts();
|