xcocoapods 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,116 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class Xcode
|
4
|
+
class PodsProjectGenerator
|
5
|
+
# This class is responsible for integrating a pod target. This includes integrating
|
6
|
+
# the test targets included by each pod target.
|
7
|
+
#
|
8
|
+
class PodTargetIntegrator
|
9
|
+
# @return [TargetInstallationResult] the installation result of the target that should be integrated.
|
10
|
+
#
|
11
|
+
attr_reader :target_installation_result
|
12
|
+
|
13
|
+
# Initialize a new instance
|
14
|
+
#
|
15
|
+
# @param [TargetInstallationResult] target_installation_result @see #target_installation_result
|
16
|
+
#
|
17
|
+
def initialize(target_installation_result)
|
18
|
+
@target_installation_result = target_installation_result
|
19
|
+
end
|
20
|
+
|
21
|
+
# Integrates the pod target.
|
22
|
+
#
|
23
|
+
# @return [void]
|
24
|
+
#
|
25
|
+
def integrate!
|
26
|
+
UI.section(integration_message) do
|
27
|
+
target_installation_result.test_specs_by_native_target.each do |test_native_target, test_specs|
|
28
|
+
add_embed_frameworks_script_phase(test_native_target)
|
29
|
+
add_copy_resources_script_phase(test_native_target)
|
30
|
+
UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(test_specs), test_native_target)
|
31
|
+
end
|
32
|
+
specs = target.non_test_specs
|
33
|
+
UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(specs), target_installation_result.native_target)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [String] a string representation suitable for debugging.
|
38
|
+
#
|
39
|
+
def inspect
|
40
|
+
"#<#{self.class} for target `#{target.label}'>"
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
# @!group Integration steps
|
46
|
+
#---------------------------------------------------------------------#
|
47
|
+
|
48
|
+
# Find or create a 'Copy Pods Resources' build phase
|
49
|
+
#
|
50
|
+
# @return [void]
|
51
|
+
#
|
52
|
+
def add_copy_resources_script_phase(native_target)
|
53
|
+
test_type = target.test_type_for_product_type(native_target.symbol_type)
|
54
|
+
script_path = "${PODS_ROOT}/#{target.copy_resources_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
|
55
|
+
resource_paths = target.all_dependent_targets.flat_map do |dependent_target|
|
56
|
+
spec_paths_to_include = dependent_target == target ? dependent_target.specs.map(&:name) : dependent_target.non_test_specs.map(&:name)
|
57
|
+
dependent_target.resource_paths.values_at(*spec_paths_to_include).flatten.compact
|
58
|
+
end
|
59
|
+
input_paths = []
|
60
|
+
output_paths = []
|
61
|
+
unless resource_paths.empty?
|
62
|
+
resource_paths_flattened = resource_paths.flatten.uniq
|
63
|
+
input_paths = [script_path, *resource_paths_flattened]
|
64
|
+
output_paths = UserProjectIntegrator::TargetIntegrator.resource_output_paths(resource_paths_flattened)
|
65
|
+
end
|
66
|
+
UserProjectIntegrator::TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)
|
67
|
+
UserProjectIntegrator::TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Find or create a 'Embed Pods Frameworks' Copy Files Build Phase
|
71
|
+
#
|
72
|
+
# @return [void]
|
73
|
+
#
|
74
|
+
def add_embed_frameworks_script_phase(native_target)
|
75
|
+
test_type = target.test_type_for_product_type(native_target.symbol_type)
|
76
|
+
script_path = "${PODS_ROOT}/#{target.embed_frameworks_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
|
77
|
+
framework_paths = target.all_dependent_targets.flat_map do |dependent_target|
|
78
|
+
spec_paths_to_include = dependent_target == target ? dependent_target.specs.map(&:name) : dependent_target.non_test_specs.map(&:name)
|
79
|
+
dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact.uniq
|
80
|
+
end
|
81
|
+
input_paths = []
|
82
|
+
output_paths = []
|
83
|
+
unless framework_paths.empty?
|
84
|
+
input_paths = [script_path, *framework_paths.flat_map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.compact]
|
85
|
+
output_paths = framework_paths.flat_map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.compact
|
86
|
+
end
|
87
|
+
UserProjectIntegrator::TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)
|
88
|
+
UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
|
89
|
+
end
|
90
|
+
|
91
|
+
# @return [String] the message that should be displayed for the target
|
92
|
+
# integration.
|
93
|
+
#
|
94
|
+
def integration_message
|
95
|
+
"Integrating target `#{target.name}`"
|
96
|
+
end
|
97
|
+
|
98
|
+
# @return [PodTarget] the target part of the installation result.
|
99
|
+
#
|
100
|
+
def target
|
101
|
+
target_installation_result.target
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param [Array<Specification] specs
|
105
|
+
# the specs to return script phrases from.
|
106
|
+
#
|
107
|
+
# @return [Array<Hash<Symbol=>String>] an array of all combined script phases from the specs.
|
108
|
+
#
|
109
|
+
def script_phases_for_specs(specs)
|
110
|
+
specs.flat_map { |spec| spec.consumer(target.platform).script_phases }
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class Xcode
|
4
|
+
class PodsProjectGenerator
|
5
|
+
# A simple container produced after a target installation is completed.
|
6
|
+
#
|
7
|
+
class TargetInstallationResult
|
8
|
+
# @return [Target] target
|
9
|
+
# The target this installation result is for.
|
10
|
+
#
|
11
|
+
attr_reader :target
|
12
|
+
|
13
|
+
# @return [PBXNativeTarget] native_target
|
14
|
+
# The native target that was produced for this target.
|
15
|
+
#
|
16
|
+
attr_reader :native_target
|
17
|
+
|
18
|
+
# @return [Array<PBXNativeTarget>] resource_bundle_targets
|
19
|
+
# The resource bundle targets that were produced for this target. Can be empty if the target had
|
20
|
+
# no resource bundles.
|
21
|
+
#
|
22
|
+
attr_reader :resource_bundle_targets
|
23
|
+
|
24
|
+
# @return [Array<PBXNativeTarget>] test_native_targets
|
25
|
+
# The test native targets that were produced for this target. Can be empty if there were no test
|
26
|
+
# native targets created (e.g. no test specs present).
|
27
|
+
#
|
28
|
+
attr_reader :test_native_targets
|
29
|
+
|
30
|
+
# @return [Hash{String=>Array<PBXNativeTarget>}] test_resource_bundle_targets
|
31
|
+
# The test resource bundle targets that were produced for this target keyed by test spec name.
|
32
|
+
# Can be empty if the target had no resource bundles for any tests.
|
33
|
+
#
|
34
|
+
attr_reader :test_resource_bundle_targets
|
35
|
+
|
36
|
+
# Initialize a new instance
|
37
|
+
#
|
38
|
+
# @param [Target] target @see #target
|
39
|
+
# @param [PBXNativeTarget] native_target @see #native_target
|
40
|
+
# @param [Array<PBXNativeTarget>] resource_bundle_targets @see #resource_bundle_targets
|
41
|
+
# @param [Array<PBXNativeTarget>] test_native_targets @see #test_native_targets
|
42
|
+
# @param [Hash{String=>Array<PBXNativeTarget>}] test_resource_bundle_targets @see #test_resource_bundle_targets
|
43
|
+
#
|
44
|
+
def initialize(target, native_target, resource_bundle_targets = [], test_native_targets = [],
|
45
|
+
test_resource_bundle_targets = {})
|
46
|
+
@target = target
|
47
|
+
@native_target = native_target
|
48
|
+
@resource_bundle_targets = resource_bundle_targets
|
49
|
+
@test_native_targets = test_native_targets
|
50
|
+
@test_resource_bundle_targets = test_resource_bundle_targets
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns the corresponding native target to use based on the provided specification.
|
54
|
+
#
|
55
|
+
# @param [Specification] spec
|
56
|
+
# The specification to base from in order to find the native target.
|
57
|
+
#
|
58
|
+
# @return [PBXNativeTarget] the native target to use or `nil` if none is found.
|
59
|
+
#
|
60
|
+
def native_target_for_spec(spec)
|
61
|
+
return native_target unless spec.test_specification?
|
62
|
+
test_native_target_from_spec(spec)
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Hash{Array => Specification}] a hash where the keys are the test native targets and the value
|
66
|
+
# an array of all the test specs associated with this native target.
|
67
|
+
#
|
68
|
+
def test_specs_by_native_target
|
69
|
+
test_specs_by_native_target = target.test_specs.group_by do |test_spec|
|
70
|
+
test_native_target_from_spec(test_spec)
|
71
|
+
end
|
72
|
+
test_specs_by_native_target.delete_if { |k, _| k.nil? }
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def test_native_target_from_spec(spec)
|
78
|
+
test_native_targets.find do |test_native_target|
|
79
|
+
test_native_target.symbol_type == target.product_type_for_test_type(spec.test_type)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,256 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Installer
|
5
|
+
class Xcode
|
6
|
+
class PodsProjectGenerator
|
7
|
+
# Controller class responsible of creating and configuring the static
|
8
|
+
# library target in Pods project. It also creates the support file needed
|
9
|
+
# by the target.
|
10
|
+
#
|
11
|
+
class TargetInstaller
|
12
|
+
include TargetInstallerHelper
|
13
|
+
|
14
|
+
# @return [Sandbox] sandbox
|
15
|
+
# The sandbox where the support files should be generated.
|
16
|
+
#
|
17
|
+
attr_reader :sandbox
|
18
|
+
|
19
|
+
# @return [Pod::Project]
|
20
|
+
# The `Pods/Pods.xcodeproj` to install the target into.
|
21
|
+
#
|
22
|
+
attr_reader :project
|
23
|
+
|
24
|
+
# @return [Target] target
|
25
|
+
# The library whose target needs to be generated.
|
26
|
+
#
|
27
|
+
attr_reader :target
|
28
|
+
|
29
|
+
# Initialize a new instance
|
30
|
+
#
|
31
|
+
# @param [Sandbox] sandbox @see #sandbox
|
32
|
+
# @param [Pod::Project] project @see #project
|
33
|
+
# @param [Target] target @see #target
|
34
|
+
#
|
35
|
+
def initialize(sandbox, project, target)
|
36
|
+
@sandbox = sandbox
|
37
|
+
@project = project
|
38
|
+
@target = target
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
#-----------------------------------------------------------------------#
|
44
|
+
|
45
|
+
# @!group Installation steps
|
46
|
+
|
47
|
+
# Adds the target for the library to the Pods project with the
|
48
|
+
# appropriate build configurations.
|
49
|
+
#
|
50
|
+
# @note The `PODS_HEADERS_SEARCH_PATHS` overrides the xcconfig.
|
51
|
+
#
|
52
|
+
# @return [PBXNativeTarget] the native target that was added.
|
53
|
+
#
|
54
|
+
def add_target
|
55
|
+
product_type = target.product_type
|
56
|
+
name = target.label
|
57
|
+
platform = target.platform.name
|
58
|
+
language = target.uses_swift? ? :swift : :objc
|
59
|
+
native_target = project.new_target(product_type, name, platform, deployment_target, nil, language)
|
60
|
+
|
61
|
+
product_name = target.product_name
|
62
|
+
product = native_target.product_reference
|
63
|
+
product.name = product_name
|
64
|
+
|
65
|
+
target.user_build_configurations.each do |bc_name, type|
|
66
|
+
native_target.add_build_configuration(bc_name, type)
|
67
|
+
end
|
68
|
+
|
69
|
+
native_target.build_configurations.each do |configuration|
|
70
|
+
configuration.build_settings.merge!(custom_build_settings)
|
71
|
+
end
|
72
|
+
|
73
|
+
native_target
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [String] The deployment target.
|
77
|
+
#
|
78
|
+
def deployment_target
|
79
|
+
target.platform.deployment_target.to_s
|
80
|
+
end
|
81
|
+
|
82
|
+
# Returns the customized build settings which are overridden in the build
|
83
|
+
# settings of the user target.
|
84
|
+
#
|
85
|
+
# @return [Hash{String => String}]
|
86
|
+
#
|
87
|
+
def custom_build_settings
|
88
|
+
settings = {}
|
89
|
+
|
90
|
+
unless target.archs.empty?
|
91
|
+
settings['ARCHS'] = target.archs
|
92
|
+
end
|
93
|
+
|
94
|
+
if target.requires_frameworks?
|
95
|
+
if target.static_framework?
|
96
|
+
settings['MACH_O_TYPE'] = 'staticlib'
|
97
|
+
end
|
98
|
+
else
|
99
|
+
settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '')
|
100
|
+
end
|
101
|
+
|
102
|
+
settings
|
103
|
+
end
|
104
|
+
|
105
|
+
# Creates the directory where to store the support files of the target.
|
106
|
+
#
|
107
|
+
def create_support_files_dir
|
108
|
+
target.support_files_dir.mkpath
|
109
|
+
end
|
110
|
+
|
111
|
+
# Remove temp file whose store .prefix/config/dummy file.
|
112
|
+
#
|
113
|
+
def clean_support_files_temp_dir
|
114
|
+
support_files_temp_dir.rmtree if support_files_temp_dir.exist?
|
115
|
+
end
|
116
|
+
|
117
|
+
# @return [String] The temp file path to store temporary files.
|
118
|
+
#
|
119
|
+
def support_files_temp_dir
|
120
|
+
sandbox.target_support_files_dir('generated_files_tmp')
|
121
|
+
end
|
122
|
+
|
123
|
+
# Creates the Info.plist file which sets public framework attributes
|
124
|
+
#
|
125
|
+
# @param [Pathname] path
|
126
|
+
# the path to save the generated Info.plist file.
|
127
|
+
#
|
128
|
+
# @param [PBXNativeTarget] native_target
|
129
|
+
# the native target to link the generated Info.plist file into.
|
130
|
+
#
|
131
|
+
# @param [Version] version
|
132
|
+
# the version to use for when generating this Info.plist file.
|
133
|
+
#
|
134
|
+
# @param [Platform] platform
|
135
|
+
# the platform to use for when generating this Info.plist file.
|
136
|
+
#
|
137
|
+
# @param [Symbol] bundle_package_type
|
138
|
+
# the CFBundlePackageType of the target this Info.plist file is for.
|
139
|
+
#
|
140
|
+
# @return [void]
|
141
|
+
#
|
142
|
+
def create_info_plist_file(path, native_target, version, platform, bundle_package_type = :fmwk)
|
143
|
+
create_info_plist_file_with_sandbox(@sandbox, path, native_target, version, platform, bundle_package_type)
|
144
|
+
add_file_to_support_group(path)
|
145
|
+
end
|
146
|
+
|
147
|
+
# Creates the module map file which ensures that the umbrella header is
|
148
|
+
# recognized with a customized path
|
149
|
+
#
|
150
|
+
# @param [PBXNativeTarget] native_target
|
151
|
+
# the native target to link the module map file into.
|
152
|
+
#
|
153
|
+
# @return [void]
|
154
|
+
#
|
155
|
+
def create_module_map(native_target)
|
156
|
+
path = target.module_map_path_to_write
|
157
|
+
UI.message "- Generating module map file at #{UI.path(path)}" do
|
158
|
+
generator = Generator::ModuleMap.new(target)
|
159
|
+
yield generator if block_given?
|
160
|
+
update_changed_file(generator, path)
|
161
|
+
add_file_to_support_group(path)
|
162
|
+
|
163
|
+
linked_path = target.module_map_path
|
164
|
+
if path != linked_path
|
165
|
+
linked_path.dirname.mkpath
|
166
|
+
FileUtils.ln_sf(path, linked_path)
|
167
|
+
end
|
168
|
+
|
169
|
+
relative_path_string = target.module_map_path.relative_path_from(sandbox.root).to_s
|
170
|
+
native_target.build_configurations.each do |c|
|
171
|
+
c.build_settings['MODULEMAP_FILE'] = relative_path_string
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Generates a header which ensures that all header files are exported
|
177
|
+
# in the module map
|
178
|
+
#
|
179
|
+
# @param [PBXNativeTarget] native_target
|
180
|
+
# the native target to link the umbrella header file into.
|
181
|
+
#
|
182
|
+
# @yield_param [Generator::UmbrellaHeader]
|
183
|
+
# yielded once to configure the imports
|
184
|
+
#
|
185
|
+
# @return [void]
|
186
|
+
#
|
187
|
+
def create_umbrella_header(native_target)
|
188
|
+
path = target.umbrella_header_path_to_write
|
189
|
+
UI.message "- Generating umbrella header at #{UI.path(path)}" do
|
190
|
+
generator = Generator::UmbrellaHeader.new(target)
|
191
|
+
yield generator if block_given?
|
192
|
+
update_changed_file(generator, path)
|
193
|
+
|
194
|
+
# Add the file to the support group and the native target,
|
195
|
+
# so it will been added to the header build phase
|
196
|
+
file_ref = add_file_to_support_group(path)
|
197
|
+
build_file = native_target.headers_build_phase.add_file_reference(file_ref)
|
198
|
+
|
199
|
+
linked_path = target.umbrella_header_path
|
200
|
+
if path != linked_path
|
201
|
+
linked_path.dirname.mkpath
|
202
|
+
FileUtils.ln_sf(path, linked_path)
|
203
|
+
end
|
204
|
+
|
205
|
+
acl = target.requires_frameworks? ? 'Public' : 'Project'
|
206
|
+
build_file.settings ||= {}
|
207
|
+
build_file.settings['ATTRIBUTES'] = [acl]
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# Generates a dummy source file for each target so libraries that contain
|
212
|
+
# only categories build.
|
213
|
+
#
|
214
|
+
# @param [PBXNativeTarget] native_target
|
215
|
+
# the native target to link the dummy source file into.
|
216
|
+
#
|
217
|
+
# @return [void]
|
218
|
+
#
|
219
|
+
def create_dummy_source(native_target)
|
220
|
+
path = target.dummy_source_path
|
221
|
+
UI.message "- Generating dummy source at #{UI.path(path)}" do
|
222
|
+
generator = Generator::DummySource.new(target.label)
|
223
|
+
update_changed_file(generator, path)
|
224
|
+
file_reference = add_file_to_support_group(path)
|
225
|
+
native_target.source_build_phase.add_file_reference(file_reference)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
private
|
230
|
+
|
231
|
+
#-----------------------------------------------------------------------#
|
232
|
+
|
233
|
+
# @!group Private helpers.
|
234
|
+
|
235
|
+
# @return [PBXGroup] the group where the file references to the support
|
236
|
+
# files should be stored.
|
237
|
+
#
|
238
|
+
attr_reader :support_files_group
|
239
|
+
|
240
|
+
# Adds a reference to the given file in the support group of this target.
|
241
|
+
#
|
242
|
+
# @param [Pathname] path
|
243
|
+
# The path of the file to which the reference should be added.
|
244
|
+
#
|
245
|
+
# @return [PBXFileReference] the file reference of the added file.
|
246
|
+
#
|
247
|
+
def add_file_to_support_group(path)
|
248
|
+
support_files_group.new_file(path)
|
249
|
+
end
|
250
|
+
|
251
|
+
#-----------------------------------------------------------------------#
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|