Skip to content

Commit

Permalink
make APPLICATION_EXTENSION_API_ONLY not break when performing a cache…
Browse files Browse the repository at this point in the history
…d install
  • Loading branch information
igor-makarov committed Sep 4, 2019
1 parent a88e953 commit c0e0e9f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
14 changes: 14 additions & 0 deletions lib/cocoapods/installer/analyzer.rb
Expand Up @@ -438,6 +438,20 @@ def generate_targets(resolver_specs_by_target, target_inspections)
end
target.search_paths_aggregate_targets.concat(search_paths_aggregate_targets).freeze
end

aggregate_targets.each do |aggregate_target|
is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
[:app_extension, :watch_extension, :watch2_extension, :tv_extension, :messages_extension]).empty?
is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }

next unless is_app_extension

aggregate_target.application_extension_api_only = true
aggregate_target.pod_targets.each do |pod_target|
pod_target.application_extension_api_only = true
end
end

if installation_options.integrate_targets?
# Copy embedded target pods that cannot have their pods embedded as frameworks to
# their host targets, and ensure we properly link library pods to their host targets
Expand Down
Expand Up @@ -41,10 +41,6 @@ def install!
aggregate_target = aggregate_target_installation_result.target
aggregate_native_target = aggregate_target_installation_result.native_target
project = aggregate_native_target.project
is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
[:app_extension, :watch_extension, :watch2_extension, :tv_extension, :messages_extension]).empty?
is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }
configure_app_extension_api_only_to_native_target(aggregate_native_target) if is_app_extension
# Wire up dependencies that are part of inherit search paths for this aggregate target.
aggregate_target.search_paths_aggregate_targets.each do |search_paths_target|
aggregate_native_target.add_dependency(aggregate_target_installation_results[search_paths_target.name].native_target)
Expand All @@ -54,7 +50,6 @@ def install!
if pod_target_installation_result = pod_target_installation_results[pod_target.name]
pod_target_native_target = pod_target_installation_result.native_target
aggregate_native_target.add_dependency(pod_target_native_target)
configure_app_extension_api_only_to_native_target(pod_target_native_target) if is_app_extension
else
# Hit the cache
is_local = sandbox.local?(pod_target.pod_name)
Expand All @@ -65,17 +60,6 @@ def install!
end
end
end

private

# Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
# configurations of the given native target.
#
def configure_app_extension_api_only_to_native_target(native_target)
native_target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
end
end
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions lib/cocoapods/target.rb
Expand Up @@ -46,6 +46,10 @@ class Target
attr_reader :build_type
private :build_type

# @return [Boolean] whether the target .
#
attr_accessor :application_extension_api_only

# Initialize a new target
#
# @param [Sandbox] sandbox @see #sandbox
Expand Down
5 changes: 5 additions & 0 deletions lib/cocoapods/target/build_settings.rb
Expand Up @@ -856,6 +856,11 @@ def requires_objc_linker_flag?
target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
end

# @return [String]
define_build_settings_method :application_extension_api_only, :build_setting => true, :memoized => true do
target.application_extension_api_only.present? ? 'YES' : nil
end

#-------------------------------------------------------------------------#

# @!group Target Properties
Expand Down

0 comments on commit c0e0e9f

Please sign in to comment.