xcake 0.8.13 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/lib/xcake.rb +1 -2
  3. data/lib/xcake/command/make.rb +1 -3
  4. data/lib/xcake/constants.rb +10 -10
  5. data/lib/xcake/context.rb +0 -2
  6. data/lib/xcake/context/xcodeproj_context.rb +5 -8
  7. data/lib/xcake/core_ext/class.rb +14 -0
  8. data/lib/xcake/dependency_provider.rb +3 -3
  9. data/lib/xcake/dsl/build_phase/copy_files_build_phase.rb +1 -3
  10. data/lib/xcake/dsl/build_rule.rb +2 -2
  11. data/lib/xcake/dsl/configurable.rb +10 -8
  12. data/lib/xcake/dsl/project/sugar.rb +13 -15
  13. data/lib/xcake/dsl/scheme.rb +2 -3
  14. data/lib/xcake/dsl/target.rb +7 -3
  15. data/lib/xcake/generator.rb +1 -0
  16. data/lib/xcake/generator/default_project_structure_generator.rb +5 -6
  17. data/lib/xcake/generator/project_generator.rb +2 -2
  18. data/lib/xcake/generator/scheme_generator.rb +31 -33
  19. data/lib/xcake/generator/target_file_reference_generator.rb +11 -10
  20. data/lib/xcake/generator/target_framework_generator.rb +6 -6
  21. data/lib/xcake/generator/target_library_generator.rb +5 -6
  22. data/lib/xcake/path_classifier.rb +23 -19
  23. data/lib/xcake/ui.rb +1 -1
  24. data/lib/xcake/version.rb +1 -1
  25. data/lib/xcake/xcode/project.rb +3 -2
  26. data/lib/xcake/xcode/scheme_list.rb +0 -2
  27. data/lib/xcake/xcodeproj_ext/PBXGroup.rb +12 -10
  28. data/lib/xcake/xcodeproj_ext/PBXNativeTarget.rb +2 -2
  29. metadata +97 -94
  30. data/.gitattributes +0 -1
  31. data/.gitignore +0 -39
  32. data/.rspec +0 -2
  33. data/.travis.yml +0 -16
  34. data/.yardopts +0 -7
  35. data/CHANGELOG.md +0 -329
  36. data/CODE_OF_CONDUCT.md +0 -13
  37. data/Gemfile +0 -4
  38. data/LICENSE.txt +0 -21
  39. data/README.md +0 -110
  40. data/Rakefile +0 -6
  41. data/bin/console +0 -10
  42. data/bin/setup +0 -7
  43. data/fastlane-plugin-xcake/Gemfile +0 -3
  44. data/fastlane-plugin-xcake/LICENSE +0 -21
  45. data/fastlane-plugin-xcake/README.md +0 -31
  46. data/fastlane-plugin-xcake/Rakefile +0 -6
  47. data/fastlane-plugin-xcake/fastlane-plugin-xcake.gemspec +0 -25
  48. data/fastlane-plugin-xcake/lib/fastlane/plugin/xcake.rb +0 -16
  49. data/fastlane-plugin-xcake/lib/fastlane/plugin/xcake/actions/xcake_action.rb +0 -34
  50. data/fastlane-plugin-xcake/lib/fastlane/plugin/xcake/version.rb +0 -5
  51. data/fastlane-plugin-xcake/spec/spec_helper.rb +0 -8
  52. data/hound.yml +0 -2
  53. data/lib/xcake/core_ext/array.rb +0 -5
  54. data/lib/xcake/core_ext/object.rb +0 -7
  55. data/rubocop.yml +0 -173
  56. data/rubocop_general.yml +0 -113
  57. data/xcake.gemspec +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 922659236668f3f498562f2355111f765332f962
4
- data.tar.gz: 38fdc71a060d82c42168b4950379193fcca38737
2
+ SHA256:
3
+ metadata.gz: b77df3cd23fa234738b12a4b908521af9abadfb2235883c82581f7c687aa1da5
4
+ data.tar.gz: 0c13c5bd3c7731022b6f4376d476a15790e9cc1ddafcafb61119201b66ee153d
5
5
  SHA512:
