Created
July 5, 2021 15:51
-
-
Save Daij-Djan/c50b0c3579b6ff29e3e2323b099ce36d to your computer and use it in GitHub Desktop.
show use of xcodeproj package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'xcodeproj' | |
projects = { | |
'my app: variant a' => '/Users/dpich/Desktop/e80f427ed_a.xcodeproj', | |
'my app: variant b' => '/Users/dpich/Desktop/e80f427ed_a_modified.xcodeproj', | |
} | |
puts "# File Counts" | |
projects.keys.each do |project| | |
#title | |
puts "## #{project}" | |
#open | |
project = Xcodeproj::Project.open(projects[project]) | |
#total | |
puts "#{project.files.count} files in total" | |
paths=project.files.map {|file|file.real_path.to_s} | |
#puts paths | |
#empty/useless | |
f=project.files.select{ |file| file.name=="BUCK" && file.parent.files.count==1 && file.parent.groups.count==0} | |
paths=f.map {|file|file.real_path.to_s} | |
puts "#{f.count} files in are in empty groups (e.g. only BUCK file, no sources/headers" | |
#puts paths | |
##generated | |
f=project.files.select{ |file| file.real_path.to_s.include? "buck-out/gen" } | |
paths=f.map {|file|file.real_path.to_s} | |
puts "#{f.count} files are generated" | |
#puts paths | |
##non sources | |
f=project.files.select{ |file| !file.real_path.to_s.end_with?(".m", ".mm", ".swift", ".h", ".c", ".cpp", "BUCK") } | |
paths=f.map {|file|file.real_path.to_s} | |
puts "#{f.count} files are no source files ('.m', '.mm', '.swift', '.h', '.c', '.cpp', 'BUCK')" | |
puts paths | |
#spacer for readability | |
puts "\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment