Module: Depcheck::Finder

Defined in:
lib/depcheck/finder.rb

Class Method Summary collapse

Class Method Details

.find_derived_data_path(project, workspace, scheme) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/depcheck/finder.rb', line 4

def self.find_derived_data_path(project, workspace, scheme)
  arg = if project
          "-project \"#{project}\""
        else
          "-workspace \"#{workspace}\" -scheme \"#{scheme}\""
        end

  build_settings = `xcodebuild #{arg} -showBuildSettings build CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO 2>&1`

  if build_settings
    derived_data_path = build_settings.match(/ OBJROOT = (.+)/)
    derived_data_path = derived_data_path[1] if derived_data_path
  end

  derived_data_path
end

.find_swiftdeps(project, workspace, scheme) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/depcheck/finder.rb', line 21

def self.find_swiftdeps(project, workspace, scheme)
  derived_data_path = find_derived_data_path(project, workspace, scheme)
  swiftdeps = Dir.glob("#{derived_data_path}/**/*.swiftdeps") if derived_data_path

  if swiftdeps.nil? || swiftdeps.empty?
    raise StandardError, 'No derived data found. Please make sure the project was built.'
  end

  swiftdeps
end