xcake 0.8.12 → 0.8.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/xcake.rb +2 -2
- data/lib/xcake/context/xcodeproj_context.rb +6 -0
- data/lib/xcake/dsl/build_rule.rb +76 -0
- data/lib/xcake/dsl/target.rb +6 -0
- data/lib/xcake/dsl/target/sugar.rb +22 -0
- data/lib/xcake/event_hooks.rb +10 -0
- data/lib/xcake/generator/scheme_generator.rb +14 -2
- data/lib/xcake/generator/target_build_rule_generator.rb +24 -0
- data/lib/xcake/path_classifier.rb +1 -1
- data/lib/xcake/ui.rb +8 -0
- data/lib/xcake/version.rb +1 -1
- data/lib/xcake/xcode/project.rb +13 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 922659236668f3f498562f2355111f765332f962
|
4
|
+
data.tar.gz: 38fdc71a060d82c42168b4950379193fcca38737
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99a37036e27cb624edb346a4bb911e7b78034a54d730d0e09934c712c070e6ce385b4eebfda2df60354eef117fadf49ff03e22a3e3a3c838e1dee835dde57856
|
7
|
+
data.tar.gz: 0f8527a7d02ba8466bae4969f741c892c209b0e118579677eac6bd7c4d7f36fa0dbecc9f69c6745bf6dbd20c611b0d69319cf1abd34ec10b7edcd24122bf5319
|
data/CHANGELOG.md
CHANGED
data/lib/xcake.rb
CHANGED
@@ -39,12 +39,12 @@ require 'xcake/dsl/project/hooks'
|
|
39
39
|
|
40
40
|
require 'xcake/dsl/scheme'
|
41
41
|
|
42
|
-
require 'xcake/dsl/scheme'
|
43
|
-
|
44
42
|
require 'xcake/dsl/target'
|
45
43
|
require 'xcake/dsl/target/sugar'
|
46
44
|
require 'xcake/dsl/target/configurable'
|
47
45
|
|
46
|
+
require 'xcake/dsl/build_rule'
|
47
|
+
|
48
48
|
require 'xcake/dsl/build_phase'
|
49
49
|
require 'xcake/dsl/build_phase/headers_build_phase'
|
50
50
|
require 'xcake/dsl/build_phase/shell_script_build_phase'
|
@@ -11,6 +11,8 @@ module Xcake
|
|
11
11
|
case dsl_object
|
12
12
|
when BuildPhase
|
13
13
|
create_object_for_build_phase(dsl_object)
|
14
|
+
when BuildRule
|
15
|
+
create_object_for_build_rule(dsl_object)
|
14
16
|
when Project
|
15
17
|
create_object_for_project(dsl_object)
|
16
18
|
when Target
|
@@ -26,6 +28,10 @@ module Xcake
|
|
26
28
|
@project.new(build_phase.build_phase_type)
|
27
29
|
end
|
28
30
|
|
31
|
+
def create_object_for_build_rule(build_rule)
|
32
|
+
@project.new(Xcodeproj::Project::Object::PBXBuildRule)
|
33
|
+
end
|
34
|
+
|
29
35
|
def create_object_for_project(project)
|
30
36
|
|
31
37
|
project_path = "./#{project.name}.xcodeproj"
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Xcake
|
2
|
+
# This class is used to describe a build rule for a
|
3
|
+
# Xcode project; This forms part of the DSL
|
4
|
+
# and is usually stored in files named `Cakefile`.
|
5
|
+
#
|
6
|
+
class BuildRule
|
7
|
+
# @return [String] the name of the rule.
|
8
|
+
#
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
# @return [String] the type of the files that should be processed by
|
12
|
+
# this rule.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# `pattern.proxy`.
|
16
|
+
#
|
17
|
+
attr_accessor :file_type
|
18
|
+
|
19
|
+
# @return [ObjectList<PBXFileReference>] the file references for the
|
20
|
+
# output files.
|
21
|
+
#
|
22
|
+
attr_accessor :output_files
|
23
|
+
|
24
|
+
# @return [ObjectList<String>] the compiler flags used when creating the
|
25
|
+
# respective output files.
|
26
|
+
#
|
27
|
+
attr_accessor :output_files_compiler_flags
|
28
|
+
|
29
|
+
# @return [String] the content of the script to use for the build rule.
|
30
|
+
#
|
31
|
+
# @note This attribute is present if the #{#compiler_spec} is
|
32
|
+
# `com.apple.compilers.proxy.script`
|
33
|
+
#
|
34
|
+
attr_accessor :script
|
35
|
+
|
36
|
+
# @param [Proc] block
|
37
|
+
# an optional block that configures the build rule through the DSL.
|
38
|
+
#
|
39
|
+
# @example Creating a Build Rule.
|
40
|
+
#
|
41
|
+
# BuildRule.new do |p|
|
42
|
+
# p.name "test"
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
def initialize
|
46
|
+
@output_files = []
|
47
|
+
@output_files_compiler_flags = []
|
48
|
+
|
49
|
+
yield(self) if block_given?
|
50
|
+
end
|
51
|
+
|
52
|
+
# This method is called when generating the build rules
|
53
|
+
# subclasses should implement this to handle the
|
54
|
+
# configuration of the build phase
|
55
|
+
#
|
56
|
+
def configure_native_build_rule(native_build_rule, _context)
|
57
|
+
native_build_rule.name = name
|
58
|
+
native_build_rule.compiler_spec = "com.apple.compilers.proxy.script"
|
59
|
+
native_build_rule.file_type = file_type
|
60
|
+
native_build_rule.script = script.strip_heredoc
|
61
|
+
if output_files_compiler_flags.empty? then
|
62
|
+
output_files.each do |file|
|
63
|
+
native_build_rule.add_output_file(file)
|
64
|
+
end
|
65
|
+
else
|
66
|
+
output_files.zip(output_files_compiler_flags).each do |file, flag|
|
67
|
+
native_build_rule.add_output_file(file, flag)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def to_s
|
73
|
+
"BuildRule<#{name}>"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/xcake/dsl/target.rb
CHANGED
@@ -42,6 +42,11 @@ module Xcake
|
|
42
42
|
#
|
43
43
|
attr_accessor :build_phases
|
44
44
|
|
45
|
+
# @return [Array<BuildRule>] the list
|
46
|
+
# of build rules for the project.
|
47
|
+
#
|
48
|
+
attr_accessor :build_rules
|
49
|
+
|
45
50
|
# @!group File patterns
|
46
51
|
|
47
52
|
#
|
@@ -189,6 +194,7 @@ module Xcake
|
|
189
194
|
def initialize
|
190
195
|
@pinned_build_phases = []
|
191
196
|
@build_phases = []
|
197
|
+
@build_rules = []
|
192
198
|
@exclude_files = []
|
193
199
|
@linked_targets = []
|
194
200
|
@system_libraries = []
|
@@ -71,5 +71,27 @@ module Xcake
|
|
71
71
|
build_phases << phase
|
72
72
|
phase
|
73
73
|
end
|
74
|
+
|
75
|
+
# Creates a new build rule for the
|
76
|
+
# target
|
77
|
+
#
|
78
|
+
# @param [String] name
|
79
|
+
# the name to use for the build rule
|
80
|
+
#
|
81
|
+
# @param [Proc] block
|
82
|
+
# an optional block that configures the build rule through the DSL.
|
83
|
+
#
|
84
|
+
# @return [BuildRule] the new xcode build rule
|
85
|
+
#
|
86
|
+
def build_rule(name, file_type, output_files, output_files_compiler_flags, script, &block)
|
87
|
+
rule = BuildRule.new(&block)
|
88
|
+
rule.name = name
|
89
|
+
rule.file_type = file_type
|
90
|
+
rule.output_files = output_files
|
91
|
+
rule.output_files_compiler_flags = output_files_compiler_flags
|
92
|
+
rule.script = script
|
93
|
+
build_rules << rule
|
94
|
+
rule
|
95
|
+
end
|
74
96
|
end
|
75
97
|
end
|
data/lib/xcake/event_hooks.rb
CHANGED
@@ -55,6 +55,11 @@ module Xcake
|
|
55
55
|
#
|
56
56
|
define_hooks :before_adding_system_framework
|
57
57
|
|
58
|
+
# Defines hook which is ran before we add build rules
|
59
|
+
# to a target
|
60
|
+
#
|
61
|
+
define_hooks :before_adding_build_rules
|
62
|
+
|
58
63
|
# Defines hook which is ran before we add build phases
|
59
64
|
# to a target
|
60
65
|
#
|
@@ -68,6 +73,11 @@ module Xcake
|
|
68
73
|
#
|
69
74
|
define_hooks :before_adding_file
|
70
75
|
|
76
|
+
# Defines hook which is ran before we add a custom build rule to
|
77
|
+
# a target
|
78
|
+
#
|
79
|
+
define_hooks :before_adding_custom_build_rule
|
80
|
+
|
71
81
|
# Defines hook which is ran before we add a custom build phase to
|
72
82
|
# a target
|
73
83
|
#
|
@@ -13,18 +13,30 @@ module Xcake
|
|
13
13
|
scheme_list = @context.scheme_list
|
14
14
|
native_target = @context.native_object_for(target)
|
15
15
|
|
16
|
-
target.schemes.each do |scheme|
|
16
|
+
target.schemes.each do |scheme|
|
17
17
|
|
18
18
|
scheme_list.supress_autocreation_of_target(native_target)
|
19
19
|
|
20
20
|
native_scheme = @context.native_object_for(scheme)
|
21
21
|
native_scheme.name = scheme.name
|
22
22
|
|
23
|
+
native_scheme.configure_with_targets(native_target, nil)
|
24
|
+
|
23
25
|
native_project = @context.native_object_for(@project)
|
24
26
|
native_unit_test_target = native_project.find_unit_test_target_for_target(target)
|
25
27
|
|
26
28
|
if native_unit_test_target
|
27
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
|
+
|
34
|
+
native_ui_test_target = native_project.find_ui_test_target_for_target(target)
|
35
|
+
|
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)
|
28
40
|
end
|
29
41
|
|
30
42
|
# # TODO: Spec
|
@@ -37,7 +49,6 @@ module Xcake
|
|
37
49
|
# build_action.add_entry(entry)
|
38
50
|
# end
|
39
51
|
|
40
|
-
native_scheme.configure_with_targets(native_target, native_unit_test_target)
|
41
52
|
native_scheme.test_action.build_configuration = scheme.test_configuration
|
42
53
|
native_scheme.launch_action.build_configuration = scheme.launch_configuration
|
43
54
|
native_scheme.profile_action.build_configuration = scheme.profile_configuration
|
@@ -48,6 +59,7 @@ module Xcake
|
|
48
59
|
end
|
49
60
|
end
|
50
61
|
|
62
|
+
|
51
63
|
def leave_project(project)
|
52
64
|
scheme_list = @context.scheme_list
|
53
65
|
scheme_list.save
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Xcake
|
2
|
+
# This generator generates the build phases for each target
|
3
|
+
# in the project
|
4
|
+
#
|
5
|
+
class TargetBuildRuleGenerator < Generator
|
6
|
+
def self.dependencies
|
7
|
+
[TargetBuildPhaseGenerator]
|
8
|
+
end
|
9
|
+
|
10
|
+
def visit_target(target)
|
11
|
+
EventHooks.run_hook :before_adding_build_rules, target
|
12
|
+
|
13
|
+
native_target = @context.native_object_for(target)
|
14
|
+
|
15
|
+
target.build_rules.each do |rule|
|
16
|
+
EventHooks.run_hook :before_adding_custom_build_rule, rule, target
|
17
|
+
|
18
|
+
native_build_rule = @context.native_object_for(rule)
|
19
|
+
rule.configure_native_build_rule(native_build_rule, @context)
|
20
|
+
native_target.build_rules << native_build_rule
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -7,7 +7,7 @@ module Xcake
|
|
7
7
|
EXTENSION_MAPPINGS = {
|
8
8
|
PBXFrameworksBuildPhase: %w(.a .dylib .so .framework).freeze,
|
9
9
|
PBXHeadersBuildPhase: %w(.h .hpp).freeze,
|
10
|
-
PBXSourcesBuildPhase: %w(.c .m .mm .cpp .swift .xcdatamodeld).freeze,
|
10
|
+
PBXSourcesBuildPhase: %w(.c .m .mm .cpp .swift .xcdatamodeld .java).freeze,
|
11
11
|
PBXResourcesBuildPhase: %w(.xcassets).freeze
|
12
12
|
}.freeze
|
13
13
|
|
data/lib/xcake/ui.rb
CHANGED
@@ -53,6 +53,10 @@ module Xcake
|
|
53
53
|
board.puts_indented "- Integrating System Frameworks #{target.system_frameworks} for #{target}"
|
54
54
|
end
|
55
55
|
|
56
|
+
EventHooks.before_adding_build_rules do |target|
|
57
|
+
board.puts_indented "- Creating build rules for #{target}"
|
58
|
+
end
|
59
|
+
|
56
60
|
EventHooks.before_adding_build_phases do |target|
|
57
61
|
board.puts_indented "- Creating build phases for #{target}"
|
58
62
|
end
|
@@ -65,6 +69,10 @@ module Xcake
|
|
65
69
|
board.puts "- Adding #{node.path}"
|
66
70
|
end
|
67
71
|
|
72
|
+
EventHooks.before_adding_custom_build_rule do |rule, target|
|
73
|
+
board.puts "- Adding \"#{rule}\" to #{target}"
|
74
|
+
end
|
75
|
+
|
68
76
|
EventHooks.before_adding_custom_build_phase do |phase, target|
|
69
77
|
board.puts "- Adding \"#{phase}\" to #{target}"
|
70
78
|
end
|
data/lib/xcake/version.rb
CHANGED
data/lib/xcake/xcode/project.rb
CHANGED
@@ -198,6 +198,19 @@ module Xcake
|
|
198
198
|
t.name == "#{target.name}Tests"
|
199
199
|
end
|
200
200
|
end
|
201
|
+
|
202
|
+
# Finds a ui test target for a xcode target
|
203
|
+
#
|
204
|
+
# @param [Target] target
|
205
|
+
# target to find a xcode target for.
|
206
|
+
#
|
207
|
+
# @return [Target] ui test target
|
208
|
+
#
|
209
|
+
def find_ui_test_target_for_target(target)
|
210
|
+
targets.find do |t|
|
211
|
+
t.name == "#{target.name}UITests"
|
212
|
+
end
|
213
|
+
end
|
201
214
|
end
|
202
215
|
end
|
203
216
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Campbell
|
@@ -252,6 +252,7 @@ files:
|
|
252
252
|
- lib/xcake/dsl/build_phase/copy_files_build_phase.rb
|
253
253
|
- lib/xcake/dsl/build_phase/headers_build_phase.rb
|
254
254
|
- lib/xcake/dsl/build_phase/shell_script_build_phase.rb
|
255
|
+
- lib/xcake/dsl/build_rule.rb
|
255
256
|
- lib/xcake/dsl/configurable.rb
|
256
257
|
- lib/xcake/dsl/configuration.rb
|
257
258
|
- lib/xcake/dsl/configuration/proxies/preproccessor_definitions_setting_proxy.rb
|
@@ -271,6 +272,7 @@ files:
|
|
271
272
|
- lib/xcake/generator/project_metadata_generator.rb
|
272
273
|
- lib/xcake/generator/scheme_generator.rb
|
273
274
|
- lib/xcake/generator/target_build_phase_generator.rb
|
275
|
+
- lib/xcake/generator/target_build_rule_generator.rb
|
274
276
|
- lib/xcake/generator/target_dependency_generator.rb
|
275
277
|
- lib/xcake/generator/target_file_reference_generator.rb
|
276
278
|
- lib/xcake/generator/target_framework_generator.rb
|