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/vite.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;
|
|
@@ -2354,9 +2354,17 @@ module Pod
|
|
|
2354
2354
|
end
|
|
2355
2355
|
|
|
2356
2356
|
def module_name
|
|
2357
|
-
attributes_hash['module_name'] ||
|
|
2357
|
+
attributes_hash['module_name'] ||
|
|
2358
|
+
c99ext_identifier(attributes_hash['header_dir']) ||
|
|
2359
|
+
c99ext_identifier(attributes_hash['name'])
|
|
2358
2360
|
end
|
|
2359
2361
|
|
|
2362
|
+
def c99ext_identifier(name)
|
|
2363
|
+
return nil if name.nil?
|
|
2364
|
+
name.gsub(/^([0-9])/, '_\1').gsub(/[^a-zA-Z0-9_]/, '_').gsub(/_+/, '_')
|
|
2365
|
+
end
|
|
2366
|
+
private :c99ext_identifier
|
|
2367
|
+
|
|
2360
2368
|
def homepage
|
|
2361
2369
|
attributes_hash['homepage']
|
|
2362
2370
|
end
|
|
@@ -2658,7 +2666,9 @@ end
|
|
|
2658
2666
|
`],
|
|
2659
2667
|
["xcodebuild -version", `Xcode ${NATIVE_GRAPH_SDK_VERSION}
|
|
2660
2668
|
`],
|
|
2661
|
-
["/usr/sbin/sysctl -n hw.optional.arm64 2>&1", "1\n"]
|
|
2669
|
+
["/usr/sbin/sysctl -n hw.optional.arm64 2>&1", "1\n"],
|
|
2670
|
+
// peach compiles without ccache
|
|
2671
|
+
["command -v ccache", ""]
|
|
2662
2672
|
]);
|
|
2663
2673
|
}
|
|
2664
2674
|
});
|
|
@@ -4382,7 +4392,7 @@ var STANDIN_SOURCE_DIGEST;
|
|
|
4382
4392
|
var init_swift_standin_digest = __esm({
|
|
4383
4393
|
"src/swift-standin-digest.ts"() {
|
|
4384
4394
|
"use strict";
|
|
4385
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
4395
|
+
STANDIN_SOURCE_DIGEST = true ? "3475ca483b1e5005a2c76ec887310c0d0f44c91ea427496b33acbb5bf6188684" : standinSourceDigest();
|
|
4386
4396
|
}
|
|
4387
4397
|
});
|
|
4388
4398
|
|
|
@@ -4421,6 +4431,56 @@ var init_native_prebuilt = __esm({
|
|
|
4421
4431
|
}
|
|
4422
4432
|
});
|
|
4423
4433
|
|
|
4434
|
+
// src/openstep-plist.ts
|
|
4435
|
+
var init_openstep_plist = __esm({
|
|
4436
|
+
"src/openstep-plist.ts"() {
|
|
4437
|
+
"use strict";
|
|
4438
|
+
}
|
|
4439
|
+
});
|
|
4440
|
+
|
|
4441
|
+
// src/pod-sources.ts
|
|
4442
|
+
var COCOAPODS_VERSION, USER_AGENT, HEADER_EXTENSIONS, SOURCE_EXTENSIONS, SOURCE_FILES_PATTERN;
|
|
4443
|
+
var init_pod_sources = __esm({
|
|
4444
|
+
"src/pod-sources.ts"() {
|
|
4445
|
+
"use strict";
|
|
4446
|
+
init_home_paths();
|
|
4447
|
+
COCOAPODS_VERSION = "1.17.0";
|
|
4448
|
+
USER_AGENT = `'CocoaPods/${COCOAPODS_VERSION} cocoapods-downloader/2.1'`;
|
|
4449
|
+
HEADER_EXTENSIONS = [
|
|
4450
|
+
".h",
|
|
4451
|
+
".hh",
|
|
4452
|
+
".hpp",
|
|
4453
|
+
".ipp",
|
|
4454
|
+
".tpp",
|
|
4455
|
+
".hxx",
|
|
4456
|
+
".def",
|
|
4457
|
+
".inl",
|
|
4458
|
+
".inc"
|
|
4459
|
+
];
|
|
4460
|
+
SOURCE_EXTENSIONS = [
|
|
4461
|
+
".m",
|
|
4462
|
+
".mm",
|
|
4463
|
+
".i",
|
|
4464
|
+
".c",
|
|
4465
|
+
".cc",
|
|
4466
|
+
".cxx",
|
|
4467
|
+
".cpp",
|
|
4468
|
+
".c++",
|
|
4469
|
+
".swift",
|
|
4470
|
+
...HEADER_EXTENSIONS
|
|
4471
|
+
];
|
|
4472
|
+
SOURCE_FILES_PATTERN = `*{${SOURCE_EXTENSIONS.join(",")}}`;
|
|
4473
|
+
}
|
|
4474
|
+
});
|
|
4475
|
+
|
|
4476
|
+
// src/cocoapods-trunk.ts
|
|
4477
|
+
var init_cocoapods_trunk = __esm({
|
|
4478
|
+
"src/cocoapods-trunk.ts"() {
|
|
4479
|
+
"use strict";
|
|
4480
|
+
init_home_paths();
|
|
4481
|
+
}
|
|
4482
|
+
});
|
|
4483
|
+
|
|
4424
4484
|
// src/plist.ts
|
|
4425
4485
|
var import_plist;
|
|
4426
4486
|
var init_plist = __esm({
|
|
@@ -4430,13 +4490,23 @@ var init_plist = __esm({
|
|
|
4430
4490
|
}
|
|
4431
4491
|
});
|
|
4432
4492
|
|
|
4493
|
+
// src/plist-bytes.ts
|
|
4494
|
+
var import_bplist_parser;
|
|
4495
|
+
var init_plist_bytes = __esm({
|
|
4496
|
+
"src/plist-bytes.ts"() {
|
|
4497
|
+
"use strict";
|
|
4498
|
+
import_bplist_parser = __toESM(require("bplist-parser"), 1);
|
|
4499
|
+
init_plist();
|
|
4500
|
+
}
|
|
4501
|
+
});
|
|
4502
|
+
|
|
4433
4503
|
// src/bazel-project.ts
|
|
4434
|
-
var import_node_path15,
|
|
4504
|
+
var import_node_path15, import_plist3, PRODUCTS;
|
|
4435
4505
|
var init_bazel_project = __esm({
|
|
4436
4506
|
"src/bazel-project.ts"() {
|
|
4437
4507
|
"use strict";
|
|
4438
4508
|
import_node_path15 = __toESM(require("node:path"), 1);
|
|
4439
|
-
|
|
4509
|
+
import_plist3 = __toESM(require("plist"), 1);
|
|
4440
4510
|
init_is_record();
|
|
4441
4511
|
PRODUCTS = import_node_path15.default.join(".build", "peach-bazel", "Products");
|
|
4442
4512
|
}
|
|
@@ -4770,13 +4840,6 @@ var init_nativeAppIconContract = __esm({
|
|
|
4770
4840
|
}
|
|
4771
4841
|
});
|
|
4772
4842
|
|
|
4773
|
-
// src/openstep-plist.ts
|
|
4774
|
-
var init_openstep_plist = __esm({
|
|
4775
|
-
"src/openstep-plist.ts"() {
|
|
4776
|
-
"use strict";
|
|
4777
|
-
}
|
|
4778
|
-
});
|
|
4779
|
-
|
|
4780
4843
|
// src/xcode-target-members.ts
|
|
4781
4844
|
var init_xcode_target_members = __esm({
|
|
4782
4845
|
"src/xcode-target-members.ts"() {
|
|
@@ -5759,7 +5822,7 @@ var init_swift_compile = __esm({
|
|
|
5759
5822
|
FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
5760
5823
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
5761
5824
|
).join("");
|
|
5762
|
-
compilerSourceDigest = true ? "
|
|
5825
|
+
compilerSourceDigest = true ? "da253e49615973dfc65a40000574546cbf7dc4c9d44a36295773bd33442d8c1d" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
5763
5826
|
C_WORDS = new Set(
|
|
5764
5827
|
"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(
|
|
5765
5828
|
" "
|
|
@@ -5988,11 +6051,11 @@ var init_xcode_json_project = __esm({
|
|
|
5988
6051
|
});
|
|
5989
6052
|
|
|
5990
6053
|
// src/xcode-project.ts
|
|
5991
|
-
var
|
|
6054
|
+
var import_plist4, runScriptTimeoutMs;
|
|
5992
6055
|
var init_xcode_project = __esm({
|
|
5993
6056
|
"src/xcode-project.ts"() {
|
|
5994
6057
|
"use strict";
|
|
5995
|
-
|
|
6058
|
+
import_plist4 = __toESM(require("plist"), 1);
|
|
5996
6059
|
init_bazel_project();
|
|
5997
6060
|
init_is_record();
|
|
5998
6061
|
init_native_app_identity();
|
|
@@ -6042,16 +6105,6 @@ var init_nitroContract = __esm({
|
|
|
6042
6105
|
}
|
|
6043
6106
|
});
|
|
6044
6107
|
|
|
6045
|
-
// src/plist-bytes.ts
|
|
6046
|
-
var import_bplist_parser;
|
|
6047
|
-
var init_plist_bytes = __esm({
|
|
6048
|
-
"src/plist-bytes.ts"() {
|
|
6049
|
-
"use strict";
|
|
6050
|
-
import_bplist_parser = __toESM(require("bplist-parser"), 1);
|
|
6051
|
-
init_plist();
|
|
6052
|
-
}
|
|
6053
|
-
});
|
|
6054
|
-
|
|
6055
6108
|
// src/swift-xcframework.ts
|
|
6056
6109
|
var init_swift_xcframework = __esm({
|
|
6057
6110
|
"src/swift-xcframework.ts"() {
|
|
@@ -6305,7 +6358,7 @@ var init_react_native_core = __esm({
|
|
|
6305
6358
|
init_swift_distribution();
|
|
6306
6359
|
init_swift_package();
|
|
6307
6360
|
init_swiftContract();
|
|
6308
|
-
recipe = true ? "
|
|
6361
|
+
recipe = true ? "f850b012b3ddd1d19a158d194b24b05cb032a23ccf2e459caa45620c0a5a823a" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
|
|
6309
6362
|
}
|
|
6310
6363
|
});
|
|
6311
6364
|
|
|
@@ -6350,6 +6403,16 @@ var init_core_data_model = __esm({
|
|
|
6350
6403
|
}
|
|
6351
6404
|
});
|
|
6352
6405
|
|
|
6406
|
+
// src/swift-catalog-png.ts
|
|
6407
|
+
var import_pngjs, pngSignature;
|
|
6408
|
+
var init_swift_catalog_png = __esm({
|
|
6409
|
+
"src/swift-catalog-png.ts"() {
|
|
6410
|
+
"use strict";
|
|
6411
|
+
import_pngjs = require("pngjs");
|
|
6412
|
+
pngSignature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
6413
|
+
}
|
|
6414
|
+
});
|
|
6415
|
+
|
|
6353
6416
|
// src/swift-cxx-reachable.ts
|
|
6354
6417
|
var init_swift_cxx_reachable = __esm({
|
|
6355
6418
|
"src/swift-cxx-reachable.ts"() {
|
|
@@ -6424,6 +6487,7 @@ var init_swift_host = __esm({
|
|
|
6424
6487
|
init_plist();
|
|
6425
6488
|
init_prepared_xcode_phases();
|
|
6426
6489
|
init_swift_binary_modules();
|
|
6490
|
+
init_swift_catalog_png();
|
|
6427
6491
|
init_swift_compile();
|
|
6428
6492
|
init_xcode_assets();
|
|
6429
6493
|
init_swift_cxx_reachable();
|
|
@@ -6449,14 +6513,6 @@ var init_swift_host = __esm({
|
|
|
6449
6513
|
}
|
|
6450
6514
|
});
|
|
6451
6515
|
|
|
6452
|
-
// src/cocoapods-trunk.ts
|
|
6453
|
-
var init_cocoapods_trunk = __esm({
|
|
6454
|
-
"src/cocoapods-trunk.ts"() {
|
|
6455
|
-
"use strict";
|
|
6456
|
-
init_home_paths();
|
|
6457
|
-
}
|
|
6458
|
-
});
|
|
6459
|
-
|
|
6460
6516
|
// src/installed-native-libraries.ts
|
|
6461
6517
|
var init_installed_native_libraries = __esm({
|
|
6462
6518
|
"src/installed-native-libraries.ts"() {
|
|
@@ -6485,15 +6541,12 @@ var init_turbo_codegen_intake = __esm({
|
|
|
6485
6541
|
});
|
|
6486
6542
|
|
|
6487
6543
|
// src/turbo-source.ts
|
|
6488
|
-
var import_node_child_process12, import_node_util8, execFileAsync3;
|
|
6489
6544
|
var init_turbo_source = __esm({
|
|
6490
6545
|
"src/turbo-source.ts"() {
|
|
6491
6546
|
"use strict";
|
|
6492
|
-
import_node_child_process12 = require("node:child_process");
|
|
6493
|
-
import_node_util8 = require("node:util");
|
|
6494
6547
|
init_cocoapods_trunk();
|
|
6495
|
-
init_home_paths();
|
|
6496
6548
|
init_installed_native_libraries();
|
|
6549
|
+
init_pod_sources();
|
|
6497
6550
|
init_answeredNativePackages();
|
|
6498
6551
|
init_expo_autolinking();
|
|
6499
6552
|
init_nitro_dependencies();
|
|
@@ -6504,7 +6557,6 @@ var init_turbo_source = __esm({
|
|
|
6504
6557
|
init_swiftContract();
|
|
6505
6558
|
init_turbo_codegen_intake();
|
|
6506
6559
|
init_xcode_project();
|
|
6507
|
-
execFileAsync3 = (0, import_node_util8.promisify)(import_node_child_process12.execFile);
|
|
6508
6560
|
}
|
|
6509
6561
|
});
|
|
6510
6562
|
|
|
@@ -12179,7 +12231,7 @@ init_answeredNativePackages();
|
|
|
12179
12231
|
init_expo_autolinking();
|
|
12180
12232
|
|
|
12181
12233
|
// src/expo-native-prebuilt.ts
|
|
12182
|
-
var
|
|
12234
|
+
var import_plist7 = __toESM(require("plist"), 1);
|
|
12183
12235
|
init_answeredNativePackages();
|
|
12184
12236
|
|
|
12185
12237
|
// src/expo-native-compiler-digest.ts
|
|
@@ -12213,163 +12265,3261 @@ init_bundle_global_footer();
|
|
|
12213
12265
|
init_is_record();
|
|
12214
12266
|
init_swiftContract();
|
|
12215
12267
|
|
|
12216
|
-
// src/
|
|
12217
|
-
|
|
12268
|
+
// src/pods-install.ts
|
|
12269
|
+
init_openstep_plist();
|
|
12270
|
+
|
|
12271
|
+
// src/pbx-table.ts
|
|
12272
|
+
init_openstep_plist();
|
|
12273
|
+
var ARRAY_SETTINGS = /* @__PURE__ */ new Set([
|
|
12274
|
+
"ALTERNATE_PERMISSIONS_FILES",
|
|
12275
|
+
"ARCHS",
|
|
12276
|
+
"BUILD_VARIANTS",
|
|
12277
|
+
"EXCLUDED_SOURCE_FILE_NAMES",
|
|
12278
|
+
"FRAMEWORK_SEARCH_PATHS",
|
|
12279
|
+
"GCC_PREPROCESSOR_DEFINITIONS",
|
|
12280
|
+
"GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS",
|
|
12281
|
+
"HEADER_SEARCH_PATHS",
|
|
12282
|
+
"INCLUDED_SOURCE_FILE_NAMES",
|
|
12283
|
+
"INFOPLIST_PREPROCESSOR_DEFINITIONS",
|
|
12284
|
+
"LD_RUNPATH_SEARCH_PATHS",
|
|
12285
|
+
"LIBRARY_SEARCH_PATHS",
|
|
12286
|
+
"LOCALIZED_STRING_MACRO_NAMES",
|
|
12287
|
+
"OTHER_CFLAGS",
|
|
12288
|
+
"OTHER_CPLUSPLUSFLAGS",
|
|
12289
|
+
"OTHER_LDFLAGS",
|
|
12290
|
+
"REZ_SEARCH_PATHS",
|
|
12291
|
+
"SECTORDER_FLAGS",
|
|
12292
|
+
"SYSTEM_FRAMEWORK_SEARCH_PATHS",
|
|
12293
|
+
"SYSTEM_HEADER_SEARCH_PATHS",
|
|
12294
|
+
"USER_HEADER_SEARCH_PATHS",
|
|
12295
|
+
"WARNING_CFLAGS",
|
|
12296
|
+
"WARNING_LDFLAGS"
|
|
12297
|
+
]);
|
|
12298
|
+
var LEGACY_ARRAY_SETTINGS = new Set(
|
|
12299
|
+
[...ARRAY_SETTINGS].filter(
|
|
12300
|
+
(key) => ![
|
|
12301
|
+
"INCLUDED_SOURCE_FILE_NAMES",
|
|
12302
|
+
"LD_RUNPATH_SEARCH_PATHS",
|
|
12303
|
+
"LOCALIZED_STRING_MACRO_NAMES",
|
|
12304
|
+
"SYSTEM_FRAMEWORK_SEARCH_PATHS",
|
|
12305
|
+
"SYSTEM_HEADER_SEARCH_PATHS",
|
|
12306
|
+
"USER_HEADER_SEARCH_PATHS"
|
|
12307
|
+
].includes(key)
|
|
12308
|
+
)
|
|
12309
|
+
);
|
|
12218
12310
|
|
|
12219
|
-
// src/
|
|
12220
|
-
|
|
12311
|
+
// src/pods-install.ts
|
|
12312
|
+
init_pod_sources();
|
|
12221
12313
|
|
|
12222
|
-
// src/
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
12314
|
+
// src/podfile-cocoapods.ts
|
|
12315
|
+
init_cocoapods_trunk();
|
|
12316
|
+
init_podspec_cocoapods();
|
|
12317
|
+
init_podspec_ruby();
|
|
12318
|
+
init_podspec_ruby_stdlib();
|
|
12319
|
+
var PODFILE = String.raw`
|
|
12320
|
+
module Pod
|
|
12321
|
+
class BuildType
|
|
12322
|
+
KNOWN_PACKAGING_OPTIONS = { :library => [:static, :dynamic], :framework => [:static, :dynamic] }.freeze
|
|
12323
|
+
attr_reader :packaging, :linkage
|
|
12324
|
+
def initialize(linkage: :static, packaging: :library)
|
|
12325
|
+
raise ArgumentError, "Invalid linkage option #{linkage.inspect}, valid options are #{KNOWN_PACKAGING_OPTIONS[packaging].inspect}" unless KNOWN_PACKAGING_OPTIONS[packaging].include?(linkage)
|
|
12326
|
+
@packaging = packaging
|
|
12327
|
+
@linkage = linkage
|
|
12328
|
+
end
|
|
12329
|
+
def self.dynamic_library; new(:linkage => :dynamic, :packaging => :library); end
|
|
12330
|
+
def self.static_library; new(:linkage => :static, :packaging => :library); end
|
|
12331
|
+
def self.dynamic_framework; new(:linkage => :dynamic, :packaging => :framework); end
|
|
12332
|
+
def self.static_framework; new(:linkage => :static, :packaging => :framework); end
|
|
12333
|
+
def dynamic?; linkage == :dynamic; end
|
|
12334
|
+
def static?; linkage == :static; end
|
|
12335
|
+
def framework?; packaging == :framework; end
|
|
12336
|
+
def library?; packaging == :library; end
|
|
12337
|
+
def dynamic_framework?; dynamic? && framework?; end
|
|
12338
|
+
def dynamic_library?; dynamic? && library?; end
|
|
12339
|
+
def static_framework?; static? && framework?; end
|
|
12340
|
+
def static_library?; static? && library?; end
|
|
12341
|
+
def to_s
|
|
12342
|
+
"#{linkage} #{packaging}"
|
|
12343
|
+
end
|
|
12344
|
+
def to_hash
|
|
12345
|
+
{ :linkage => linkage, :packaging => packaging }
|
|
12346
|
+
end
|
|
12347
|
+
def ==(other)
|
|
12348
|
+
linkage == other.linkage && packaging == other.packaging
|
|
12349
|
+
end
|
|
12350
|
+
end
|
|
12226
12351
|
|
|
12227
|
-
|
|
12228
|
-
|
|
12352
|
+
class Sandbox
|
|
12353
|
+
attr_reader :root, :stored_podspecs
|
|
12354
|
+
def initialize(root)
|
|
12355
|
+
@root = Pathname.new(root)
|
|
12356
|
+
@stored_podspecs = {}
|
|
12357
|
+
@local_paths = {}
|
|
12358
|
+
end
|
|
12359
|
+
def specifications_root
|
|
12360
|
+
root + 'Local Podspecs'
|
|
12361
|
+
end
|
|
12362
|
+
def specification(name)
|
|
12363
|
+
@stored_podspecs[Specification.root_name(name)]
|
|
12364
|
+
end
|
|
12365
|
+
def store_local_path(name, path, was_absolute = false)
|
|
12366
|
+
@local_paths[Specification.root_name(name)] = [path.dirname, was_absolute]
|
|
12367
|
+
end
|
|
12368
|
+
def local_path(name)
|
|
12369
|
+
@local_paths[Specification.root_name(name)]&.first
|
|
12370
|
+
end
|
|
12371
|
+
def local?(name)
|
|
12372
|
+
@local_paths.key?(Specification.root_name(name))
|
|
12373
|
+
end
|
|
12374
|
+
def development_pods
|
|
12375
|
+
@local_paths.transform_values(&:first)
|
|
12376
|
+
end
|
|
12377
|
+
def store_podspec(name, podspec, _external_source = false, json = false)
|
|
12378
|
+
file_name = json ? "#{name}.podspec.json" : "#{name}.podspec"
|
|
12379
|
+
output_path = specifications_root + file_name
|
|
12380
|
+
spec = case podspec
|
|
12381
|
+
when Specification
|
|
12382
|
+
raise ArgumentError, 'can only store Specification objects as json' unless json
|
|
12383
|
+
# the checksum of the JSON CocoaPods writes to output_path
|
|
12384
|
+
podspec.dup.tap { |stored| stored.instance_variable_set(:@checksum, Digest::SHA1.hexdigest(podspec.to_pretty_json)) }
|
|
12385
|
+
else
|
|
12386
|
+
raise ArgumentError, "Peach stores only evaluated podspecs, not #{podspec.inspect}"
|
|
12387
|
+
end
|
|
12388
|
+
spec.defined_in_file = output_path
|
|
12389
|
+
unless spec.name == name
|
|
12390
|
+
raise Informative, "The name of the given podspec '#{spec.name}' doesn't match the expected one '#{name}'"
|
|
12391
|
+
end
|
|
12392
|
+
@stored_podspecs[spec.name] = spec
|
|
12393
|
+
end
|
|
12394
|
+
end
|
|
12229
12395
|
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12233
|
-
|
|
12396
|
+
class Installer
|
|
12397
|
+
attr_reader :sandbox, :podfile, :lockfile
|
|
12398
|
+
attr_accessor :pod_targets, :aggregate_targets
|
|
12399
|
+
def initialize(sandbox, podfile, lockfile = nil)
|
|
12400
|
+
@sandbox = sandbox
|
|
12401
|
+
@podfile = podfile
|
|
12402
|
+
@lockfile = lockfile
|
|
12403
|
+
@pod_targets = []
|
|
12404
|
+
@aggregate_targets = []
|
|
12405
|
+
end
|
|
12234
12406
|
|
|
12235
|
-
|
|
12236
|
-
init_expo_autolinking();
|
|
12237
|
-
init_forked_script_contract();
|
|
12238
|
-
init_is_record();
|
|
12239
|
-
init_nitro_source();
|
|
12407
|
+
private
|
|
12240
12408
|
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
init_swift_distribution();
|
|
12409
|
+
def run_podfile_pre_install_hooks
|
|
12410
|
+
podfile.pre_install!(self)
|
|
12411
|
+
end
|
|
12245
12412
|
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
init_swift_root_lock();
|
|
12250
|
-
init_swift_toolchain();
|
|
12251
|
-
init_workspace_root();
|
|
12252
|
-
init_xcode_project();
|
|
12253
|
-
var utf8Env = { ...process.env, LANG: "en_US.UTF-8", LC_ALL: "en_US.UTF-8" };
|
|
12254
|
-
var ABANDONED_WORKSPACE_MS = 24 * 36e5;
|
|
12413
|
+
def run_podfile_post_install_hooks
|
|
12414
|
+
podfile.post_install!(self)
|
|
12415
|
+
end
|
|
12255
12416
|
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
init_native_app_identity();
|
|
12260
|
-
init_swiftContract();
|
|
12417
|
+
def run_podfile_post_integrate_hooks
|
|
12418
|
+
podfile.post_integrate!(self)
|
|
12419
|
+
end
|
|
12261
12420
|
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
init_native_app_identity_project();
|
|
12266
|
-
init_native_prebuilt();
|
|
12267
|
-
init_nitroContract();
|
|
12268
|
-
init_swift_native_pin();
|
|
12269
|
-
init_xcode_project();
|
|
12270
|
-
var IDENTITY_SOURCE_SKIPS = 1 | 4 | 8 | 16 | 32 | 64 | 128 | 4096;
|
|
12421
|
+
# upstream runs plugin hooks and prints warnings here; Peach loads no plugins
|
|
12422
|
+
def perform_post_install_actions
|
|
12423
|
+
end
|
|
12271
12424
|
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12425
|
+
# the workspace, deintegration of targets the Podfile dropped and the
|
|
12426
|
+
# override warnings are left out: Peach builds from the projects in memory
|
|
12427
|
+
class UserProjectIntegrator
|
|
12428
|
+
attr_reader :podfile, :sandbox, :installation_root, :targets, :targets_to_integrate, :use_input_output_paths
|
|
12429
|
+
alias use_input_output_paths? use_input_output_paths
|
|
12430
|
+
|
|
12431
|
+
def initialize(podfile, sandbox, installation_root, targets, targets_to_integrate, use_input_output_paths: true)
|
|
12432
|
+
@podfile = podfile
|
|
12433
|
+
@sandbox = sandbox
|
|
12434
|
+
@installation_root = installation_root
|
|
12435
|
+
@targets = targets
|
|
12436
|
+
@targets_to_integrate = targets_to_integrate
|
|
12437
|
+
@use_input_output_paths = use_input_output_paths
|
|
12438
|
+
end
|
|
12278
12439
|
|
|
12279
|
-
|
|
12280
|
-
|
|
12440
|
+
def integrate!
|
|
12441
|
+
integrate_user_targets
|
|
12442
|
+
save_projects(user_projects_to_integrate)
|
|
12443
|
+
end
|
|
12281
12444
|
|
|
12282
|
-
|
|
12283
|
-
init_public_brand();
|
|
12445
|
+
private
|
|
12284
12446
|
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
init_native_app_identity();
|
|
12289
|
-
init_swift_toolchain();
|
|
12290
|
-
init_swiftContract();
|
|
12291
|
-
var EXPIRY_MS = 7 * 24 * 36e5;
|
|
12292
|
-
var ORPHAN_TEMPORARY_MS = 24 * 36e5;
|
|
12293
|
-
var MISSING_TREE = "0".repeat(64);
|
|
12447
|
+
def integrate_user_targets
|
|
12448
|
+
Peach::Pods.integrate_user_targets(targets_to_integrate.sort_by(&:name).map(&:label))
|
|
12449
|
+
end
|
|
12294
12450
|
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
init_is_record();
|
|
12451
|
+
def user_projects_to_integrate
|
|
12452
|
+
targets_to_integrate.map(&:user_project).compact.uniq
|
|
12453
|
+
end
|
|
12299
12454
|
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
store(owner, token, value) {
|
|
12306
|
-
if (!token) return;
|
|
12307
|
-
const previous = this.receipts.get(token);
|
|
12308
|
-
if (previous) (0, import_node_timers.clearTimeout)(previous.expiry);
|
|
12309
|
-
const expiry = setTimeoutNode(() => this.receipts.delete(token), 30 * 60 * 1e3);
|
|
12310
|
-
expiry.unref();
|
|
12311
|
-
this.receipts.set(token, { owner, value, expiry });
|
|
12312
|
-
}
|
|
12313
|
-
take(owner, token) {
|
|
12314
|
-
if (!token) return;
|
|
12315
|
-
const receipt = this.receipts.get(token);
|
|
12316
|
-
if (!receipt || receipt.owner !== owner) return;
|
|
12317
|
-
this.receipts.delete(token);
|
|
12318
|
-
(0, import_node_timers.clearTimeout)(receipt.expiry);
|
|
12319
|
-
return { value: receipt.value };
|
|
12320
|
-
}
|
|
12321
|
-
};
|
|
12455
|
+
def save_projects(projects)
|
|
12456
|
+
projects.each(&:save)
|
|
12457
|
+
end
|
|
12458
|
+
end
|
|
12459
|
+
end
|
|
12322
12460
|
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
|
|
12461
|
+
class Specification
|
|
12462
|
+
SCRIPT_PHASE_REQUIRED_KEYS = [:name, :script].freeze
|
|
12463
|
+
SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :input_file_lists, :output_file_lists,
|
|
12464
|
+
:show_env_vars_in_log, :execution_position, :dependency_file, :always_out_of_date].freeze
|
|
12465
|
+
EXECUTION_POSITION_KEYS = [:before_compile, :after_compile, :before_headers, :after_headers, :any].freeze
|
|
12466
|
+
ALL_SCRIPT_PHASE_KEYS = (SCRIPT_PHASE_REQUIRED_KEYS + SCRIPT_PHASE_OPTIONAL_KEYS).freeze
|
|
12467
|
+
|
|
12468
|
+
def defined_in_file
|
|
12469
|
+
root? ? @defined_in_file : root.defined_in_file
|
|
12470
|
+
end
|
|
12326
12471
|
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
init_swiftContract();
|
|
12332
|
-
init_xcode_project();
|
|
12472
|
+
def defined_in_file=(file)
|
|
12473
|
+
raise StandardError, 'Defined in file can be set only for root specs.' unless root?
|
|
12474
|
+
@defined_in_file = file
|
|
12475
|
+
end
|
|
12333
12476
|
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
init_swift_package();
|
|
12342
|
-
init_swift_root_lock();
|
|
12343
|
-
init_swift_standins();
|
|
12344
|
-
init_swift_submit();
|
|
12345
|
-
init_swift_toolchain();
|
|
12346
|
-
init_turbo_source();
|
|
12347
|
-
var run5 = (0, import_node_util9.promisify)(import_node_child_process13.execFile);
|
|
12348
|
-
var scriptEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" };
|
|
12349
|
-
var traceStore = new import_node_async_hooks3.AsyncLocalStorage();
|
|
12350
|
-
var openPreparations = new NativePreparationReceipts();
|
|
12477
|
+
def self.root_name(full_name)
|
|
12478
|
+
if full_name[0] == '/'
|
|
12479
|
+
full_name.split('/', 3).first(2).join('/')
|
|
12480
|
+
else
|
|
12481
|
+
full_name.split('/', 2).first
|
|
12482
|
+
end
|
|
12483
|
+
end
|
|
12351
12484
|
|
|
12352
|
-
|
|
12353
|
-
|
|
12485
|
+
def self.from_json(json, path = nil)
|
|
12486
|
+
from_hash(JSON.parse(json)).tap { |spec| spec.defined_in_file = path }
|
|
12487
|
+
end
|
|
12354
12488
|
|
|
12355
|
-
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12489
|
+
def ==(other)
|
|
12490
|
+
other.is_a?(self.class) && name == other.name && version == other.version
|
|
12491
|
+
end
|
|
12492
|
+
alias_method :eql?, :==
|
|
12493
|
+
|
|
12494
|
+
def hash
|
|
12495
|
+
(name.hash * 53) ^ version.hash
|
|
12496
|
+
end
|
|
12497
|
+
|
|
12498
|
+
def test_specs
|
|
12499
|
+
subspecs.select(&:test_specification?)
|
|
12500
|
+
end
|
|
12501
|
+
|
|
12502
|
+
def app_specs
|
|
12503
|
+
subspecs.select(&:app_specification?)
|
|
12504
|
+
end
|
|
12505
|
+
|
|
12506
|
+
def recursive_subspecs
|
|
12507
|
+
mapper = lambda do |spec|
|
|
12508
|
+
spec.subspecs.map do |subspec|
|
|
12509
|
+
[subspec, *mapper.call(subspec)]
|
|
12510
|
+
end.flatten
|
|
12511
|
+
end
|
|
12512
|
+
mapper.call(self)
|
|
12513
|
+
end
|
|
12514
|
+
|
|
12515
|
+
def all_dependencies(platform = nil)
|
|
12516
|
+
dependencies(platform) + subspec_dependencies(platform)
|
|
12517
|
+
end
|
|
12518
|
+
|
|
12519
|
+
def subspec_dependencies(platform = nil)
|
|
12520
|
+
specs = if default_subspecs.empty?
|
|
12521
|
+
subspecs.compact.reject(&:non_library_specification?)
|
|
12522
|
+
else
|
|
12523
|
+
default_subspecs.map do |subspec_name|
|
|
12524
|
+
root.subspec_by_name("#{name}/#{subspec_name}")
|
|
12525
|
+
end
|
|
12526
|
+
end
|
|
12527
|
+
if platform
|
|
12528
|
+
specs = specs.select { |s| s.supported_on_platform?(platform) }
|
|
12529
|
+
end
|
|
12530
|
+
specs.map { |s| Dependency.new(s.name, version) }
|
|
12531
|
+
end
|
|
12532
|
+
|
|
12533
|
+
def supported_on_platform?(platform, target = nil)
|
|
12534
|
+
platform = Platform.new(platform, target) unless platform.is_a?(Platform)
|
|
12535
|
+
available_platforms.any? { |available| platform.supports?(available) }
|
|
12536
|
+
end
|
|
12537
|
+
|
|
12538
|
+
def to_pretty_json(*a)
|
|
12539
|
+
JSON.pretty_generate(to_hash, *a) << "\n"
|
|
12540
|
+
end
|
|
12541
|
+
|
|
12542
|
+
def checksum
|
|
12543
|
+
@checksum ||= begin
|
|
12544
|
+
if root?
|
|
12545
|
+
unless defined_in_file.nil?
|
|
12546
|
+
require 'digest'
|
|
12547
|
+
checksum = Digest::SHA1.hexdigest(File.read(defined_in_file))
|
|
12548
|
+
checksum = checksum.encode('UTF-8') if checksum.respond_to?(:encode)
|
|
12549
|
+
checksum
|
|
12550
|
+
end
|
|
12551
|
+
else
|
|
12552
|
+
root.checksum
|
|
12553
|
+
end
|
|
12554
|
+
end
|
|
12555
|
+
end
|
|
12556
|
+
end
|
|
12557
|
+
|
|
12558
|
+
class Podfile
|
|
12559
|
+
class StandardError < ::StandardError; end
|
|
12560
|
+
|
|
12561
|
+
module DSL
|
|
12562
|
+
def install!(installation_method, options = {})
|
|
12563
|
+
unless current_target_definition.root?
|
|
12564
|
+
raise Informative, 'The installation method can only be set at the root level of the Podfile.'
|
|
12565
|
+
end
|
|
12566
|
+
set_hash_value('installation_method', 'name' => installation_method, 'options' => options)
|
|
12567
|
+
end
|
|
12568
|
+
|
|
12569
|
+
# checks the Bundler running CocoaPods; Peach runs neither
|
|
12570
|
+
def ensure_bundler!(version = '>= 0')
|
|
12571
|
+
end
|
|
12572
|
+
|
|
12573
|
+
def pod(name = nil, *requirements)
|
|
12574
|
+
unless name
|
|
12575
|
+
raise StandardError, 'A dependency requires a name.'
|
|
12576
|
+
end
|
|
12577
|
+
if block_given?
|
|
12578
|
+
raise StandardError, "A block was passed to pod #{name}, which is not supported."
|
|
12579
|
+
end
|
|
12580
|
+
current_target_definition.store_pod(name, *requirements)
|
|
12581
|
+
end
|
|
12582
|
+
|
|
12583
|
+
def podspec(options = nil)
|
|
12584
|
+
current_target_definition.store_podspec(options)
|
|
12585
|
+
end
|
|
12586
|
+
|
|
12587
|
+
def target(name, options = nil)
|
|
12588
|
+
if options
|
|
12589
|
+
raise Informative, "Unsupported options #{options} for target #{name}."
|
|
12590
|
+
end
|
|
12591
|
+
parent = current_target_definition
|
|
12592
|
+
definition = TargetDefinition.new(name, parent)
|
|
12593
|
+
self.current_target_definition = definition
|
|
12594
|
+
yield if block_given?
|
|
12595
|
+
ensure
|
|
12596
|
+
self.current_target_definition = parent
|
|
12597
|
+
end
|
|
12598
|
+
|
|
12599
|
+
def script_phase(options)
|
|
12600
|
+
raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?
|
|
12601
|
+
raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?
|
|
12602
|
+
current_target_definition.store_script_phase(options)
|
|
12603
|
+
end
|
|
12604
|
+
|
|
12605
|
+
def abstract_target(name)
|
|
12606
|
+
target(name) do
|
|
12607
|
+
abstract!
|
|
12608
|
+
yield if block_given?
|
|
12609
|
+
end
|
|
12610
|
+
end
|
|
12611
|
+
|
|
12612
|
+
def abstract!(abstract = true)
|
|
12613
|
+
current_target_definition.abstract = abstract
|
|
12614
|
+
end
|
|
12615
|
+
|
|
12616
|
+
def inherit!(inheritance)
|
|
12617
|
+
current_target_definition.inheritance = inheritance
|
|
12618
|
+
end
|
|
12619
|
+
|
|
12620
|
+
def platform(name, target = nil)
|
|
12621
|
+
current_target_definition.set_platform!(name, target)
|
|
12622
|
+
end
|
|
12623
|
+
|
|
12624
|
+
def project(path, build_configurations = {})
|
|
12625
|
+
current_target_definition.user_project_path = path
|
|
12626
|
+
current_target_definition.build_configurations = build_configurations
|
|
12627
|
+
end
|
|
12628
|
+
|
|
12629
|
+
def inhibit_all_warnings!
|
|
12630
|
+
current_target_definition.inhibit_all_warnings = true
|
|
12631
|
+
end
|
|
12632
|
+
|
|
12633
|
+
def use_modular_headers!
|
|
12634
|
+
current_target_definition.use_modular_headers_for_all_pods = true
|
|
12635
|
+
end
|
|
12636
|
+
|
|
12637
|
+
def use_frameworks!(option = true)
|
|
12638
|
+
current_target_definition.use_frameworks!(option)
|
|
12639
|
+
end
|
|
12640
|
+
|
|
12641
|
+
def supports_swift_versions(*requirements)
|
|
12642
|
+
current_target_definition.store_swift_version_requirements(*requirements)
|
|
12643
|
+
end
|
|
12644
|
+
|
|
12645
|
+
def workspace(path)
|
|
12646
|
+
set_hash_value('workspace', path)
|
|
12647
|
+
end
|
|
12648
|
+
|
|
12649
|
+
def generate_bridge_support!
|
|
12650
|
+
set_hash_value('generate_bridge_support', true)
|
|
12651
|
+
end
|
|
12652
|
+
|
|
12653
|
+
def set_arc_compatibility_flag!
|
|
12654
|
+
set_hash_value('set_arc_compatibility_flag', true)
|
|
12655
|
+
end
|
|
12656
|
+
|
|
12657
|
+
def source(source)
|
|
12658
|
+
hash_sources = get_hash_value('sources') || []
|
|
12659
|
+
hash_sources << source
|
|
12660
|
+
set_hash_value('sources', hash_sources.uniq)
|
|
12661
|
+
end
|
|
12662
|
+
|
|
12663
|
+
def plugin(name, options = {})
|
|
12664
|
+
hash_plugins = get_hash_value('plugins') || {}
|
|
12665
|
+
(hash_plugins[name] ||= {}).merge!(options)
|
|
12666
|
+
set_hash_value('plugins', hash_plugins)
|
|
12667
|
+
end
|
|
12668
|
+
|
|
12669
|
+
def pre_install(&block)
|
|
12670
|
+
@pre_install_callback = block
|
|
12671
|
+
end
|
|
12672
|
+
|
|
12673
|
+
def pre_integrate(&block)
|
|
12674
|
+
@pre_integrate_callback = block
|
|
12675
|
+
end
|
|
12676
|
+
|
|
12677
|
+
def post_install(&block)
|
|
12678
|
+
@post_install_callback = block
|
|
12679
|
+
end
|
|
12680
|
+
|
|
12681
|
+
def post_integrate(&block)
|
|
12682
|
+
@post_integrate_callback = block
|
|
12683
|
+
end
|
|
12684
|
+
end
|
|
12685
|
+
|
|
12686
|
+
include DSL
|
|
12687
|
+
|
|
12688
|
+
HASH_KEYS = %w(installation_method workspace sources plugins set_arc_compatibility_flag generate_bridge_support target_definitions).freeze
|
|
12689
|
+
|
|
12690
|
+
attr_accessor :defined_in_file
|
|
12691
|
+
attr_accessor :current_target_definition
|
|
12692
|
+
attr_reader :internal_hash
|
|
12693
|
+
|
|
12694
|
+
def initialize(defined_in_file = nil, internal_hash = {})
|
|
12695
|
+
@defined_in_file = defined_in_file
|
|
12696
|
+
@internal_hash = internal_hash
|
|
12697
|
+
default_target_def = TargetDefinition.new('Pods', self)
|
|
12698
|
+
default_target_def.abstract = true
|
|
12699
|
+
@root_target_definitions = [default_target_def]
|
|
12700
|
+
@current_target_definition = default_target_def
|
|
12701
|
+
end
|
|
12702
|
+
|
|
12703
|
+
def to_s
|
|
12704
|
+
'Podfile'
|
|
12705
|
+
end
|
|
12706
|
+
|
|
12707
|
+
def target_definitions
|
|
12708
|
+
Hash[target_definition_list.map { |td| [td.name, td] }]
|
|
12709
|
+
end
|
|
12710
|
+
|
|
12711
|
+
def target_definition_list
|
|
12712
|
+
root_target_definitions.map { |td| [td, td.recursive_children] }.flatten
|
|
12713
|
+
end
|
|
12714
|
+
|
|
12715
|
+
attr_accessor :root_target_definitions
|
|
12716
|
+
|
|
12717
|
+
def dependencies
|
|
12718
|
+
target_definition_list.map(&:dependencies).flatten.uniq
|
|
12719
|
+
end
|
|
12720
|
+
|
|
12721
|
+
def checksum
|
|
12722
|
+
@checksum ||= Digest::SHA1.hexdigest(File.read(defined_in_file)) unless defined_in_file.nil?
|
|
12723
|
+
end
|
|
12724
|
+
|
|
12725
|
+
def workspace_path
|
|
12726
|
+
path = get_hash_value('workspace')
|
|
12727
|
+
if path
|
|
12728
|
+
if File.extname(path) == '.xcworkspace'
|
|
12729
|
+
path
|
|
12730
|
+
else
|
|
12731
|
+
"#{path}.xcworkspace"
|
|
12732
|
+
end
|
|
12733
|
+
end
|
|
12734
|
+
end
|
|
12735
|
+
|
|
12736
|
+
def generate_bridge_support?
|
|
12737
|
+
get_hash_value('generate_bridge_support')
|
|
12738
|
+
end
|
|
12739
|
+
|
|
12740
|
+
def set_arc_compatibility_flag?
|
|
12741
|
+
get_hash_value('set_arc_compatibility_flag')
|
|
12742
|
+
end
|
|
12743
|
+
|
|
12744
|
+
def installation_method
|
|
12745
|
+
get_hash_value('installation_method', 'name' => 'cocoapods', 'options' => {}).values_at('name', 'options')
|
|
12746
|
+
end
|
|
12747
|
+
|
|
12748
|
+
def sources
|
|
12749
|
+
get_hash_value('sources') || []
|
|
12750
|
+
end
|
|
12751
|
+
|
|
12752
|
+
def plugins
|
|
12753
|
+
get_hash_value('plugins') || {}
|
|
12754
|
+
end
|
|
12755
|
+
|
|
12756
|
+
def to_hash
|
|
12757
|
+
hash = {}
|
|
12758
|
+
hash['target_definitions'] = root_target_definitions.map(&:to_hash)
|
|
12759
|
+
hash.merge!(internal_hash)
|
|
12760
|
+
hash
|
|
12761
|
+
end
|
|
12762
|
+
|
|
12763
|
+
def pre_install!(installer)
|
|
12764
|
+
@pre_install_callback ? @pre_install_callback.call(installer) || true : false
|
|
12765
|
+
end
|
|
12766
|
+
|
|
12767
|
+
def post_install!(installer)
|
|
12768
|
+
@post_install_callback ? @post_install_callback.call(installer) || true : false
|
|
12769
|
+
end
|
|
12770
|
+
|
|
12771
|
+
def post_integrate!(installer)
|
|
12772
|
+
@post_integrate_callback ? @post_integrate_callback.call(installer) || true : false
|
|
12773
|
+
end
|
|
12774
|
+
|
|
12775
|
+
def set_hash_value(key, value)
|
|
12776
|
+
raise StandardError, "Unsupported hash key '#{key}'" unless HASH_KEYS.include?(key)
|
|
12777
|
+
internal_hash[key] = value
|
|
12778
|
+
end
|
|
12779
|
+
|
|
12780
|
+
def get_hash_value(key, default = nil)
|
|
12781
|
+
raise StandardError, "Unsupported hash key '#{key}'" unless HASH_KEYS.include?(key)
|
|
12782
|
+
internal_hash.fetch(key, default)
|
|
12783
|
+
end
|
|
12784
|
+
|
|
12785
|
+
class TargetDefinition
|
|
12786
|
+
attr_reader :parent
|
|
12787
|
+
attr_reader :internal_hash
|
|
12788
|
+
attr_accessor :children
|
|
12789
|
+
|
|
12790
|
+
HASH_KEYS = %w(
|
|
12791
|
+
name platform podspecs exclusive link_with link_with_first_target inhibit_warnings use_modular_headers
|
|
12792
|
+
user_project_path build_configurations project_names dependencies script_phases children
|
|
12793
|
+
configuration_pod_whitelist uses_frameworks swift_version_requirements inheritance abstract swift_version
|
|
12794
|
+
).freeze
|
|
12795
|
+
|
|
12796
|
+
def initialize(name, parent, internal_hash = nil)
|
|
12797
|
+
@internal_hash = internal_hash || {}
|
|
12798
|
+
@parent = parent
|
|
12799
|
+
@children = []
|
|
12800
|
+
@label = nil
|
|
12801
|
+
self.name ||= name
|
|
12802
|
+
if parent.is_a?(TargetDefinition)
|
|
12803
|
+
parent.children << self
|
|
12804
|
+
end
|
|
12805
|
+
end
|
|
12806
|
+
|
|
12807
|
+
def recursive_children
|
|
12808
|
+
(children + children.map(&:recursive_children)).flatten
|
|
12809
|
+
end
|
|
12810
|
+
|
|
12811
|
+
def root?
|
|
12812
|
+
parent.is_a?(Podfile) || parent.nil?
|
|
12813
|
+
end
|
|
12814
|
+
|
|
12815
|
+
def root
|
|
12816
|
+
if root?
|
|
12817
|
+
self
|
|
12818
|
+
else
|
|
12819
|
+
parent.root
|
|
12820
|
+
end
|
|
12821
|
+
end
|
|
12822
|
+
|
|
12823
|
+
def podfile
|
|
12824
|
+
root.parent
|
|
12825
|
+
end
|
|
12826
|
+
|
|
12827
|
+
def dependencies
|
|
12828
|
+
if exclusive?
|
|
12829
|
+
non_inherited_dependencies
|
|
12830
|
+
else
|
|
12831
|
+
non_inherited_dependencies + parent.dependencies
|
|
12832
|
+
end
|
|
12833
|
+
end
|
|
12834
|
+
|
|
12835
|
+
def targets_to_inherit_search_paths
|
|
12836
|
+
return [] unless inheritance == 'search_paths'
|
|
12837
|
+
if root? || !matches_platform?(parent)
|
|
12838
|
+
raise StandardError, "Non-root target definitions (#{label}) need a parent target definition with the same platform."
|
|
12839
|
+
elsif parent.inheritance == 'search_paths'
|
|
12840
|
+
parent.targets_to_inherit_search_paths << parent
|
|
12841
|
+
else
|
|
12842
|
+
[parent]
|
|
12843
|
+
end
|
|
12844
|
+
end
|
|
12845
|
+
|
|
12846
|
+
def non_inherited_dependencies
|
|
12847
|
+
pod_dependencies.concat(podspec_dependencies)
|
|
12848
|
+
end
|
|
12849
|
+
|
|
12850
|
+
def empty?
|
|
12851
|
+
non_inherited_dependencies.empty?
|
|
12852
|
+
end
|
|
12853
|
+
|
|
12854
|
+
def label
|
|
12855
|
+
@label ||= if root? && name == 'Pods'
|
|
12856
|
+
'Pods'
|
|
12857
|
+
elsif exclusive? || parent.nil?
|
|
12858
|
+
"Pods-#{name}"
|
|
12859
|
+
else
|
|
12860
|
+
"#{parent.label}-#{name}"
|
|
12861
|
+
end
|
|
12862
|
+
end
|
|
12863
|
+
|
|
12864
|
+
alias_method :to_s, :label
|
|
12865
|
+
|
|
12866
|
+
def inspect
|
|
12867
|
+
"#<#{self.class} label=#{label}>"
|
|
12868
|
+
end
|
|
12869
|
+
|
|
12870
|
+
def name
|
|
12871
|
+
get_hash_value('name')
|
|
12872
|
+
end
|
|
12873
|
+
|
|
12874
|
+
def name=(name)
|
|
12875
|
+
@label = nil
|
|
12876
|
+
set_hash_value('name', name)
|
|
12877
|
+
end
|
|
12878
|
+
|
|
12879
|
+
def abstract?
|
|
12880
|
+
get_hash_value('abstract', root?)
|
|
12881
|
+
end
|
|
12882
|
+
|
|
12883
|
+
def abstract=(abstract)
|
|
12884
|
+
set_hash_value('abstract', abstract)
|
|
12885
|
+
end
|
|
12886
|
+
|
|
12887
|
+
def swift_version
|
|
12888
|
+
get_hash_value('swift_version')
|
|
12889
|
+
end
|
|
12890
|
+
|
|
12891
|
+
def swift_version=(version)
|
|
12892
|
+
set_hash_value('swift_version', version)
|
|
12893
|
+
end
|
|
12894
|
+
|
|
12895
|
+
def swift_version_requirements
|
|
12896
|
+
get_hash_value('swift_version_requirements')
|
|
12897
|
+
end
|
|
12898
|
+
|
|
12899
|
+
def store_swift_version_requirements(*requirements)
|
|
12900
|
+
set_hash_value('swift_version_requirements', requirements.flatten.map(&:to_s))
|
|
12901
|
+
end
|
|
12902
|
+
|
|
12903
|
+
def inheritance
|
|
12904
|
+
get_hash_value('inheritance', 'complete')
|
|
12905
|
+
end
|
|
12906
|
+
|
|
12907
|
+
def inheritance=(inheritance)
|
|
12908
|
+
inheritance = inheritance.to_s
|
|
12909
|
+
unless %w(none search_paths complete).include?(inheritance)
|
|
12910
|
+
raise Informative, "Unrecognized inheritance option '#{inheritance}' specified for target '#{name}'."
|
|
12911
|
+
end
|
|
12912
|
+
if root?
|
|
12913
|
+
raise Informative, 'Cannot set inheritance for the root target definition.'
|
|
12914
|
+
end
|
|
12915
|
+
if abstract?
|
|
12916
|
+
raise Informative, 'Cannot set inheritance for abstract target definition.'
|
|
12917
|
+
end
|
|
12918
|
+
set_hash_value('inheritance', inheritance)
|
|
12919
|
+
end
|
|
12920
|
+
|
|
12921
|
+
def exclusive?
|
|
12922
|
+
if root?
|
|
12923
|
+
true
|
|
12924
|
+
else
|
|
12925
|
+
!matches_platform?(parent) || (inheritance != 'complete')
|
|
12926
|
+
end
|
|
12927
|
+
end
|
|
12928
|
+
|
|
12929
|
+
def matches_platform?(target_definition)
|
|
12930
|
+
return false unless target_definition
|
|
12931
|
+
return true if target_definition.platform == platform
|
|
12932
|
+
!target_definition.platform && target_definition.abstract?
|
|
12933
|
+
end
|
|
12934
|
+
|
|
12935
|
+
def user_project_path
|
|
12936
|
+
path = get_hash_value('user_project_path')
|
|
12937
|
+
if path
|
|
12938
|
+
Pathname(path).sub_ext('.xcodeproj').to_path
|
|
12939
|
+
else
|
|
12940
|
+
parent.user_project_path unless root?
|
|
12941
|
+
end
|
|
12942
|
+
end
|
|
12943
|
+
|
|
12944
|
+
def user_project_path=(path)
|
|
12945
|
+
set_hash_value('user_project_path', path)
|
|
12946
|
+
end
|
|
12947
|
+
|
|
12948
|
+
def build_configurations
|
|
12949
|
+
if root?
|
|
12950
|
+
get_hash_value('build_configurations')
|
|
12951
|
+
else
|
|
12952
|
+
get_hash_value('build_configurations') || parent.build_configurations
|
|
12953
|
+
end
|
|
12954
|
+
end
|
|
12955
|
+
|
|
12956
|
+
def build_configurations=(hash)
|
|
12957
|
+
set_hash_value('build_configurations', hash) unless hash.empty?
|
|
12958
|
+
end
|
|
12959
|
+
|
|
12960
|
+
def script_phases
|
|
12961
|
+
script_phases_hashes = get_hash_value('script_phases', [])
|
|
12962
|
+
script_phases_hashes.map do |script_phase_hash|
|
|
12963
|
+
Specification.convert_keys_to_symbol(script_phase_hash)
|
|
12964
|
+
end
|
|
12965
|
+
end
|
|
12966
|
+
|
|
12967
|
+
def project_name_for_pod(pod_name)
|
|
12968
|
+
if root?
|
|
12969
|
+
raw_project_names_hash[pod_name]
|
|
12970
|
+
else
|
|
12971
|
+
raw_project_names_hash[pod_name] || parent.project_name_for_pod(pod_name)
|
|
12972
|
+
end
|
|
12973
|
+
end
|
|
12974
|
+
|
|
12975
|
+
def inhibits_warnings_for_pod?(pod_name)
|
|
12976
|
+
if Array(inhibit_warnings_hash['not_for_pods']).include?(pod_name)
|
|
12977
|
+
false
|
|
12978
|
+
elsif Array(inhibit_warnings_hash['for_pods']).include?(pod_name)
|
|
12979
|
+
true
|
|
12980
|
+
elsif inhibit_warnings_hash['all']
|
|
12981
|
+
true
|
|
12982
|
+
elsif !root? && parent.inhibits_warnings_for_pod?(pod_name)
|
|
12983
|
+
true
|
|
12984
|
+
else
|
|
12985
|
+
false
|
|
12986
|
+
end
|
|
12987
|
+
end
|
|
12988
|
+
|
|
12989
|
+
def inhibit_all_warnings=(flag)
|
|
12990
|
+
raw_inhibit_warnings_hash['all'] = flag
|
|
12991
|
+
end
|
|
12992
|
+
|
|
12993
|
+
def set_inhibit_warnings_for_pod(pod_name, should_inhibit)
|
|
12994
|
+
hash_key = case should_inhibit
|
|
12995
|
+
when true
|
|
12996
|
+
'for_pods'
|
|
12997
|
+
when false
|
|
12998
|
+
'not_for_pods'
|
|
12999
|
+
when nil
|
|
13000
|
+
return
|
|
13001
|
+
else
|
|
13002
|
+
raise ArgumentError, "Got '#{should_inhibit.inspect}', should be a boolean"
|
|
13003
|
+
end
|
|
13004
|
+
raw_inhibit_warnings_hash[hash_key] ||= []
|
|
13005
|
+
raw_inhibit_warnings_hash[hash_key] << pod_name
|
|
13006
|
+
end
|
|
13007
|
+
|
|
13008
|
+
def build_pod_as_module?(pod_name)
|
|
13009
|
+
if Array(use_modular_headers_hash['not_for_pods']).include?(pod_name)
|
|
13010
|
+
false
|
|
13011
|
+
elsif Array(use_modular_headers_hash['for_pods']).include?(pod_name)
|
|
13012
|
+
true
|
|
13013
|
+
elsif use_modular_headers_hash['all']
|
|
13014
|
+
true
|
|
13015
|
+
elsif !root? && parent.build_pod_as_module?(pod_name)
|
|
13016
|
+
true
|
|
13017
|
+
else
|
|
13018
|
+
false
|
|
13019
|
+
end
|
|
13020
|
+
end
|
|
13021
|
+
|
|
13022
|
+
def use_modular_headers_for_all_pods=(flag)
|
|
13023
|
+
raw_use_modular_headers_hash['all'] = flag
|
|
13024
|
+
end
|
|
13025
|
+
|
|
13026
|
+
def set_use_modular_headers_for_pod(pod_name, flag)
|
|
13027
|
+
hash_key = case flag
|
|
13028
|
+
when true
|
|
13029
|
+
'for_pods'
|
|
13030
|
+
when false
|
|
13031
|
+
'not_for_pods'
|
|
13032
|
+
when nil
|
|
13033
|
+
return
|
|
13034
|
+
else
|
|
13035
|
+
raise ArgumentError, "Got '#{flag.inspect}', should be a boolean"
|
|
13036
|
+
end
|
|
13037
|
+
raw_use_modular_headers_hash[hash_key] ||= []
|
|
13038
|
+
raw_use_modular_headers_hash[hash_key] << pod_name
|
|
13039
|
+
end
|
|
13040
|
+
|
|
13041
|
+
def use_frameworks!(option = true)
|
|
13042
|
+
value = case option
|
|
13043
|
+
when true, false
|
|
13044
|
+
option ? BuildType.dynamic_framework : BuildType.static_library
|
|
13045
|
+
when Hash
|
|
13046
|
+
BuildType.new(:linkage => option.fetch(:linkage), :packaging => :framework)
|
|
13047
|
+
else
|
|
13048
|
+
raise ArgumentError, "Got '#{option.inspect}', should be a boolean or hash."
|
|
13049
|
+
end
|
|
13050
|
+
set_hash_value('uses_frameworks', value.to_hash)
|
|
13051
|
+
end
|
|
13052
|
+
|
|
13053
|
+
def build_type
|
|
13054
|
+
value = get_hash_value('uses_frameworks', root? ? BuildType.static_library.to_hash : parent.build_type.to_hash)
|
|
13055
|
+
case value
|
|
13056
|
+
when true, false
|
|
13057
|
+
value ? BuildType.dynamic_framework : BuildType.static_library
|
|
13058
|
+
when Hash
|
|
13059
|
+
BuildType.new(:linkage => value.fetch(:linkage), :packaging => value.fetch(:packaging))
|
|
13060
|
+
when BuildType
|
|
13061
|
+
value
|
|
13062
|
+
else
|
|
13063
|
+
raise ArgumentError, "Got '#{value.inspect}', should be a boolean, hash or BuildType."
|
|
13064
|
+
end
|
|
13065
|
+
end
|
|
13066
|
+
|
|
13067
|
+
def uses_frameworks?
|
|
13068
|
+
if internal_hash['uses_frameworks'].nil?
|
|
13069
|
+
root? ? false : parent.uses_frameworks?
|
|
13070
|
+
else
|
|
13071
|
+
build_type.framework?
|
|
13072
|
+
end
|
|
13073
|
+
end
|
|
13074
|
+
|
|
13075
|
+
def whitelist_pod_for_configuration(pod_name, configuration_name)
|
|
13076
|
+
found = raw_configuration_pod_whitelist.find { |configuration, _| configuration.casecmp(configuration_name.to_s).zero? }
|
|
13077
|
+
configuration_name = found.nil? ? configuration_name.to_s : found.first
|
|
13078
|
+
list = raw_configuration_pod_whitelist[configuration_name] ||= []
|
|
13079
|
+
list << pod_name
|
|
13080
|
+
end
|
|
13081
|
+
|
|
13082
|
+
def pod_whitelisted_for_configuration?(pod_name, configuration_name)
|
|
13083
|
+
found = false
|
|
13084
|
+
configuration_pod_whitelist.each do |configuration, pods|
|
|
13085
|
+
if pods.include?(pod_name)
|
|
13086
|
+
found = true
|
|
13087
|
+
if configuration.casecmp(configuration_name.to_s).zero?
|
|
13088
|
+
return true
|
|
13089
|
+
end
|
|
13090
|
+
end
|
|
13091
|
+
end
|
|
13092
|
+
!found && (root? || (inheritance != 'none' && parent.pod_whitelisted_for_configuration?(pod_name, configuration_name)))
|
|
13093
|
+
end
|
|
13094
|
+
|
|
13095
|
+
def all_whitelisted_configurations
|
|
13096
|
+
parent_configurations = (root? || inheritance == 'none') ? [] : parent.all_whitelisted_configurations
|
|
13097
|
+
(configuration_pod_whitelist.keys + parent_configurations).uniq
|
|
13098
|
+
end
|
|
13099
|
+
|
|
13100
|
+
def platform
|
|
13101
|
+
name_or_hash = get_hash_value('platform')
|
|
13102
|
+
if name_or_hash
|
|
13103
|
+
if name_or_hash.is_a?(Hash)
|
|
13104
|
+
name = name_or_hash.keys.first.to_sym
|
|
13105
|
+
target = name_or_hash.values.first
|
|
13106
|
+
else
|
|
13107
|
+
name = name_or_hash.to_sym
|
|
13108
|
+
end
|
|
13109
|
+
target ||= (name == :ios ? '4.3' : '10.6')
|
|
13110
|
+
Platform.new(name, target)
|
|
13111
|
+
else
|
|
13112
|
+
parent.platform unless root?
|
|
13113
|
+
end
|
|
13114
|
+
end
|
|
13115
|
+
|
|
13116
|
+
def set_platform(name, target = nil)
|
|
13117
|
+
name = :osx if name == :macos
|
|
13118
|
+
unless [:ios, :osx, :tvos, :visionos, :watchos].include?(name)
|
|
13119
|
+
raise StandardError, "Unsupported platform '#{name}'. Platform must be ':ios', ':osx', ':macos', ':tvos', :visionos, or ':watchos'."
|
|
13120
|
+
end
|
|
13121
|
+
if target
|
|
13122
|
+
value = { name.to_s => target }
|
|
13123
|
+
else
|
|
13124
|
+
value = name.to_s
|
|
13125
|
+
end
|
|
13126
|
+
set_hash_value('platform', value)
|
|
13127
|
+
end
|
|
13128
|
+
|
|
13129
|
+
def set_platform!(name, target = nil)
|
|
13130
|
+
raise StandardError, "The target '#{label}' already has a platform set." if get_hash_value('platform')
|
|
13131
|
+
set_platform(name, target)
|
|
13132
|
+
end
|
|
13133
|
+
|
|
13134
|
+
def store_pod(name, *requirements)
|
|
13135
|
+
return if parse_subspecs(name, requirements)
|
|
13136
|
+
parse_inhibit_warnings(name, requirements)
|
|
13137
|
+
parse_modular_headers(name, requirements)
|
|
13138
|
+
parse_configuration_whitelist(name, requirements)
|
|
13139
|
+
parse_project_name(name, requirements)
|
|
13140
|
+
if requirements && !requirements.empty?
|
|
13141
|
+
pod = { name => requirements }
|
|
13142
|
+
else
|
|
13143
|
+
pod = name
|
|
13144
|
+
end
|
|
13145
|
+
get_hash_value('dependencies', []) << pod
|
|
13146
|
+
nil
|
|
13147
|
+
end
|
|
13148
|
+
|
|
13149
|
+
def store_podspec(options = nil)
|
|
13150
|
+
options ||= {}
|
|
13151
|
+
unless options.keys.all? { |key| [:autodetect, :path, :name, :subspecs, :subspec].include?(key) }
|
|
13152
|
+
raise StandardError, "Unrecognized options for the podspec method '#{options}'"
|
|
13153
|
+
end
|
|
13154
|
+
if subspec_name = options[:subspec]
|
|
13155
|
+
options[:subspecs] = [subspec_name]
|
|
13156
|
+
end
|
|
13157
|
+
options[:autodetect] = true if !options.include?(:name) && !options.include?(:path)
|
|
13158
|
+
get_hash_value('podspecs', []) << options
|
|
13159
|
+
end
|
|
13160
|
+
|
|
13161
|
+
def store_script_phase(options)
|
|
13162
|
+
option_keys = options.keys
|
|
13163
|
+
unrecognized_keys = option_keys - Specification::ALL_SCRIPT_PHASE_KEYS
|
|
13164
|
+
unless unrecognized_keys.empty?
|
|
13165
|
+
raise StandardError, "Unrecognized options '#{unrecognized_keys}' in shell script '#{options[:name]}' within '#{name}' target. Available options are '#{Specification::ALL_SCRIPT_PHASE_KEYS}'."
|
|
13166
|
+
end
|
|
13167
|
+
missing_required_keys = Specification::SCRIPT_PHASE_REQUIRED_KEYS - option_keys
|
|
13168
|
+
unless missing_required_keys.empty?
|
|
13169
|
+
raise StandardError, "Missing required shell script phase options '#{missing_required_keys.join(', ')}'"
|
|
13170
|
+
end
|
|
13171
|
+
script_phases_hash = get_hash_value('script_phases', [])
|
|
13172
|
+
if script_phases_hash.map { |script_phase_options| script_phase_options[:name] }.include?(options[:name])
|
|
13173
|
+
raise StandardError, "Script phase with name '#{options[:name]}' name already present for target '#{name}'."
|
|
13174
|
+
end
|
|
13175
|
+
options[:execution_position] = :any unless options.key?(:execution_position)
|
|
13176
|
+
unless Specification::EXECUTION_POSITION_KEYS.include?(options[:execution_position])
|
|
13177
|
+
raise StandardError, "Invalid execution position value '#{options[:execution_position]}' in shell script '#{options[:name]}' within '#{name}' target. Available options are '#{Specification::EXECUTION_POSITION_KEYS}'."
|
|
13178
|
+
end
|
|
13179
|
+
script_phases_hash << options
|
|
13180
|
+
end
|
|
13181
|
+
|
|
13182
|
+
def to_hash
|
|
13183
|
+
hash = internal_hash.dup
|
|
13184
|
+
unless children.empty?
|
|
13185
|
+
hash['children'] = children.map(&:to_hash)
|
|
13186
|
+
end
|
|
13187
|
+
hash
|
|
13188
|
+
end
|
|
13189
|
+
|
|
13190
|
+
private
|
|
13191
|
+
|
|
13192
|
+
def set_hash_value(key, value)
|
|
13193
|
+
unless HASH_KEYS.include?(key)
|
|
13194
|
+
raise StandardError, "Unsupported hash key '#{key}'"
|
|
13195
|
+
end
|
|
13196
|
+
internal_hash[key] = value
|
|
13197
|
+
end
|
|
13198
|
+
|
|
13199
|
+
def get_hash_value(key, base_value = nil)
|
|
13200
|
+
unless HASH_KEYS.include?(key)
|
|
13201
|
+
raise StandardError, "Unsupported hash key '#{key}'"
|
|
13202
|
+
end
|
|
13203
|
+
internal_hash[key] = base_value if internal_hash[key].nil?
|
|
13204
|
+
internal_hash[key]
|
|
13205
|
+
end
|
|
13206
|
+
|
|
13207
|
+
def raw_inhibit_warnings_hash
|
|
13208
|
+
get_hash_value('inhibit_warnings', {})
|
|
13209
|
+
end
|
|
13210
|
+
|
|
13211
|
+
def inhibit_warnings_hash
|
|
13212
|
+
inhibit_hash = raw_inhibit_warnings_hash
|
|
13213
|
+
if exclusive?
|
|
13214
|
+
inhibit_hash
|
|
13215
|
+
else
|
|
13216
|
+
parent_hash = parent.send(:inhibit_warnings_hash).dup
|
|
13217
|
+
if parent_hash['not_for_pods']
|
|
13218
|
+
parent_hash['not_for_pods'] -= Array(inhibit_hash['for_pods'])
|
|
13219
|
+
end
|
|
13220
|
+
if parent_hash['for_pods']
|
|
13221
|
+
parent_hash['for_pods'] -= Array(inhibit_hash['not_for_pods'])
|
|
13222
|
+
end
|
|
13223
|
+
if inhibit_hash['all']
|
|
13224
|
+
parent_hash['all'] = true
|
|
13225
|
+
end
|
|
13226
|
+
parent_hash.merge(inhibit_hash) do |_, l, r|
|
|
13227
|
+
Array(l).concat(r).uniq
|
|
13228
|
+
end
|
|
13229
|
+
end
|
|
13230
|
+
end
|
|
13231
|
+
|
|
13232
|
+
def raw_use_modular_headers_hash
|
|
13233
|
+
get_hash_value('use_modular_headers', {})
|
|
13234
|
+
end
|
|
13235
|
+
|
|
13236
|
+
def use_modular_headers_hash
|
|
13237
|
+
raw_hash = raw_use_modular_headers_hash
|
|
13238
|
+
if exclusive?
|
|
13239
|
+
raw_hash
|
|
13240
|
+
else
|
|
13241
|
+
parent_hash = parent.send(:use_modular_headers_hash).dup
|
|
13242
|
+
if parent_hash['not_for_pods']
|
|
13243
|
+
parent_hash['not_for_pods'] -= Array(raw_hash['for_pods'])
|
|
13244
|
+
end
|
|
13245
|
+
if parent_hash['for_pods']
|
|
13246
|
+
parent_hash['for_pods'] -= Array(raw_hash['not_for_pods'])
|
|
13247
|
+
end
|
|
13248
|
+
if raw_hash['all']
|
|
13249
|
+
parent_hash['all'] = true
|
|
13250
|
+
end
|
|
13251
|
+
parent_hash.merge(raw_hash) do |_, l, r|
|
|
13252
|
+
Array(l).concat(r).uniq
|
|
13253
|
+
end
|
|
13254
|
+
end
|
|
13255
|
+
end
|
|
13256
|
+
|
|
13257
|
+
def raw_project_names_hash
|
|
13258
|
+
get_hash_value('project_names', {})
|
|
13259
|
+
end
|
|
13260
|
+
|
|
13261
|
+
def raw_configuration_pod_whitelist
|
|
13262
|
+
get_hash_value('configuration_pod_whitelist', {})
|
|
13263
|
+
end
|
|
13264
|
+
|
|
13265
|
+
def configuration_pod_whitelist
|
|
13266
|
+
raw_configuration_pod_whitelist
|
|
13267
|
+
end
|
|
13268
|
+
|
|
13269
|
+
def pod_dependencies
|
|
13270
|
+
pods = get_hash_value('dependencies') || []
|
|
13271
|
+
pods.map do |name_or_hash|
|
|
13272
|
+
if name_or_hash.is_a?(Hash)
|
|
13273
|
+
name = name_or_hash.keys.first
|
|
13274
|
+
requirements = name_or_hash.values.first
|
|
13275
|
+
else
|
|
13276
|
+
name = name_or_hash
|
|
13277
|
+
requirements = []
|
|
13278
|
+
end
|
|
13279
|
+
Dependency.new(name, *requirements)
|
|
13280
|
+
end
|
|
13281
|
+
end
|
|
13282
|
+
|
|
13283
|
+
def podspec_dependencies
|
|
13284
|
+
podspecs = get_hash_value('podspecs') || []
|
|
13285
|
+
podspecs.map do |options|
|
|
13286
|
+
file = podspec_path_from_options(options)
|
|
13287
|
+
spec = Specification.from_file(file)
|
|
13288
|
+
subspec_names = options[:subspecs] || options[:subspec]
|
|
13289
|
+
specs = if subspec_names.blank?
|
|
13290
|
+
[spec]
|
|
13291
|
+
else
|
|
13292
|
+
subspec_names = [subspec_names] if subspec_names.is_a?(String)
|
|
13293
|
+
subspec_names.map { |subspec_name| spec.subspec_by_name("#{spec.name}/#{subspec_name}") }
|
|
13294
|
+
end
|
|
13295
|
+
specs.map do |subspec|
|
|
13296
|
+
all_specs = [subspec, *subspec.recursive_subspecs]
|
|
13297
|
+
all_deps = all_specs.map { |s| s.dependencies(platform) }.flatten
|
|
13298
|
+
all_deps.reject { |dep| dep.root_name == subspec.root.name }
|
|
13299
|
+
end.flatten
|
|
13300
|
+
end.flatten.uniq
|
|
13301
|
+
end
|
|
13302
|
+
|
|
13303
|
+
def podspec_path_from_options(options)
|
|
13304
|
+
if path = options[:path]
|
|
13305
|
+
if File.basename(path).include?('.podspec')
|
|
13306
|
+
path_with_ext = path
|
|
13307
|
+
else
|
|
13308
|
+
path_with_ext = "#{path}.podspec"
|
|
13309
|
+
end
|
|
13310
|
+
path_without_tilde = path_with_ext.gsub('~', ENV['HOME'])
|
|
13311
|
+
podfile.defined_in_file.dirname + path_without_tilde
|
|
13312
|
+
elsif name = options[:name]
|
|
13313
|
+
name = File.basename(name).include?('.podspec') ? name : "#{name}.podspec"
|
|
13314
|
+
podfile.defined_in_file.dirname + name
|
|
13315
|
+
elsif options[:autodetect]
|
|
13316
|
+
glob_pattern = podfile.defined_in_file.dirname + '*.podspec{,.json}'
|
|
13317
|
+
path = Pathname.glob(glob_pattern).first
|
|
13318
|
+
unless path
|
|
13319
|
+
raise Informative, 'Could not locate a podspec in the current directory. ' \
|
|
13320
|
+
'You can specify the path via the path option.'
|
|
13321
|
+
end
|
|
13322
|
+
path
|
|
13323
|
+
end
|
|
13324
|
+
end
|
|
13325
|
+
|
|
13326
|
+
def parse_inhibit_warnings(name, requirements)
|
|
13327
|
+
options = requirements.last
|
|
13328
|
+
return requirements unless options.is_a?(Hash)
|
|
13329
|
+
should_inhibit = options.delete(:inhibit_warnings)
|
|
13330
|
+
pod_name = Specification.root_name(name)
|
|
13331
|
+
set_inhibit_warnings_for_pod(pod_name, should_inhibit)
|
|
13332
|
+
requirements.pop if options.empty?
|
|
13333
|
+
end
|
|
13334
|
+
|
|
13335
|
+
def parse_modular_headers(name, requirements)
|
|
13336
|
+
options = requirements.last
|
|
13337
|
+
return requirements unless options.is_a?(Hash)
|
|
13338
|
+
defines_module = options.delete(:modular_headers)
|
|
13339
|
+
pod_name = Specification.root_name(name)
|
|
13340
|
+
set_use_modular_headers_for_pod(pod_name, defines_module)
|
|
13341
|
+
requirements.pop if options.empty?
|
|
13342
|
+
end
|
|
13343
|
+
|
|
13344
|
+
def parse_project_name(name, requirements)
|
|
13345
|
+
options = requirements.last
|
|
13346
|
+
return requirements unless options.is_a?(Hash)
|
|
13347
|
+
project_name = options.delete(:project_name)
|
|
13348
|
+
pod_name = Specification.root_name(name)
|
|
13349
|
+
raw_project_names_hash[pod_name] = project_name if project_name
|
|
13350
|
+
requirements.pop if options.empty?
|
|
13351
|
+
end
|
|
13352
|
+
|
|
13353
|
+
def parse_configuration_whitelist(name, requirements)
|
|
13354
|
+
options = requirements.last
|
|
13355
|
+
return requirements unless options.is_a?(Hash)
|
|
13356
|
+
configurations = options.delete(:configurations)
|
|
13357
|
+
configurations ||= options.delete(:configuration)
|
|
13358
|
+
Array(configurations).each do |configuration|
|
|
13359
|
+
whitelist_pod_for_configuration(name, configuration)
|
|
13360
|
+
end
|
|
13361
|
+
requirements.pop if options.empty?
|
|
13362
|
+
end
|
|
13363
|
+
|
|
13364
|
+
def parse_subspecs(name, requirements)
|
|
13365
|
+
options = requirements.last
|
|
13366
|
+
return false unless options.is_a?(Hash)
|
|
13367
|
+
subspecs = options.delete(:subspecs)
|
|
13368
|
+
test_specs = options.delete(:testspecs)
|
|
13369
|
+
app_specs = options.delete(:appspecs)
|
|
13370
|
+
if subspecs && subspecs.empty?
|
|
13371
|
+
raise StandardError, 'Empty subspecs list.'
|
|
13372
|
+
end
|
|
13373
|
+
subspecs.each do |ss|
|
|
13374
|
+
store_pod("#{name}/#{ss}", *requirements.dup)
|
|
13375
|
+
end if subspecs
|
|
13376
|
+
requirements.pop if options.empty?
|
|
13377
|
+
if test_specs || app_specs
|
|
13378
|
+
options[:testspecs] = test_specs.uniq if test_specs
|
|
13379
|
+
options[:appspecs] = app_specs.uniq if app_specs
|
|
13380
|
+
requirements.push(options)
|
|
13381
|
+
end
|
|
13382
|
+
!subspecs.nil?
|
|
13383
|
+
end
|
|
13384
|
+
end
|
|
13385
|
+
end
|
|
13386
|
+
end
|
|
13387
|
+
`;
|
|
13388
|
+
var RESOLVER = String.raw`
|
|
13389
|
+
module Pod
|
|
13390
|
+
module ExternalSources
|
|
13391
|
+
def self.from_dependency(dependency, podfile_path)
|
|
13392
|
+
params = dependency.external_source
|
|
13393
|
+
name = dependency.root_name
|
|
13394
|
+
if params.key?(:podspec)
|
|
13395
|
+
PodspecSource.new(name, params, podfile_path)
|
|
13396
|
+
elsif params.key?(:path)
|
|
13397
|
+
PathSource.new(name, params, podfile_path)
|
|
13398
|
+
else
|
|
13399
|
+
raise Informative, "Peach does not fetch the external source of '#{name}': #{params}"
|
|
13400
|
+
end
|
|
13401
|
+
end
|
|
13402
|
+
|
|
13403
|
+
class AbstractExternalSource
|
|
13404
|
+
attr_reader :name, :params, :podfile_path
|
|
13405
|
+
def initialize(name, params, podfile_path)
|
|
13406
|
+
@name = name
|
|
13407
|
+
@params = params
|
|
13408
|
+
@podfile_path = podfile_path
|
|
13409
|
+
end
|
|
13410
|
+
|
|
13411
|
+
def normalized_podspec_path(declared_path)
|
|
13412
|
+
extension = File.extname(declared_path)
|
|
13413
|
+
if extension == '.podspec' || extension == '.json'
|
|
13414
|
+
path_with_ext = declared_path
|
|
13415
|
+
else
|
|
13416
|
+
path_with_ext = "#{declared_path}/#{name}.podspec"
|
|
13417
|
+
end
|
|
13418
|
+
podfile_dir = File.dirname(podfile_path || '')
|
|
13419
|
+
File.expand_path(path_with_ext, podfile_dir)
|
|
13420
|
+
end
|
|
13421
|
+
|
|
13422
|
+
private
|
|
13423
|
+
|
|
13424
|
+
def store_podspec(sandbox, spec, json = false)
|
|
13425
|
+
sandbox.store_podspec(name, Specification.from_file(spec), true, true)
|
|
13426
|
+
end
|
|
13427
|
+
end
|
|
13428
|
+
|
|
13429
|
+
class PathSource < AbstractExternalSource
|
|
13430
|
+
def fetch(sandbox)
|
|
13431
|
+
podspec = podspec_path
|
|
13432
|
+
raise Informative, "No podspec found for '#{name}' in '#{declared_path}'" unless podspec.exist?
|
|
13433
|
+
store_podspec(sandbox, podspec, podspec.extname == '.json')
|
|
13434
|
+
sandbox.store_local_path(name, podspec, Pathname(declared_path).absolute? || declared_path.start_with?('~'))
|
|
13435
|
+
end
|
|
13436
|
+
|
|
13437
|
+
def declared_path
|
|
13438
|
+
result = params[:path]
|
|
13439
|
+
result.to_s if result
|
|
13440
|
+
end
|
|
13441
|
+
|
|
13442
|
+
def podspec_path
|
|
13443
|
+
path = Pathname(normalized_podspec_path(declared_path))
|
|
13444
|
+
path.exist? ? path : Pathname("#{path}.json")
|
|
13445
|
+
end
|
|
13446
|
+
end
|
|
13447
|
+
|
|
13448
|
+
class PodspecSource < AbstractExternalSource
|
|
13449
|
+
def fetch(sandbox)
|
|
13450
|
+
podspec_path = Pathname(podspec_uri)
|
|
13451
|
+
raise Informative, "Peach does not download the podspec of '#{name}' from #{podspec_uri}" unless podspec_path.exist?
|
|
13452
|
+
store_podspec(sandbox, podspec_path, podspec_path.extname == '.json')
|
|
13453
|
+
end
|
|
13454
|
+
|
|
13455
|
+
def podspec_uri
|
|
13456
|
+
declared_path = params[:podspec].to_s
|
|
13457
|
+
declared_path =~ %r{^.+://} ? declared_path : normalized_podspec_path(declared_path)
|
|
13458
|
+
end
|
|
13459
|
+
end
|
|
13460
|
+
end
|
|
13461
|
+
|
|
13462
|
+
class Resolver
|
|
13463
|
+
class Vertex
|
|
13464
|
+
attr_reader :name, :requirements, :origins
|
|
13465
|
+
attr_accessor :spec, :platforms
|
|
13466
|
+
def initialize(name)
|
|
13467
|
+
@name = name
|
|
13468
|
+
@requirements = []
|
|
13469
|
+
@origins = []
|
|
13470
|
+
@platforms = []
|
|
13471
|
+
end
|
|
13472
|
+
end
|
|
13473
|
+
|
|
13474
|
+
attr_reader :vertices, :trunk_roots
|
|
13475
|
+
|
|
13476
|
+
# trunk answers versions(name) with its published version strings and
|
|
13477
|
+
# specification(name, version) with the Specification, or nil until fetched
|
|
13478
|
+
def initialize(sandbox, podfile, trunk)
|
|
13479
|
+
@sandbox = sandbox
|
|
13480
|
+
@podfile = podfile
|
|
13481
|
+
@trunk = trunk
|
|
13482
|
+
@chosen = {}
|
|
13483
|
+
@learned = Hash.new { |h, k| h[k] = [] }
|
|
13484
|
+
@excluded = Hash.new { |h, k| h[k] = [] }
|
|
13485
|
+
end
|
|
13486
|
+
|
|
13487
|
+
def fetch_external_sources
|
|
13488
|
+
@podfile.dependencies.select(&:external_source).uniq(&:root_name).sort.each do |dependency|
|
|
13489
|
+
ExternalSources.from_dependency(dependency, @podfile.defined_in_file).fetch(@sandbox)
|
|
13490
|
+
end
|
|
13491
|
+
end
|
|
13492
|
+
|
|
13493
|
+
# the trunk names and versions still to fetch, empty once resolved
|
|
13494
|
+
def resolve
|
|
13495
|
+
@platforms_by_dependency = Hash.new { |h, k| h[k] = [] }
|
|
13496
|
+
explicit = []
|
|
13497
|
+
@podfile.target_definition_list.each do |target|
|
|
13498
|
+
target.dependencies.each do |dep|
|
|
13499
|
+
explicit << dep
|
|
13500
|
+
@platforms_by_dependency[dep.to_s].push(target.platform) if target.platform
|
|
13501
|
+
end
|
|
13502
|
+
end
|
|
13503
|
+
explicit.uniq!
|
|
13504
|
+
@platforms_by_dependency.each_value(&:uniq!)
|
|
13505
|
+
@podfile_requirements = @podfile.dependencies.group_by(&:root_name)
|
|
13506
|
+
100.times do
|
|
13507
|
+
@missing = []
|
|
13508
|
+
activate(explicit)
|
|
13509
|
+
return @missing.uniq unless @missing.empty?
|
|
13510
|
+
return [] if consistent?
|
|
13511
|
+
end
|
|
13512
|
+
raise Informative, 'CocoaPods dependency resolution did not settle'
|
|
13513
|
+
end
|
|
13514
|
+
|
|
13515
|
+
def specs_by_target
|
|
13516
|
+
@podfile.target_definition_list.each_with_object({}) do |target, result|
|
|
13517
|
+
next if target.abstract? && !target.platform
|
|
13518
|
+
explicit = target.dependencies.map(&:name)
|
|
13519
|
+
used = {}
|
|
13520
|
+
loop do
|
|
13521
|
+
added = @vertices.values.select do |v|
|
|
13522
|
+
v.spec && !used[v.name] && (explicit.include?(v.name) || v.origins.any? { |origin, dep| used[origin] && edge_valid?(origin, dep, target.platform) })
|
|
13523
|
+
end
|
|
13524
|
+
break if added.empty?
|
|
13525
|
+
added.each { |v| used[v.name] = true }
|
|
13526
|
+
end
|
|
13527
|
+
aggregate = {}
|
|
13528
|
+
loop do
|
|
13529
|
+
added = used.keys.select do |name|
|
|
13530
|
+
!aggregate[name] && @vertices[name].spec.library_specification? &&
|
|
13531
|
+
(explicit.include?(name) || @vertices[name].origins.any? { |origin, _| aggregate[origin] })
|
|
13532
|
+
end
|
|
13533
|
+
break if added.empty?
|
|
13534
|
+
added.each { |name| aggregate[name] = true }
|
|
13535
|
+
end
|
|
13536
|
+
result[target] = used.keys.map { |name| [@vertices[name].spec, !aggregate[name]] }.sort_by { |spec, _| spec.name }
|
|
13537
|
+
end
|
|
13538
|
+
end
|
|
13539
|
+
|
|
13540
|
+
def specifications
|
|
13541
|
+
specs_by_target.values.flatten(1).map(&:first).uniq
|
|
13542
|
+
end
|
|
13543
|
+
|
|
13544
|
+
private
|
|
13545
|
+
|
|
13546
|
+
def activate(explicit)
|
|
13547
|
+
@vertices = {}
|
|
13548
|
+
@requirements = Hash.new { |h, k| h[k] = [] }
|
|
13549
|
+
@trunk_roots = []
|
|
13550
|
+
queue = explicit.map { |dep| [dep, nil] }
|
|
13551
|
+
until queue.empty?
|
|
13552
|
+
dep, origin = queue.shift
|
|
13553
|
+
vertex = (@vertices[dep.name] ||= Vertex.new(dep.name))
|
|
13554
|
+
vertex.requirements << dep
|
|
13555
|
+
vertex.origins << [origin, dep] if origin
|
|
13556
|
+
@requirements[dep.root_name] << dep
|
|
13557
|
+
next if vertex.requirements.size > 1
|
|
13558
|
+
root_spec = root_specification(dep)
|
|
13559
|
+
next unless root_spec
|
|
13560
|
+
spec = root_spec.subspec_by_name(dep.name, false, true)
|
|
13561
|
+
raise Informative, "Unable to find a specification for '#{dep}'" unless spec
|
|
13562
|
+
vertex.spec = spec
|
|
13563
|
+
dependencies_for(spec).each { |d| queue << [d, dep.name] }
|
|
13564
|
+
end
|
|
13565
|
+
end
|
|
13566
|
+
|
|
13567
|
+
def dependencies_for(spec)
|
|
13568
|
+
root_name = Specification.root_name(spec.name)
|
|
13569
|
+
spec.all_dependencies.map do |dependency|
|
|
13570
|
+
dependency.root_name == root_name ? dependency.dup.tap { |d| d.specific_version = spec.version } : dependency
|
|
13571
|
+
end
|
|
13572
|
+
end
|
|
13573
|
+
|
|
13574
|
+
def root_specification(dep)
|
|
13575
|
+
root = dep.root_name
|
|
13576
|
+
stored = @sandbox.specification(root)
|
|
13577
|
+
return stored if stored
|
|
13578
|
+
raise Informative, "Unable to find a specification for '#{dep}'" if dep.external_source
|
|
13579
|
+
@trunk_roots << root unless @trunk_roots.include?(root)
|
|
13580
|
+
version = (@chosen[root] ||= choose(root))
|
|
13581
|
+
return nil unless version
|
|
13582
|
+
spec = @trunk.specification(root, version.to_s)
|
|
13583
|
+
@missing << [root, version.to_s] unless spec
|
|
13584
|
+
spec
|
|
13585
|
+
end
|
|
13586
|
+
|
|
13587
|
+
def choose(root)
|
|
13588
|
+
versions = @trunk.versions(root)
|
|
13589
|
+
unless versions
|
|
13590
|
+
@missing << [root, nil]
|
|
13591
|
+
return nil
|
|
13592
|
+
end
|
|
13593
|
+
deps = @requirements[root] + Array(@podfile_requirements[root])
|
|
13594
|
+
requirements = deps.map(&:requirement) + @learned[root]
|
|
13595
|
+
prerelease = deps.any? { |d| d.prerelease? || d.external_source }
|
|
13596
|
+
candidates = versions.map { |v| Version.new(v) }.sort.reverse.reject { |v| @excluded[root].include?(v) }
|
|
13597
|
+
chosen = candidates.find { |v| requirements.all? { |r| r.satisfied_by?(v) } && (prerelease || !v.prerelease?) }
|
|
13598
|
+
raise Informative, "CocoaPods could not find compatible versions for pod '#{root}': #{requirements.map(&:to_s).uniq.join(', ')}" unless chosen
|
|
13599
|
+
chosen
|
|
13600
|
+
end
|
|
13601
|
+
|
|
13602
|
+
# the version each pod took satisfies every requirement on it and the
|
|
13603
|
+
# platforms of every target that reaches it; otherwise the pass repeats
|
|
13604
|
+
def consistent?
|
|
13605
|
+
platforms
|
|
13606
|
+
settled = true
|
|
13607
|
+
@vertices.each_value do |vertex|
|
|
13608
|
+
spec = vertex.spec
|
|
13609
|
+
root = Specification.root_name(vertex.name)
|
|
13610
|
+
unsatisfied = @requirements[root].map(&:requirement).reject { |r| r.satisfied_by?(spec.version) }
|
|
13611
|
+
unless unsatisfied.empty?
|
|
13612
|
+
raise Informative, "CocoaPods could not satisfy #{unsatisfied.map(&:to_s).join(', ')} with '#{root}' (#{spec.version})" unless @chosen.key?(root)
|
|
13613
|
+
@learned[root] |= unsatisfied
|
|
13614
|
+
@chosen.delete(root)
|
|
13615
|
+
settled = false
|
|
13616
|
+
next
|
|
13617
|
+
end
|
|
13618
|
+
next if platform_compatible?(vertex)
|
|
13619
|
+
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)
|
|
13620
|
+
@excluded[root] << spec.version
|
|
13621
|
+
@chosen.delete(root)
|
|
13622
|
+
settled = false
|
|
13623
|
+
end
|
|
13624
|
+
settled
|
|
13625
|
+
end
|
|
13626
|
+
|
|
13627
|
+
def platforms
|
|
13628
|
+
@vertices.each_value do |vertex|
|
|
13629
|
+
vertex.platforms = vertex.requirements.reject { |dep| vertex.origins.any? { |_, d| d.equal?(dep) } }.flat_map { |dep| @platforms_by_dependency[dep.to_s] }.uniq
|
|
13630
|
+
end
|
|
13631
|
+
loop do
|
|
13632
|
+
grew = false
|
|
13633
|
+
@vertices.each_value do |vertex|
|
|
13634
|
+
inherited = vertex.origins.flat_map { |origin, _| @vertices[origin].platforms } - vertex.platforms
|
|
13635
|
+
next if inherited.empty?
|
|
13636
|
+
vertex.platforms |= inherited
|
|
13637
|
+
grew = true
|
|
13638
|
+
end
|
|
13639
|
+
break unless grew
|
|
13640
|
+
end
|
|
13641
|
+
end
|
|
13642
|
+
|
|
13643
|
+
def platform_compatible?(vertex)
|
|
13644
|
+
spec = vertex.spec
|
|
13645
|
+
vertex.platforms.all? do |platform|
|
|
13646
|
+
spec.available_platforms.all? do |spec_platform|
|
|
13647
|
+
spec_platform.name != platform.name || spec.non_library_specification? || platform.supports?(spec_platform)
|
|
13648
|
+
end
|
|
13649
|
+
end
|
|
13650
|
+
end
|
|
13651
|
+
|
|
13652
|
+
def edge_valid?(origin, dep, platform)
|
|
13653
|
+
@vertices[origin].spec.all_dependencies(platform).any? { |d| d.name == dep.name }
|
|
13654
|
+
end
|
|
13655
|
+
end
|
|
13656
|
+
end
|
|
13657
|
+
`;
|
|
13658
|
+
|
|
13659
|
+
// src/pods-analysis.ts
|
|
13660
|
+
init_podspec_cocoapods();
|
|
13661
|
+
init_podspec_ruby();
|
|
13662
|
+
init_podspec_ruby_stdlib();
|
|
13663
|
+
var ANALYSIS = String.raw`
|
|
13664
|
+
module Pod
|
|
13665
|
+
class Podfile
|
|
13666
|
+
class TargetDefinition
|
|
13667
|
+
def supports_swift_version?(swift_version)
|
|
13668
|
+
if swift_version_requirements.nil?
|
|
13669
|
+
root? || parent.supports_swift_version?(swift_version)
|
|
13670
|
+
else
|
|
13671
|
+
Requirement.create(swift_version_requirements).satisfied_by?(swift_version)
|
|
13672
|
+
end
|
|
13673
|
+
end
|
|
13674
|
+
end
|
|
13675
|
+
end
|
|
13676
|
+
|
|
13677
|
+
class Sandbox
|
|
13678
|
+
def pod_dir(name)
|
|
13679
|
+
root_name = Specification.root_name(name)
|
|
13680
|
+
local?(root_name) ? Pathname.new(local_path(root_name)) : root + root_name
|
|
13681
|
+
end
|
|
13682
|
+
end
|
|
13683
|
+
|
|
13684
|
+
class Specification
|
|
13685
|
+
def static_framework
|
|
13686
|
+
attributes_hash['static_framework']
|
|
13687
|
+
end
|
|
13688
|
+
|
|
13689
|
+
def info_plist
|
|
13690
|
+
attributes_hash['info_plist'] || {}
|
|
13691
|
+
end
|
|
13692
|
+
|
|
13693
|
+
def dependency_whitelisted_for_configuration?(dependency, configuration)
|
|
13694
|
+
inherited = -> { root? ? true : parent.dependency_whitelisted_for_configuration?(dependency, configuration) }
|
|
13695
|
+
return inherited[] unless configuration_whitelist = attributes_hash['configuration_pod_whitelist']
|
|
13696
|
+
return inherited[] unless whitelist_for_pod = configuration_whitelist[dependency.name]
|
|
13697
|
+
whitelist_for_pod.include?(configuration.to_s.downcase)
|
|
13698
|
+
end
|
|
13699
|
+
end
|
|
13700
|
+
|
|
13701
|
+
class Target
|
|
13702
|
+
DEFAULT_BUILD_CONFIGURATIONS = { 'Release' => :release, 'Debug' => :debug }.freeze
|
|
13703
|
+
attr_reader :sandbox, :user_build_configurations, :archs, :platform, :build_type
|
|
13704
|
+
private :build_type
|
|
13705
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform)
|
|
13706
|
+
@sandbox = sandbox
|
|
13707
|
+
@user_build_configurations = user_build_configurations
|
|
13708
|
+
@archs = archs
|
|
13709
|
+
@platform = platform
|
|
13710
|
+
@build_type = build_type
|
|
13711
|
+
end
|
|
13712
|
+
def name; label; end
|
|
13713
|
+
alias to_s name
|
|
13714
|
+
def build_as_dynamic?; build_type.dynamic?; end
|
|
13715
|
+
def build_as_dynamic_framework?; build_type.dynamic_framework?; end
|
|
13716
|
+
def build_as_framework?; build_type.framework?; end
|
|
13717
|
+
def build_as_library?; build_type.library?; end
|
|
13718
|
+
def build_as_static?; build_type.static?; end
|
|
13719
|
+
def build_as_static_framework?; build_type.static_framework?; end
|
|
13720
|
+
def build_as_static_library?; build_type.static_library?; end
|
|
13721
|
+
def requires_frameworks?; build_as_framework?; end
|
|
13722
|
+
def inspect; "#<#{self.class} name=#{name}>"; end
|
|
13723
|
+
end
|
|
13724
|
+
|
|
13725
|
+
class PodTarget < Target
|
|
13726
|
+
attr_reader :specs, :library_specs, :test_specs, :app_specs, :target_definitions, :swift_version, :dependent_targets, :dependent_targets_by_config
|
|
13727
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform, specs, target_definitions, swift_version)
|
|
13728
|
+
super(sandbox, build_type, user_build_configurations, archs, platform)
|
|
13729
|
+
@specs = specs.dup.freeze
|
|
13730
|
+
@target_definitions = target_definitions
|
|
13731
|
+
@swift_version = swift_version
|
|
13732
|
+
by_type = @specs.group_by(&:spec_type)
|
|
13733
|
+
@library_specs = by_type[:library] || []
|
|
13734
|
+
@test_specs = by_type[:test] || []
|
|
13735
|
+
@app_specs = by_type[:app] || []
|
|
13736
|
+
self.dependent_targets = []
|
|
13737
|
+
end
|
|
13738
|
+
def dependent_targets=(targets)
|
|
13739
|
+
@dependent_targets = targets
|
|
13740
|
+
@dependent_targets_by_config = { :debug => targets, :release => targets }
|
|
13741
|
+
end
|
|
13742
|
+
def dependent_targets_by_config=(by_config)
|
|
13743
|
+
@dependent_targets_by_config = by_config
|
|
13744
|
+
@dependent_targets = by_config.values.reduce([], &:|)
|
|
13745
|
+
end
|
|
13746
|
+
def label; root_spec.name; end
|
|
13747
|
+
def root_spec; @root_spec ||= specs.first.root; end
|
|
13748
|
+
def pod_name; root_spec.name; end
|
|
13749
|
+
def product_module_name; root_spec.module_name; end
|
|
13750
|
+
def podfile; target_definitions.first.podfile; end
|
|
13751
|
+
def spec_consumers; specs.map { |spec| spec.consumer(platform) }; end
|
|
13752
|
+
def dependencies
|
|
13753
|
+
spec_consumers.flat_map { |consumer| consumer.dependencies.map { |dep| Specification.root_name(dep.name) } }.uniq
|
|
13754
|
+
end
|
|
13755
|
+
def inhibit_warnings?
|
|
13756
|
+
answers = target_definitions.map { |td| td.inhibits_warnings_for_pod?(root_spec.name) }.uniq
|
|
13757
|
+
answers.size > 1 ? podfile.root_target_definitions.first.inhibits_warnings_for_pod?(root_spec.name) : answers.first || false
|
|
13758
|
+
end
|
|
13759
|
+
def build_pod_as_module?
|
|
13760
|
+
explicit = target_definitions.select { |td| td.dependencies.any? { |d| d.root_name == pod_name } }
|
|
13761
|
+
answers = explicit.group_by { |td| td.build_pod_as_module?(pod_name) }
|
|
13762
|
+
return false if answers.size > 1
|
|
13763
|
+
answers.keys.first == true || target_definitions.all? { |td| td.build_pod_as_module?(pod_name) }
|
|
13764
|
+
end
|
|
13765
|
+
end
|
|
13766
|
+
|
|
13767
|
+
class AggregateTarget < Target
|
|
13768
|
+
attr_reader :target_definition, :client_root, :user_project, :user_target_uuids, :pod_targets_for_build_configuration, :search_paths_aggregate_targets
|
|
13769
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform, target_definition, client_root, user_project, user_target_uuids, pod_targets_for_build_configuration)
|
|
13770
|
+
super(sandbox, build_type, user_build_configurations, archs, platform)
|
|
13771
|
+
@target_definition = target_definition
|
|
13772
|
+
@client_root = client_root
|
|
13773
|
+
@user_project = user_project
|
|
13774
|
+
@user_target_uuids = user_target_uuids
|
|
13775
|
+
@pod_targets_for_build_configuration = pod_targets_for_build_configuration
|
|
13776
|
+
@search_paths_aggregate_targets = []
|
|
13777
|
+
end
|
|
13778
|
+
def label; target_definition.label; end
|
|
13779
|
+
def podfile; target_definition.podfile; end
|
|
13780
|
+
def pod_targets; pod_targets_for_build_configuration.values.flatten.uniq; end
|
|
13781
|
+
def pod_targets_for_build_configuration(build_configuration = nil)
|
|
13782
|
+
build_configuration ? @pod_targets_for_build_configuration[build_configuration] || [] : @pod_targets_for_build_configuration
|
|
13783
|
+
end
|
|
13784
|
+
def user_targets
|
|
13785
|
+
user_target_uuids.map { |uuid| user_project.objects_by_uuid[uuid] }
|
|
13786
|
+
end
|
|
13787
|
+
end
|
|
13788
|
+
|
|
13789
|
+
class Installer
|
|
13790
|
+
# Installer::Analyzer#generate_targets for one variant of each pod, which
|
|
13791
|
+
# is every Podfile with one platform and no target-specific subspecs
|
|
13792
|
+
def peach_analyze(resolver, user_build_configurations, user_project, user_target_uuids, user_swift_version)
|
|
13793
|
+
if user_swift_version
|
|
13794
|
+
podfile.target_definition_list.each { |td| td.swift_version = user_swift_version unless td.abstract? }
|
|
13795
|
+
end
|
|
13796
|
+
specs_by_target = resolver.specs_by_target.reject { |td, _| td.abstract? && !td.platform }
|
|
13797
|
+
# keyed by names: a stored podspec is a copy whose subspecs still name the original root
|
|
13798
|
+
variants = {}
|
|
13799
|
+
specs_by_target.each do |td, resolver_specs|
|
|
13800
|
+
resolver_specs.group_by { |spec, _| spec.root.name }.each do |root_name, entries|
|
|
13801
|
+
all = entries.map(&:first)
|
|
13802
|
+
root = all.first.root
|
|
13803
|
+
unless all.all?(&:library_specification?)
|
|
13804
|
+
raise Informative, "Peach builds no test or app specifications (#{root_name} in #{td.label})"
|
|
13805
|
+
end
|
|
13806
|
+
build_type = td.build_type.framework? ? (root.static_framework ? BuildType.static_framework : td.build_type) : BuildType.static_library
|
|
13807
|
+
key = [all.map(&:name).sort, td.platform.to_s, build_type.to_s].join(' ')
|
|
13808
|
+
variants[root_name] ||= {}
|
|
13809
|
+
(variants[root_name][key] ||= [all, build_type, []])[2] << td
|
|
13810
|
+
end
|
|
13811
|
+
end
|
|
13812
|
+
@pod_targets = variants.map do |root_name, by_variant|
|
|
13813
|
+
if by_variant.size > 1
|
|
13814
|
+
raise Informative, "Peach builds one variant of each pod; #{root_name} differs between #{by_variant.values.map { |v| v[2].map(&:label) }.flatten.join(', ')}"
|
|
13815
|
+
end
|
|
13816
|
+
specs, build_type, target_definitions = by_variant.values.first
|
|
13817
|
+
root = specs.first.root
|
|
13818
|
+
target_definitions.reject!(&:abstract?) unless target_definitions.all?(&:abstract?)
|
|
13819
|
+
swift_version = peach_swift_version(root, target_definitions)
|
|
13820
|
+
PodTarget.new(sandbox, build_type, user_build_configurations, [], peach_platform(specs, target_definitions, build_type), specs, target_definitions, swift_version)
|
|
13821
|
+
end
|
|
13822
|
+
all_specs = specs_by_target.values.flatten(1).map(&:first).uniq.group_by(&:name)
|
|
13823
|
+
by_name = @pod_targets.group_by(&:pod_name)
|
|
13824
|
+
@pod_targets.each do |target|
|
|
13825
|
+
target.dependent_targets_by_config = Hash[[:debug, :release].map do |config|
|
|
13826
|
+
specs = {}
|
|
13827
|
+
target.library_specs.each do |s|
|
|
13828
|
+
s.dependencies(target.platform).each do |dep|
|
|
13829
|
+
all_specs[dep.name].each do |spec|
|
|
13830
|
+
raise Informative, "#{s} depends upon #{spec}, which is a #{spec.spec_type} spec." if spec.non_library_specification?
|
|
13831
|
+
specs[spec.name] ||= spec if s.dependency_whitelisted_for_configuration?(dep, config)
|
|
13832
|
+
end
|
|
13833
|
+
end
|
|
13834
|
+
end
|
|
13835
|
+
own = target.library_specs.map(&:name)
|
|
13836
|
+
[config, specs.values.reject { |spec| own.include?(spec.name) }.group_by { |spec| spec.root.name }.map do |root_name, deps|
|
|
13837
|
+
by_name[root_name].find { |t| t.build_as_framework? == target.build_as_framework? && deps.all? { |d| t.specs.map(&:name).include?(d.name) } }
|
|
13838
|
+
end]
|
|
13839
|
+
end]
|
|
13840
|
+
end
|
|
13841
|
+
@aggregate_targets = specs_by_target.keys.reject(&:abstract?).map do |td|
|
|
13842
|
+
configurations = user_build_configurations.keys.concat(td.all_whitelisted_configurations).uniq
|
|
13843
|
+
pods = @pod_targets.select { |t| t.target_definitions.include?(td) }
|
|
13844
|
+
named = specs_by_target[td].group_by { |spec, _| spec.root.name }.reject { |_, entries| entries.all? { |_, non_library_only| non_library_only } }
|
|
13845
|
+
pods.keep_if { |t| named.key?(t.pod_name) }
|
|
13846
|
+
dependencies = td.dependencies.group_by(&:root_name)
|
|
13847
|
+
by_configuration = Hash[configurations.map { |c| [c, []] }]
|
|
13848
|
+
pods.each do |t|
|
|
13849
|
+
configurations.each do |c|
|
|
13850
|
+
answers = (dependencies[t.pod_name] || []).map { |d| td.pod_whitelisted_for_configuration?(d.name, c) }.uniq
|
|
13851
|
+
raise Informative, "The subspecs of #{t.pod_name} are linked to different build configurations for #{td}" if answers.size > 1
|
|
13852
|
+
by_configuration[c] << t unless answers == [false]
|
|
13853
|
+
end
|
|
13854
|
+
end
|
|
13855
|
+
build_type = td.uses_frameworks? ? BuildType.static_framework : BuildType.static_library
|
|
13856
|
+
AggregateTarget.new(sandbox, build_type, user_build_configurations, [], td.platform, td, Config.instance.installation_root, user_project, user_target_uuids, by_configuration)
|
|
13857
|
+
end
|
|
13858
|
+
raise Informative, "Peach builds the pods of one application target, not #{@aggregate_targets.map(&:label).join(', ')}" unless @aggregate_targets.size == 1
|
|
13859
|
+
@aggregate_targets.each do |target|
|
|
13860
|
+
target.search_paths_aggregate_targets.concat(@aggregate_targets.select { |other| target.target_definition.targets_to_inherit_search_paths.include?(other.target_definition) })
|
|
13861
|
+
end
|
|
13862
|
+
run_podfile_pre_install_hooks
|
|
13863
|
+
end
|
|
13864
|
+
|
|
13865
|
+
private
|
|
13866
|
+
|
|
13867
|
+
def peach_platform(specs, target_definitions, build_type)
|
|
13868
|
+
name = target_definitions.first.platform.name
|
|
13869
|
+
defaults = { :ios => '4.3', :osx => '10.6', :tvos => '9.0', :visionos => '1.0', :watchos => '2.0' }
|
|
13870
|
+
target = specs.select(&:library_specification?).map { |s| Version.new(s.deployment_target(name) || defaults[name]) }.max
|
|
13871
|
+
target = [target, Version.new('8.0')].max if name == :ios && build_type.framework?
|
|
13872
|
+
Platform.new(name, target)
|
|
13873
|
+
end
|
|
13874
|
+
|
|
13875
|
+
def peach_swift_version(root, target_definitions)
|
|
13876
|
+
if root.swift_versions.empty?
|
|
13877
|
+
target_definitions.map(&:swift_version).compact.uniq.first
|
|
13878
|
+
else
|
|
13879
|
+
root.swift_versions.sort.reverse.find { |v| target_definitions.all? { |td| td.supports_swift_version?(v) } }.to_s
|
|
13880
|
+
end
|
|
13881
|
+
end
|
|
13882
|
+
end
|
|
13883
|
+
end
|
|
13884
|
+
`;
|
|
13885
|
+
var EXPORT = String.raw`
|
|
13886
|
+
lambda do |installer, attributes|
|
|
13887
|
+
spec_json = lambda do |spec, platform|
|
|
13888
|
+
consumer = spec.consumer(platform)
|
|
13889
|
+
values = attributes.each_with_object({}) { |a, h| h[a] = consumer.value_for_attribute(a.to_sym) }
|
|
13890
|
+
values['pod_target_xcconfig'] = consumer.pod_target_xcconfig
|
|
13891
|
+
values['user_target_xcconfig'] = consumer.user_target_xcconfig
|
|
13892
|
+
values['dependencies'] = consumer.dependencies.map(&:name)
|
|
13893
|
+
{ 'name' => spec.name, 'root' => spec.root?, 'deploymentTarget' => spec.deployment_target(platform.name), 'consumer' => values }
|
|
13894
|
+
end
|
|
13895
|
+
{
|
|
13896
|
+
'pods' => installer.pod_targets.map do |t|
|
|
13897
|
+
root = t.root_spec
|
|
13898
|
+
local = installer.sandbox.local_path(root.name)
|
|
13899
|
+
{
|
|
13900
|
+
'label' => t.label,
|
|
13901
|
+
'name' => t.pod_name,
|
|
13902
|
+
'version' => root.version.to_s,
|
|
13903
|
+
'moduleName' => t.product_module_name,
|
|
13904
|
+
'local' => local && local.to_s,
|
|
13905
|
+
'source' => root.source,
|
|
13906
|
+
'license' => root.attributes_hash['license'],
|
|
13907
|
+
'platform' => { 'name' => t.platform.name.to_s, 'deploymentTarget' => t.platform.deployment_target.to_s },
|
|
13908
|
+
'framework' => t.build_as_framework?,
|
|
13909
|
+
'dynamic' => t.build_as_dynamic?,
|
|
13910
|
+
'swiftVersion' => t.swift_version,
|
|
13911
|
+
'swiftVersions' => root.swift_versions.map(&:to_s),
|
|
13912
|
+
'targetDefinitions' => t.target_definitions.map(&:label),
|
|
13913
|
+
'dependencies' => { 'debug' => t.dependent_targets_by_config[:debug].map(&:label), 'release' => t.dependent_targets_by_config[:release].map(&:label) },
|
|
13914
|
+
'inhibitWarnings' => t.inhibit_warnings?,
|
|
13915
|
+
'buildPodAsModule' => t.build_pod_as_module?,
|
|
13916
|
+
'infoPlist' => root.info_plist,
|
|
13917
|
+
'specs' => t.specs.map { |s| spec_json.call(s, t.platform) },
|
|
13918
|
+
}
|
|
13919
|
+
end,
|
|
13920
|
+
'aggregates' => installer.aggregate_targets.map do |t|
|
|
13921
|
+
td = t.target_definition
|
|
13922
|
+
{
|
|
13923
|
+
'label' => t.label,
|
|
13924
|
+
'name' => td.name,
|
|
13925
|
+
'platform' => { 'name' => t.platform.name.to_s, 'deploymentTarget' => t.platform.deployment_target.to_s },
|
|
13926
|
+
'framework' => t.build_as_framework?,
|
|
13927
|
+
'userBuildConfigurations' => t.user_build_configurations.transform_values(&:to_s),
|
|
13928
|
+
'podsByConfiguration' => t.pod_targets_for_build_configuration.transform_values { |pods| pods.map(&:label) },
|
|
13929
|
+
'searchPathsAggregates' => t.search_paths_aggregate_targets.map(&:label),
|
|
13930
|
+
'inhibitAllWarnings' => td.inhibits_warnings_for_pod?(''),
|
|
13931
|
+
'swiftVersion' => td.swift_version.to_s,
|
|
13932
|
+
'setArcCompatibilityFlag' => td.podfile.set_arc_compatibility_flag? ? true : false,
|
|
13933
|
+
'userTargets' => t.user_target_uuids,
|
|
13934
|
+
'scriptPhases' => td.script_phases,
|
|
13935
|
+
}
|
|
13936
|
+
end,
|
|
13937
|
+
}
|
|
13938
|
+
end
|
|
13939
|
+
`;
|
|
13940
|
+
|
|
13941
|
+
// src/pods-files.ts
|
|
13942
|
+
init_is_record();
|
|
13943
|
+
init_plist_bytes();
|
|
13944
|
+
var HEADER_EXTENSIONS2 = [
|
|
13945
|
+
".h",
|
|
13946
|
+
".hh",
|
|
13947
|
+
".hpp",
|
|
13948
|
+
".ipp",
|
|
13949
|
+
".tpp",
|
|
13950
|
+
".hxx",
|
|
13951
|
+
".def",
|
|
13952
|
+
".inl",
|
|
13953
|
+
".inc"
|
|
13954
|
+
];
|
|
13955
|
+
var SOURCE_FILE_EXTENSIONS = [
|
|
13956
|
+
.../* @__PURE__ */ new Set([
|
|
13957
|
+
".m",
|
|
13958
|
+
".mm",
|
|
13959
|
+
".i",
|
|
13960
|
+
".c",
|
|
13961
|
+
".cc",
|
|
13962
|
+
".cxx",
|
|
13963
|
+
".cpp",
|
|
13964
|
+
".c++",
|
|
13965
|
+
".swift",
|
|
13966
|
+
...HEADER_EXTENSIONS2
|
|
13967
|
+
])
|
|
13968
|
+
];
|
|
13969
|
+
var GLOB_PATTERNS = {
|
|
13970
|
+
source_files: `*{${SOURCE_FILE_EXTENSIONS.join(",")}}`,
|
|
13971
|
+
public_header_files: `*{${HEADER_EXTENSIONS2.join(",")}}`
|
|
13972
|
+
};
|
|
13973
|
+
|
|
13974
|
+
// src/pods-post-install.ts
|
|
13975
|
+
init_openstep_plist();
|
|
13976
|
+
init_plist_bytes();
|
|
13977
|
+
init_podspec_cocoapods();
|
|
13978
|
+
init_podspec_ruby();
|
|
13979
|
+
init_podspec_ruby_stdlib();
|
|
13980
|
+
var XCODEPROJ = String.raw`
|
|
13981
|
+
module Xcodeproj
|
|
13982
|
+
module Constants
|
|
13983
|
+
INHERITED_KEYWORDS = ['$(inherited)', '$' + '{inherited}'].freeze
|
|
13984
|
+
PRODUCT_TYPE_UTI = Peach::Xcode.product_type_utis.freeze
|
|
13985
|
+
end
|
|
13986
|
+
|
|
13987
|
+
class Informative < StandardError; end
|
|
13988
|
+
|
|
13989
|
+
module Plist
|
|
13990
|
+
def self.read_from_path(path)
|
|
13991
|
+
path = path.to_s
|
|
13992
|
+
raise Informative, "The plist file at path '#{path}' doesn't exist." unless File.exist?(path)
|
|
13993
|
+
Peach::Xcode.plist_read(path)
|
|
13994
|
+
end
|
|
13995
|
+
|
|
13996
|
+
def self.write_to_path(hash, path)
|
|
13997
|
+
Peach::Xcode.plist_write(path.to_s, hash)
|
|
13998
|
+
end
|
|
13999
|
+
end
|
|
14000
|
+
|
|
14001
|
+
class Config
|
|
14002
|
+
attr_accessor :attributes, :other_linker_flags, :includes
|
|
14003
|
+
|
|
14004
|
+
def initialize(source = {})
|
|
14005
|
+
@attributes, @other_linker_flags, @includes =
|
|
14006
|
+
source.is_a?(Hash) ? Peach::Xcode.config_from_hash(source) : Peach::Xcode.config_parse(source.to_s)
|
|
14007
|
+
end
|
|
14008
|
+
|
|
14009
|
+
def ==(other)
|
|
14010
|
+
other.attributes == attributes && other.other_linker_flags == other_linker_flags && other.includes == includes
|
|
14011
|
+
end
|
|
14012
|
+
|
|
14013
|
+
def merge!(xcconfig)
|
|
14014
|
+
xcconfig = Config.new(xcconfig) if xcconfig.is_a?(Hash)
|
|
14015
|
+
@attributes, @other_linker_flags = Peach::Xcode.config_merge(self, xcconfig)
|
|
14016
|
+
self
|
|
14017
|
+
end
|
|
14018
|
+
alias_method :<<, :merge!
|
|
14019
|
+
|
|
14020
|
+
def merge(config)
|
|
14021
|
+
dup.tap { |copy| copy.merge!(config) }
|
|
14022
|
+
end
|
|
14023
|
+
|
|
14024
|
+
def dup
|
|
14025
|
+
Config.new(to_hash.dup)
|
|
14026
|
+
end
|
|
14027
|
+
|
|
14028
|
+
def to_hash(prefix = nil)
|
|
14029
|
+
raise ArgumentError, 'Peach writes no prefixed xcconfig' if prefix
|
|
14030
|
+
Peach::Xcode.config_hash(self)
|
|
14031
|
+
end
|
|
14032
|
+
alias_method :to_h, :to_hash
|
|
14033
|
+
|
|
14034
|
+
def to_s(prefix = nil)
|
|
14035
|
+
raise ArgumentError, 'Peach writes no prefixed xcconfig' if prefix
|
|
14036
|
+
Peach::Xcode.config_render(self)
|
|
14037
|
+
end
|
|
14038
|
+
|
|
14039
|
+
def save_as(pathname, prefix = nil)
|
|
14040
|
+
return if File.exist?(pathname) && Config.new(pathname) == self
|
|
14041
|
+
File.write(pathname.to_s, to_s(prefix))
|
|
14042
|
+
end
|
|
14043
|
+
end
|
|
14044
|
+
|
|
14045
|
+
class Project
|
|
14046
|
+
attr_reader :path, :root_object, :object_version, :generated_uuids
|
|
14047
|
+
|
|
14048
|
+
# keys whose values name objects without referring to them
|
|
14049
|
+
PEACH_PLAIN_KEYS = %w(isa remoteGlobalIDString containerPortal).freeze
|
|
14050
|
+
|
|
14051
|
+
def initialize(path, objects, root_uuid, object_version)
|
|
14052
|
+
@path = Pathname.new(path)
|
|
14053
|
+
@objects = objects
|
|
14054
|
+
@object_version = object_version
|
|
14055
|
+
@wrapped = {}
|
|
14056
|
+
@generated_uuids = []
|
|
14057
|
+
@available_uuids = []
|
|
14058
|
+
@dirty = false
|
|
14059
|
+
@root_object = object(root_uuid)
|
|
14060
|
+
end
|
|
14061
|
+
|
|
14062
|
+
def object(uuid)
|
|
14063
|
+
@wrapped[uuid] ||= begin
|
|
14064
|
+
attributes = @objects[uuid]
|
|
14065
|
+
raise ArgumentError, "#{path} has no object #{uuid}" unless attributes
|
|
14066
|
+
klass = Object::ISA[attributes['isa']]
|
|
14067
|
+
raise ArgumentError, "Peach models no #{attributes['isa']} (#{uuid} in #{path})" unless klass
|
|
14068
|
+
klass.new(self, uuid, attributes)
|
|
14069
|
+
end
|
|
14070
|
+
end
|
|
14071
|
+
|
|
14072
|
+
def objects_by_uuid
|
|
14073
|
+
@objects.keys.each_with_object({}) { |uuid, by_uuid| by_uuid[uuid] = object(uuid) }
|
|
14074
|
+
end
|
|
14075
|
+
|
|
14076
|
+
def objects
|
|
14077
|
+
@objects.keys.map { |uuid| object(uuid) }
|
|
14078
|
+
end
|
|
14079
|
+
|
|
14080
|
+
def uuids
|
|
14081
|
+
@objects.keys
|
|
14082
|
+
end
|
|
14083
|
+
|
|
14084
|
+
def new(klass)
|
|
14085
|
+
klass = Object.const_get(klass) if klass.is_a?(String)
|
|
14086
|
+
raise ArgumentError, "Peach creates no #{klass}" unless Object::ISA[klass.isa].equal?(klass)
|
|
14087
|
+
uuid = generate_uuid
|
|
14088
|
+
attributes = { 'isa' => klass.isa }
|
|
14089
|
+
klass.peach_defaults.each { |key, value| attributes[key] = value.dup }
|
|
14090
|
+
@objects[uuid] = attributes
|
|
14091
|
+
mark_dirty!
|
|
14092
|
+
object(uuid)
|
|
14093
|
+
end
|
|
14094
|
+
|
|
14095
|
+
def generate_uuid
|
|
14096
|
+
generate_available_uuid_list while @available_uuids.empty?
|
|
14097
|
+
@available_uuids.shift
|
|
14098
|
+
end
|
|
14099
|
+
|
|
14100
|
+
# Xcodeproj draws random ids; Peach derives them from the project and a counter
|
|
14101
|
+
def generate_available_uuid_list(count = 100)
|
|
14102
|
+
start = @generated_uuids.size
|
|
14103
|
+
candidates = Array.new(count) { |i| Digest::SHA1.hexdigest("#{path.basename}/#{start + i}")[0, 24].upcase }
|
|
14104
|
+
uniques = candidates - (@generated_uuids + uuids)
|
|
14105
|
+
@generated_uuids += uniques
|
|
14106
|
+
@available_uuids += uniques
|
|
14107
|
+
end
|
|
14108
|
+
|
|
14109
|
+
def mark_dirty!
|
|
14110
|
+
@dirty = true
|
|
14111
|
+
@referrers = nil
|
|
14112
|
+
end
|
|
14113
|
+
|
|
14114
|
+
def dirty?
|
|
14115
|
+
@dirty
|
|
14116
|
+
end
|
|
14117
|
+
|
|
14118
|
+
def peach_referrers(uuid)
|
|
14119
|
+
unless @referrers
|
|
14120
|
+
@referrers = {}
|
|
14121
|
+
@objects.each do |owner, attributes|
|
|
14122
|
+
attributes.each do |key, value|
|
|
14123
|
+
next if PEACH_PLAIN_KEYS.include?(key)
|
|
14124
|
+
refs = value.is_a?(Array) ? value : [value]
|
|
14125
|
+
refs.each { |ref| (@referrers[ref] ||= []) << owner if ref.is_a?(String) && @objects.key?(ref) }
|
|
14126
|
+
end
|
|
14127
|
+
end
|
|
14128
|
+
end
|
|
14129
|
+
(@referrers[uuid] || []).uniq.map { |owner| object(owner) }
|
|
14130
|
+
end
|
|
14131
|
+
|
|
14132
|
+
def peach_remove(uuid)
|
|
14133
|
+
@objects.each_value do |attributes|
|
|
14134
|
+
attributes.keys.each do |key|
|
|
14135
|
+
next if PEACH_PLAIN_KEYS.include?(key)
|
|
14136
|
+
value = attributes[key]
|
|
14137
|
+
if value == uuid
|
|
14138
|
+
attributes.delete(key)
|
|
14139
|
+
elsif value.is_a?(Array)
|
|
14140
|
+
value.delete(uuid)
|
|
14141
|
+
end
|
|
14142
|
+
end
|
|
14143
|
+
end
|
|
14144
|
+
@objects.delete(uuid)
|
|
14145
|
+
@wrapped.delete(uuid)
|
|
14146
|
+
mark_dirty!
|
|
14147
|
+
end
|
|
14148
|
+
|
|
14149
|
+
# the objects table after Peach's TypeScript integrator changed it
|
|
14150
|
+
def peach_reload(objects)
|
|
14151
|
+
@objects.keys.each do |uuid|
|
|
14152
|
+
next if objects.key?(uuid)
|
|
14153
|
+
@objects.delete(uuid)
|
|
14154
|
+
@wrapped.delete(uuid)
|
|
14155
|
+
end
|
|
14156
|
+
objects.each do |uuid, attributes|
|
|
14157
|
+
current = @objects[uuid]
|
|
14158
|
+
if current
|
|
14159
|
+
current.keys.each { |key| current.delete(key) unless attributes.key?(key) }
|
|
14160
|
+
attributes.each { |key, value| current[key] = value unless current[key] == value }
|
|
14161
|
+
else
|
|
14162
|
+
@objects[uuid] = attributes
|
|
14163
|
+
end
|
|
14164
|
+
end
|
|
14165
|
+
mark_dirty!
|
|
14166
|
+
end
|
|
14167
|
+
|
|
14168
|
+
def project_dir
|
|
14169
|
+
path.dirname
|
|
14170
|
+
end
|
|
14171
|
+
|
|
14172
|
+
def main_group
|
|
14173
|
+
root_object.main_group
|
|
14174
|
+
end
|
|
14175
|
+
|
|
14176
|
+
def [](group_name)
|
|
14177
|
+
main_group[group_name]
|
|
14178
|
+
end
|
|
14179
|
+
|
|
14180
|
+
def targets
|
|
14181
|
+
root_object.targets
|
|
14182
|
+
end
|
|
14183
|
+
|
|
14184
|
+
def native_targets
|
|
14185
|
+
targets.select { |o| o.is_a?(Object::PBXNativeTarget) }
|
|
14186
|
+
end
|
|
14187
|
+
|
|
14188
|
+
def build_configuration_list
|
|
14189
|
+
root_object.build_configuration_list
|
|
14190
|
+
end
|
|
14191
|
+
|
|
14192
|
+
def build_configurations
|
|
14193
|
+
root_object.build_configuration_list.build_configurations
|
|
14194
|
+
end
|
|
14195
|
+
|
|
14196
|
+
def build_settings(name)
|
|
14197
|
+
root_object.build_configuration_list.build_settings(name)
|
|
14198
|
+
end
|
|
14199
|
+
|
|
14200
|
+
def files
|
|
14201
|
+
objects.select { |o| o.is_a?(Object::PBXFileReference) }
|
|
14202
|
+
end
|
|
14203
|
+
|
|
14204
|
+
def groups
|
|
14205
|
+
main_group.groups
|
|
14206
|
+
end
|
|
14207
|
+
|
|
14208
|
+
def products_group
|
|
14209
|
+
root_object.product_ref_group
|
|
14210
|
+
end
|
|
14211
|
+
|
|
14212
|
+
def frameworks_group
|
|
14213
|
+
main_group['Frameworks'] || main_group.new_group('Frameworks')
|
|
14214
|
+
end
|
|
14215
|
+
|
|
14216
|
+
# the tables stay in memory, where Peach reads them
|
|
14217
|
+
def save(save_path = nil)
|
|
14218
|
+
raise ArgumentError, "Peach saves #{path} only in place" if save_path
|
|
14219
|
+
end
|
|
14220
|
+
|
|
14221
|
+
# Xcodeproj's to-many attribute: a live list of the uuids in the owner's table entry
|
|
14222
|
+
class ObjectList
|
|
14223
|
+
include Enumerable
|
|
14224
|
+
attr_reader :owner
|
|
14225
|
+
|
|
14226
|
+
def initialize(owner, key)
|
|
14227
|
+
@owner = owner
|
|
14228
|
+
@key = key
|
|
14229
|
+
end
|
|
14230
|
+
|
|
14231
|
+
def uuids
|
|
14232
|
+
@owner.peach_uuids(@key).dup
|
|
14233
|
+
end
|
|
14234
|
+
|
|
14235
|
+
def objects
|
|
14236
|
+
@owner.peach_uuids(@key).map { |uuid| @owner.project.object(uuid) }
|
|
14237
|
+
end
|
|
14238
|
+
alias_method :to_a, :objects
|
|
14239
|
+
alias_method :to_ary, :objects
|
|
14240
|
+
|
|
14241
|
+
def each(&block)
|
|
14242
|
+
objects.each(&block)
|
|
14243
|
+
self
|
|
14244
|
+
end
|
|
14245
|
+
|
|
14246
|
+
def size
|
|
14247
|
+
@owner.peach_uuids(@key).size
|
|
14248
|
+
end
|
|
14249
|
+
alias_method :length, :size
|
|
14250
|
+
|
|
14251
|
+
def empty?
|
|
14252
|
+
size.zero?
|
|
14253
|
+
end
|
|
14254
|
+
|
|
14255
|
+
def [](index)
|
|
14256
|
+
objects[index]
|
|
14257
|
+
end
|
|
14258
|
+
alias_method :at, :[]
|
|
14259
|
+
|
|
14260
|
+
def first
|
|
14261
|
+
objects.first
|
|
14262
|
+
end
|
|
14263
|
+
|
|
14264
|
+
def last
|
|
14265
|
+
objects.last
|
|
14266
|
+
end
|
|
14267
|
+
|
|
14268
|
+
def index(object = nil, &block)
|
|
14269
|
+
block ? objects.index(&block) : objects.index(object)
|
|
14270
|
+
end
|
|
14271
|
+
alias_method :find_index, :index
|
|
14272
|
+
|
|
14273
|
+
def include?(object)
|
|
14274
|
+
objects.include?(object)
|
|
14275
|
+
end
|
|
14276
|
+
|
|
14277
|
+
def ==(other)
|
|
14278
|
+
objects == (other.is_a?(ObjectList) ? other.objects : other)
|
|
14279
|
+
end
|
|
14280
|
+
|
|
14281
|
+
def inspect
|
|
14282
|
+
objects.inspect
|
|
14283
|
+
end
|
|
14284
|
+
|
|
14285
|
+
def <<(object)
|
|
14286
|
+
live << peach_uuid(object)
|
|
14287
|
+
self
|
|
14288
|
+
end
|
|
14289
|
+
alias_method :push, :<<
|
|
14290
|
+
|
|
14291
|
+
def concat(list)
|
|
14292
|
+
list.each { |object| self << object }
|
|
14293
|
+
self
|
|
14294
|
+
end
|
|
14295
|
+
|
|
14296
|
+
def insert(index, object)
|
|
14297
|
+
live.insert(index, peach_uuid(object))
|
|
14298
|
+
self
|
|
14299
|
+
end
|
|
14300
|
+
|
|
14301
|
+
def unshift(object)
|
|
14302
|
+
live.unshift(peach_uuid(object))
|
|
14303
|
+
self
|
|
14304
|
+
end
|
|
14305
|
+
|
|
14306
|
+
def delete(object)
|
|
14307
|
+
return nil unless object.is_a?(Object::AbstractObject) && live.include?(object.uuid)
|
|
14308
|
+
live.delete(object.uuid)
|
|
14309
|
+
@owner.project.mark_dirty!
|
|
14310
|
+
object
|
|
14311
|
+
end
|
|
14312
|
+
|
|
14313
|
+
def delete_at(index)
|
|
14314
|
+
uuid = live.delete_at(index)
|
|
14315
|
+
@owner.project.mark_dirty!
|
|
14316
|
+
uuid && @owner.project.object(uuid)
|
|
14317
|
+
end
|
|
14318
|
+
|
|
14319
|
+
def delete_if(&block)
|
|
14320
|
+
live.reject! { |uuid| block.call(@owner.project.object(uuid)) }
|
|
14321
|
+
@owner.project.mark_dirty!
|
|
14322
|
+
self
|
|
14323
|
+
end
|
|
14324
|
+
|
|
14325
|
+
def clear
|
|
14326
|
+
live.clear
|
|
14327
|
+
@owner.project.mark_dirty!
|
|
14328
|
+
self
|
|
14329
|
+
end
|
|
14330
|
+
|
|
14331
|
+
def uniq!
|
|
14332
|
+
result = live.uniq!
|
|
14333
|
+
@owner.project.mark_dirty!
|
|
14334
|
+
result && self
|
|
14335
|
+
end
|
|
14336
|
+
|
|
14337
|
+
def move(object, new_index)
|
|
14338
|
+
return if index(object) == new_index
|
|
14339
|
+
raise "Attempt to move object '#{object}' not present in the list '#{inspect}'" unless delete(object)
|
|
14340
|
+
insert(new_index, object)
|
|
14341
|
+
end
|
|
14342
|
+
|
|
14343
|
+
def move_from(current_index, new_index)
|
|
14344
|
+
return if current_index == new_index
|
|
14345
|
+
object = delete_at(current_index)
|
|
14346
|
+
raise "Attempt to move object from index '#{current_index}' which is beyond bounds of the list '#{inspect}'" unless object
|
|
14347
|
+
insert(new_index, object)
|
|
14348
|
+
end
|
|
14349
|
+
|
|
14350
|
+
private
|
|
14351
|
+
|
|
14352
|
+
def live
|
|
14353
|
+
@owner.peach_live_uuids(@key)
|
|
14354
|
+
end
|
|
14355
|
+
|
|
14356
|
+
def peach_uuid(object)
|
|
14357
|
+
unless object.is_a?(Object::AbstractObject) && object.project.equal?(@owner.project)
|
|
14358
|
+
raise ArgumentError, "#{@owner.inspect} lists objects of its own project, not #{object.inspect}"
|
|
14359
|
+
end
|
|
14360
|
+
@owner.project.mark_dirty!
|
|
14361
|
+
object.uuid
|
|
14362
|
+
end
|
|
14363
|
+
end
|
|
14364
|
+
|
|
14365
|
+
module Object
|
|
14366
|
+
class AbstractObject
|
|
14367
|
+
attr_reader :project, :uuid
|
|
14368
|
+
|
|
14369
|
+
def self.isa
|
|
14370
|
+
name.split('::').last
|
|
14371
|
+
end
|
|
14372
|
+
|
|
14373
|
+
def self.peach_defaults
|
|
14374
|
+
inherited = equal?(AbstractObject) ? {} : superclass.peach_defaults
|
|
14375
|
+
inherited.merge(@peach_defaults || {})
|
|
14376
|
+
end
|
|
14377
|
+
|
|
14378
|
+
def initialize(project, uuid, attributes)
|
|
14379
|
+
@project = project
|
|
14380
|
+
@uuid = uuid
|
|
14381
|
+
@attributes = attributes
|
|
14382
|
+
end
|
|
14383
|
+
|
|
14384
|
+
def self.attribute(name, key, default = nil)
|
|
14385
|
+
(@peach_defaults ||= {})[key] = default unless default.nil?
|
|
14386
|
+
define_method(name) { @attributes[key] }
|
|
14387
|
+
define_method("#{name}=") { |value| peach_set(key, value) }
|
|
14388
|
+
end
|
|
14389
|
+
|
|
14390
|
+
def self.has_one(name, key)
|
|
14391
|
+
define_method(name) { (uuid = @attributes[key]) && project.object(uuid) }
|
|
14392
|
+
define_method("#{name}=") { |object| peach_set(key, object) }
|
|
14393
|
+
end
|
|
14394
|
+
|
|
14395
|
+
def self.has_many(name, key)
|
|
14396
|
+
(@peach_defaults ||= {})[key] = []
|
|
14397
|
+
define_method(name) { Project::ObjectList.new(self, key) }
|
|
14398
|
+
end
|
|
14399
|
+
|
|
14400
|
+
def peach_uuid(key)
|
|
14401
|
+
@attributes[key]
|
|
14402
|
+
end
|
|
14403
|
+
|
|
14404
|
+
def peach_uuids(key)
|
|
14405
|
+
@attributes[key] || []
|
|
14406
|
+
end
|
|
14407
|
+
|
|
14408
|
+
def peach_live_uuids(key)
|
|
14409
|
+
@attributes[key] ||= []
|
|
14410
|
+
end
|
|
14411
|
+
|
|
14412
|
+
def peach_set(key, value)
|
|
14413
|
+
value = value.uuid if value.is_a?(AbstractObject)
|
|
14414
|
+
if value.nil?
|
|
14415
|
+
@attributes.delete(key)
|
|
14416
|
+
else
|
|
14417
|
+
@attributes[key] = value
|
|
14418
|
+
end
|
|
14419
|
+
project.mark_dirty!
|
|
14420
|
+
end
|
|
14421
|
+
|
|
14422
|
+
def isa
|
|
14423
|
+
@attributes['isa']
|
|
14424
|
+
end
|
|
14425
|
+
|
|
14426
|
+
def referrers
|
|
14427
|
+
project.peach_referrers(uuid)
|
|
14428
|
+
end
|
|
14429
|
+
|
|
14430
|
+
def mark_project_as_dirty!
|
|
14431
|
+
project.mark_dirty!
|
|
14432
|
+
end
|
|
14433
|
+
|
|
14434
|
+
def remove_from_project
|
|
14435
|
+
project.peach_remove(uuid)
|
|
14436
|
+
end
|
|
14437
|
+
|
|
14438
|
+
def display_name
|
|
14439
|
+
declared_name = name if respond_to?(:name)
|
|
14440
|
+
declared_name && !declared_name.empty? ? declared_name : isa.gsub(/^(PBX|XC)/, '')
|
|
14441
|
+
end
|
|
14442
|
+
alias_method :to_s, :display_name
|
|
14443
|
+
|
|
14444
|
+
def inspect
|
|
14445
|
+
"<#{isa} name=#{display_name.inspect} uuid=#{uuid}>"
|
|
14446
|
+
end
|
|
14447
|
+
end
|
|
14448
|
+
|
|
14449
|
+
module GroupableHelper
|
|
14450
|
+
SOURCE_TREES_BY_KEY = {
|
|
14451
|
+
:absolute => '<absolute>',
|
|
14452
|
+
:group => '<group>',
|
|
14453
|
+
:project => 'SOURCE_ROOT',
|
|
14454
|
+
:built_products => 'BUILT_PRODUCTS_DIR',
|
|
14455
|
+
:developer_dir => 'DEVELOPER_DIR',
|
|
14456
|
+
:sdk_root => 'SDKROOT',
|
|
14457
|
+
}.freeze
|
|
14458
|
+
|
|
14459
|
+
def self.normalize_source_tree(source_tree)
|
|
14460
|
+
source_tree = SOURCE_TREES_BY_KEY[source_tree] if source_tree.is_a?(Symbol)
|
|
14461
|
+
raise "[Xcodeproj] Unrecognized source tree option '#{source_tree}'" unless SOURCE_TREES_BY_KEY.values.include?(source_tree)
|
|
14462
|
+
source_tree
|
|
14463
|
+
end
|
|
14464
|
+
|
|
14465
|
+
def parent
|
|
14466
|
+
parents = referrers
|
|
14467
|
+
parents = parents.select { |o| o.is_a?(PBXGroup) } if parents.count > 1
|
|
14468
|
+
raise "[Xcodeproj] Consistency issue: no parent for object '#{display_name}'" if parents.empty?
|
|
14469
|
+
raise "[Xcodeproj] Consistency issue: unexpected multiple parents for object '#{display_name}'" if parents.count > 1
|
|
14470
|
+
parents.first
|
|
14471
|
+
end
|
|
14472
|
+
|
|
14473
|
+
def real_path
|
|
14474
|
+
source_tree_path = source_tree_real_path
|
|
14475
|
+
source_tree_path ? source_tree_path + (path || '') : Pathname(path || '')
|
|
14476
|
+
end
|
|
14477
|
+
|
|
14478
|
+
def source_tree_real_path
|
|
14479
|
+
case source_tree
|
|
14480
|
+
when '<group>'
|
|
14481
|
+
object_parent = parent
|
|
14482
|
+
if object_parent.isa == 'PBXProject'
|
|
14483
|
+
project.project_dir + project.root_object.project_dir_path
|
|
14484
|
+
else
|
|
14485
|
+
object_parent.real_path
|
|
14486
|
+
end
|
|
14487
|
+
when 'SOURCE_ROOT'
|
|
14488
|
+
project.project_dir
|
|
14489
|
+
when '<absolute>'
|
|
14490
|
+
nil
|
|
14491
|
+
else
|
|
14492
|
+
Pathname.new("$" + "{#{source_tree}}")
|
|
14493
|
+
end
|
|
14494
|
+
end
|
|
14495
|
+
|
|
14496
|
+
def set_source_tree(source_tree)
|
|
14497
|
+
self.source_tree = GroupableHelper.normalize_source_tree(source_tree)
|
|
14498
|
+
end
|
|
14499
|
+
|
|
14500
|
+
def peach_set_path_with_source_tree(new_path, source_tree)
|
|
14501
|
+
new_path = Pathname.new(new_path.to_s)
|
|
14502
|
+
source_tree = GroupableHelper.normalize_source_tree(source_tree)
|
|
14503
|
+
self.source_tree = source_tree
|
|
14504
|
+
if source_tree == '<absolute>'
|
|
14505
|
+
raise "[Xcodeproj] Attempt to set a relative path with an absolute source tree: '#{new_path}'" unless new_path.absolute?
|
|
14506
|
+
self.path = new_path.to_s
|
|
14507
|
+
elsif source_tree == '<group>' || source_tree == 'SOURCE_ROOT'
|
|
14508
|
+
tree_path = source_tree_real_path
|
|
14509
|
+
self.path = tree_path && tree_path.absolute? == new_path.absolute? ? new_path.relative_path_from(tree_path).to_s : new_path.to_s
|
|
14510
|
+
else
|
|
14511
|
+
self.path = new_path.to_s
|
|
14512
|
+
end
|
|
14513
|
+
end
|
|
14514
|
+
|
|
14515
|
+
def build_files
|
|
14516
|
+
referrers.select { |o| o.is_a?(PBXBuildFile) }
|
|
14517
|
+
end
|
|
14518
|
+
|
|
14519
|
+
def remove_from_project
|
|
14520
|
+
build_files.each(&:remove_from_project)
|
|
14521
|
+
super
|
|
14522
|
+
end
|
|
14523
|
+
end
|
|
14524
|
+
class XCBuildConfiguration < AbstractObject
|
|
14525
|
+
MUTUAL_RECURSION_SENTINEL = 'xcodeproj.mutual_recursion_sentinel'.freeze
|
|
14526
|
+
ARRAY_SETTINGS = %w(
|
|
14527
|
+
ALTERNATE_PERMISSIONS_FILES ARCHS BUILD_VARIANTS EXCLUDED_SOURCE_FILE_NAMES FRAMEWORK_SEARCH_PATHS
|
|
14528
|
+
GCC_PREPROCESSOR_DEFINITIONS GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS HEADER_SEARCH_PATHS
|
|
14529
|
+
INFOPLIST_PREPROCESSOR_DEFINITIONS LIBRARY_SEARCH_PATHS OTHER_CFLAGS OTHER_CPLUSPLUSFLAGS OTHER_LDFLAGS
|
|
14530
|
+
REZ_SEARCH_PATHS SECTORDER_FLAGS WARNING_CFLAGS WARNING_LDFLAGS
|
|
14531
|
+
).freeze
|
|
14532
|
+
ARRAY_SETTINGS_OBJECT_VERSION_50 = %w(
|
|
14533
|
+
ALTERNATE_PERMISSIONS_FILES ARCHS BUILD_VARIANTS EXCLUDED_SOURCE_FILE_NAMES FRAMEWORK_SEARCH_PATHS
|
|
14534
|
+
GCC_PREPROCESSOR_DEFINITIONS GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS HEADER_SEARCH_PATHS
|
|
14535
|
+
INCLUDED_SOURCE_FILE_NAMES INFOPLIST_PREPROCESSOR_DEFINITIONS LD_RUNPATH_SEARCH_PATHS LIBRARY_SEARCH_PATHS
|
|
14536
|
+
LOCALIZED_STRING_MACRO_NAMES OTHER_CFLAGS OTHER_CPLUSPLUSFLAGS OTHER_LDFLAGS REZ_SEARCH_PATHS SECTORDER_FLAGS
|
|
14537
|
+
SYSTEM_FRAMEWORK_SEARCH_PATHS SYSTEM_HEADER_SEARCH_PATHS USER_HEADER_SEARCH_PATHS WARNING_CFLAGS WARNING_LDFLAGS
|
|
14538
|
+
).freeze
|
|
14539
|
+
|
|
14540
|
+
attribute :name, 'name'
|
|
14541
|
+
has_one :base_configuration_reference, 'baseConfigurationReference'
|
|
14542
|
+
|
|
14543
|
+
def build_settings
|
|
14544
|
+
@attributes['buildSettings'] ||= {}
|
|
14545
|
+
end
|
|
14546
|
+
|
|
14547
|
+
def build_settings=(settings)
|
|
14548
|
+
peach_set('buildSettings', settings)
|
|
14549
|
+
end
|
|
14550
|
+
|
|
14551
|
+
def debug?
|
|
14552
|
+
gcc_preprocessor_definitions = resolve_build_setting('GCC_PREPROCESSOR_DEFINITIONS')
|
|
14553
|
+
gcc_preprocessor_definitions && gcc_preprocessor_definitions.include?('DEBUG=1')
|
|
14554
|
+
end
|
|
14555
|
+
|
|
14556
|
+
def type
|
|
14557
|
+
debug? ? :debug : :release
|
|
14558
|
+
end
|
|
14559
|
+
|
|
14560
|
+
def resolve_build_setting(key, root_target = nil, previous_key = nil)
|
|
14561
|
+
setting = build_settings[key]
|
|
14562
|
+
setting = resolve_variable_substitution(key, setting, root_target, previous_key)
|
|
14563
|
+
|
|
14564
|
+
config_setting = config[key]
|
|
14565
|
+
config_setting = resolve_variable_substitution(key, config_setting, root_target, previous_key)
|
|
14566
|
+
|
|
14567
|
+
project_setting = project.build_configuration_list[name]
|
|
14568
|
+
project_setting = nil if equal?(project_setting)
|
|
14569
|
+
project_setting &&= project_setting.resolve_build_setting(key, root_target)
|
|
14570
|
+
|
|
14571
|
+
defaults = {
|
|
14572
|
+
'CONFIGURATION' => name,
|
|
14573
|
+
'SRCROOT' => project.project_dir.to_s,
|
|
14574
|
+
}
|
|
14575
|
+
|
|
14576
|
+
if previous_key.nil? && setting == MUTUAL_RECURSION_SENTINEL
|
|
14577
|
+
setting = nil
|
|
14578
|
+
end
|
|
14579
|
+
|
|
14580
|
+
[defaults[key], project_setting, config_setting, setting, ENV[key]].compact.reduce(nil) do |inherited, value|
|
|
14581
|
+
expand_build_setting(value, inherited)
|
|
14582
|
+
end
|
|
14583
|
+
end
|
|
14584
|
+
|
|
14585
|
+
private
|
|
14586
|
+
|
|
14587
|
+
def expand_build_setting(build_setting_value, config_value)
|
|
14588
|
+
if build_setting_value.is_a?(Array) && config_value.is_a?(String)
|
|
14589
|
+
config_value = split_build_setting_array_to_string(config_value)
|
|
14590
|
+
elsif build_setting_value.is_a?(String) && config_value.is_a?(Array)
|
|
14591
|
+
build_setting_value = split_build_setting_array_to_string(build_setting_value)
|
|
14592
|
+
end
|
|
14593
|
+
|
|
14594
|
+
default = build_setting_value.is_a?(String) ? '' : []
|
|
14595
|
+
inherited = config_value || default
|
|
14596
|
+
|
|
14597
|
+
return build_setting_value.gsub(Regexp.union(Constants::INHERITED_KEYWORDS), inherited) if build_setting_value.is_a? String
|
|
14598
|
+
build_setting_value.flat_map { |value| Constants::INHERITED_KEYWORDS.include?(value) ? inherited : value }
|
|
14599
|
+
end
|
|
14600
|
+
|
|
14601
|
+
def resolve_variable_substitution(key, value, root_target, previous_key = nil)
|
|
14602
|
+
case value
|
|
14603
|
+
when Array
|
|
14604
|
+
return value.map { |v| resolve_variable_substitution(key, v, root_target) }
|
|
14605
|
+
when nil
|
|
14606
|
+
return
|
|
14607
|
+
when String
|
|
14608
|
+
nil
|
|
14609
|
+
else
|
|
14610
|
+
raise ArgumentError, "Settings values can only be nil, string, or array, got #{value.inspect} for #{key}"
|
|
14611
|
+
end
|
|
14612
|
+
|
|
14613
|
+
unless variable_match_data = value.match(/\$(?:[{]([_a-zA-Z0-9]+?)[}]|[(]([_a-zA-Z0-9]+?)[)])/)
|
|
14614
|
+
return value
|
|
14615
|
+
end
|
|
14616
|
+
variable_reference = variable_match_data[0]
|
|
14617
|
+
variable = variable_match_data[1] || variable_match_data[2]
|
|
14618
|
+
|
|
14619
|
+
case variable
|
|
14620
|
+
when 'inherited'
|
|
14621
|
+
value
|
|
14622
|
+
when key
|
|
14623
|
+
nil
|
|
14624
|
+
when previous_key
|
|
14625
|
+
MUTUAL_RECURSION_SENTINEL
|
|
14626
|
+
else
|
|
14627
|
+
configuration_to_resolve_against = root_target ? root_target.build_configuration_list[name] : self
|
|
14628
|
+
resolved_value_for_variable = configuration_to_resolve_against.resolve_build_setting(variable, root_target, key) || ''
|
|
14629
|
+
|
|
14630
|
+
if resolved_value_for_variable == MUTUAL_RECURSION_SENTINEL
|
|
14631
|
+
return MUTUAL_RECURSION_SENTINEL
|
|
14632
|
+
end
|
|
14633
|
+
|
|
14634
|
+
value = value.gsub(variable_reference, resolved_value_for_variable)
|
|
14635
|
+
resolve_variable_substitution(key, value, root_target)
|
|
14636
|
+
end
|
|
14637
|
+
end
|
|
14638
|
+
|
|
14639
|
+
def normalize_array_settings(settings)
|
|
14640
|
+
return unless settings
|
|
14641
|
+
|
|
14642
|
+
array_settings = project.object_version.to_i >= 50 ? ARRAY_SETTINGS_OBJECT_VERSION_50 : ARRAY_SETTINGS
|
|
14643
|
+
|
|
14644
|
+
settings.keys.each do |key|
|
|
14645
|
+
next unless value = settings[key]
|
|
14646
|
+
stripped_key = key.sub(/\[[^\]]+\]$/, '')
|
|
14647
|
+
case value
|
|
14648
|
+
when String
|
|
14649
|
+
next unless array_settings.include?(stripped_key)
|
|
14650
|
+
array_value = split_build_setting_array_to_string(value)
|
|
14651
|
+
next unless array_value.size > 1
|
|
14652
|
+
settings[key] = array_value
|
|
14653
|
+
when Array
|
|
14654
|
+
next if value.size > 1 && array_settings.include?(stripped_key)
|
|
14655
|
+
settings[key] = value.join(' ')
|
|
14656
|
+
end
|
|
14657
|
+
end
|
|
14658
|
+
end
|
|
14659
|
+
|
|
14660
|
+
def split_build_setting_array_to_string(string)
|
|
14661
|
+
regexp = / *((['"]?).*?[^\\]\2)(?=( |\z))/
|
|
14662
|
+
string.scan(regexp).map(&:first)
|
|
14663
|
+
end
|
|
14664
|
+
|
|
14665
|
+
def config
|
|
14666
|
+
return {} unless base_configuration_reference
|
|
14667
|
+
# integration sets the reference after hooks have read the settings
|
|
14668
|
+
@config = nil unless @config_reference == peach_uuid('baseConfigurationReference')
|
|
14669
|
+
@config_reference = peach_uuid('baseConfigurationReference')
|
|
14670
|
+
@config ||=
|
|
14671
|
+
if base_configuration_reference.real_path.exist?
|
|
14672
|
+
Xcodeproj::Config.new(base_configuration_reference.real_path).to_hash.tap do |hash|
|
|
14673
|
+
normalize_array_settings(hash)
|
|
14674
|
+
end
|
|
14675
|
+
else
|
|
14676
|
+
{}
|
|
14677
|
+
end
|
|
14678
|
+
end
|
|
14679
|
+
end
|
|
14680
|
+
|
|
14681
|
+
class XCConfigurationList < AbstractObject
|
|
14682
|
+
attribute :default_configuration_is_visible, 'defaultConfigurationIsVisible', '0'
|
|
14683
|
+
attribute :default_configuration_name, 'defaultConfigurationName'
|
|
14684
|
+
has_many :build_configurations, 'buildConfigurations'
|
|
14685
|
+
|
|
14686
|
+
def [](name)
|
|
14687
|
+
build_configurations.find { |bc| bc.name == name }
|
|
14688
|
+
end
|
|
14689
|
+
|
|
14690
|
+
def build_settings(build_configuration_name)
|
|
14691
|
+
configuration = self[build_configuration_name]
|
|
14692
|
+
configuration && configuration.build_settings
|
|
14693
|
+
end
|
|
14694
|
+
end
|
|
14695
|
+
|
|
14696
|
+
class PBXBuildFile < AbstractObject
|
|
14697
|
+
attribute :settings, 'settings'
|
|
14698
|
+
has_one :file_ref, 'fileRef'
|
|
14699
|
+
has_one :product_ref, 'productRef'
|
|
14700
|
+
|
|
14701
|
+
def display_name
|
|
14702
|
+
if product_ref
|
|
14703
|
+
product_ref.display_name
|
|
14704
|
+
elsif file_ref
|
|
14705
|
+
file_ref.display_name
|
|
14706
|
+
else
|
|
14707
|
+
super
|
|
14708
|
+
end
|
|
14709
|
+
end
|
|
14710
|
+
end
|
|
14711
|
+
|
|
14712
|
+
class AbstractBuildPhase < AbstractObject
|
|
14713
|
+
has_many :files, 'files'
|
|
14714
|
+
attribute :build_action_mask, 'buildActionMask', '2147483647'
|
|
14715
|
+
attribute :run_only_for_deployment_postprocessing, 'runOnlyForDeploymentPostprocessing', '0'
|
|
14716
|
+
attribute :always_out_of_date, 'alwaysOutOfDate'
|
|
14717
|
+
|
|
14718
|
+
def files_references
|
|
14719
|
+
files.map(&:file_ref)
|
|
14720
|
+
end
|
|
14721
|
+
|
|
14722
|
+
def file_display_names
|
|
14723
|
+
files.map(&:display_name)
|
|
14724
|
+
end
|
|
14725
|
+
|
|
14726
|
+
def build_file(file_ref)
|
|
14727
|
+
files.find { |build_file| build_file.peach_uuid('fileRef') == file_ref.uuid }
|
|
14728
|
+
end
|
|
14729
|
+
|
|
14730
|
+
def include?(file_ref)
|
|
14731
|
+
!build_file(file_ref).nil?
|
|
14732
|
+
end
|
|
14733
|
+
|
|
14734
|
+
def add_file_reference(file_ref, avoid_duplicates = false)
|
|
14735
|
+
existing = avoid_duplicates && build_file(file_ref)
|
|
14736
|
+
return existing if existing
|
|
14737
|
+
build_file = project.new(PBXBuildFile)
|
|
14738
|
+
build_file.file_ref = file_ref
|
|
14739
|
+
files << build_file
|
|
14740
|
+
build_file
|
|
14741
|
+
end
|
|
14742
|
+
|
|
14743
|
+
def remove_file_reference(file_ref)
|
|
14744
|
+
build_file = files.find { |bf| bf.file_ref == file_ref }
|
|
14745
|
+
remove_build_file(build_file) if build_file
|
|
14746
|
+
end
|
|
14747
|
+
|
|
14748
|
+
def remove_build_file(build_file)
|
|
14749
|
+
build_file.file_ref = nil
|
|
14750
|
+
build_file.remove_from_project
|
|
14751
|
+
end
|
|
14752
|
+
|
|
14753
|
+
def clear
|
|
14754
|
+
files.objects.each { |bf| remove_build_file(bf) }
|
|
14755
|
+
end
|
|
14756
|
+
alias_method :clear_build_files, :clear
|
|
14757
|
+
|
|
14758
|
+
def display_name
|
|
14759
|
+
super.gsub(/BuildPhase$/, '')
|
|
14760
|
+
end
|
|
14761
|
+
end
|
|
14762
|
+
|
|
14763
|
+
class PBXHeadersBuildPhase < AbstractBuildPhase; end
|
|
14764
|
+
class PBXSourcesBuildPhase < AbstractBuildPhase; end
|
|
14765
|
+
class PBXFrameworksBuildPhase < AbstractBuildPhase; end
|
|
14766
|
+
class PBXResourcesBuildPhase < AbstractBuildPhase; end
|
|
14767
|
+
|
|
14768
|
+
class PBXCopyFilesBuildPhase < AbstractBuildPhase
|
|
14769
|
+
attribute :name, 'name'
|
|
14770
|
+
attribute :dst_path, 'dstPath', ''
|
|
14771
|
+
attribute :dst_subfolder_spec, 'dstSubfolderSpec', '7'
|
|
14772
|
+
end
|
|
14773
|
+
|
|
14774
|
+
class PBXShellScriptBuildPhase < AbstractBuildPhase
|
|
14775
|
+
attribute :name, 'name'
|
|
14776
|
+
attribute :input_paths, 'inputPaths', []
|
|
14777
|
+
attribute :input_file_list_paths, 'inputFileListPaths', []
|
|
14778
|
+
attribute :output_paths, 'outputPaths', []
|
|
14779
|
+
attribute :output_file_list_paths, 'outputFileListPaths', []
|
|
14780
|
+
attribute :shell_path, 'shellPath', '/bin/sh'
|
|
14781
|
+
attribute :shell_script, 'shellScript', "# Type a script or drag a script file from your workspace to insert its path.\n"
|
|
14782
|
+
attribute :show_env_vars_in_log, 'showEnvVarsInLog'
|
|
14783
|
+
attribute :dependency_file, 'dependencyFile'
|
|
14784
|
+
end
|
|
14785
|
+
|
|
14786
|
+
class PBXFileReference < AbstractObject
|
|
14787
|
+
include GroupableHelper
|
|
14788
|
+
attribute :name, 'name'
|
|
14789
|
+
attribute :path, 'path'
|
|
14790
|
+
attribute :source_tree, 'sourceTree', 'SOURCE_ROOT'
|
|
14791
|
+
attribute :explicit_file_type, 'explicitFileType'
|
|
14792
|
+
attribute :last_known_file_type, 'lastKnownFileType'
|
|
14793
|
+
attribute :include_in_index, 'includeInIndex', '1'
|
|
14794
|
+
attribute :fileEncoding, 'fileEncoding'
|
|
14795
|
+
|
|
14796
|
+
def display_name
|
|
14797
|
+
if name
|
|
14798
|
+
name
|
|
14799
|
+
elsif source_tree == 'BUILT_PRODUCTS_DIR'
|
|
14800
|
+
path
|
|
14801
|
+
elsif path
|
|
14802
|
+
File.basename(path)
|
|
14803
|
+
end
|
|
14804
|
+
end
|
|
14805
|
+
|
|
14806
|
+
def set_path(new_path)
|
|
14807
|
+
if new_path
|
|
14808
|
+
peach_set_path_with_source_tree(new_path, source_tree)
|
|
14809
|
+
else
|
|
14810
|
+
self.path = nil
|
|
14811
|
+
end
|
|
14812
|
+
end
|
|
14813
|
+
|
|
14814
|
+
def set_last_known_file_type(type = nil)
|
|
14815
|
+
if type
|
|
14816
|
+
self.last_known_file_type = type
|
|
14817
|
+
elsif path
|
|
14818
|
+
self.last_known_file_type = Peach::Xcode.file_type(File.extname(path)[1..-1].to_s)
|
|
14819
|
+
end
|
|
14820
|
+
end
|
|
14821
|
+
|
|
14822
|
+
def set_explicit_file_type(type = nil)
|
|
14823
|
+
self.last_known_file_type = nil
|
|
14824
|
+
if type
|
|
14825
|
+
self.explicit_file_type = type
|
|
14826
|
+
elsif path
|
|
14827
|
+
self.explicit_file_type = Peach::Xcode.file_type(File.extname(path)[1..-1].to_s)
|
|
14828
|
+
end
|
|
14829
|
+
end
|
|
14830
|
+
end
|
|
14831
|
+
|
|
14832
|
+
class PBXReferenceProxy < AbstractObject
|
|
14833
|
+
include GroupableHelper
|
|
14834
|
+
attribute :name, 'name'
|
|
14835
|
+
attribute :path, 'path'
|
|
14836
|
+
attribute :file_type, 'fileType'
|
|
14837
|
+
attribute :source_tree, 'sourceTree'
|
|
14838
|
+
has_one :remote_ref, 'remoteRef'
|
|
14839
|
+
end
|
|
14840
|
+
|
|
14841
|
+
class PBXGroup < AbstractObject
|
|
14842
|
+
include GroupableHelper
|
|
14843
|
+
has_many :children, 'children'
|
|
14844
|
+
attribute :source_tree, 'sourceTree', '<group>'
|
|
14845
|
+
attribute :path, 'path'
|
|
14846
|
+
attribute :name, 'name'
|
|
14847
|
+
|
|
14848
|
+
def display_name
|
|
14849
|
+
if name
|
|
14850
|
+
name
|
|
14851
|
+
elsif path
|
|
14852
|
+
File.basename(path)
|
|
14853
|
+
elsif equal?(project.main_group)
|
|
14854
|
+
'Main Group'
|
|
14855
|
+
end
|
|
14856
|
+
end
|
|
14857
|
+
|
|
14858
|
+
def set_path(new_path)
|
|
14859
|
+
if new_path
|
|
14860
|
+
peach_set_path_with_source_tree(new_path, source_tree)
|
|
14861
|
+
else
|
|
14862
|
+
self.path = nil
|
|
14863
|
+
self.source_tree = '<group>'
|
|
14864
|
+
end
|
|
14865
|
+
end
|
|
14866
|
+
|
|
14867
|
+
def files
|
|
14868
|
+
children.select { |o| o.is_a?(PBXFileReference) }
|
|
14869
|
+
end
|
|
14870
|
+
|
|
14871
|
+
def find_file_by_path(file_path)
|
|
14872
|
+
files.find { |ref| ref.path == file_path }
|
|
14873
|
+
end
|
|
14874
|
+
|
|
14875
|
+
def groups
|
|
14876
|
+
children.select { |o| o.instance_of?(PBXGroup) }
|
|
14877
|
+
end
|
|
14878
|
+
|
|
14879
|
+
def recursive_children_groups
|
|
14880
|
+
groups.flat_map { |child| [child] + child.recursive_children_groups }
|
|
14881
|
+
end
|
|
14882
|
+
|
|
14883
|
+
def recursive_children
|
|
14884
|
+
children.flat_map { |child| child.is_a?(PBXGroup) ? [child] + child.recursive_children : [child] }
|
|
14885
|
+
end
|
|
14886
|
+
|
|
14887
|
+
def empty?
|
|
14888
|
+
children.count.zero?
|
|
14889
|
+
end
|
|
14890
|
+
|
|
14891
|
+
# FileReferencesFactory.new_reference for a plain file
|
|
14892
|
+
def new_reference(file_path, source_tree = :group)
|
|
14893
|
+
extension = File.extname(file_path.to_s).downcase
|
|
14894
|
+
raise ArgumentError, "Peach adds no #{extension} reference (#{file_path})" if %w(.xcdatamodeld .xcodeproj).include?(extension)
|
|
14895
|
+
ref = project.new(PBXFileReference)
|
|
14896
|
+
children << ref
|
|
14897
|
+
ref.peach_set_path_with_source_tree(file_path, source_tree)
|
|
14898
|
+
ref.set_last_known_file_type
|
|
14899
|
+
ref.name = ref.path.split('/').last if ref.path.include?('/')
|
|
14900
|
+
ref.include_in_index = nil if File.extname(ref.path).downcase == '.framework'
|
|
14901
|
+
ref
|
|
14902
|
+
end
|
|
14903
|
+
alias_method :new_file, :new_reference
|
|
14904
|
+
|
|
14905
|
+
def new_product_ref_for_target(product_basename, product_type)
|
|
14906
|
+
extension = Peach::Xcode.product_extension(product_type.to_s)
|
|
14907
|
+
product_path = "#{product_type == :static_library ? 'lib' : ''}#{product_basename}"
|
|
14908
|
+
product_path += ".#{extension}" if extension
|
|
14909
|
+
ref = new_reference(product_path, :built_products)
|
|
14910
|
+
ref.include_in_index = '0'
|
|
14911
|
+
ref.set_explicit_file_type
|
|
14912
|
+
ref
|
|
14913
|
+
end
|
|
14914
|
+
|
|
14915
|
+
def new_group(name, group_path = nil, source_tree = :group)
|
|
14916
|
+
group = project.new(PBXGroup)
|
|
14917
|
+
children << group
|
|
14918
|
+
group.name = name
|
|
14919
|
+
group.set_source_tree(source_tree)
|
|
14920
|
+
group.set_path(group_path)
|
|
14921
|
+
group
|
|
14922
|
+
end
|
|
14923
|
+
|
|
14924
|
+
def [](group_path)
|
|
14925
|
+
find_subpath(group_path, false)
|
|
14926
|
+
end
|
|
14927
|
+
|
|
14928
|
+
def <<(child)
|
|
14929
|
+
children << child
|
|
14930
|
+
end
|
|
14931
|
+
|
|
14932
|
+
def find_subpath(group_path, should_create = false)
|
|
14933
|
+
return self unless group_path
|
|
14934
|
+
group_path = group_path.split('/') unless group_path.is_a?(Array)
|
|
14935
|
+
child_name = group_path.first
|
|
14936
|
+
rest = group_path.drop(1)
|
|
14937
|
+
child = children.find { |c| c.display_name == child_name }
|
|
14938
|
+
if child.nil?
|
|
14939
|
+
return nil unless should_create
|
|
14940
|
+
child = new_group(child_name)
|
|
14941
|
+
end
|
|
14942
|
+
rest.empty? ? child : child.find_subpath(rest, should_create)
|
|
14943
|
+
end
|
|
14944
|
+
end
|
|
14945
|
+
|
|
14946
|
+
class PBXVariantGroup < PBXGroup
|
|
14947
|
+
attribute :last_known_file_type, 'lastKnownFileType'
|
|
14948
|
+
end
|
|
14949
|
+
|
|
14950
|
+
class XCVersionGroup < PBXGroup
|
|
14951
|
+
attribute :version_group_type, 'versionGroupType', 'wrapper.xcdatamodel'
|
|
14952
|
+
end
|
|
14953
|
+
|
|
14954
|
+
class PBXContainerItemProxy < AbstractObject
|
|
14955
|
+
attribute :container_portal, 'containerPortal'
|
|
14956
|
+
attribute :proxy_type, 'proxyType'
|
|
14957
|
+
attribute :remote_global_id_string, 'remoteGlobalIDString'
|
|
14958
|
+
attribute :remote_info, 'remoteInfo'
|
|
14959
|
+
end
|
|
14960
|
+
|
|
14961
|
+
class PBXTargetDependency < AbstractObject
|
|
14962
|
+
has_one :target, 'target'
|
|
14963
|
+
has_one :target_proxy, 'targetProxy'
|
|
14964
|
+
has_one :product_ref, 'productRef'
|
|
14965
|
+
attribute :name, 'name'
|
|
14966
|
+
|
|
14967
|
+
def display_name
|
|
14968
|
+
return name if name
|
|
14969
|
+
return target.name if target
|
|
14970
|
+
return target_proxy.remote_info if target_proxy
|
|
14971
|
+
return product_ref.product_name if product_ref
|
|
14972
|
+
end
|
|
14973
|
+
end
|
|
14974
|
+
|
|
14975
|
+
class XCSwiftPackageProductDependency < AbstractObject
|
|
14976
|
+
has_one :package, 'package'
|
|
14977
|
+
attribute :product_name, 'productName'
|
|
14978
|
+
|
|
14979
|
+
def display_name
|
|
14980
|
+
product_name || super
|
|
14981
|
+
end
|
|
14982
|
+
end
|
|
14983
|
+
|
|
14984
|
+
class XCRemoteSwiftPackageReference < AbstractObject
|
|
14985
|
+
attribute :repositoryURL, 'repositoryURL'
|
|
14986
|
+
attribute :requirement, 'requirement'
|
|
14987
|
+
|
|
14988
|
+
def display_name
|
|
14989
|
+
repositoryURL || super
|
|
14990
|
+
end
|
|
14991
|
+
end
|
|
14992
|
+
|
|
14993
|
+
class XCLocalSwiftPackageReference < AbstractObject
|
|
14994
|
+
attribute :path, 'path'
|
|
14995
|
+
attribute :relative_path, 'relativePath'
|
|
14996
|
+
end
|
|
14997
|
+
|
|
14998
|
+
class AbstractTarget < AbstractObject
|
|
14999
|
+
attribute :name, 'name'
|
|
15000
|
+
attribute :product_name, 'productName'
|
|
15001
|
+
has_one :build_configuration_list, 'buildConfigurationList'
|
|
15002
|
+
has_many :dependencies, 'dependencies'
|
|
15003
|
+
has_many :build_phases, 'buildPhases'
|
|
15004
|
+
|
|
15005
|
+
def build_configurations
|
|
15006
|
+
build_configuration_list.build_configurations
|
|
15007
|
+
end
|
|
15008
|
+
|
|
15009
|
+
def build_settings(build_configuration_name)
|
|
15010
|
+
build_configuration_list.build_settings(build_configuration_name)
|
|
15011
|
+
end
|
|
15012
|
+
|
|
15013
|
+
def common_resolved_build_setting(key)
|
|
15014
|
+
values = build_configurations.map { |config| config.resolve_build_setting(key, self) }.compact.uniq
|
|
15015
|
+
values.first if values.count <= 1
|
|
15016
|
+
end
|
|
15017
|
+
|
|
15018
|
+
def dependency_for_target(target)
|
|
15019
|
+
dependencies.find { |dep| dep.target ? dep.target.uuid == target.uuid : dep.target_proxy && dep.target_proxy.remote_global_id_string == target.uuid }
|
|
15020
|
+
end
|
|
15021
|
+
|
|
15022
|
+
def shell_script_build_phases
|
|
15023
|
+
build_phases.select { |o| o.is_a?(PBXShellScriptBuildPhase) }
|
|
15024
|
+
end
|
|
15025
|
+
|
|
15026
|
+
def copy_files_build_phases
|
|
15027
|
+
build_phases.select { |o| o.is_a?(PBXCopyFilesBuildPhase) }
|
|
15028
|
+
end
|
|
15029
|
+
|
|
15030
|
+
def new_shell_script_build_phase(name = nil)
|
|
15031
|
+
phase = project.new(PBXShellScriptBuildPhase)
|
|
15032
|
+
phase.name = name
|
|
15033
|
+
build_phases << phase
|
|
15034
|
+
phase
|
|
15035
|
+
end
|
|
15036
|
+
|
|
15037
|
+
def new_copy_files_build_phase(name = nil)
|
|
15038
|
+
phase = project.new(PBXCopyFilesBuildPhase)
|
|
15039
|
+
phase.name = name
|
|
15040
|
+
build_phases << phase
|
|
15041
|
+
phase
|
|
15042
|
+
end
|
|
15043
|
+
end
|
|
15044
|
+
|
|
15045
|
+
class PBXNativeTarget < AbstractTarget
|
|
15046
|
+
attribute :product_type, 'productType'
|
|
15047
|
+
attribute :product_install_path, 'productInstallPath'
|
|
15048
|
+
has_one :product_reference, 'productReference'
|
|
15049
|
+
has_many :package_product_dependencies, 'packageProductDependencies'
|
|
15050
|
+
|
|
15051
|
+
def symbol_type
|
|
15052
|
+
Constants::PRODUCT_TYPE_UTI.key(product_type)
|
|
15053
|
+
end
|
|
15054
|
+
|
|
15055
|
+
def test_target_type?
|
|
15056
|
+
%i(octest_bundle unit_test_bundle ui_test_bundle).include?(symbol_type)
|
|
15057
|
+
end
|
|
15058
|
+
|
|
15059
|
+
def extension_target_type?
|
|
15060
|
+
%i(app_extension watch_extension watch2_extension tv_extension messages_extension).include?(symbol_type)
|
|
15061
|
+
end
|
|
15062
|
+
|
|
15063
|
+
def launchable_target_type?
|
|
15064
|
+
%i(application command_line_tool).include?(symbol_type)
|
|
15065
|
+
end
|
|
15066
|
+
|
|
15067
|
+
def source_build_phase
|
|
15068
|
+
peach_phase(PBXSourcesBuildPhase)
|
|
15069
|
+
end
|
|
15070
|
+
|
|
15071
|
+
def headers_build_phase
|
|
15072
|
+
peach_phase(PBXHeadersBuildPhase)
|
|
15073
|
+
end
|
|
15074
|
+
|
|
15075
|
+
def frameworks_build_phase
|
|
15076
|
+
peach_phase(PBXFrameworksBuildPhase)
|
|
15077
|
+
end
|
|
15078
|
+
|
|
15079
|
+
def resources_build_phase
|
|
15080
|
+
peach_phase(PBXResourcesBuildPhase)
|
|
15081
|
+
end
|
|
15082
|
+
|
|
15083
|
+
def add_file_references(file_references, compiler_flags = {})
|
|
15084
|
+
file_references.map do |file|
|
|
15085
|
+
header = Peach::Xcode.header?(file.path)
|
|
15086
|
+
phase = header ? headers_build_phase : source_build_phase
|
|
15087
|
+
build_file = phase.build_file(file) || phase.add_file_reference(file)
|
|
15088
|
+
if compiler_flags && !compiler_flags.empty? && !header
|
|
15089
|
+
settings = build_file.settings || {}
|
|
15090
|
+
settings['COMPILER_FLAGS'] = [settings['COMPILER_FLAGS'], compiler_flags].compact.join(' ')
|
|
15091
|
+
build_file.settings = settings
|
|
15092
|
+
end
|
|
15093
|
+
yield build_file if block_given?
|
|
15094
|
+
build_file
|
|
15095
|
+
end
|
|
15096
|
+
end
|
|
15097
|
+
|
|
15098
|
+
def add_resources(resource_file_references)
|
|
15099
|
+
resource_file_references.each do |file|
|
|
15100
|
+
resources_build_phase.add_file_reference(file) unless resources_build_phase.include?(file)
|
|
15101
|
+
end
|
|
15102
|
+
end
|
|
15103
|
+
|
|
15104
|
+
private
|
|
15105
|
+
|
|
15106
|
+
def peach_phase(klass)
|
|
15107
|
+
build_phases.find { |phase| phase.instance_of?(klass) } || project.new(klass).tap { |phase| build_phases << phase }
|
|
15108
|
+
end
|
|
15109
|
+
end
|
|
15110
|
+
|
|
15111
|
+
class PBXAggregateTarget < AbstractTarget; end
|
|
15112
|
+
class PBXLegacyTarget < AbstractTarget; end
|
|
15113
|
+
|
|
15114
|
+
class PBXProject < AbstractObject
|
|
15115
|
+
has_many :targets, 'targets'
|
|
15116
|
+
attribute :attributes, 'attributes'
|
|
15117
|
+
has_one :build_configuration_list, 'buildConfigurationList'
|
|
15118
|
+
attribute :compatibility_version, 'compatibilityVersion'
|
|
15119
|
+
attribute :development_region, 'developmentRegion'
|
|
15120
|
+
attribute :known_regions, 'knownRegions'
|
|
15121
|
+
has_one :main_group, 'mainGroup'
|
|
15122
|
+
has_one :product_ref_group, 'productRefGroup'
|
|
15123
|
+
attribute :project_dir_path, 'projectDirPath', ''
|
|
15124
|
+
attribute :project_root, 'projectRoot', ''
|
|
15125
|
+
has_many :package_references, 'packageReferences'
|
|
15126
|
+
|
|
15127
|
+
def name
|
|
15128
|
+
project.path.basename('.xcodeproj').to_s
|
|
15129
|
+
end
|
|
15130
|
+
end
|
|
15131
|
+
|
|
15132
|
+
ISA = [
|
|
15133
|
+
XCBuildConfiguration, XCConfigurationList, PBXBuildFile, PBXHeadersBuildPhase, PBXSourcesBuildPhase,
|
|
15134
|
+
PBXFrameworksBuildPhase, PBXResourcesBuildPhase, PBXCopyFilesBuildPhase, PBXShellScriptBuildPhase,
|
|
15135
|
+
PBXFileReference, PBXReferenceProxy, PBXGroup, PBXVariantGroup, XCVersionGroup, PBXContainerItemProxy,
|
|
15136
|
+
PBXTargetDependency, XCSwiftPackageProductDependency, XCRemoteSwiftPackageReference,
|
|
15137
|
+
XCLocalSwiftPackageReference, PBXNativeTarget, PBXAggregateTarget, PBXLegacyTarget, PBXProject,
|
|
15138
|
+
].each_with_object({}) { |klass, by_isa| by_isa[klass.isa] = klass }.freeze
|
|
15139
|
+
end
|
|
15140
|
+
|
|
15141
|
+
include Object
|
|
15142
|
+
end
|
|
15143
|
+
end
|
|
15144
|
+
|
|
15145
|
+
module Pod
|
|
15146
|
+
class Project < Xcodeproj::Project
|
|
15147
|
+
def initialize(path, objects, root_uuid, object_version)
|
|
15148
|
+
@uuid_prefix = Digest::SHA256.hexdigest(File.basename(path)).upcase
|
|
15149
|
+
super
|
|
15150
|
+
end
|
|
15151
|
+
|
|
15152
|
+
def generate_available_uuid_list(count = 100)
|
|
15153
|
+
start = @generated_uuids.size
|
|
15154
|
+
uniques = Array.new(count) { |i| format('%.6s%07X0', @uuid_prefix, start + i) }
|
|
15155
|
+
@generated_uuids += uniques
|
|
15156
|
+
@available_uuids += uniques
|
|
15157
|
+
end
|
|
15158
|
+
|
|
15159
|
+
def pods
|
|
15160
|
+
main_group['Pods']
|
|
15161
|
+
end
|
|
15162
|
+
|
|
15163
|
+
def development_pods
|
|
15164
|
+
main_group['Development Pods']
|
|
15165
|
+
end
|
|
15166
|
+
|
|
15167
|
+
def pod_groups
|
|
15168
|
+
[pods, development_pods].compact.flat_map(&:children)
|
|
15169
|
+
end
|
|
15170
|
+
|
|
15171
|
+
def pod_group(pod_name)
|
|
15172
|
+
pod_groups.find { |group| group.name == pod_name }
|
|
15173
|
+
end
|
|
15174
|
+
end
|
|
15175
|
+
end
|
|
15176
|
+
`;
|
|
15177
|
+
var INSTALLER = String.raw`
|
|
15178
|
+
module Pod
|
|
15179
|
+
class Installer
|
|
15180
|
+
class Xcode
|
|
15181
|
+
class PodsProjectGenerator
|
|
15182
|
+
class TargetInstallationResult
|
|
15183
|
+
attr_reader :target, :native_target, :resource_bundle_targets, :test_native_targets,
|
|
15184
|
+
:test_resource_bundle_targets, :test_app_host_targets, :app_native_targets,
|
|
15185
|
+
:app_resource_bundle_targets
|
|
15186
|
+
|
|
15187
|
+
def initialize(target, native_target, resource_bundle_targets = [])
|
|
15188
|
+
@target = target
|
|
15189
|
+
@native_target = native_target
|
|
15190
|
+
@resource_bundle_targets = resource_bundle_targets
|
|
15191
|
+
@test_native_targets = []
|
|
15192
|
+
@test_resource_bundle_targets = {}
|
|
15193
|
+
@test_app_host_targets = []
|
|
15194
|
+
@app_native_targets = {}
|
|
15195
|
+
@app_resource_bundle_targets = {}
|
|
15196
|
+
end
|
|
15197
|
+
end
|
|
15198
|
+
|
|
15199
|
+
class InstallationResults
|
|
15200
|
+
attr_reader :pod_target_installation_results, :aggregate_target_installation_results
|
|
15201
|
+
|
|
15202
|
+
def initialize(pod_target_installation_results, aggregate_target_installation_results)
|
|
15203
|
+
@pod_target_installation_results = pod_target_installation_results
|
|
15204
|
+
@aggregate_target_installation_results = aggregate_target_installation_results
|
|
15205
|
+
end
|
|
15206
|
+
end
|
|
15207
|
+
end
|
|
15208
|
+
end
|
|
15209
|
+
|
|
15210
|
+
attr_reader :pods_project, :target_installation_results
|
|
15211
|
+
|
|
15212
|
+
def generated_projects
|
|
15213
|
+
[pods_project]
|
|
15214
|
+
end
|
|
15215
|
+
|
|
15216
|
+
def generated_pod_targets
|
|
15217
|
+
pod_targets
|
|
15218
|
+
end
|
|
15219
|
+
|
|
15220
|
+
def generated_aggregate_targets
|
|
15221
|
+
aggregate_targets
|
|
15222
|
+
end
|
|
15223
|
+
|
|
15224
|
+
# what pod install does once it has generated the Pods project
|
|
15225
|
+
def peach_install(pods_project, pod_results, aggregate_results, aggregate_xcconfigs, pod_xcconfigs, file_accessors)
|
|
15226
|
+
@pods_project = pods_project
|
|
15227
|
+
result_class = Xcode::PodsProjectGenerator::TargetInstallationResult
|
|
15228
|
+
by_label = pod_targets.each_with_object({}) { |t, h| h[t.label] = t }
|
|
15229
|
+
aggregates_by_label = aggregate_targets.each_with_object({}) { |t, h| h[t.label] = t }
|
|
15230
|
+
pods = pod_results.each_with_object({}) do |(label, (native_target, bundles)), h|
|
|
15231
|
+
h[label] = result_class.new(by_label.fetch(label), pods_project.object(native_target), bundles.map { |uuid| pods_project.object(uuid) })
|
|
15232
|
+
end
|
|
15233
|
+
aggregates = aggregate_results.each_with_object({}) do |(label, native_target), h|
|
|
15234
|
+
h[label] = result_class.new(aggregates_by_label.fetch(label), pods_project.object(native_target))
|
|
15235
|
+
end
|
|
15236
|
+
@target_installation_results = Xcode::PodsProjectGenerator::InstallationResults.new(pods, aggregates)
|
|
15237
|
+
aggregate_xcconfigs.each { |label, by_config| aggregates_by_label.fetch(label).peach_xcconfigs = by_config }
|
|
15238
|
+
pod_xcconfigs.each { |label, by_config| by_label.fetch(label).peach_xcconfigs = by_config }
|
|
15239
|
+
file_accessors.each { |label, accessors| by_label.fetch(label).peach_file_accessors = accessors }
|
|
15240
|
+
run_podfile_post_install_hooks
|
|
15241
|
+
integrate_user_project
|
|
15242
|
+
perform_post_install_actions
|
|
15243
|
+
end
|
|
15244
|
+
|
|
15245
|
+
def integrate_user_project
|
|
15246
|
+
UserProjectIntegrator.new(podfile, sandbox, Pod::Config.instance.installation_root, aggregate_targets,
|
|
15247
|
+
generated_aggregate_targets).integrate!
|
|
15248
|
+
run_podfile_post_integrate_hooks
|
|
15249
|
+
end
|
|
15250
|
+
end
|
|
15251
|
+
|
|
15252
|
+
class Target
|
|
15253
|
+
def support_files_dir
|
|
15254
|
+
sandbox.root + 'Target Support Files' + label
|
|
15255
|
+
end
|
|
15256
|
+
|
|
15257
|
+
def xcconfig_path(variant = nil)
|
|
15258
|
+
if variant
|
|
15259
|
+
support_files_dir + "#{label}.#{variant.to_s.gsub(File::SEPARATOR, '-').downcase}.xcconfig"
|
|
15260
|
+
else
|
|
15261
|
+
support_files_dir + "#{label}.xcconfig"
|
|
15262
|
+
end
|
|
15263
|
+
end
|
|
15264
|
+
end
|
|
15265
|
+
|
|
15266
|
+
class AggregateTarget
|
|
15267
|
+
attr_writer :peach_xcconfigs
|
|
15268
|
+
|
|
15269
|
+
def xcconfigs
|
|
15270
|
+
@peach_xcconfigs
|
|
15271
|
+
end
|
|
15272
|
+
|
|
15273
|
+
def build_settings(configuration_name = nil)
|
|
15274
|
+
@build_settings ||= @peach_xcconfigs.each_with_object({}) do |(name, xcconfig), by_name|
|
|
15275
|
+
by_name[name] = Target::BuildSettings::AggregateTargetSettings.new(xcconfig)
|
|
15276
|
+
end
|
|
15277
|
+
if configuration_name
|
|
15278
|
+
@build_settings[configuration_name] ||
|
|
15279
|
+
raise(ArgumentError, "#{self} does not contain a build setting for the #{configuration_name} configuration, only #{@build_settings.keys}")
|
|
15280
|
+
else
|
|
15281
|
+
@build_settings.each_value.first || raise(ArgumentError, "#{self} does not contain any build settings")
|
|
15282
|
+
end
|
|
15283
|
+
end
|
|
15284
|
+
end
|
|
15285
|
+
|
|
15286
|
+
class PodTarget
|
|
15287
|
+
attr_writer :peach_file_accessors, :peach_xcconfigs
|
|
15288
|
+
|
|
15289
|
+
def file_accessors
|
|
15290
|
+
@peach_file_accessors
|
|
15291
|
+
end
|
|
15292
|
+
|
|
15293
|
+
def build_settings
|
|
15294
|
+
@build_settings ||= @peach_xcconfigs.each_with_object({}) do |(name, xcconfig), by_name|
|
|
15295
|
+
by_name[name] = Target::BuildSettings::PodTargetSettings.new(xcconfig)
|
|
15296
|
+
end
|
|
15297
|
+
end
|
|
15298
|
+
end
|
|
15299
|
+
|
|
15300
|
+
class Target
|
|
15301
|
+
# the settings Peach computed, as the xcconfig CocoaPods writes for them
|
|
15302
|
+
class BuildSettings
|
|
15303
|
+
attr_reader :xcconfig
|
|
15304
|
+
|
|
15305
|
+
def initialize(xcconfig)
|
|
15306
|
+
@xcconfig = xcconfig
|
|
15307
|
+
end
|
|
15308
|
+
|
|
15309
|
+
class PodTargetSettings < BuildSettings; end
|
|
15310
|
+
class AggregateTargetSettings < BuildSettings; end
|
|
15311
|
+
end
|
|
15312
|
+
end
|
|
15313
|
+
|
|
15314
|
+
class Sandbox
|
|
15315
|
+
class FileAccessor
|
|
15316
|
+
attr_reader :spec, :resource_bundles
|
|
15317
|
+
|
|
15318
|
+
def initialize(spec, resource_bundles)
|
|
15319
|
+
@spec = spec
|
|
15320
|
+
@resource_bundles = resource_bundles
|
|
15321
|
+
end
|
|
15322
|
+
end
|
|
15323
|
+
end
|
|
15324
|
+
end
|
|
15325
|
+
`;
|
|
15326
|
+
|
|
15327
|
+
// src/pods-project.ts
|
|
15328
|
+
init_openstep_plist();
|
|
15329
|
+
var HEADERS = new Set(HEADER_EXTENSIONS2);
|
|
15330
|
+
var SOURCES = new Set(SOURCE_FILE_EXTENSIONS);
|
|
15331
|
+
|
|
15332
|
+
// src/pods-install.ts
|
|
15333
|
+
init_podspec_cocoapods();
|
|
15334
|
+
init_podspec_ruby();
|
|
15335
|
+
init_podspec_ruby_stdlib();
|
|
15336
|
+
var COCOAPODS_VERSION2 = "1.17.0";
|
|
15337
|
+
var INSTALL_INPUTS = String.raw`
|
|
15338
|
+
lambda do |podfile, sandbox, resolver|
|
|
15339
|
+
roots = resolver.specifications.map(&:root).uniq
|
|
15340
|
+
{
|
|
15341
|
+
'definitions' => podfile.target_definition_list.reject(&:abstract?).map do |td|
|
|
15342
|
+
{ '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 }
|
|
15343
|
+
end,
|
|
15344
|
+
'workspace' => podfile.workspace_path&.to_s,
|
|
15345
|
+
'downloads' => roots.reject { |spec| sandbox.local?(spec.name) }.map { |spec| [spec.name, spec.to_pretty_json] },
|
|
15346
|
+
'stored' => sandbox.stored_podspecs.map { |name, spec| [name, spec.to_pretty_json] },
|
|
15347
|
+
}
|
|
15348
|
+
end
|
|
15349
|
+
`;
|
|
15350
|
+
var LOCKFILE = String.raw`
|
|
15351
|
+
lambda do |podfile, sandbox, resolver|
|
|
15352
|
+
specs = resolver.specifications
|
|
15353
|
+
pods = specs.each_with_object({}) { |spec, result| (result[spec.to_s] ||= []).concat(spec.all_dependencies.map(&:to_s)) }
|
|
15354
|
+
trunk = specs.map(&:root).uniq.reject { |spec| sandbox.specification(spec.name) }.map(&:name)
|
|
15355
|
+
{
|
|
15356
|
+
'PODS' => pods.map { |name, deps| deps.empty? ? name : { name => deps.uniq } },
|
|
15357
|
+
'DEPENDENCIES' => podfile.dependencies.map(&:to_s),
|
|
15358
|
+
'SPEC REPOS' => trunk.empty? ? {} : { 'trunk' => trunk },
|
|
15359
|
+
'EXTERNAL SOURCES' => podfile.dependencies.select(&:external?).each_with_object({}) { |dep, result| result[dep.root_name] = dep.external_source },
|
|
15360
|
+
'SPEC CHECKSUMS' => specs.select(&:defined_in_file).each_with_object({}) { |spec, result| result[spec.root.name] = spec.checksum },
|
|
15361
|
+
'PODFILE CHECKSUM' => podfile.checksum,
|
|
15362
|
+
'COCOAPODS' => '${COCOAPODS_VERSION2}',
|
|
15363
|
+
}
|
|
15364
|
+
end
|
|
15365
|
+
`;
|
|
15366
|
+
|
|
15367
|
+
// src/expo-native-workspace.ts
|
|
15368
|
+
init_podspec_sources();
|
|
15369
|
+
|
|
15370
|
+
// src/portable-expo-workspace.ts
|
|
15371
|
+
init_is_record();
|
|
15372
|
+
|
|
15373
|
+
// src/native-firebase-config.ts
|
|
15374
|
+
init_is_record();
|
|
15375
|
+
init_plist();
|
|
15376
|
+
init_xcode_project();
|
|
15377
|
+
|
|
15378
|
+
// src/portable-expo-workspace.ts
|
|
15379
|
+
init_podspec_sources();
|
|
15380
|
+
|
|
15381
|
+
// src/portable-expo-contract.ts
|
|
15382
|
+
var import_zod3 = require("zod");
|
|
15383
|
+
init_is_record();
|
|
15384
|
+
init_podspec_sources();
|
|
15385
|
+
|
|
15386
|
+
// src/prepared-native-inventory.ts
|
|
15387
|
+
init_expo_autolinking();
|
|
15388
|
+
init_forked_script_contract();
|
|
15389
|
+
init_is_record();
|
|
15390
|
+
init_nitro_source();
|
|
15391
|
+
|
|
15392
|
+
// src/portable-expo-workspace.ts
|
|
15393
|
+
init_prepared_xcode_phases();
|
|
15394
|
+
init_swift_compile();
|
|
15395
|
+
init_swift_distribution();
|
|
15396
|
+
|
|
15397
|
+
// src/expo-native-workspace.ts
|
|
15398
|
+
init_retired_cache_directory();
|
|
15399
|
+
init_swift_helper();
|
|
15400
|
+
init_swift_root_lock();
|
|
15401
|
+
init_swift_toolchain();
|
|
15402
|
+
init_workspace_root();
|
|
15403
|
+
init_xcode_project();
|
|
15404
|
+
var ABANDONED_WORKSPACE_MS = 24 * 36e5;
|
|
15405
|
+
|
|
15406
|
+
// src/expoSwiftContract.ts
|
|
15407
|
+
init_bundle_global_footer();
|
|
15408
|
+
init_is_record();
|
|
15409
|
+
init_native_app_identity();
|
|
15410
|
+
init_swiftContract();
|
|
15411
|
+
|
|
15412
|
+
// src/expo-native-prebuilt.ts
|
|
15413
|
+
init_is_record();
|
|
15414
|
+
init_native_app_identity();
|
|
15415
|
+
init_native_app_identity_project();
|
|
15416
|
+
init_native_prebuilt();
|
|
15417
|
+
init_nitroContract();
|
|
15418
|
+
init_swift_native_pin();
|
|
15419
|
+
init_xcode_project();
|
|
15420
|
+
var IDENTITY_SOURCE_SKIPS = 1 | 4 | 8 | 16 | 32 | 64 | 128 | 4096;
|
|
15421
|
+
|
|
15422
|
+
// src/expo-swift-host.ts
|
|
15423
|
+
var import_node_async_hooks3 = require("node:async_hooks");
|
|
15424
|
+
var import_node_child_process12 = require("node:child_process");
|
|
15425
|
+
var import_node_util8 = require("node:util");
|
|
15426
|
+
init_answeredNativePackages();
|
|
15427
|
+
init_expo_autolinking();
|
|
15428
|
+
|
|
15429
|
+
// src/expo-discovery-cache.ts
|
|
15430
|
+
init_answeredNativePackages();
|
|
15431
|
+
|
|
15432
|
+
// src/cli-version.ts
|
|
15433
|
+
init_public_brand();
|
|
15434
|
+
|
|
15435
|
+
// src/expo-discovery-cache.ts
|
|
15436
|
+
init_home_paths();
|
|
15437
|
+
init_is_record();
|
|
15438
|
+
init_native_app_identity();
|
|
15439
|
+
init_swift_toolchain();
|
|
15440
|
+
init_swiftContract();
|
|
15441
|
+
var EXPIRY_MS = 7 * 24 * 36e5;
|
|
15442
|
+
var ORPHAN_TEMPORARY_MS = 24 * 36e5;
|
|
15443
|
+
var MISSING_TREE = "0".repeat(64);
|
|
15444
|
+
|
|
15445
|
+
// src/expo-swift-host.ts
|
|
15446
|
+
init_forked_script_contract();
|
|
15447
|
+
init_home_paths();
|
|
15448
|
+
init_is_record();
|
|
15449
|
+
|
|
15450
|
+
// src/native-preparation.ts
|
|
15451
|
+
var import_node_timers = require("node:timers");
|
|
15452
|
+
var setTimeoutNode = import_node_timers.setTimeout;
|
|
15453
|
+
var NativePreparationReceipts = class {
|
|
15454
|
+
receipts = /* @__PURE__ */ new Map();
|
|
15455
|
+
store(owner, token, value) {
|
|
15456
|
+
if (!token) return;
|
|
15457
|
+
const previous = this.receipts.get(token);
|
|
15458
|
+
if (previous) (0, import_node_timers.clearTimeout)(previous.expiry);
|
|
15459
|
+
const expiry = setTimeoutNode(() => this.receipts.delete(token), 30 * 60 * 1e3);
|
|
15460
|
+
expiry.unref();
|
|
15461
|
+
this.receipts.set(token, { owner, value, expiry });
|
|
15462
|
+
}
|
|
15463
|
+
take(owner, token) {
|
|
15464
|
+
if (!token) return;
|
|
15465
|
+
const receipt = this.receipts.get(token);
|
|
15466
|
+
if (!receipt || receipt.owner !== owner) return;
|
|
15467
|
+
this.receipts.delete(token);
|
|
15468
|
+
(0, import_node_timers.clearTimeout)(receipt.expiry);
|
|
15469
|
+
return { value: receipt.value };
|
|
15470
|
+
}
|
|
15471
|
+
};
|
|
15472
|
+
|
|
15473
|
+
// src/expo-swift-host.ts
|
|
15474
|
+
init_native_static_libraries();
|
|
15475
|
+
init_prepared_xcode_phases();
|
|
15476
|
+
|
|
15477
|
+
// src/react-native-bridge-modules.ts
|
|
15478
|
+
init_answeredNativePackages();
|
|
15479
|
+
init_swift_compile();
|
|
15480
|
+
init_swift_objc_compile();
|
|
15481
|
+
init_swiftContract();
|
|
15482
|
+
init_xcode_project();
|
|
15483
|
+
|
|
15484
|
+
// src/expo-swift-host.ts
|
|
15485
|
+
init_react_native_core();
|
|
15486
|
+
init_swift_binary_modules();
|
|
15487
|
+
init_swift_compile();
|
|
15488
|
+
init_swift_distribution();
|
|
15489
|
+
init_swift_host();
|
|
15490
|
+
init_swift_objc_standin();
|
|
15491
|
+
init_swift_package();
|
|
15492
|
+
init_swift_root_lock();
|
|
15493
|
+
init_swift_standins();
|
|
15494
|
+
init_swift_submit();
|
|
15495
|
+
init_swift_toolchain();
|
|
15496
|
+
init_turbo_source();
|
|
15497
|
+
var run5 = (0, import_node_util8.promisify)(import_node_child_process12.execFile);
|
|
15498
|
+
var scriptEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" };
|
|
15499
|
+
var traceStore = new import_node_async_hooks3.AsyncLocalStorage();
|
|
15500
|
+
var openPreparations = new NativePreparationReceipts();
|
|
15501
|
+
|
|
15502
|
+
// src/expo-pod-prebuilt.ts
|
|
15503
|
+
init_is_record();
|
|
15504
|
+
|
|
15505
|
+
// src/native-package-slice.ts
|
|
15506
|
+
var v6 = __toESM(require("valibot"), 1);
|
|
15507
|
+
init_native_prebuilt();
|
|
15508
|
+
init_swift_compile();
|
|
15509
|
+
init_swift_distribution();
|
|
15510
|
+
init_swift_icu();
|
|
15511
|
+
init_swift_native_pin();
|
|
15512
|
+
init_swift_package();
|
|
15513
|
+
init_swiftNativePinContract();
|
|
15514
|
+
var sliceTargetSchema = v6.object({
|
|
15515
|
+
name: v6.string(),
|
|
15516
|
+
archiveFile: v6.string(),
|
|
15517
|
+
archiveBytes: v6.number(),
|
|
15518
|
+
swiftmoduleFile: v6.exactOptional(v6.string()),
|
|
15519
|
+
swiftmoduleBytes: v6.exactOptional(v6.number()),
|
|
15520
|
+
objcHeaderFile: v6.exactOptional(v6.string())
|
|
15521
|
+
});
|
|
15522
|
+
var resourceBundleSchema = v6.object({
|
|
12373
15523
|
target: v6.string(),
|
|
12374
15524
|
sourcePath: v6.string(),
|
|
12375
15525
|
path: v6.string()
|
|
@@ -17494,17 +20644,17 @@ function readOneNativeAppCatalog(entryConfig, root) {
|
|
|
17494
20644
|
}
|
|
17495
20645
|
|
|
17496
20646
|
// src/one-widget-metadata.ts
|
|
17497
|
-
var
|
|
20647
|
+
var import_node_child_process13 = require("node:child_process");
|
|
17498
20648
|
var import_node_crypto6 = require("node:crypto");
|
|
17499
20649
|
var import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
17500
20650
|
var import_node_module2 = require("node:module");
|
|
17501
20651
|
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
17502
|
-
var
|
|
20652
|
+
var import_node_util9 = require("node:util");
|
|
17503
20653
|
init_forked_script_contract();
|
|
17504
20654
|
init_is_record();
|
|
17505
20655
|
init_swift_source_file();
|
|
17506
20656
|
init_swift_submit();
|
|
17507
|
-
var run6 = (0,
|
|
20657
|
+
var run6 = (0, import_node_util9.promisify)(import_node_child_process13.execFile);
|
|
17508
20658
|
var configs = /* @__PURE__ */ new Map();
|
|
17509
20659
|
var reads = /* @__PURE__ */ new Map();
|
|
17510
20660
|
var CONFIG_CHILD = `
|