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

1. Use Xcodeproj gem

Pros

  1. No reinventing the wheel by taking advantage of OSS
  2. Speed
  3. Lib is already tested by the community
  4. ...

Cons

  1. New dependency
  2. ...

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

  1. No new dependencies
  2. ...

Cons

  1. Time commitment
  2. 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
  3. ...

Resources

iOS projects in GitLab

Search: https://gitlab.com/search?scope=projects&search=ios

  1. https://gitlab.com/gym-rats/ios-app
Edited by Eugie Limpin