Closed swl367 closed 9 years ago
nevermind, I got it working. for any one else that needs it:
require 'xcodeproj'
def addfiles (direc, current_group, main_target)
Dir.glob(direc) do |item|
next if item == '.' or item == '.DS_Store'
if File.directory?(item)
new_folder = File.basename(item)
created_group = current_group.new_group(new_folder)
addfiles("#{item}/*", created_group, main_target)
else
i = current_group.new_file(item)
if item.include? ".m"
main_target.add_file_references([i])
end
end
end
end
project_file = 'myproj' + '.xcodeproj'
project = Xcodeproj::Project.open(project_file)
kit_group = project.new_group('UIKIT')
data_group = project.new_group('DATAKIT')
ex_group = project.new_group('LIBKIT')
uipath = '/Git/UIKit'
datapath = '/Git/DataServicesKit'
expath = '/Git/External'
main_target = project.targets.first
addfiles("#{uipath}/*", kit_group, main_target)
addfiles("#{datapath}/*", data_group, main_target)
addfiles("#{expath}/*", ex_group, main_target)
project.save(project_file)
is there a way to add something as a reference for the FacebookSDK framework? When I drag that framework, the headers folder is blue, but when I add it via new_file, then it's yellow and doesn't compile correctly
Please don't use the issues list for usage questions. You can find an example of how CocoaPods handles frameworks in its codebase.
@fabiopelosin Could you provide a link to the .framework example?
I understand we can add individual files to the target and add file references to those files, but can we do this in one step for an entire folder at some absolute path? (Of course there would need to be some way of knowing which files are .m files and which are .h)
e.g.
require 'xcodeproj' project_file = 'app.xcodeproj' project = Xcodeproj::Project.open(project_file)
kit_group = project.new_group('UIKIT') files = kit_group.new_files('absolute/path/to/my/files')
main_target = project.targets.first main_target.add_file_references([files])
project.save(project_file)