Sha256: 646a972c294839c64cacc187b450ab64951f8fc9366c737cf10e080b2d76991a

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

require 'xcodeproj'

module Xcake
  # This generator processes the configurations
  # and creates xcode build configurations.
  #
  class ConfigurationGenerator < Generator

    def self.dependencies
      [TargetGenerator, ProjectStructureGenerator]
    end

    def visit_project(project)
      create_build_configurations_for(project)
    end

    def visit_target(target)
      create_build_configurations_for(target)
    end

    def create_build_configurations_for(configuration_object)
      puts "Creating build configurations for #{configuration_object}..."

      configuration_object.flatten_configurations.each do |configuration|
        puts "Creating build configuration #{configuration.name} for #{configuration_object}..."

        build_configuration = @context.native_object_for(configuration)
        build_configuration.name = configuration.name
        build_configuration.build_settings = configuration.settings

        native_configuration_object = @context.native_object_for(configuration_object)
        native_configuration_object.build_configurations << build_configuration

        xcconfig = install_xcconfig(configuration)
        native_configuration_object.base_configuration_reference = xcconfig
      end
    end

    def install_xcconfig(configuration)
      # TODO: Remove need to construct a Node Object to do this.
      node = Node.new
      node.path = configuration.configuration_file
      native_group = @context.native_object_for(node)
      native_group.new_reference(node.path)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xcake-0.6.4 lib/xcake/generator/configuration_generator.rb