Detect if project is for an iOS app
Background
We want to detect if a project is an iOS project to guide users to start using MacOS runners in gitlab.com
.
Implementation options
Xcodeproj gem
1. UsePros
- No reinventing the wheel by taking advantage of OSS
- Speed
- Lib is already tested by the community
- ...
Cons
- New dependency
- ...
Sample code
require 'xcodeproj'
project_path='./ios-app-master/GymRats.xcodeproj'
p=Xcodeproj::Project.open(project_path)
puts "Number of targets: #{p.targets.length}"
unique_platforms = p.targets.map do |t|
t.platform_name
end.uniq
puts "Platforms: "
unique_platforms.each do |p|
puts p
end
# sample output
#
# Number of targets: 3
# Platforms:
# ios
2. Implement from scratch
Pros
- No new dependencies
- ...
Cons
- Time commitment
- Possibly error prone - we don't have extensive knowledge on XCode projects so we can assume that we'll make mistakes and miss edge cases while implementing
- ...
Resources
iOS projects in GitLab
Edited by Eugie Limpin