6
- metadata.gz: 99a37036e27cb624edb346a4bb911e7b78034a54d730d0e09934c712c070e6ce385b4eebfda2df60354eef117fadf49ff03e22a3e3a3c838e1dee835dde57856
7
- data.tar.gz: 0f8527a7d02ba8466bae4969f741c892c209b0e118579677eac6bd7c4d7f36fa0dbecc9f69c6745bf6dbd20c611b0d69319cf1abd34ec10b7edcd24122bf5319
6
+ metadata.gz: 0f146ce1f82ec0a38b44b146c4dd58122ffd27a16b24673cff3f1f0132d53a77e15476c596fff6b7ee1dacc26448a8375ef803bda0ce0414c492f26ead423214
7
+ data.tar.gz: 47d1d3d1ab0ff600c80f67413c7dd86386599210e9f240a17ab7ff69583131f15016960447605cfc57abb40399a563c9cf423631bc8c9320af52e965e854425d
data/lib/xcake.rb CHANGED
@@ -1,5 +1,4 @@
1
- require 'xcake/core_ext/array'
2
- require 'xcake/core_ext/object'
1
+ require 'xcake/core_ext/class'
3
2
  require 'xcake/core_ext/string'
4
3
 
5
4
  require 'xcake/xcode/project'
@@ -7,9 +7,7 @@ module Xcake
7
7
  def run
8
8
  file_path = "#{Dir.pwd}/Cakefile"
9
9
 
10
- unless File.exist?(file_path)
11
- raise Xcake::Informative, "Couldn't find Cakefile"
12
- end
10
+ raise Xcake::Informative, "Couldn't find Cakefile" unless File.exist?(file_path)
13
11
 
14
12
  EventHooks.run_hook :before_cakefile_read
15
13
  file_contents = File.read(file_path)
@@ -11,10 +11,10 @@ module Xcake
11
11
  ]
12
12
  }.freeze,
13
13
  [:ios, :ui_test_bundle] => {
14
- "LD_RUNPATH_SEARCH_PATHS" => [
15
- "$(inherited)",
16
- "@executable_path/Frameworks",
17
- "@loader_path/Frameworks"
14
+ 'LD_RUNPATH_SEARCH_PATHS' => [
15
+ '$(inherited)',
16
+ '@executable_path/Frameworks',
17
+ '@loader_path/Frameworks'
18
18
  ]
19
19
  }.freeze,
20
20
  [:osx, :unit_test_bundle] => {
@@ -25,10 +25,10 @@ module Xcake
25
25
  ]
26
26
  }.freeze,
27
27
  [:osx, :ui_test_bundle] => {
28
- "LD_RUNPATH_SEARCH_PATHS" => [
29
- "$(inherited)",
30
- "@executable_path/../Frameworks",
31
- "@loader_path/../Frameworks"
28
+ 'LD_RUNPATH_SEARCH_PATHS' => [
29
+ '$(inherited)',
30
+ '@executable_path/../Frameworks',
31
+ '@loader_path/../Frameworks'
32
32
  ]
33
33
  }.freeze
34
34
  ).freeze
@@ -60,8 +60,8 @@ module Xcake
60
60
  #
61
61
  # @return [Hash] The common build settings
62
62
  #
63
- def self.common_build_settings(type, platform = nil, deployment_target = nil, target_product_type = nil, language = :objc)
64
- target_product_type = (PRODUCT_TYPE_UTI.find { |_, v| v == target_product_type } || [target_product_type || :application])[0]
63
+ def self.common_build_settings(type, platform = nil, deployment_target = nil, target_product_type = nil, language = :objc) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/LineLength
64
+ target_product_type = (PRODUCT_TYPE_UTI.find { |_, v| v == target_product_type } || [target_product_type || :application])[0] # rubocop:disable Metrics/LineLength
65
65
  common_settings = COMMON_BUILD_SETTINGS
66
66
 
67
67
  # Use intersecting settings for all key sets as base
data/lib/xcake/context.rb CHANGED
@@ -14,8 +14,6 @@ module Xcake
14
14
  # The internal hash of native objects reference by their
15
15
  # related DSL object
16
16
  #
17
- attr_accessor :object_hash
18
-
19
17
  def object_hash
20
18
  @object_hash ||= {}
21
19
  end
@@ -7,7 +7,7 @@ module Xcake
7
7
 
8
8
  attr_accessor :project
9
9
 
10
- def create_object_for(dsl_object)
10
+ def create_object_for(dsl_object) # rubocop:disable Metrics/CyclomaticComplexity
11
11
  case dsl_object
12
12
  when BuildPhase
13
13
  create_object_for_build_phase(dsl_object)
@@ -28,17 +28,14 @@ module Xcake
28
28
  @project.new(build_phase.build_phase_type)
29
29
  end
30
30
 
31
- def create_object_for_build_rule(build_rule)
31
+ def create_object_for_build_rule(_build_rule)
32
32
  @project.new(Xcodeproj::Project::Object::PBXBuildRule)
