Skip to content

Commit e184194

Browse files
committed
do not include target to product-target map if its build config is missing
1 parent a70faa4 commit e184194

File tree

10 files changed

+23
-21
lines changed

10 files changed

+23
-21
lines changed

lib/build/product_extractor.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def list_products(built_node)
4848
elsif built_node.has_acceptable_product?
4949
list_single_product(built_node)
5050
else
51-
raise Informative, "#{built_node.name} has unsupported product type: #{built_node.native_target.product_type}"
51+
raise XcodeArchiveCache::Informative, "#{built_node.name} has unsupported product type: #{built_node.native_target.product_type}"
5252
end
5353
end
5454

@@ -60,7 +60,7 @@ def list_framework_products(built_node)
6060
framework_glob = get_main_product_glob(built_node)
6161
framework_path = Dir.glob(framework_glob).first
6262
unless framework_path
63-
raise Informative, "Framework product not found for #{built_node.name}"
63+
raise XcodeArchiveCache::Informative, "Framework product not found for #{built_node.name}"
6464
end
6565

6666
framework_dsym_glob = File.join(File.dirname(framework_glob), built_node.dsym_file_name)
@@ -79,7 +79,7 @@ def list_single_product(built_node)
7979
product_glob = get_main_product_glob(built_node)
8080
product_path = Dir.glob(product_glob).first
8181
unless product_path
82-
raise Informative, "Product of type #{built_node.native_target.product_type} not found for #{built_node.name}"
82+
raise XcodeArchiveCache::Informative, "Product of type #{built_node.native_target.product_type} not found for #{built_node.name}"
8383
end
8484

8585
paths = [product_path]
@@ -181,7 +181,7 @@ def list_framework_bc_symbolmaps(framework_path)
181181
executable_name = File.basename(framework_path, File.extname(framework_path))
182182
executable_path = File.join(framework_path, executable_name)
183183
unless File.exist?(executable_path)
184-
raise Informative, "Failed to find executable inside framework: #{framework_path}"
184+
raise XcodeArchiveCache::Informative, "Failed to find executable inside framework: #{framework_path}"
185185
end
186186

187187
uuids = list_bc_symbolmap_uuids(executable_path)

lib/build_graph/builder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def add_to_graph(target, graph, is_root, target_stack = [])
6161
display_name = target.display_name
6262
if target_stack.include?(display_name)
6363
target_stack.push(display_name)
64-
raise Informative, "Circular dependency detected: #{target_stack.join(" -> ")}"
64+
raise XcodeArchiveCache::Informative, "Circular dependency detected: #{target_stack.join(" -> ")}"
6565
end
6666

6767
node = ALL_NODES.select {|node| node.native_target.uuid == target.uuid && node.native_target.project == target.project}.first
@@ -141,7 +141,7 @@ def get_settings(target)
141141
info("getting settings for #{target.display_name}")
142142
build_settings = build_settings_loader.get_settings(target.project.path, target.display_name)
143143
unless build_settings
144-
raise Informative, "No build settings loaded for #{target.display_name}"
144+
raise XcodeArchiveCache::Informative, "No build settings loaded for #{target.display_name}"
145145
end
146146

147147
build_settings

lib/build_graph/native_target_finder.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ def find_for_file(file)
102102
end
103103

104104
if target == nil
105-
raise Informative, "Target for #{file.file_ref.path} not found"
105+
raise XcodeArchiveCache::Informative, "Target for #{file.file_ref.path} not found"
106106
end
107107

108108
target
109109
elsif file.file_ref.is_a?(Xcodeproj::Project::Object::PBXFileReference)
110110
# products of sibling project targets are added as PBXFileReferences
111111
targets = find_with_product_path(file.file_ref.path)
112112
if targets.length > 1
113-
raise Informative, "Found more than one target with product #{File.basename(file.file_ref.path)} in:\n#{targets.map(&:project)}"
113+
raise XcodeArchiveCache::Informative, "Found more than one target with product #{File.basename(file.file_ref.path)} in:\n#{targets.map(&:project)}"
114114
end
115115

116116
targets.first
@@ -149,7 +149,9 @@ def setup_product_name_to_target_mapping
149149
@product_name_to_target = Hash.new
150150

151151
@all_targets.each do |target|
152-
build_settings = target.find_build_configuration(build_configuration_name).build_settings
152+
build_settings = target.find_build_configuration(build_configuration_name, raise_if_not_found: false)&.build_settings
153+
next unless build_settings
154+
153155
full_settings = build_settings
154156
full_settings[XcodeArchiveCache::BuildSettings::TARGET_NAME_KEY] = target.name
155157
product_name = @interpolator.interpolate(build_settings[XcodeArchiveCache::BuildSettings::PRODUCT_NAME_KEY], full_settings)

