Commit 76432759 authored by Eloy Durán's avatar Eloy Durán

[Installer] Validate the configs a pos is whitelisted for.

parent 028921ab
...@@ -7,7 +7,7 @@ GIT ...@@ -7,7 +7,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: 73c5a6b0c6331c4bfdc0d58360abf0f3f13beb56 revision: c53a14e82afa7bf03bcc6175c747a173d00c69b4
branch: lookback-pods-by-config branch: lookback-pods-by-config
specs: specs:
cocoapods-core (0.29.0) cocoapods-core (0.29.0)
...@@ -103,7 +103,7 @@ GEM ...@@ -103,7 +103,7 @@ GEM
escape (0.0.4) escape (0.0.4)
ffi (1.9.3) ffi (1.9.3)
fuzzy_match (2.0.4) fuzzy_match (2.0.4)
github-markup (1.0.0) github-markup (1.0.1)
i18n (0.6.9) i18n (0.6.9)
json (1.8.1) json (1.8.1)
json_pure (1.8.1) json_pure (1.8.1)
......
...@@ -94,6 +94,7 @@ module Pod ...@@ -94,6 +94,7 @@ module Pod
def resolve_dependencies def resolve_dependencies
UI.section "Analyzing dependencies" do UI.section "Analyzing dependencies" do
analyze analyze
validate_whitelisted_configurations
prepare_for_legacy_compatibility prepare_for_legacy_compatibility
clean_sandbox clean_sandbox
end end
...@@ -174,6 +175,19 @@ module Pod ...@@ -174,6 +175,19 @@ module Pod
@aggregate_targets = analyzer.result.targets @aggregate_targets = analyzer.result.targets
end end
# @raise Raises an informative if the hooks raises.
def validate_whitelisted_configurations
whitelisted_configs = pod_targets.map do |target|
target.target_definition.all_whitelisted_configurations
end.flatten.uniq
all_user_configurations = analysis_result.all_user_build_configurations.keys
remainder = whitelisted_configs - all_user_configurations
unless remainder.empty?
raise Informative, "Unknown #{'configuration'.pluralize(remainder.size)} whitelisted: #{remainder.sort.to_sentence}."
end
end
# Prepares the Pods folder in order to be compatible with the most recent # Prepares the Pods folder in order to be compatible with the most recent
# version of CocoaPods. # version of CocoaPods.
# #
......
...@@ -181,7 +181,7 @@ module Pod ...@@ -181,7 +181,7 @@ module Pod
else else
target.client_root = config.installation_root target.client_root = config.installation_root
target.user_target_uuids = [] target.user_target_uuids = []
target.user_build_configurations = {} target.user_build_configurations = target_definition.build_configurations || {}
if target_definition.platform.name == :osx if target_definition.platform.name == :osx
target.archs = '$(ARCHS_STANDARD_64_BIT)' target.archs = '$(ARCHS_STANDARD_64_BIT)'
end end
......
...@@ -124,6 +124,28 @@ module Pod ...@@ -124,6 +124,28 @@ module Pod
#--------------------------------------# #--------------------------------------#
describe "#validate_whitelisted_configurations" do
it "raises when a whitelisted configuration doesn’t exist in the user's project" do
target_definition = @installer.podfile.target_definitions.values.first
target_definition.whitelist_pod_for_configuration('JSONKit', 'YOLO')
@installer.send(:analyze)
should.raise Informative do
@installer.send(:validate_whitelisted_configurations)
end
end
it "does not raise if all whitelisted configurations exist in the user's project" do
target_definition = @installer.podfile.target_definitions.values.first
target_definition.whitelist_pod_for_configuration('JSONKit', 'Test')
@installer.send(:analyze)
should.not.raise do
@installer.send(:validate_whitelisted_configurations)
end
end
end
#--------------------------------------#
describe "#clean_sandbox" do describe "#clean_sandbox" do
before do before do
......
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