class Xcodeproj::Project::Object::PBXNativeTarget


Represents a target handled by Xcode.

def add_file_references(file_references, compiler_flags = {})

Returns:
  • (void) -

Parameters:
  • compiler_flags (Hash{String=>String}) --
  • file_references (Array) --
def add_file_references(file_references, compiler_flags = {})
  file_references.each do |file|
    build_file = project.new(PBXBuildFile)
    build_file.file_ref = file
    extension = File.extname(file.path)
    header_extensions = Constants::HEADER_FILES_EXTENSIONS
    if (header_extensions.include?(extension))
      build_file.settings = { 'ATTRIBUTES' => ["Public"] }
      headers_build_phase.files << build_file
    else
      build_file.settings = { 'COMPILER_FLAGS' => compiler_flags } if compiler_flags && !compiler_flags.empty?
      source_build_phase.files << build_file
    end
  end
end

def frameworks_build_phase

Returns:
  • (PBXFrameworksBuildPhase) - the frameworks build phase.

Other tags:
    Note: - A target should have only one frameworks build phase.
def frameworks_build_phase
  bp = build_phases.find { |bp| bp.class == PBXFrameworksBuildPhase }
  unless bp
    bp = project.new(PBXFrameworksBuildPhase)
    build_phases << bp
  end
  bp
end

def headers_build_phase

Returns:
  • (PBXHeadersBuildPhase) - the headers build phase.

Other tags:
    Note: - A target should have only one headers build phase.
def headers_build_phase
  unless @headers_build_phase
    headers_build_phase = build_phases.find { |bp| bp.class == PBXHeadersBuildPhase }
    unless headers_build_phase
      # Working around a bug in Xcode 4.2 betas, remove this once the
      # Xcode bug is fixed:
      # https://github.com/alloy/cocoapods/issues/13
      # phase = copy_header_phase || headers_build_phases.first
      headers_build_phase = project.new(PBXHeadersBuildPhase)
      build_phases << headers_build_phase
    end
    @headers_build_phase = headers_build_phase
  end
  @headers_build_phase
end

def resources_build_phase

Returns:
  • (PBXResourcesBuildPhase) - the resources build phase.

Other tags:
    Note: - A target should have only one resources build phase.
def resources_build_phase
  bp = build_phases.find { |bp| bp.class == PBXResourcesBuildPhase }
  unless bp
    bp = project.new(PBXResourcesBuildPhase)
    build_phases << bp
  end
  bp
end

def source_build_phase

Returns:
  • (PBXSourcesBuildPhase) - the source build phase.

Other tags:
    Note: - A target should have only one source build phase.
def source_build_phase
  unless @source_build_phase
    source_build_phase = build_phases.find { |bp| bp.class == PBXSourcesBuildPhase }
    unless source_build_phase
      source_build_phase = project.new(PBXSourcesBuildPhase)
      build_phases << source_build_phase
    end
    @source_build_phase = source_build_phase
  end
  @source_build_phase
end