lib/config/config.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def file_path
5252
def active_configuration
5353
configuration = configurations.select{|config| config.name == active_configuration_name }.first
5454
if configuration == nil
55-
raise Informative, "Found no configuration with name \"#{active_configuration_name}\""
55+
raise XcodeArchiveCache::Informative, "Found no configuration with name \"#{active_configuration_name}\""
5656
end
5757

5858
configuration
@@ -172,7 +172,7 @@ def self.from_file(path)
172172
begin
173173
eval(contents, nil, path)
174174
rescue Exception => e
175-
raise Informative, "Invalid #{File.basename(path)} file: #{e.message}"
175+
raise XcodeArchiveCache::Informative, "Invalid #{File.basename(path)} file: #{e.message}"
176176
end
177177
end
178178

lib/extensions/target.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ module BuildConfigurationSearch
1111
#
1212
# @return [Xcodeproj::Project::Object::XCBuildConfiguration]
1313
#
14-
def find_build_configuration(configuration_name)
14+
def find_build_configuration(configuration_name, raise_if_not_found: true)
1515
build_configuration = build_configurations
1616
.select { |configuration| configuration.name == configuration_name }
1717
.first
18-
unless build_configuration
19-
raise Informative, "#{configuration_name} build configuration not found on target #{display_name}"
18+
if raise_if_not_found && build_configuration == nil
19+
raise XcodeArchiveCache::Informative, "#{configuration_name} build configuration not found on target #{display_name} #{project.path}"
2020
end
2121

2222
build_configuration

lib/injection/injector.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def add_as_prebuilt_dependency(prebuilt_node, dependent_target)
175175
debug("adding #{prebuilt_node.name} as prebuilt to #{dependent_target.display_name}")
176176

177177
unless prebuilt_node.has_acceptable_product?
178-
raise Informative, "#{prebuilt_node.name} has unsupported product type: #{prebuilt_node.native_target.product_type}"
178+
raise XcodeArchiveCache::Informative, "#{prebuilt_node.name} has unsupported product type: #{prebuilt_node.native_target.product_type}"
179179
end
180180

181181
if prebuilt_node.has_framework_product?

lib/injection/pods_xcframework_fixer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def fix(target, build_settings_loader)
3030
fix_file(script_path)
3131

3232
unless shell_executor.execute_with_env(script_path, build_settings.all)
33-
raise Informative, "Failed to execute Pods XCFramework script #{script_path}"
33+
raise XcodeArchiveCache::Informative, "Failed to execute Pods XCFramework script #{script_path}"
3434
end
3535
end
3636

lib/runner/runner.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def list_projects
3737
return workspace.file_references.map {|file_reference| Xcodeproj::Project.open(file_reference.absolute_path(workspace_dir))}
3838
end
3939

40-
raise Informative, "Configuration misses entry point -- must have either a project or a workspace"
40+
raise XcodeArchiveCache::Informative, "Configuration misses entry point -- must have either a project or a workspace"
4141
end
4242

4343
def run
@@ -65,7 +65,7 @@ def perform_cleanup
6565
def handle_target(target_config)
6666
target = @native_target_finder.find_for_product_name(target_config.name)
6767
unless target
68-
raise Informative, "Target not found for #{target_config.name}"
68+
raise XcodeArchiveCache::Informative, "Target not found for #{target_config.name}"
6969
end
7070

7171
xcodebuild_executor = XcodeArchiveCache::Xcodebuild::Executor.new(config.active_configuration.build_configuration,
@@ -111,7 +111,7 @@ def handle_target(target_config)
111111
def find_dependency_target(target, dependency_name)
112112
dependency_target = @native_target_finder.find_for_product_name(dependency_name)
113113
unless dependency_target
114-
raise Informative, "Target not found for #{dependency_name} of #{target.display_name}"
114+
raise XcodeArchiveCache::Informative, "Target not found for #{dependency_name} of #{target.display_name}"
115115
end
116116

117117
dependency_target

lib/shell/executor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def execute_for_output(command, print_command = false)
1212
output, status = Open3.capture2e(actual_command)
1313

1414
if status.exitstatus != 0
15-
raise Informative, "#{command}\nexecution failed\n#{output}"
15+
raise XcodeArchiveCache::Informative, "#{command}\nexecution failed\n#{output}"
1616
end
1717

1818
output

lib/xcodebuild/executor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def destination_flag
117117
#
118118
inferred_destination = action == ARCHIVE_ACTION ? GENERIC_DESTINATION : destination_by_platform
119119
if inferred_destination == nil
120-
raise Informative, "Destination not set for #{platform} platform"
120+
raise XcodeArchiveCache::Informative, "Destination not set for #{platform} platform"
121121
end
122122

123123
destination_specifier = inferred_destination == GENERIC_DESTINATION ? "generic/platform=#{platform}" : inferred_destination

0 commit comments

Comments
 (0)