Sha256: de0ba5991cf2e4812b1182c573d14132ccf828b6b226763c8cb5b6f83bc4247d

Contents?: true

Size: 1.89 KB

Versions: 3

Compression:

Stored size: 1.89 KB

Contents

module Xcake
  class SchemeGenerator < Generator
    def self.dependencies
      [TargetGenerator, DefaultProjectStructureGenerator, ConfigurationGenerator]
    end

    def visit_project(project)
      EventHooks.run_hook :before_adding_user_schemes
      @project = project
    end

    def visit_target(target)
      scheme_list = @context.scheme_list
      native_target = @context.native_object_for(target)

      target.schemes.each do |scheme| 

          scheme_list.supress_autocreation_of_target(native_target)

          native_scheme = @context.native_object_for(scheme)
          native_scheme.name = scheme.name

          native_project = @context.native_object_for(@project)
          native_unit_test_target = native_project.find_unit_test_target_for_target(target)

          if native_unit_test_target
            scheme_list.supress_autocreation_of_target(native_unit_test_target)
          end

          # # TODO: Spec
          # if native_target.library_target_type?
          #   build_action = native_scheme.build_action

          #   entry = Xcodeproj::XCScheme::BuildAction::Entry.initialize()
          #   entry.build_for_running(true)

          #   build_action.add_entry(entry)
          # end

          native_scheme.configure_with_targets(native_target, native_unit_test_target)
          native_scheme.test_action.build_configuration = scheme.test_configuration
          native_scheme.launch_action.build_configuration = scheme.launch_configuration
          native_scheme.profile_action.build_configuration = scheme.profile_configuration
          native_scheme.analyze_action.build_configuration = scheme.analyze_configuration
          native_scheme.archive_action.build_configuration = scheme.archive_configuration

          scheme_list.schemes << native_scheme
      end
    end

    def leave_project(project)
      scheme_list = @context.scheme_list
      scheme_list.save
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcake-0.8.12 lib/xcake/generator/scheme_generator.rb
xcake-0.8.10 lib/xcake/generator/scheme_generator.rb
xcake-0.8.9 lib/xcake/generator/scheme_generator.rb