xcake 0.8.13 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) 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_phase/shell_script_build_phase.rb +10 -0
  11. data/lib/xcake/dsl/build_rule.rb +2 -2
  12. data/lib/xcake/dsl/configurable.rb +10 -8
  13. data/lib/xcake/dsl/configuration/sugar.rb +1 -1
  14. data/lib/xcake/dsl/project.rb +1 -1
  15. data/lib/xcake/dsl/project/hooks.rb +4 -0
  16. data/lib/xcake/dsl/project/sugar.rb +17 -15
  17. data/lib/xcake/dsl/scheme.rb +2 -3
  18. data/lib/xcake/dsl/target.rb +13 -5
  19. data/lib/xcake/generator.rb +1 -0
  20. data/lib/xcake/generator/default_project_structure_generator.rb +5 -6
  21. data/lib/xcake/generator/project_generator.rb +3 -2
  22. data/lib/xcake/generator/scheme_generator.rb +31 -33
  23. data/lib/xcake/generator/target_file_reference_generator.rb +11 -10
  24. data/lib/xcake/generator/target_framework_generator.rb +6 -6
  25. data/lib/xcake/generator/target_library_generator.rb +5 -6
  26. data/lib/xcake/path_classifier.rb +23 -19
  27. data/lib/xcake/ui.rb +1 -1
  28. data/lib/xcake/version.rb +1 -1
  29. data/lib/xcake/xcode/project.rb +3 -2
  30. data/lib/xcake/xcode/scheme_list.rb +0 -2
  31. data/lib/xcake/xcodeproj_ext/PBXGroup.rb +12 -10
  32. data/lib/xcake/xcodeproj_ext/PBXNativeTarget.rb +2 -2
  33. metadata +135 -91
  34. data/.gitattributes +0 -1
  35. data/.gitignore +0 -39
  36. data/.rspec +0 -2
  37. data/.travis.yml +0 -16
  38. data/.yardopts +0 -7
  39. data/CHANGELOG.md +0 -329
  40. data/CODE_OF_CONDUCT.md +0 -13
  41. data/Gemfile +0 -4
  42. data/LICENSE.txt +0 -21
  43. data/README.md +0 -110
  44. data/Rakefile +0 -6
  45. data/bin/console +0 -10
  46. data/bin/setup +0 -7
  47. data/fastlane-plugin-xcake/Gemfile +0 -3
  48. data/fastlane-plugin-xcake/LICENSE +0 -21
  49. data/fastlane-plugin-xcake/README.md +0 -31
  50. data/fastlane-plugin-xcake/Rakefile +0 -6
  51. data/fastlane-plugin-xcake/fastlane-plugin-xcake.gemspec +0 -25
  52. data/fastlane-plugin-xcake/lib/fastlane/plugin/xcake.rb +0 -16
  53. data/fastlane-plugin-xcake/lib/fastlane/plugin/xcake/actions/xcake_action.rb +0 -34
  54. data/fastlane-plugin-xcake/lib/fastlane/plugin/xcake/version.rb +0 -5
  55. data/fastlane-plugin-xcake/spec/spec_helper.rb +0 -8
  56. data/hound.yml +0 -2
  57. data/lib/xcake/core_ext/array.rb +0 -5
  58. data/lib/xcake/core_ext/object.rb +0 -7
  59. data/rubocop.yml +0 -173
  60. data/rubocop_general.yml +0 -113
  61. 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: 798f479f92ab560e1c5cca364dad5368a8ccb082ba53a534133822d6fe68c3fe
4
+ data.tar.gz: 5a5d2e73f2856bab26dfb2a1acb5fa77054a1b3b48d47073a847f400a121354e
5
5
  SHA512:
6
- metadata.gz: 99a37036e27cb624edb346a4bb911e7b78034a54d730d0e09934c712c070e6ce385b4eebfda2df60354eef117fadf49ff03e22a3e3a3c838e1dee835dde57856
7
- data.tar.gz: 0f8527a7d02ba8466bae4969f741c892c209b0e118579677eac6bd7c4d7f36fa0dbecc9f69c6745bf6dbd20c611b0d69319cf1abd34ec10b7edcd24122bf5319
6
+ metadata.gz: 629a256181ebfcc5a51735f1d273430aaae9c0b6b17795c7742914e9852f23bdbe12ab360b38d6110e02666c5ad34d2c99346c519367690c17b409ebeb08c5b4
7
+ data.tar.gz: 14bc5caa9620adc2aa740d00ac9723c614b6015b7ef41cebe79dc8ece7c781310830ddb407b55b3c4194c71637daf620522c3e605140275aab125cc7c7030c9a
@@ -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
@@ -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
 
@@ -8,6 +8,12 @@ module Xcake
8
8
  # String coataining the contents of the script to run
9
9
  attr_accessor :script
10
10
 
11
+ # input/output paths
12
+ attr_accessor :input_paths
13
+ attr_accessor :output_paths
14
+ attr_accessor :input_file_list_paths
15
+ attr_accessor :output_file_list_paths
16
+
11
17
  def build_phase_type