33
33
  end
34
34
 
35
35
  def create_object_for_project(project)
36
-
37
36
  project_path = "./#{project.name}.xcodeproj"
38
-
39
- if File.exist?(project_path)
40
- FileUtils.remove_dir(project_path)
41
- end
37
+
38
+ FileUtils.remove_dir(project_path) if File.exist?(project_path)
42
39
 
43
40
  @project = Xcode::Project.new(project_path, true)
44
41
  @project.setup_for_xcake
@@ -53,7 +50,7 @@ module Xcake
53
50
  @project.new_configuration(configuration)
54
51
  end
55
52
 
56
- def create_object_for_scheme(scheme)
53
+ def create_object_for_scheme(_scheme)
57
54
  Xcode::Scheme.new
58
55
  end
59
56
 
@@ -0,0 +1,14 @@
1
+ module Xcake
2
+ module CoreExtensions
3
+ # @example Including in a class
4
+ # Class.send(:include, Xcake::CoreExtensions::ClassDescendants) # done with send because of old ruby versions
5
+ #
6
+ module ClassDescendants
7
+ # Returns all descendants of a class
8
+ #
9
+ def descendants
10
+ ObjectSpace.each_object(singleton_class).select { |klass| klass < self }
11
+ end
12
+ end
13
+ end
14
+ end
@@ -7,9 +7,9 @@ module Xcake
7
7
  def initialize(dependency_class)
8
8
  plugins = dependency_class.load_plugins
9
9
 
10
- @dependency_graph = plugins.map do |p|
11
- [p, p.dependencies]
12
- end.to_h
10
+ @dependency_graph = plugins.each_with_object({}) do |p, hash|
11
+ hash[p] = p.dependencies
12
+ end
13
13
  end
14
14
 
15
15
  def tsort_each_node(&block)
@@ -29,9 +29,7 @@ module Xcake
29
29
  @files.each do |file|
30
30
  file_reference = context.file_reference_for_path(file)
31
31
  build_file = native_build_phase.add_file_reference(file_reference)
32
- if code_sign
33
- build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy'] }
34
- end
32
+ build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy'] } if code_sign
35
33
  end
36
34
  end
37
35
 
@@ -55,10 +55,10 @@ module Xcake
55
55
  #
56
56
  def configure_native_build_rule(native_build_rule, _context)
57
57
  native_build_rule.name = name
58
- native_build_rule.compiler_spec = "com.apple.compilers.proxy.script"
58
+ native_build_rule.compiler_spec = 'com.apple.compilers.proxy.script'
59
59
  native_build_rule.file_type = file_type
60
60
  native_build_rule.script = script.strip_heredoc
61
- if output_files_compiler_flags.empty? then
61
+ if output_files_compiler_flags.empty?
62
62
  output_files.each do |file|
63
63
  native_build_rule.add_output_file(file)
64
64
  end
@@ -39,9 +39,11 @@ module Xcake
39
39
  private
40
40
 
41
41
  def copy_parent_configurations
42
+ return unless parent_configurable
43
+
42
44
  parent_configurable.all_configurations.each do |c|
43
45
  configuration(c.name, c.type)
44
- end if parent_configurable
46
+ end
45
47
  end
46
48
 
47
49
  public
@@ -93,13 +95,13 @@ module Xcake
93
95
  default_settings = default_settings_for_type(type)
94
96
  configurations = configurations_of_type(type)
95
97
 
96
- if name.nil?
97
- build_configuration = configurations.first
98
- else
99
- build_configuration = configurations.detect do |c|
100
- c.name == name.to_s
101
- end
102
- end
98
+ build_configuration = if name.nil?
99
+ configurations.first
100
+ else
101
+ configurations.detect do |c|
102
+ c.name == name.to_s
103
+ end
104
+ end
103
105
 
104
106
  if build_configuration.nil?
105
107
 
@@ -89,26 +89,24 @@ module Xcake
89
89
  private
90
90
 
91
91
  def configure_test_target_for_host_target(test_target, host_target)
92
-
93
92
  test_target.target_dependencies << host_target
94
93
  test_target.platform = host_target.platform
95
94
  test_target.deployment_target = host_target.deployment_target
96
95
  test_target.language = host_target.language
97
96
 
