Sha256: 3a862ba38c1d9dfca71b4c041235dbd4ad6539270ccf7a4ad7cec43f5c969f23

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 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

        if configuration.configuration_file != nil
          xcconfig = install_xcconfig(configuration)
          native_configuration_object.base_configuration_reference = xcconfig
        end
      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

3 entries across 3 versions & 1 rubygems

Version Path
xcake-0.6.7 lib/xcake/generator/configuration_generator.rb
xcake-0.6.6 lib/xcake/generator/configuration_generator.rb
xcake-0.6.5 lib/xcake/generator/configuration_generator.rb