Skip to content

Commit 0b6c2e5

Browse files
committed
Add xconfig integration
1 parent d41bf77 commit 0b6c2e5

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/unitypods/cli.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,20 @@ def integrate_subproject
9696
CocoaPodsHelper::add_flag( unity_project_target, build_configuration_name, "HEADER_SEARCH_PATHS", "$(SRCROOT)/Pods/Headers/**")
9797
end
9898

99+
set_xcconfig(unity_project)
100+
99101
unity_project.save(@unity_project_path)
100102
end
103+
104+
def set_xcconfig(unity_project)
105+
xcconfig_relative_path = "Pods/Pods.xcconfig"
106+
xcconfig = unity_project.files.select { |f| f.path == xcconfig_relative_path }.first ||
107+
unity_project.new_file(xcconfig_relative_path)
108+
unity_project_target = Unity3dHelper::find_default_unity_target(unity_project)
109+
110+
Unity3dHelper::find_default_unity_target(unity_project).build_configurations.each do |config|
111+
config.base_configuration_reference = xcconfig
112+
end
113+
end
101114
end
102115
end

spec/unitypods_command_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,16 @@
5858

5959
commnandline_args = [] << "install" << "-i" << "-p" << path_of_fixture_podfile_for_dir("fakepod_podfile") << "-b" << tmp_dir
6060
Unitypods::UnitypodsCommand.start(commnandline_args)
61+
62+
unity_project = Xcodeproj::Project.open( Unity3dHelper::default_unity_project_path(tmp_dir) )
6163
expect(Pathname(File.join(tmp_dir, "Podfile.lock")).exist?).to be_true
64+
65+
#xcconfig
66+
xcconfig = unity_project.files.find { |f| f.path == "Pods/Pods.xcconfig"}
67+
expect(xcconfig).to_not be_nil
68+
Unity3dHelper::find_default_unity_target(unity_project).build_configurations.each do |config|
69+
config.base_configuration_reference.should == xcconfig
70+
end
6271
end
6372
end
6473
end

0 commit comments

Comments
 (0)