12
18
  Xcodeproj::Project::Object::PBXShellScriptBuildPhase
13
19
  end
@@ -15,6 +21,10 @@ module Xcake
15
21
  def configure_native_build_phase(native_build_phase, _context)
16
22
  native_build_phase.name = name
17
23
  native_build_phase.shell_script = script.strip_heredoc
24
+ native_build_phase.input_paths = input_paths || []
25
+ native_build_phase.output_paths = output_paths || []
26
+ native_build_phase.input_file_list_paths = input_file_list_paths || []
27
+ native_build_phase.output_file_list_paths = output_file_list_paths || []
18
28
  end
19
29
 
20
30
  def to_s
@@ -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
 
@@ -17,7 +17,7 @@ module Xcake
17
17
  #
18
18
  # @example Using Supported Devices
19
19
  #
20
- # Target.new do |t|
20
+ # Target.new(project) do |t|
21
21
  # t.all_configurations.each do |c|
22
22
  # c.supported_devices = :ipad_only
23
23
  # end
@@ -63,7 +63,7 @@ module Xcake
63
63
  # the newly created target
64
64
  #
65
65
  def target(&block)
66
- target = Target.new(&block)
66
+ target = Target.new(self, &block)
67
67
  targets << target
68
68
  target
69
69
  end
@@ -5,6 +5,10 @@ module Xcake
5
5
  include Hooks
6
6
  include Hooks::InstanceHooks
7
7
 
8
+ # Defines hook which is ran before project is saved.
9
+ #
10
+ define_hooks :before_save
11
+
8
12
  # Defines hook which is ran after project is saved.
9
13
  #
10
14
  define_hooks :after_save
@@ -60,6 +60,10 @@ module Xcake
60
60
  t.type = :ui_test_bundle
61
61
  configure_test_target_for_host_target(t, host_target)
62
62
 
63
+ t.all_configurations.each do |c|
64
+ c.settings['TEST_TARGET_NAME'] = host_target.name
65
+ end
66
+
63
67
  yield(t) if block_given?
64
68
  end
65
69
  end
@@ -89,26 +93,24 @@ module Xcake
89
93
  private
90
94
 
91
95
  def configure_test_target_for_host_target(test_target, host_target)
92
-
93
96
  test_target.target_dependencies << host_target
94
97
  test_target.platform = host_target.platform
95
98
  test_target.deployment_target = host_target.deployment_target
96
99
  test_target.language = host_target.language
97
100
 
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
101
+ return unless host_target.type == :application
102
+
103
+ test_target.all_configurations.each do |c|
104
+ # Do nothing as they break UITests
105
+ # For more details https://github.com/jcampbell05/xcake/issues/115
106
+ next if test_target.type == :ui_test_bundle
107
+
108
+ c.settings['BUNDLE_LOADER'] = '$(TEST_HOST)'
109
+ c.settings['TEST_HOST'] = if host_target.platform == :osx
110
+ "$(BUILT_PRODUCTS_DIR)/#{host_target.name}.app/Contents/MacOS/#{host_target.name}"
111
+ else
112
+ "$(BUILT_PRODUCTS_DIR)/#{host_target.name}.app/#{host_target.name}"
113
+ end
112
114
  end
113
115
  end
114
116
 
@@ -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
  #
@@ -182,16 +182,19 @@ module Xcake
182
182
  #
183
183
  attr_accessor :schemes
184
184
 
185
+ # @param [Project] project
186
+ # the project the target belongs to.
187
+ #
185
188
  # @param [Proc] block
186
189
  # an optional block that configures the target through the DSL.
187
190
  #
188
191
  # @example Creating a Target.
189
192
  #
190
- # Target.new do |t|
193
+ # Target.new(project) do |t|
191
194
  # t.name "test"
192
195
  # end
193
196
  #
194
- def initialize
197
+ def initialize(project)
195
198
  @pinned_build_phases = []
196
199
  @build_phases = []
197
200
  @build_rules = []
@@ -200,6 +203,7 @@ module Xcake
200
203
  @system_libraries = []
201
204
  @target_dependencies = []
202
205
  @schemes = []
206
+ @project = project
203
207
 
204
208
  yield(self) if block_given?
205
209
  end
@@ -209,7 +213,7 @@ module Xcake
209
213
  # Creates a new scheme for the target
210
214
  #
211
215
  # @param [String] name
212
- # the name of the new scheme
216
+ # the name of the new scheme
213
217
  #
214
218
  # @return [Scheme] the scheme
215
219
  # the newly created scheme
@@ -232,6 +236,10 @@ module Xcake
232
236
  @system_frameworks ||= default_system_frameworks_for(platform)
233
237
  end
234
238
 
239
+ def info_plist_paths
240
+ all_configurations.map { |config| config.settings['INFOPLIST_FILE'] }.uniq
241
+ end
242
+
235
243
  # @!group Conversion
236
244
 
237
245
  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,13 +1,14 @@
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
 
9
9
  def leave_project(project)
10
10
  native_project = @context.native_object_for(project)
11
+ project.run_hook :before_save, native_project
11
12
  native_project.save
12
13
  project.run_hook :after_save
13
14