Author: jmolenda Date: Mon Jul 23 16:34:50 2018 New Revision: 337774 URL: http://llvm.org/viewvc/llvm-project?rev=337774&view=rev Log: Change sort-pbxproj.rb to find the project.pbxproj in the most likely locations. And have it overwrite the original file with the sorted output.
Modified: lldb/trunk/scripts/sort-pbxproj.rb Modified: lldb/trunk/scripts/sort-pbxproj.rb URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/sort-pbxproj.rb?rev=337774&r1=337773&r2=337774&view=diff ============================================================================== --- lldb/trunk/scripts/sort-pbxproj.rb (original) +++ lldb/trunk/scripts/sort-pbxproj.rb Mon Jul 23 16:34:50 2018 @@ -20,11 +20,6 @@ # can lead to merge failures. segregated_filenames = ["Swift", "repl", "RPC"] -if !File.exists?("project.pbxproj") - STDERR.puts "ERROR: project.pbxproj does not exist." - exit(1) -end - def read_pbxproj(fn) beginning = Array.new # All lines before "PBXBuildFile section" files = Array.new # PBXBuildFile section lines -- sort these @@ -74,7 +69,20 @@ def read_pbxproj(fn) return beginning, files, middle, refs, ending end -beginning, files, middle, refs, ending = read_pbxproj("project.pbxproj") +xcodeproj_filename = nil +[ "../lldb.xcodeproj/project.pbxproj", "lldb.xcodeproj/project.pbxproj", "project.pbxproj" ].each do |ent| + if File.exists?(ent) + xcodeproj_filename = ent + break + end +end + +if xcodeproj_filename.nil? + STDERR.puts "Could not find xcode project file to sort." + exit(1) +end + +beginning, files, middle, refs, ending = read_pbxproj(xcodeproj_filename) ### If we're given a "canonical" project.pbxproj file, get the uuid and fileref ids for @@ -236,6 +244,8 @@ end ####### output the sorted pbxproj -[ beginning, files, middle, refs, ending ].each do |arr| - arr.each {|l| puts l} +File.open(xcodeproj_filename, 'w') do |outfile| + [ beginning, files, middle, refs, ending ].each do |arr| + arr.each {|l| outfile.puts l} + end end _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits