cocoapods 1.9.1 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +292 -5
- data/README.md +2 -1
- data/lib/cocoapods/command/lib/lint.rb +12 -3
- data/lib/cocoapods/command/repo/push.rb +1 -1
- data/lib/cocoapods/command/repo/update.rb +11 -0
- data/lib/cocoapods/command/spec/lint.rb +12 -3
- data/lib/cocoapods/command.rb +12 -2
- data/lib/cocoapods/config.rb +17 -0
- data/lib/cocoapods/downloader/cache.rb +2 -2
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/app_target_helper.rb +10 -2
- data/lib/cocoapods/generator/copy_dsyms_script.rb +56 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +2 -14
- data/lib/cocoapods/generator/copy_xcframework_script.rb +245 -0
- data/lib/cocoapods/generator/embed_frameworks_script.rb +125 -212
- data/lib/cocoapods/generator/script_phase_constants.rb +99 -0
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +1 -1
- data/lib/cocoapods/installer/analyzer.rb +17 -8
- data/lib/cocoapods/installer/base_install_hooks_context.rb +135 -0
- data/lib/cocoapods/installer/installation_options.rb +5 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +2 -1
- data/lib/cocoapods/installer/post_install_hooks_context.rb +1 -127
- data/lib/cocoapods/installer/post_integrate_hooks_context.rb +9 -0
- data/lib/cocoapods/installer/project_cache/project_metadata_cache.rb +4 -0
- data/lib/cocoapods/installer/sandbox_dir_cleaner.rb +2 -1
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +132 -111
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +13 -27
- data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +5 -1
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +2 -1
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +8 -6
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +187 -61
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +61 -30
- data/lib/cocoapods/installer/xcode/pods_project_generator/project_generator.rb +3 -2
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +5 -7
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +45 -6
- data/lib/cocoapods/installer/xcode/pods_project_generator_result.rb +19 -0
- data/lib/cocoapods/installer/xcode/target_validator.rb +1 -1
- data/lib/cocoapods/installer.rb +70 -3
- data/lib/cocoapods/sandbox/file_accessor.rb +10 -1
- data/lib/cocoapods/sources_manager.rb +2 -1
- data/lib/cocoapods/target/aggregate_target.rb +35 -0
- data/lib/cocoapods/target/build_settings.rb +94 -18
- data/lib/cocoapods/target/pod_target.rb +85 -11
- data/lib/cocoapods/target.rb +44 -2
- data/lib/cocoapods/user_interface/error_report.rb +1 -1
- data/lib/cocoapods/user_interface/inspector_reporter.rb +3 -10
- data/lib/cocoapods/validator.rb +38 -12
- data/lib/cocoapods/xcode/framework_paths.rb +1 -1
- data/lib/cocoapods/xcode/xcframework/xcframework_slice.rb +91 -4
- data/lib/cocoapods/xcode/xcframework.rb +17 -4
- data/lib/cocoapods.rb +3 -1
- metadata +31 -53
- data/lib/cocoapods/generator/prepare_artifacts_script.rb +0 -257
@@ -0,0 +1,99 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
module ScriptPhaseConstants
|
4
|
+
DEFAULT_SCRIPT_PHASE_HEADER = <<-SH.strip_heredoc.freeze
|
5
|
+
#!/bin/sh
|
6
|
+
set -e
|
7
|
+
set -u
|
8
|
+
set -o pipefail
|
9
|
+
|
10
|
+
function on_error {
|
11
|
+
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
|
12
|
+
}
|
13
|
+
trap 'on_error $LINENO' ERR
|
14
|
+
SH
|
15
|
+
|
16
|
+
RSYNC_PROTECT_TMP_FILES = <<-SH.strip_heredoc.freeze
|
17
|
+
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
18
|
+
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
19
|
+
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
20
|
+
SH
|
21
|
+
|
22
|
+
STRIP_INVALID_ARCHITECTURES_METHOD = <<-SH.strip_heredoc.freeze
|
23
|
+
# Used as a return value for each invocation of `strip_invalid_archs` function.
|
24
|
+
STRIP_BINARY_RETVAL=0
|
25
|
+
|
26
|
+
# Strip invalid architectures
|
27
|
+
strip_invalid_archs() {
|
28
|
+
binary="$1"
|
29
|
+
warn_missing_arch=${2:-true}
|
30
|
+
# Get architectures for current target binary
|
31
|
+
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
|
32
|
+
# Intersect them with the architectures we are building for
|
33
|
+
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\\n' | sort | uniq -d)"
|
34
|
+
# If there are no archs supported by this binary then warn the user
|
35
|
+
if [[ -z "$intersected_archs" ]]; then
|
36
|
+
if [[ "$warn_missing_arch" == "true" ]]; then
|
37
|
+
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
|
38
|
+
fi
|
39
|
+
STRIP_BINARY_RETVAL=1
|
40
|
+
return
|
41
|
+
fi
|
42
|
+
stripped=""
|
43
|
+
for arch in $binary_archs; do
|
44
|
+
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
45
|
+
# Strip non-valid architectures in-place
|
46
|
+
lipo -remove "$arch" -output "$binary" "$binary"
|
47
|
+
stripped="$stripped $arch"
|
48
|
+
fi
|
49
|
+
done
|
50
|
+
if [[ "$stripped" ]]; then
|
51
|
+
echo "Stripped $binary of architectures:$stripped"
|
52
|
+
fi
|
53
|
+
STRIP_BINARY_RETVAL=0
|
54
|
+
}
|
55
|
+
SH
|
56
|
+
|
57
|
+
INSTALL_DSYM_METHOD = <<-SH.strip_heredoc.freeze
|
58
|
+
# Copies and strips a vendored dSYM
|
59
|
+
install_dsym() {
|
60
|
+
local source="$1"
|
61
|
+
warn_missing_arch=${2:-true}
|
62
|
+
if [ -r "$source" ]; then
|
63
|
+
# Copy the dSYM into the targets temp dir.
|
64
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DERIVED_FILES_DIR}\\""
|
65
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
|
66
|
+
|
67
|
+
local basename
|
68
|
+
basename="$(basename -s .dSYM "$source")"
|
69
|
+
binary_name="$(ls "$source/Contents/Resources/DWARF")"
|
70
|
+
binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"
|
71
|
+
|
72
|
+
# Strip invalid architectures from the dSYM.
|
73
|
+
if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
|
74
|
+
strip_invalid_archs "$binary" "$warn_missing_arch"
|
75
|
+
fi
|
76
|
+
if [[ $STRIP_BINARY_RETVAL == 0 ]]; then
|
77
|
+
# Move the stripped file into its final destination.
|
78
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\\" \\"${DWARF_DSYM_FOLDER_PATH}\\""
|
79
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
|
80
|
+
else
|
81
|
+
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
|
82
|
+
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
|
83
|
+
fi
|
84
|
+
fi
|
85
|
+
}
|
86
|
+
SH
|
87
|
+
|
88
|
+
INSTALL_BCSYMBOLMAP_METHOD = <<-SH.strip_heredoc.freeze
|
89
|
+
# Copies the bcsymbolmap files of a vendored framework
|
90
|
+
install_bcsymbolmap() {
|
91
|
+
local bcsymbolmap_path="$1"
|
92
|
+
local destination="${BUILT_PRODUCTS_DIR}"
|
93
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${bcsymbolmap_path}\" \"${destination}\""
|
94
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
|
95
|
+
}
|
96
|
+
SH
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -50,7 +50,7 @@ module Pod
|
|
50
50
|
@build_configurations = build_configurations
|
51
51
|
@platform = platform
|
52
52
|
@archs = archs
|
53
|
-
@client_root = project.project_dir.realpath
|
53
|
+
@client_root = Pathname.new(project.project_dir + project.root_object.project_dir_path).realpath
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -446,11 +446,18 @@ module Pod
|
|
446
446
|
is_app_extension ||= aggregate_target.user_targets.any? do |user_target|
|
447
447
|
user_target.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY', :resolve_against_xcconfig => true) == 'YES'
|
448
448
|
end
|
449
|
+
if is_app_extension
|
450
|
+
aggregate_target.mark_application_extension_api_only
|
451
|
+
aggregate_target.pod_targets.each(&:mark_application_extension_api_only)
|
452
|
+
end
|
449
453
|
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
+
build_library_for_distribution = aggregate_target.user_targets.any? do |user_target|
|
455
|
+
user_target.common_resolved_build_setting('BUILD_LIBRARY_FOR_DISTRIBUTION', :resolve_against_xcconfig => true) == 'YES'
|
456
|
+
end
|
457
|
+
if build_library_for_distribution
|
458
|
+
aggregate_target.mark_build_library_for_distribution
|
459
|
+
aggregate_target.pod_targets.each(&:mark_build_library_for_distribution)
|
460
|
+
end
|
454
461
|
end
|
455
462
|
|
456
463
|
if installation_options.integrate_targets?
|
@@ -648,8 +655,10 @@ module Pod
|
|
648
655
|
resolver_specs_by_target.flat_map do |target_definition, specs|
|
649
656
|
grouped_specs = specs.group_by(&:root).values.uniq
|
650
657
|
pod_targets = grouped_specs.flat_map do |pod_specs|
|
651
|
-
build_type = determine_build_type(pod_specs.first, target_definition.build_type)
|
652
|
-
|
658
|
+
build_type = determine_build_type(pod_specs.first.spec, target_definition.build_type)
|
659
|
+
swift_version = determine_swift_version(pod_specs.first.spec, [target_definition])
|
660
|
+
generate_pod_target([target_definition], build_type, target_inspections, pod_specs.map(&:spec),
|
661
|
+
:swift_version => swift_version).scoped(dedupe_cache)
|
653
662
|
end
|
654
663
|
|
655
664
|
compute_pod_target_dependencies(pod_targets, specs.map(&:spec).group_by(&:name))
|
@@ -690,13 +699,13 @@ module Pod
|
|
690
699
|
hash[app_spec.name] = Hash[app_dependencies_by_config.map { |k, v| [k, filter_dependencies(v, pod_targets_by_name, target)] }]
|
691
700
|
end
|
692
701
|
|
693
|
-
target.
|
702
|
+
target.test_app_hosts_by_spec = target.test_specs.each_with_object({}) do |test_spec, hash|
|
694
703
|
next unless app_host_name = test_spec.consumer(target.platform).app_host_name
|
695
704
|
app_host_spec = pod_targets_by_name[Specification.root_name(app_host_name)].flat_map(&:app_specs).find do |pt|
|
696
705
|
pt.name == app_host_name
|
697
706
|
end
|
698
707
|
app_host_dependencies = { app_host_spec.root => [app_host_spec] }
|
699
|
-
hash[test_spec
|
708
|
+
hash[test_spec] = [app_host_spec, filter_dependencies(app_host_dependencies, pod_targets_by_name, target).first]
|
700
709
|
end
|
701
710
|
end
|
702
711
|
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
# Context object designed to be used with the HooksManager which describes
|
4
|
+
# the context of the installer.
|
5
|
+
#
|
6
|
+
class BaseInstallHooksContext
|
7
|
+
# @return [Sandbox] The Sandbox for the project.
|
8
|
+
#
|
9
|
+
attr_reader :sandbox
|
10
|
+
|
11
|
+
# @return [String] The path to the sandbox root (`Pods` directory).
|
12
|
+
#
|
13
|
+
attr_reader :sandbox_root
|
14
|
+
|
15
|
+
# @return [Xcodeproj::Project] The Pods Xcode project.
|
16
|
+
#
|
17
|
+
attr_reader :pods_project
|
18
|
+
|
19
|
+
# @return [Array<UmbrellaTargetDescription>] The list of
|
20
|
+
# the CocoaPods umbrella targets generated by the installer.
|
21
|
+
#
|
22
|
+
attr_reader :umbrella_targets
|
23
|
+
|
24
|
+
# Initialize a new instance
|
25
|
+
#
|
26
|
+
# @param [Sandbox] sandbox see #sandbox
|
27
|
+
# @param [String] sandbox_root see #sandbox_root
|
28
|
+
# @param [Xcodeproj::Project] pods_project see #pods_project
|
29
|
+
# @param [Array<UmbrellaTargetDescription>] umbrella_targets see #umbrella_targets
|
30
|
+
#
|
31
|
+
def initialize(sandbox, sandbox_root, pods_project, umbrella_targets)
|
32
|
+
@sandbox = sandbox
|
33
|
+
@sandbox_root = sandbox_root
|
34
|
+
@pods_project = pods_project
|
35
|
+
@umbrella_targets = umbrella_targets
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [PostInstallHooksContext] Convenience class generator method
|
39
|
+
#
|
40
|
+
# @param [Sandbox] sandbox
|
41
|
+
# The sandbox
|
42
|
+
#
|
43
|
+
# @param [Project] pods_project
|
44
|
+
# The pods project.
|
45
|
+
#
|
46
|
+
# @param [Array<AggregateTarget>] aggregate_targets
|
47
|
+
# The aggregate targets, which will been presented by an adequate
|
48
|
+
# {UmbrellaTargetDescription} in the generated context.
|
49
|
+
#
|
50
|
+
# @return [HooksContext] Convenience class method to generate the
|
51
|
+
# static context.
|
52
|
+
#
|
53
|
+
def self.generate(sandbox, pods_project, aggregate_targets)
|
54
|
+
umbrella_targets_descriptions = aggregate_targets.map do |umbrella|
|
55
|
+
user_project = umbrella.user_project
|
56
|
+
user_targets = umbrella.user_targets
|
57
|
+
specs = umbrella.specs
|
58
|
+
platform_name = umbrella.platform.name
|
59
|
+
platform_deployment_target = umbrella.platform.deployment_target.to_s
|
60
|
+
cocoapods_target_label = umbrella.label
|
61
|
+
UmbrellaTargetDescription.new(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
|
62
|
+
end
|
63
|
+
|
64
|
+
new(sandbox, sandbox.root.to_s, pods_project, umbrella_targets_descriptions)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Pure data class which describes an umbrella target.
|
68
|
+
#
|
69
|
+
class UmbrellaTargetDescription
|
70
|
+
# @return [Xcodeproj::Project] The user project into which this target
|
71
|
+
# is integrated.
|
72
|
+
#
|
73
|
+
attr_reader :user_project
|
74
|
+
|
75
|
+
# @return [Array<PBXNativeTarget>]
|
76
|
+
# The list of user targets integrated by this umbrella target.
|
77
|
+
#
|
78
|
+
attr_reader :user_targets
|
79
|
+
|
80
|
+
# @return [Array<Specification>] The list of the
|
81
|
+
# specifications of the target.
|
82
|
+
#
|
83
|
+
attr_reader :specs
|
84
|
+
|
85
|
+
# @return [Symbol] The platform (either `:ios`, `:watchos`, `:tvos`, or `:osx`).
|
86
|
+
#
|
87
|
+
attr_reader :platform_name
|
88
|
+
|
89
|
+
# @return [String] The deployment target.
|
90
|
+
#
|
91
|
+
attr_reader :platform_deployment_target
|
92
|
+
|
93
|
+
# @return [String] The label for the target.
|
94
|
+
#
|
95
|
+
attr_reader :cocoapods_target_label
|
96
|
+
|
97
|
+
# Initialize a new instance
|
98
|
+
#
|
99
|
+
# @param [Xcodeproj::Project] user_project see #user_project
|
100
|
+
# @param [Array<PBXNativeTarget>] user_targets see #user_targets
|
101
|
+
# @param [Array<Specification>] specs see #specs
|
102
|
+
# @param [Symbol] platform_name see #platform_name
|
103
|
+
# @param [String] platform_deployment_target see #platform_deployment_target
|
104
|
+
# @param [String] cocoapods_target_label see #cocoapods_target_label
|
105
|
+
#
|
106
|
+
def initialize(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
|
107
|
+
@user_project = user_project
|
108
|
+
@user_targets = user_targets
|
109
|
+
@specs = specs
|
110
|
+
@platform_name = platform_name
|
111
|
+
@platform_deployment_target = platform_deployment_target
|
112
|
+
@cocoapods_target_label = cocoapods_target_label
|
113
|
+
end
|
114
|
+
|
115
|
+
# @return [String] The path of the user project
|
116
|
+
# integrated by this target.
|
117
|
+
#
|
118
|
+
def user_project_path
|
119
|
+
user_project.path if user_project
|
120
|
+
end
|
121
|
+
|
122
|
+
# @return [Array<String>] The list of the UUIDs of the
|
123
|
+
# user targets integrated by this umbrella
|
124
|
+
# target. They can be used to find the
|
125
|
+
# targets opening the project They can be used
|
126
|
+
# to find the targets opening the project with
|
127
|
+
# Xcodeproj.
|
128
|
+
#
|
129
|
+
def user_target_uuids
|
130
|
+
user_targets.map(&:uuid)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -153,6 +153,11 @@ module Pod
|
|
153
153
|
#
|
154
154
|
option :warn_for_multiple_pod_sources, true
|
155
155
|
|
156
|
+
# Whether to emit a warning if a project is not explicitly specifying the git based master specs repo and can
|
157
|
+
# instead use CDN which is the default.
|
158
|
+
#
|
159
|
+
option :warn_for_unused_master_specs_repo, true
|
160
|
+
|
156
161
|
# Whether to share Xcode schemes for development pods.
|
157
162
|
#
|
158
163
|
# Schemes for development pods are created automatically but are not shared by default.
|
@@ -90,7 +90,8 @@ module Pod
|
|
90
90
|
#
|
91
91
|
def lock_files!(file_accessors)
|
92
92
|
return if local?
|
93
|
-
|
93
|
+
unlocked_files = source_files(file_accessors).reject { |f| (File.stat(f).mode & 0o200).zero? }
|
94
|
+
FileUtils.chmod('u-w', unlocked_files)
|
94
95
|
end
|
95
96
|
|
96
97
|
# Unlocks the source files if appropriate.
|
@@ -3,133 +3,7 @@ module Pod
|
|
3
3
|
# Context object designed to be used with the HooksManager which describes
|
4
4
|
# the context of the installer.
|
5
5
|
#
|
6
|
-
class PostInstallHooksContext
|
7
|
-
# @return [Sandbox] The Sandbox for the project.
|
8
|
-
#
|
9
|
-
attr_reader :sandbox
|
10
|
-
|
11
|
-
# @return [String] The path to the sandbox root (`Pods` directory).
|
12
|
-
#
|
13
|
-
attr_reader :sandbox_root
|
14
|
-
|
15
|
-
# @return [Xcodeproj::Project] The Pods Xcode project.
|
16
|
-
#
|
17
|
-
attr_reader :pods_project
|
18
|
-
|
19
|
-
# @return [Array<UmbrellaTargetDescription>] The list of
|
20
|
-
# the CocoaPods umbrella targets generated by the installer.
|
21
|
-
#
|
22
|
-
attr_reader :umbrella_targets
|
23
|
-
|
24
|
-
# Initialize a new instance
|
25
|
-
#
|
26
|
-
# @param [Sandbox] sandbox see #sandbox
|
27
|
-
# @param [String] sandbox_root see #sandbox_root
|
28
|
-
# @param [Xcodeproj::Project] pods_project see #pods_project
|
29
|
-
# @param [Array<UmbrellaTargetDescription>] umbrella_targets see #umbrella_targets
|
30
|
-
#
|
31
|
-
def initialize(sandbox, sandbox_root, pods_project, umbrella_targets)
|
32
|
-
@sandbox = sandbox
|
33
|
-
@sandbox_root = sandbox_root
|
34
|
-
@pods_project = pods_project
|
35
|
-
@umbrella_targets = umbrella_targets
|
36
|
-
end
|
37
|
-
|
38
|
-
# @return [PostInstallHooksContext] Convenience class generator method
|
39
|
-
#
|
40
|
-
# @param [Sandbox] sandbox
|
41
|
-
# The sandbox
|
42
|
-
#
|
43
|
-
# @param [Project] pods_project
|
44
|
-
# The pods project.
|
45
|
-
#
|
46
|
-
# @param [Array<AggregateTarget>] aggregate_targets
|
47
|
-
# The aggregate targets, which will been presented by an adequate
|
48
|
-
# {UmbrellaTargetDescription} in the generated context.
|
49
|
-
#
|
50
|
-
# @return [HooksContext] Convenience class method to generate the
|
51
|
-
# static context.
|
52
|
-
#
|
53
|
-
def self.generate(sandbox, pods_project, aggregate_targets)
|
54
|
-
umbrella_targets_descriptions = aggregate_targets.map do |umbrella|
|
55
|
-
user_project = umbrella.user_project
|
56
|
-
user_targets = umbrella.user_targets
|
57
|
-
specs = umbrella.specs
|
58
|
-
platform_name = umbrella.platform.name
|
59
|
-
platform_deployment_target = umbrella.platform.deployment_target.to_s
|
60
|
-
cocoapods_target_label = umbrella.label
|
61
|
-
UmbrellaTargetDescription.new(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
|
62
|
-
end
|
63
|
-
|
64
|
-
new(sandbox, sandbox.root.to_s, pods_project, umbrella_targets_descriptions)
|
65
|
-
end
|
66
|
-
|
67
|
-
# Pure data class which describes an umbrella target.
|
68
|
-
#
|
69
|
-
class UmbrellaTargetDescription
|
70
|
-
# @return [Xcodeproj::Project] The user project into which this target
|
71
|
-
# is integrated.
|
72
|
-
#
|
73
|
-
attr_reader :user_project
|
74
|
-
|
75
|
-
# @return [Array<PBXNativeTarget>]
|
76
|
-
# The list of user targets integrated by this umbrella target.
|
77
|
-
#
|
78
|
-
attr_reader :user_targets
|
79
|
-
|
80
|
-
# @return [Array<Specification>] The list of the
|
81
|
-
# specifications of the target.
|
82
|
-
#
|
83
|
-
attr_reader :specs
|
84
|
-
|
85
|
-
# @return [Symbol] The platform (either `:ios`, `:watchos`, `:tvos`, or `:osx`).
|
86
|
-
#
|
87
|
-
attr_reader :platform_name
|
88
|
-
|
89
|
-
# @return [String] The deployment target.
|
90
|
-
#
|
91
|
-
attr_reader :platform_deployment_target
|
92
|
-
|
93
|
-
# @return [String] The label for the target.
|
94
|
-
#
|
95
|
-
attr_reader :cocoapods_target_label
|
96
|
-
|
97
|
-
# Initialize a new instance
|
98
|
-
#
|
99
|
-
# @param [Xcodeproj::Project] user_project see #user_project
|
100
|
-
# @param [Array<PBXNativeTarget>] user_targets see #user_targets
|
101
|
-
# @param [Array<Specification>] specs see #specs
|
102
|
-
# @param [Symbol] platform_name see #platform_name
|
103
|
-
# @param [String] platform_deployment_target see #platform_deployment_target
|
104
|
-
# @param [String] cocoapods_target_label see #cocoapods_target_label
|
105
|
-
#
|
106
|
-
def initialize(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
|
107
|
-
@user_project = user_project
|
108
|
-
@user_targets = user_targets
|
109
|
-
@specs = specs
|
110
|
-
@platform_name = platform_name
|
111
|
-
@platform_deployment_target = platform_deployment_target
|
112
|
-
@cocoapods_target_label = cocoapods_target_label
|
113
|
-
end
|
114
|
-
|
115
|
-
# @return [String] The path of the user project
|
116
|
-
# integrated by this target.
|
117
|
-
#
|
118
|
-
def user_project_path
|
119
|
-
user_project.path if user_project
|
120
|
-
end
|
121
|
-
|
122
|
-
# @return [Array<String>] The list of the UUIDs of the
|
123
|
-
# user targets integrated by this umbrella
|
124
|
-
# target. They can be used to find the
|
125
|
-
# targets opening the project They can be used
|
126
|
-
# to find the targets opening the project with
|
127
|
-
# Xcodeproj.
|
128
|
-
#
|
129
|
-
def user_target_uuids
|
130
|
-
user_targets.map(&:uuid)
|
131
|
-
end
|
132
|
-
end
|
6
|
+
class PostInstallHooksContext < BaseInstallHooksContext
|
133
7
|
end
|
134
8
|
end
|
135
9
|
end
|
@@ -54,6 +54,10 @@ module Pod
|
|
54
54
|
installation_results.each do |installation_result|
|
55
55
|
native_target = installation_result.native_target
|
56
56
|
target_label_by_metadata[native_target.name] = TargetMetadata.from_native_target(sandbox, native_target)
|
57
|
+
# app targets need to be added to the cache because they can be used as app hosts for test targets, even if those test targets live inside a different pod (and thus project)
|
58
|
+
installation_result.app_native_targets.each_value do |app_target|
|
59
|
+
target_label_by_metadata[app_target.name] = TargetMetadata.from_native_target(sandbox, app_target)
|
60
|
+
end
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
@@ -67,8 +67,9 @@ module Pod
|
|
67
67
|
sandbox.pod_target_project_path(pod_target.project_name)
|
68
68
|
end
|
69
69
|
project_dir_names = sandbox_project_dir_names - [sandbox.project_path]
|
70
|
+
user_project_dir_names = aggregate_targets.map(&:user_project_path).uniq
|
70
71
|
|
71
|
-
removed_project_dir_names = project_dir_names - project_dir_names_to_install
|
72
|
+
removed_project_dir_names = project_dir_names - user_project_dir_names - project_dir_names_to_install
|
72
73
|
removed_project_dir_names.each { |dir| remove_dir(dir) }
|
73
74
|
end
|
74
75
|
end
|