Class: Projects::AppleTargetPlatformDetectorService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/projects/apple_target_platform_detector_service.rb

Overview

Service class to detect target platforms of a project made for the Apple Ecosystem.

This service searches project.pbxproj and *.xcconfig files (contains build settings) for the string “SDKROOT = <SDK_name>” where SDK_name can be 'iphoneos', 'macosx', 'appletvos' or 'watchos'. Currently, the service is intentionally limited (for performance reasons) to detect if a project targets iOS.

Ref: developer.apple.com/documentation/xcode/build-settings-reference/

Example usage: > AppleTargetPlatformDetectorService.new(a_project).execute

> []

> AppleTargetPlatformDetectorService.new(an_ios_project).execute

> [:ios]

> AppleTargetPlatformDetectorService.new(multiplatform_project).execute

> [:ios, :osx, :tvos, :watchos]

Constant Summary collapse

BUILD_CONFIG_FILENAMES =
%w(project.pbxproj *.xcconfig).freeze
PLATFORM_SDK_NAMES =

For the current iteration, we only want to detect when the project targets iOS. In the future, we can use the same logic to detect projects that target OSX, TvOS, and WatchOS platforms with SDK names 'macosx', 'appletvos', and 'watchos', respectively.

{ ios: 'iphoneos' }.freeze

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#executeObject


31
32
33
# File 'app/services/projects/apple_target_platform_detector_service.rb', line 31

def execute
  detect_platforms
end