Commit c3d23564 authored by Joachim Bengtsson's avatar Joachim Bengtsson Committed by Eloy Durán

WIP: Support for defining pods per build config

This is not even nearly functional, I'm just prodding pieces of code to
see how it works.
parent b6ca8ff2
...@@ -11,9 +11,11 @@ module Pod ...@@ -11,9 +11,11 @@ module Pod
attr_reader :target attr_reader :target
# @param [Target] target @see target # @param [Target] target @see target
# @param [String] build_config Name of the build config to generate this xcconfig for
# #
def initialize(target) def initialize(target, build_config)
@target = target @target = target
@build_config = build_config
end end
# @return [Xcodeproj::Config] The generated xcconfig. # @return [Xcodeproj::Config] The generated xcconfig.
...@@ -54,6 +56,8 @@ module Pod ...@@ -54,6 +56,8 @@ module Pod
}) })
target.pod_targets.each do |pod_target| target.pod_targets.each do |pod_target|
next unless pod_target.include_in_build_config? @build_config
pod_target.file_accessors.each do |file_accessor| pod_target.file_accessors.each do |file_accessor|
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig) XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig)
file_accessor.vendored_frameworks.each do |vendored_framework| file_accessor.vendored_frameworks.each do |vendored_framework|
......
...@@ -32,15 +32,14 @@ module Pod ...@@ -32,15 +32,14 @@ module Pod
# @return [void] # @return [void]
# #
def create_xcconfig_file def create_xcconfig_file
path = library.xcconfig_path target.build_configurations.each do |build_config|
UI.message "- Generating xcconfig file at #{UI.path(path)}" do path = library.xcconfig_path build_config
gen = Generator::XCConfig::AggregateXCConfig.new(library) UI.message "- Generating #{build_config.name} xcconfig file at #{UI.path(path)}" do
gen.save_as(path) gen = Generator::XCConfig::AggregateXCConfig.new(library, build_config)
library.xcconfig = gen.xcconfig gen.save_as(path)
xcconfig_file_ref = add_file_to_support_group(path) library.xcconfigs[build_config.name] = gen.xcconfig
xcconfig_file_ref = add_file_to_support_group(path)
target.build_configurations.each do |c| build_config.base_configuration_reference = xcconfig_file_ref
c.base_configuration_reference = xcconfig_file_ref
end end
end end
end end
......
...@@ -79,8 +79,8 @@ module Pod ...@@ -79,8 +79,8 @@ module Pod
# @return [Pathname] the absolute path of the xcconfig file. # @return [Pathname] the absolute path of the xcconfig file.
# #
def xcconfig_path def xcconfig_path variant
support_files_root + "#{label}.xcconfig" support_files_root + "#{label}-#{variant}.xcconfig"
end end
# @return [Pathname] the absolute path of the private xcconfig file. # @return [Pathname] the absolute path of the private xcconfig file.
......
...@@ -13,6 +13,7 @@ module Pod ...@@ -13,6 +13,7 @@ module Pod
@sandbox = sandbox @sandbox = sandbox
@pod_targets = [] @pod_targets = []
@file_accessors = [] @file_accessors = []
@xcconfigs = {}
end end
# @return [String] the label for the target. # @return [String] the label for the target.
...@@ -44,13 +45,14 @@ module Pod ...@@ -44,13 +45,14 @@ module Pod
# #
attr_accessor :user_target_uuids attr_accessor :user_target_uuids
# @return [Xcodeproj::Config] The configuration file of the target. # @return [Hash<String, Xcodeproj::Config>] Map from configuration name to configuration file for the target
# #
# @note The configuration is generated by the {TargetInstaller} and # @note The configurations are generated by the {TargetInstaller} and
# used by {UserProjectIntegrator} to check for any overridden # used by {UserProjectIntegrator} to check for any overridden
# values. # values.
# #
attr_accessor :xcconfig attr_reader :xcconfigs
# @return [Array<PodTarget>] The dependencies for this target. # @return [Array<PodTarget>] The dependencies for this target.
# #
...@@ -90,11 +92,12 @@ module Pod ...@@ -90,11 +92,12 @@ module Pod
"${SRCROOT}/#{support_files_root.relative_path_from(client_root)}" "${SRCROOT}/#{support_files_root.relative_path_from(client_root)}"
end end
# @param [String] config_name The build configuration name to get the xcconfig for
# @return [String] The path of the xcconfig file relative to the root of # @return [String] The path of the xcconfig file relative to the root of
# the user project. # the user project.
# #
def xcconfig_relative_path def xcconfig_relative_path config_name
relative_to_srcroot(xcconfig_path).to_s relative_to_srcroot(xcconfig_path, config_name).to_s
end end
# @return [String] The path of the copy resources script relative to the # @return [String] The path of the copy resources script relative to the
......
...@@ -64,5 +64,11 @@ module Pod ...@@ -64,5 +64,11 @@ module Pod
end.flatten end.flatten
end end
# @param [String] build_config Name of the build configuration that caller is unsure if this target should
# be linked with.
def include_in_build_config? build_config
true
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment