Class: Xcake::SchemeGenerator

Inherits:
Generator show all
Defined in:
lib/xcake/generator/scheme_generator.rb

Instance Attribute Summary

Attributes inherited from Generator

#context

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Generator

#initialize, plugins_location

Methods included from CoreExtensions::ClassDescendants

#descendants

Methods included from Visitor

#item_name, #leave, #visit

Methods included from Plugin

included

Methods included from Dependency

included

Constructor Details

This class inherits a constructor from Xcake::Generator

Class Method Details

.dependenciesObject



3
4
5
# File 'lib/xcake/generator/scheme_generator.rb', line 3

def self.dependencies
  [TargetGenerator, DefaultProjectStructureGenerator, ConfigurationGenerator]
end

Instance Method Details

#leave_project(_project) ⇒ Object



61
62
63
64
# File 'lib/xcake/generator/scheme_generator.rb', line 61

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

#visit_project(project) ⇒ Object



7
8
9
10
# File 'lib/xcake/generator/scheme_generator.rb', line 7

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

#visit_target(target) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/xcake/generator/scheme_generator.rb', line 12

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_scheme.configure_with_targets(native_target, nil, launch_target: native_target.launchable_target_type?)

    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)
      # native_scheme.add_build_target(native_unit_test_target, false)
      native_scheme.add_test_target(native_unit_test_target)
    end

    native_ui_test_target = native_project.find_ui_test_target_for_target(target)

    if native_ui_test_target
      scheme_list.supress_autocreation_of_target(native_ui_test_target)
      # native_scheme.add_build_target(native_ui_test_target, false)
      native_scheme.add_test_target(native_ui_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.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