98
- if host_target.type == :application
99
- test_target.all_configurations.each do |c|
100
- if test_target.type == :ui_test_bundle
101
- # Do nothing as they break UITests
102
- # For more details https://github.com/jcampbell05/xcake/issues/115
103
- else
104
- c.settings["BUNDLE_LOADER"] = "$(TEST_HOST)"
105
- if host_target.platform == :osx
106
- c.settings["TEST_HOST"] = "$(BUILT_PRODUCTS_DIR)/#{host_target.name}.app/Contents/MacOS/#{host_target.name}"
107
- else
108
- c.settings["TEST_HOST"] = "$(BUILT_PRODUCTS_DIR)/#{host_target.name}.app/#{host_target.name}"
109
- end
110
- end
111
- end
97
+ return unless host_target.type == :application
98
+
99
+ test_target.all_configurations.each do |c|
100
+ # Do nothing as they break UITests
101
+ # For more details https://github.com/jcampbell05/xcake/issues/115
102
+ next if test_target.type == :ui_test_bundle
103
+
104
+ c.settings['BUNDLE_LOADER'] = '$(TEST_HOST)'
105
+ c.settings['TEST_HOST'] = if host_target.platform == :osx
106
+ "$(BUILT_PRODUCTS_DIR)/#{host_target.name}.app/Contents/MacOS/#{host_target.name}"
107
+ else
108
+ "$(BUILT_PRODUCTS_DIR)/#{host_target.name}.app/#{host_target.name}"
109
+ end
112
110
  end
113
111
  end
114
112
 
@@ -7,13 +7,13 @@ module Xcake
7
7
  include Visitable
8
8
 
9
9
  # The name for the scheme
10
- #
10
+ #
11
11
  attr_accessor :name
12
12
 
13
13
  # The configuration to use when testing
14
14
  #
15
15
  # Defaults to "Debug"
16
- #
16
+ #
17
17
  attr_accessor :test_configuration
18
18
 
19
19
  # The configuration to use when launching
@@ -41,7 +41,6 @@ module Xcake
41
41
  attr_accessor :archive_configuration
42
42
 
43
43
  def initialize(name)
44
-
45
44
  @name = name
46
45
  @test_configuration = 'Debug'
47
46
  @launch_configuration = 'Debug'
@@ -136,7 +136,7 @@ module Xcake
136
136
  #
137
137
  # spec.include_files = "Classes/**/*.{h,m}"
138
138
  #
139
- attr_accessor :include_files
139
+ attr_writer :include_files
140
140
 
141
141
  # @return [Array or String] files to exclude for the target.
142
142
  # Supports regular expressions
@@ -158,7 +158,7 @@ module Xcake
158
158
  #
159
159
  # spec.system_frameworks = ["Foundation"]
160
160
  #
161
- attr_accessor :system_frameworks
161
+ attr_writer :system_frameworks
162
162
 
163
163
  # @return [Array<String>] system libraries to include for the target
164
164
  #
@@ -209,7 +209,7 @@ module Xcake
209
209
  # Creates a new scheme for the target
210
210
  #
211
211
  # @param [String] name
212
- # the name of the new scheme
212
+ # the name of the new scheme
213
213
  #
214
214
  # @return [Scheme] the scheme
215
215
  # the newly created scheme
@@ -232,6 +232,10 @@ module Xcake
232
232
  @system_frameworks ||= default_system_frameworks_for(platform)
233
233
  end
234
234
 
235
+ def info_plist_paths
236
+ all_configurations.map { |config| config.settings['INFOPLIST_FILE'] }.uniq
237
+ end
238
+
235
239
  # @!group Conversion
236
240
 
237
241
  def to_s
@@ -3,6 +3,7 @@ module Xcake
3
3
  include Dependency
4
4
  include Plugin
5
5
  include Visitor
6
+ Class.send(:include, CoreExtensions::ClassDescendants) # done with send because of old ruby versions
6
7
 
7
8
  attr_accessor :context
8
9
 
@@ -8,7 +8,6 @@ module Xcake
8
8
  # and targets have all of the same configurations.
9
9
  #
10
10
  class DefaultProjectStructureGenerator < Generator
11
-
12
11
  def self.dependencies
13
12
  [ProjectMetadataGenerator, TargetGenerator]
14
13
  end
@@ -40,11 +39,11 @@ module Xcake
40
39
 
41
40
  target.all_configurations.each do |c|
42
41
  target.scheme "#{target.name}-#{c.name}" do |s|
43
- s.test_configuration = c.name
44
- s.launch_configuration = c.name
45
- s.profile_configuration = c.name
46
- s.analyze_configuration = c.name
47
- s.archive_configuration = c.name
42
+ s.test_configuration = c.name
43
+ s.launch_configuration = c.name
44
+ s.profile_configuration = c.name
45
+ s.analyze_configuration = c.name
46
+ s.archive_configuration = c.name
48
47
  end
