Skip to content

Commit 6b864a6

Browse files
authored
Merge pull request #1578 from firebase/revert-1577-revert-1576-nc/phase
Revert "Revert "[Infra] Embed frameworks `scripts/add_framework_script.rb`""
2 parents 234d643 + 5132652 commit 6b864a6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

scripts/add_framework_script.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@
3737
project = Xcodeproj::Project.open(project_path)
3838
project_framework_group = project.frameworks_group
3939

40-
def add_ref(group, path, source_tree, phase)
40+
def add_ref(group, path, source_tree, phase_list)
4141
ref = group.new_reference("#{path}")
4242
ref.name = "#{File.basename(path)}"
4343
ref.source_tree = source_tree
44-
phase.add_file_reference(ref)
44+
phase_list.each do |phase|
45+
phase.add_file_reference(ref)
46+
end
4547
puts ref
4648
end
4749

@@ -53,7 +55,7 @@ def add_ref(group, path, source_tree, phase)
5355
add_ref(project.main_group,
5456
framework_path,
5557
source_tree,
56-
project_target.resources_build_phase)
58+
[project_target.resources_build_phase])
5759
end
5860
else
5961
framework_group = Dir.glob(File.join(framework_path, "*.{#{file_ext}}"))
@@ -62,12 +64,13 @@ def add_ref(group, path, source_tree, phase)
6264
next unless project_target.name == target
6365
framework_set = project_target.frameworks_build_phase.files.to_set
6466
puts "The following frameworks are added to #{project_target}"
67+
embed_frameworks_phase = project_target.new_copy_files_build_phase("Embed Frameworks")
6568
framework_group.each do |framework|
6669
next if framework_set.size == framework_set.add(framework).size
6770
add_ref(project_framework_group,
6871
framework,
6972
source_tree,
70-
project_target.frameworks_build_phase)
73+
[project_target.frameworks_build_phase, embed_frameworks_phase])
7174
end
7275
end
7376
end
@@ -78,7 +81,7 @@ def add_ref(group, path, source_tree, phase)
7881
add_ref(project_framework_group,
7982
framework_path,
8083
source_tree,
81-
project_target.frameworks_build_phase)
84+
[project_target.frameworks_build_phase])
8285
end
8386
end
8487
project.save()

0 commit comments

Comments
 (0)