class Xcodeproj::Helper::TargetDiff

Attributes

project[R]
target1[R]
target2[R]

Public Class Methods

new(project, target1_name, target2_name) click to toggle source
# File lib/xcodeproj/helper.rb, line 6
def initialize(project, target1_name, target2_name)
  @project = project
  unless @target1 = @project.targets.find { |target| target.name == target1_name }
    raise ArgumentError, "Target 1 by name `#{target1_name}' not found in the project."
  end
  unless @target2 = @project.targets.find { |target| target.name == target2_name }
    raise ArgumentError, "Target 1 by name `#{target2_name}' not found in the project."
  end
end

Public Instance Methods

new_source_build_files() click to toggle source

@return [Array<PBXBuildFile>] A list of source files (that will be

compiled) which are in ‘target 2’ but not in ‘target 1’. The
list is sorted by file path.
# File lib/xcodeproj/helper.rb, line 20
def new_source_build_files
  new = @target2.source_build_phase.files.reject do |target2_build_file|
    @target1.source_build_phase.files.any? do |target1_build_file|
      target1_build_file.file_ref.path == target2_build_file.file_ref.path
    end
  end
  new.sort_by { |build_file| build_file.file_ref.path }
end