49
48
  end
50
49
  end
@@ -1,8 +1,8 @@
1
1
  module Xcake
2
2
  class ProjectGenerator < Generator
3
3
  def self.dependencies
4
- Generator.descendants.select do |g|
5
- g != self
4
+ Generator.descendants.reject do |g|
5
+ g == self
6
6
  end
7
7
  end
8
8
 
@@ -14,53 +14,51 @@ module Xcake
14
14
  native_target = @context.native_object_for(target)
15
15
 
16
16
  target.schemes.each do |scheme|
17
+ scheme_list.supress_autocreation_of_target(native_target)
17
18
 
18
- scheme_list.supress_autocreation_of_target(native_target)
19
+ native_scheme = @context.native_object_for(scheme)
20
+ native_scheme.name = scheme.name
19
21
 
20
- native_scheme = @context.native_object_for(scheme)
21
- native_scheme.name = scheme.name
22
+ native_scheme.configure_with_targets(native_target, nil)
22
23
 
23
- native_scheme.configure_with_targets(native_target, nil)
24
+ native_project = @context.native_object_for(@project)
25
+ native_unit_test_target = native_project.find_unit_test_target_for_target(target)
24
26
 
25
- native_project = @context.native_object_for(@project)
26
- native_unit_test_target = native_project.find_unit_test_target_for_target(target)
27
+ if native_unit_test_target
28
+ scheme_list.supress_autocreation_of_target(native_unit_test_target)
29
+ # native_scheme.add_build_target(native_unit_test_target, false)
30
+ native_scheme.add_test_target(native_unit_test_target)
31
+ end
27
32
 
28
- if native_unit_test_target
29
- scheme_list.supress_autocreation_of_target(native_unit_test_target)
30
- # native_scheme.add_build_target(native_unit_test_target, false)
31
- native_scheme.add_test_target(native_unit_test_target)
32
- end
33
+ native_ui_test_target = native_project.find_ui_test_target_for_target(target)
33
34
 
34
- native_ui_test_target = native_project.find_ui_test_target_for_target(target)
35
+ if native_ui_test_target
36
+ scheme_list.supress_autocreation_of_target(native_ui_test_target)
37
+ # native_scheme.add_build_target(native_ui_test_target, false)
38
+ native_scheme.add_test_target(native_ui_test_target)
39
+ end
35
40
 
36
- if native_ui_test_target
37
- scheme_list.supress_autocreation_of_target(native_ui_test_target)
38
- # native_scheme.add_build_target(native_ui_test_target, false)
39
- native_scheme.add_test_target(native_ui_test_target)
40
- end
41
+ # # TODO: Spec
42
+ # if native_target.library_target_type?
43
+ # build_action = native_scheme.build_action
41
44
 
42
- # # TODO: Spec
43
- # if native_target.library_target_type?
44
- # build_action = native_scheme.build_action
45
+ # entry = Xcodeproj::XCScheme::BuildAction::Entry.initialize()
46
+ # entry.build_for_running(true)
45
47
 
46
- # entry = Xcodeproj::XCScheme::BuildAction::Entry.initialize()
47
- # entry.build_for_running(true)
48
+ # build_action.add_entry(entry)
49
+ # end
48
50
 
49
- # build_action.add_entry(entry)
50
- # end
51
+ native_scheme.test_action.build_configuration = scheme.test_configuration
52
+ native_scheme.launch_action.build_configuration = scheme.launch_configuration
53
+ native_scheme.profile_action.build_configuration = scheme.profile_configuration
54
+ native_scheme.analyze_action.build_configuration = scheme.analyze_configuration
55
+ native_scheme.archive_action.build_configuration = scheme.archive_configuration
51
56
 
52
- native_scheme.test_action.build_configuration = scheme.test_configuration
53
- native_scheme.launch_action.build_configuration = scheme.launch_configuration
54
- native_scheme.profile_action.build_configuration = scheme.profile_configuration
55
- native_scheme.analyze_action.build_configuration = scheme.analyze_configuration
56
- native_scheme.archive_action.build_configuration = scheme.archive_configuration
57
-
58
- scheme_list.schemes << native_scheme
57
+ scheme_list.schemes << native_scheme
59
58
  end
60
59
  end
61
60
 
62
-
63
- def leave_project(project)
61
+ def leave_project(_project)
64
62
  scheme_list = @context.scheme_list
65
63
  scheme_list.save
66
64
  end