xcocoapods 1.5.3
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +6303 -0
- data/LICENSE +28 -0
- data/README.md +80 -0
- data/bin/pod +56 -0
- data/bin/sandbox-pod +168 -0
- data/lib/cocoapods.rb +73 -0
- data/lib/cocoapods/command.rb +175 -0
- data/lib/cocoapods/command/cache.rb +28 -0
- data/lib/cocoapods/command/cache/clean.rb +90 -0
- data/lib/cocoapods/command/cache/list.rb +69 -0
- data/lib/cocoapods/command/env.rb +66 -0
- data/lib/cocoapods/command/init.rb +128 -0
- data/lib/cocoapods/command/install.rb +45 -0
- data/lib/cocoapods/command/ipc.rb +19 -0
- data/lib/cocoapods/command/ipc/list.rb +40 -0
- data/lib/cocoapods/command/ipc/podfile.rb +31 -0
- data/lib/cocoapods/command/ipc/podfile_json.rb +30 -0
- data/lib/cocoapods/command/ipc/repl.rb +51 -0
- data/lib/cocoapods/command/ipc/spec.rb +29 -0
- data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
- data/lib/cocoapods/command/lib.rb +11 -0
- data/lib/cocoapods/command/lib/create.rb +105 -0
- data/lib/cocoapods/command/lib/lint.rb +121 -0
- data/lib/cocoapods/command/list.rb +39 -0
- data/lib/cocoapods/command/options/project_directory.rb +36 -0
- data/lib/cocoapods/command/options/repo_update.rb +34 -0
- data/lib/cocoapods/command/outdated.rb +140 -0
- data/lib/cocoapods/command/repo.rb +29 -0
- data/lib/cocoapods/command/repo/add.rb +103 -0
- data/lib/cocoapods/command/repo/lint.rb +82 -0
- data/lib/cocoapods/command/repo/list.rb +93 -0
- data/lib/cocoapods/command/repo/push.rb +281 -0
- data/lib/cocoapods/command/repo/remove.rb +36 -0
- data/lib/cocoapods/command/repo/update.rb +28 -0
- data/lib/cocoapods/command/setup.rb +103 -0
- data/lib/cocoapods/command/spec.rb +112 -0
- data/lib/cocoapods/command/spec/cat.rb +51 -0
- data/lib/cocoapods/command/spec/create.rb +283 -0
- data/lib/cocoapods/command/spec/edit.rb +87 -0
- data/lib/cocoapods/command/spec/env_spec.rb +53 -0
- data/lib/cocoapods/command/spec/lint.rb +137 -0
- data/lib/cocoapods/command/spec/which.rb +43 -0
- data/lib/cocoapods/command/update.rb +101 -0
- data/lib/cocoapods/config.rb +347 -0
- data/lib/cocoapods/core_overrides.rb +1 -0
- data/lib/cocoapods/downloader.rb +190 -0
- data/lib/cocoapods/downloader/cache.rb +233 -0
- data/lib/cocoapods/downloader/request.rb +86 -0
- data/lib/cocoapods/downloader/response.rb +16 -0
- data/lib/cocoapods/executable.rb +222 -0
- data/lib/cocoapods/external_sources.rb +57 -0
- data/lib/cocoapods/external_sources/abstract_external_source.rb +205 -0
- data/lib/cocoapods/external_sources/downloader_source.rb +30 -0
- data/lib/cocoapods/external_sources/path_source.rb +55 -0
- data/lib/cocoapods/external_sources/podspec_source.rb +54 -0
- data/lib/cocoapods/gem_version.rb +5 -0
- data/lib/cocoapods/generator/acknowledgements.rb +107 -0
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +44 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +94 -0
- data/lib/cocoapods/generator/app_target_helper.rb +244 -0
- data/lib/cocoapods/generator/bridge_support.rb +22 -0
- data/lib/cocoapods/generator/constant.rb +19 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +230 -0
- data/lib/cocoapods/generator/dummy_source.rb +31 -0
- data/lib/cocoapods/generator/embed_frameworks_script.rb +215 -0
- data/lib/cocoapods/generator/header.rb +103 -0
- data/lib/cocoapods/generator/info_plist_file.rb +116 -0
- data/lib/cocoapods/generator/module_map.rb +99 -0
- data/lib/cocoapods/generator/prefix_header.rb +60 -0
- data/lib/cocoapods/generator/umbrella_header.rb +46 -0
- data/lib/cocoapods/hooks_manager.rb +132 -0
- data/lib/cocoapods/installer.rb +703 -0
- data/lib/cocoapods/installer/analyzer.rb +972 -0
- data/lib/cocoapods/installer/analyzer/analysis_result.rb +87 -0
- data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +98 -0
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +67 -0
- data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +157 -0
- data/lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb +54 -0
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +240 -0
- data/lib/cocoapods/installer/analyzer/specs_state.rb +84 -0
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +53 -0
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +260 -0
- data/lib/cocoapods/installer/installation_options.rb +158 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +202 -0
- data/lib/cocoapods/installer/pod_source_preparer.rb +77 -0
- data/lib/cocoapods/installer/podfile_validator.rb +139 -0
- data/lib/cocoapods/installer/post_install_hooks_context.rb +132 -0
- data/lib/cocoapods/installer/pre_install_hooks_context.rb +51 -0
- data/lib/cocoapods/installer/source_provider_hooks_context.rb +34 -0
- data/lib/cocoapods/installer/user_project_integrator.rb +250 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +463 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +146 -0
- data/lib/cocoapods/installer/xcode.rb +8 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +416 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +181 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +84 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +334 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +777 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +116 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +86 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +256 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +68 -0
- data/lib/cocoapods/installer/xcode/target_validator.rb +147 -0
- data/lib/cocoapods/open-uri.rb +33 -0
- data/lib/cocoapods/project.rb +414 -0
- data/lib/cocoapods/resolver.rb +585 -0
- data/lib/cocoapods/resolver/lazy_specification.rb +79 -0
- data/lib/cocoapods/sandbox.rb +404 -0
- data/lib/cocoapods/sandbox/file_accessor.rb +444 -0
- data/lib/cocoapods/sandbox/headers_store.rb +146 -0
- data/lib/cocoapods/sandbox/path_list.rb +220 -0
- data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +85 -0
- data/lib/cocoapods/sandbox/podspec_finder.rb +23 -0
- data/lib/cocoapods/sources_manager.rb +157 -0
- data/lib/cocoapods/target.rb +261 -0
- data/lib/cocoapods/target/aggregate_target.rb +338 -0
- data/lib/cocoapods/target/build_settings.rb +1075 -0
- data/lib/cocoapods/target/pod_target.rb +559 -0
- data/lib/cocoapods/user_interface.rb +459 -0
- data/lib/cocoapods/user_interface/error_report.rb +187 -0
- data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
- data/lib/cocoapods/validator.rb +981 -0
- metadata +533 -0
|
@@ -0,0 +1,132 @@
|
|
|
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 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 [Array<AggregateTarget>] aggregate_targets
|
|
44
|
+
# The aggregate targets, which will been presented by an adequate
|
|
45
|
+
# {UmbrellaTargetDescription} in the generated context.
|
|
46
|
+
#
|
|
47
|
+
# @return [HooksContext] Convenience class method to generate the
|
|
48
|
+
# static context.
|
|
49
|
+
#
|
|
50
|
+
def self.generate(sandbox, aggregate_targets)
|
|
51
|
+
umbrella_targets_descriptions = aggregate_targets.map do |umbrella|
|
|
52
|
+
user_project = umbrella.user_project
|
|
53
|
+
user_targets = umbrella.user_targets
|
|
54
|
+
specs = umbrella.specs
|
|
55
|
+
platform_name = umbrella.platform.name
|
|
56
|
+
platform_deployment_target = umbrella.platform.deployment_target.to_s
|
|
57
|
+
cocoapods_target_label = umbrella.label
|
|
58
|
+
UmbrellaTargetDescription.new(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
new(sandbox, sandbox.root.to_s, sandbox.project, umbrella_targets_descriptions)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Pure data class which describes and umbrella target.
|
|
65
|
+
#
|
|
66
|
+
class UmbrellaTargetDescription
|
|
67
|
+
# @return [Xcodeproj::Project] The user project into which this target
|
|
68
|
+
# is integrated.
|
|
69
|
+
#
|
|
70
|
+
attr_reader :user_project
|
|
71
|
+
|
|
72
|
+
# @return [Array<PBXNativeTarget>]
|
|
73
|
+
# The list of user targets integrated by this umbrella target.
|
|
74
|
+
#
|
|
75
|
+
attr_reader :user_targets
|
|
76
|
+
|
|
77
|
+
# @return [Array<Specification>] The list of the
|
|
78
|
+
# specifications of the target.
|
|
79
|
+
#
|
|
80
|
+
attr_reader :specs
|
|
81
|
+
|
|
82
|
+
# @return [Symbol] The platform (either `:ios`, `:watchos`, `:tvos`, or `:osx`).
|
|
83
|
+
#
|
|
84
|
+
attr_reader :platform_name
|
|
85
|
+
|
|
86
|
+
# @return [String] The deployment target.
|
|
87
|
+
#
|
|
88
|
+
attr_reader :platform_deployment_target
|
|
89
|
+
|
|
90
|
+
# @return [String] The label for the target.
|
|
91
|
+
#
|
|
92
|
+
attr_reader :cocoapods_target_label
|
|
93
|
+
|
|
94
|
+
# Initialize a new instance
|
|
95
|
+
#
|
|
96
|
+
# @param [Xcodeproj::Project] user_project see #user_project
|
|
97
|
+
# @param [Array<PBXNativeTarget>] user_targets see #user_targets
|
|
98
|
+
# @param [Array<Specification>] specs see #specs
|
|
99
|
+
# @param [Symbol] platform_name see #platform_name
|
|
100
|
+
# @param [String] platform_deployment_target see #platform_deployment_target
|
|
101
|
+
# @param [String] cocoapods_target_label see #cocoapods_target_label
|
|
102
|
+
#
|
|
103
|
+
def initialize(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
|
|
104
|
+
@user_project = user_project
|
|
105
|
+
@user_targets = user_targets
|
|
106
|
+
@specs = specs
|
|
107
|
+
@platform_name = platform_name
|
|
108
|
+
@platform_deployment_target = platform_deployment_target
|
|
109
|
+
@cocoapods_target_label = cocoapods_target_label
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# @return [String] The path of the user project
|
|
113
|
+
# integrated by this target.
|
|
114
|
+
#
|
|
115
|
+
def user_project_path
|
|
116
|
+
user_project.path if user_project
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# @return [Array<String>] The list of the UUIDs of the
|
|
120
|
+
# user targets integrated by this umbrella
|
|
121
|
+
# target. They can be used to find the
|
|
122
|
+
# targets opening the project They can be used
|
|
123
|
+
# to find the targets opening the project with
|
|
124
|
+
# Xcodeproj.
|
|
125
|
+
#
|
|
126
|
+
def user_target_uuids
|
|
127
|
+
user_targets.map(&:uuid)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Installer
|
|
3
|
+
# Context object designed to be used with the HooksManager which describes
|
|
4
|
+
# the context of the installer before analysis has been completed.
|
|
5
|
+
#
|
|
6
|
+
class PreInstallHooksContext
|
|
7
|
+
# @return [Podfile] The Podfile for the project.
|
|
8
|
+
#
|
|
9
|
+
attr_reader :podfile
|
|
10
|
+
|
|
11
|
+
# @return [Sandbox] The Sandbox for the project.
|
|
12
|
+
#
|
|
13
|
+
attr_reader :sandbox
|
|
14
|
+
|
|
15
|
+
# @return [String] The path to the sandbox root (`Pods` directory).
|
|
16
|
+
#
|
|
17
|
+
attr_reader :sandbox_root
|
|
18
|
+
|
|
19
|
+
# @return [Lockfile] The Lockfile for the project.
|
|
20
|
+
#
|
|
21
|
+
attr_reader :lockfile
|
|
22
|
+
|
|
23
|
+
# Initialize a new instance
|
|
24
|
+
#
|
|
25
|
+
# @param [Sandbox] sandbox see #sandbox
|
|
26
|
+
# @param [String] sandbox_root see #sandbox_root
|
|
27
|
+
# @param [Podfile] podfile see #podfile
|
|
28
|
+
# @param [Lockfile] lockfile see #lockfile
|
|
29
|
+
#
|
|
30
|
+
def initialize(podfile, sandbox, sandbox_root, lockfile)
|
|
31
|
+
@podfile = podfile
|
|
32
|
+
@sandbox = sandbox
|
|
33
|
+
@sandbox_root = sandbox_root
|
|
34
|
+
@lockfile = lockfile
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# @param [Sandbox] sandbox see {#sandbox}
|
|
38
|
+
#
|
|
39
|
+
# @param [Podfile] podfile see {#podfile}
|
|
40
|
+
#
|
|
41
|
+
# @param [Lockfile] lockfile see {#lockfile}
|
|
42
|
+
#
|
|
43
|
+
# @return [PreInstallHooksContext] Convenience class method to generate the
|
|
44
|
+
# static context.
|
|
45
|
+
#
|
|
46
|
+
def self.generate(sandbox, podfile, lockfile)
|
|
47
|
+
new(podfile, sandbox, sandbox.root.to_s, lockfile)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Installer
|
|
3
|
+
# Context object designed to be used with the HooksManager which describes
|
|
4
|
+
# the context of the installer before spec sources have been created
|
|
5
|
+
#
|
|
6
|
+
class SourceProviderHooksContext
|
|
7
|
+
# @return [Array<Source>] The source objects to send to the installer
|
|
8
|
+
#
|
|
9
|
+
attr_reader :sources
|
|
10
|
+
|
|
11
|
+
# @return [SourceProviderHooksContext] Convenience class method to generate the
|
|
12
|
+
# static context.
|
|
13
|
+
#
|
|
14
|
+
def self.generate
|
|
15
|
+
result = new
|
|
16
|
+
result
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initialize
|
|
20
|
+
@sources = []
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# @param [Source] source object to be added to the installer
|
|
24
|
+
#
|
|
25
|
+
# @return [void]
|
|
26
|
+
#
|
|
27
|
+
def add_source(source)
|
|
28
|
+
unless source.nil?
|
|
29
|
+
@sources << source
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
require 'xcodeproj/workspace'
|
|
2
|
+
require 'xcodeproj/project'
|
|
3
|
+
|
|
4
|
+
require 'active_support/core_ext/string/inflections'
|
|
5
|
+
require 'active_support/core_ext/array/conversions'
|
|
6
|
+
|
|
7
|
+
module Pod
|
|
8
|
+
class Installer
|
|
9
|
+
# The {UserProjectIntegrator} integrates the libraries generated by
|
|
10
|
+
# TargetDefinitions of the {Podfile} with their correspondent user
|
|
11
|
+
# projects.
|
|
12
|
+
#
|
|
13
|
+
class UserProjectIntegrator
|
|
14
|
+
autoload :TargetIntegrator, 'cocoapods/installer/user_project_integrator/target_integrator'
|
|
15
|
+
|
|
16
|
+
# @return [Podfile] the podfile that should be integrated with the user
|
|
17
|
+
# projects.
|
|
18
|
+
#
|
|
19
|
+
attr_reader :podfile
|
|
20
|
+
|
|
21
|
+
# @return [Project] the pods project which contains the libraries to
|
|
22
|
+
# integrate.
|
|
23
|
+
#
|
|
24
|
+
# attr_reader :pods_project
|
|
25
|
+
|
|
26
|
+
attr_reader :sandbox
|
|
27
|
+
|
|
28
|
+
# @return [Pathname] the path of the installation.
|
|
29
|
+
#
|
|
30
|
+
# @todo This is only used to compute the workspace path in case that it
|
|
31
|
+
# should be inferred by the project. If the workspace should be in
|
|
32
|
+
# the same dir of the project, this could be removed.
|
|
33
|
+
#
|
|
34
|
+
attr_reader :installation_root
|
|
35
|
+
|
|
36
|
+
# @return [Array<AggregateTarget>] the targets represented in the Podfile.
|
|
37
|
+
#
|
|
38
|
+
attr_reader :targets
|
|
39
|
+
|
|
40
|
+
# Init a new UserProjectIntegrator
|
|
41
|
+
#
|
|
42
|
+
# @param [Podfile] podfile @see #podfile
|
|
43
|
+
# @param [Sandbox] sandbox @see #sandbox
|
|
44
|
+
# @param [Pathname] installation_root @see #installation_root
|
|
45
|
+
# @param [Array<AggregateTarget>] targets @see #targets
|
|
46
|
+
#
|
|
47
|
+
def initialize(podfile, sandbox, installation_root, targets)
|
|
48
|
+
@podfile = podfile
|
|
49
|
+
@sandbox = sandbox
|
|
50
|
+
@installation_root = installation_root
|
|
51
|
+
@targets = targets
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Integrates the user projects associated with the {TargetDefinitions}
|
|
55
|
+
# with the Pods project and its products.
|
|
56
|
+
#
|
|
57
|
+
# @return [void]
|
|
58
|
+
#
|
|
59
|
+
def integrate!
|
|
60
|
+
create_workspace
|
|
61
|
+
integrate_user_targets
|
|
62
|
+
warn_about_xcconfig_overrides
|
|
63
|
+
save_projects
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
#-----------------------------------------------------------------------#
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
|
|
70
|
+
# @!group Integration steps
|
|
71
|
+
|
|
72
|
+
# Creates and saved the workspace containing the Pods project and the
|
|
73
|
+
# user projects, if needed.
|
|
74
|
+
#
|
|
75
|
+
# @note If the workspace already contains the projects it is not saved
|
|
76
|
+
# to avoid Xcode from displaying the revert dialog: `Do you want to
|
|
77
|
+
# keep the Xcode version or revert to the version on disk?`
|
|
78
|
+
#
|
|
79
|
+
# @return [void]
|
|
80
|
+
#
|
|
81
|
+
def create_workspace
|
|
82
|
+
all_projects = user_project_paths.sort.push(sandbox.project_path).uniq
|
|
83
|
+
file_references = all_projects.map do |path|
|
|
84
|
+
relative_path = path.relative_path_from(workspace_path.dirname).to_s
|
|
85
|
+
Xcodeproj::Workspace::FileReference.new(relative_path, 'group')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if workspace_path.exist?
|
|
89
|
+
workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
|
|
90
|
+
new_file_references = file_references - workspace.file_references
|
|
91
|
+
unless new_file_references.empty?
|
|
92
|
+
new_file_references.each { |fr| workspace << fr }
|
|
93
|
+
workspace.save_as(workspace_path)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
else
|
|
97
|
+
UI.notice "Please close any current Xcode sessions and use `#{workspace_path.basename}` for this project from now on."
|
|
98
|
+
workspace = Xcodeproj::Workspace.new(*file_references)
|
|
99
|
+
workspace.save_as(workspace_path)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Integrates the targets of the user projects with the libraries
|
|
104
|
+
# generated from the {Podfile}.
|
|
105
|
+
#
|
|
106
|
+
# @note {TargetDefinition} without dependencies are skipped prevent
|
|
107
|
+
# creating empty libraries for targets definitions which are only
|
|
108
|
+
# wrappers for others.
|
|
109
|
+
#
|
|
110
|
+
# @return [void]
|
|
111
|
+
#
|
|
112
|
+
def integrate_user_targets
|
|
113
|
+
target_integrators = targets_to_integrate.sort_by(&:name).map do |target|
|
|
114
|
+
TargetIntegrator.new(target)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
Config.instance.with_changes(:silent => true) do
|
|
118
|
+
deintegrator = Deintegrator.new
|
|
119
|
+
all_project_targets = user_projects.flat_map(&:native_targets).uniq
|
|
120
|
+
all_native_targets = targets_to_integrate.flat_map(&:user_targets).uniq
|
|
121
|
+
targets_to_deintegrate = all_project_targets - all_native_targets
|
|
122
|
+
targets_to_deintegrate.each do |target|
|
|
123
|
+
deintegrator.deintegrate_target(target)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
target_integrators.each(&:integrate!)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Save all user projects.
|
|
131
|
+
#
|
|
132
|
+
# @return [void]
|
|
133
|
+
#
|
|
134
|
+
def save_projects
|
|
135
|
+
user_projects.each do |project|
|
|
136
|
+
if project.dirty?
|
|
137
|
+
project.save
|
|
138
|
+
else
|
|
139
|
+
# There is a bug in Xcode where the process of deleting and
|
|
140
|
+
# re-creating the xcconfig files used in the build
|
|
141
|
+
# configuration cause building the user project to fail until
|
|
142
|
+
# Xcode is relaunched.
|
|
143
|
+
#
|
|
144
|
+
# Touching/saving the project causes Xcode to reload these.
|
|
145
|
+
#
|
|
146
|
+
# https://github.com/CocoaPods/CocoaPods/issues/2665
|
|
147
|
+
FileUtils.touch(project.path + 'project.pbxproj')
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
IGNORED_KEYS = %w(CODE_SIGN_IDENTITY).freeze
|
|
153
|
+
INHERITED_FLAGS = %w($(inherited) ${inherited}).freeze
|
|
154
|
+
|
|
155
|
+
# Checks whether the settings of the CocoaPods generated xcconfig are
|
|
156
|
+
# overridden by the build configuration of a target and prints a
|
|
157
|
+
# warning to inform the user if needed.
|
|
158
|
+
#
|
|
159
|
+
def warn_about_xcconfig_overrides
|
|
160
|
+
targets.each do |aggregate_target|
|
|
161
|
+
aggregate_target.user_targets.each do |user_target|
|
|
162
|
+
user_target.build_configurations.each do |config|
|
|
163
|
+
xcconfig = aggregate_target.xcconfigs[config.name]
|
|
164
|
+
if xcconfig
|
|
165
|
+
(xcconfig.to_hash.keys - IGNORED_KEYS).each do |key|
|
|
166
|
+
target_values = config.build_settings[key]
|
|
167
|
+
if target_values &&
|
|
168
|
+
!INHERITED_FLAGS.any? { |flag| target_values.include?(flag) }
|
|
169
|
+
print_override_warning(aggregate_target, user_target, config, key)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
private
|
|
179
|
+
|
|
180
|
+
# @!group Private Helpers
|
|
181
|
+
#-----------------------------------------------------------------------#
|
|
182
|
+
|
|
183
|
+
# @return [Pathname] the path where the workspace containing the Pods
|
|
184
|
+
# project and the user projects should be saved.
|
|
185
|
+
#
|
|
186
|
+
def workspace_path
|
|
187
|
+
if podfile.workspace_path
|
|
188
|
+
declared_path = podfile.workspace_path
|
|
189
|
+
path_with_ext = File.extname(declared_path) == '.xcworkspace' ? declared_path : "#{declared_path}.xcworkspace"
|
|
190
|
+
podfile_dir = File.dirname(podfile.defined_in_file || '')
|
|
191
|
+
absolute_path = File.expand_path(path_with_ext, podfile_dir)
|
|
192
|
+
Pathname.new(absolute_path)
|
|
193
|
+
elsif user_project_paths.count == 1
|
|
194
|
+
project = user_project_paths.first.basename('.xcodeproj')
|
|
195
|
+
installation_root + "#{project}.xcworkspace"
|
|
196
|
+
else
|
|
197
|
+
raise Informative, 'Could not automatically select an Xcode ' \
|
|
198
|
+
"workspace. Specify one in your Podfile like so:\n\n" \
|
|
199
|
+
" workspace 'path/to/Workspace.xcworkspace'\n"
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# @return [Array<Pathname>] the paths of all the user projects referenced
|
|
204
|
+
# by the target definitions.
|
|
205
|
+
#
|
|
206
|
+
# @note Empty target definitions are ignored.
|
|
207
|
+
#
|
|
208
|
+
def user_project_paths
|
|
209
|
+
targets.map(&:user_project_path).compact.uniq
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def user_projects
|
|
213
|
+
targets.map(&:user_project).compact.uniq
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def targets_to_integrate
|
|
217
|
+
targets
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Prints a warning informing the user that a build configuration of
|
|
221
|
+
# the integrated target is overriding the CocoaPods build settings.
|
|
222
|
+
#
|
|
223
|
+
# @param [Target::AggregateTarget] aggregate_target
|
|
224
|
+
# The umbrella target.
|
|
225
|
+
#
|
|
226
|
+
# @param [XcodeProj::PBXNativeTarget] user_target
|
|
227
|
+
# The native target.
|
|
228
|
+
#
|
|
229
|
+
# @param [Xcodeproj::XCBuildConfiguration] config
|
|
230
|
+
# The build configuration.
|
|
231
|
+
#
|
|
232
|
+
# @param [String] key
|
|
233
|
+
# The key of the overridden build setting.
|
|
234
|
+
#
|
|
235
|
+
def print_override_warning(aggregate_target, user_target, config, key)
|
|
236
|
+
actions = [
|
|
237
|
+
'Use the `$(inherited)` flag, or',
|
|
238
|
+
'Remove the build settings from the target.',
|
|
239
|
+
]
|
|
240
|
+
message = "The `#{user_target.name} [#{config.name}]` " \
|
|
241
|
+
"target overrides the `#{key}` build setting defined in " \
|
|
242
|
+
"`#{aggregate_target.xcconfig_relative_path(config.name)}'. " \
|
|
243
|
+
'This can lead to problems with the CocoaPods installation'
|
|
244
|
+
UI.warn(message, actions)
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
#-----------------------------------------------------------------------#
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
end
|