xcake 0.7.1 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -3
- data/CHANGELOG.md +15 -0
- data/README.md +3 -1
- data/bin/xcake +0 -1
- data/docs/Cakefile.md +82 -1
- data/docs/Xcode Project Support.md +5 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/project.pbxproj +973 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/project.xcworkspace/xcuserdata/maxim.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/xcshareddata/xcschemes/CakeMania-AppStore.xcscheme +91 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/xcshareddata/xcschemes/CakeMania-Debug.xcscheme +91 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/xcshareddata/xcschemes/CakeMania-Production.xcscheme +91 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/xcshareddata/xcschemes/CakeMania-RC.xcscheme +91 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/xcshareddata/xcschemes/CakeMania-Staging.xcscheme +91 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/xcuserdata/maxim.xcuserdatad/xcschemes/CakeManiaTst.xcscheme +56 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/xcuserdata/maxim.xcuserdatad/xcschemes/CakeManiaUITst.xcscheme +56 -0
- data/example/app/CakeMania/CakeMania.xcodeproj/xcuserdata/maxim.xcuserdatad/xcschemes/xcschememanagement.plist +72 -0
- data/{docs/Sample → example/app/CakeMania}/Cakefile +80 -47
- data/example/app/CakeMania/Info/CakeMania.plist +38 -0
- data/example/app/CakeMania/Info/CakeManiaTst.plist +22 -0
- data/example/app/CakeMania/Info/CakeManiaUITst.plist +22 -0
- data/example/app/CakeMania/Res/CakeMania-test.entitlements +10 -0
- data/example/app/CakeMania/Res/CakeMania.entitlements +10 -0
- data/example/app/CakeMania/Res/CakeMania.xcassets/AppIcon.appiconset/Contents.json +48 -0
- data/example/app/CakeMania/Src/AppDelegate.swift +46 -0
- data/example/app/CakeMania/Src/Base.lproj/LaunchScreen.storyboard +27 -0
- data/example/app/CakeMania/Src/Base.lproj/Main.storyboard +26 -0
- data/example/app/CakeMania/Src/ObjC/CakeMania-Bridging-Header.h +3 -0
- data/example/app/CakeMania/Src/ObjC/Prefix.pch +14 -0
- data/example/app/CakeMania/Src/ViewController.swift +25 -0
- data/example/app/CakeMania/Tst/Main.swift +36 -0
- data/example/app/CakeMania/UITst/Main.swift +36 -0
- data/example/framework/Cakefile +133 -0
- data/gemfiles/Gemfile.xcodeproj-1.3.x +5 -0
- data/gemfiles/Gemfile.xcodeproj-1.4.x +5 -0
- data/gemfiles/Gemfile.xcodeproj-edge +5 -0
- data/lib/xcake/build_phase/headers_build_phase.rb +47 -0
- data/lib/xcake/build_phase/shell_script_build_phase.rb +24 -0
- data/lib/xcake/build_phase.rb +36 -0
- data/lib/xcake/constants.rb +82 -0
- data/lib/xcake/context/xcodeproj_context.rb +10 -0
- data/lib/xcake/context.rb +24 -0
- data/lib/xcake/generator/scheme_generator.rb +13 -2
- data/lib/xcake/generator/target_build_phase_generator.rb +11 -3
- data/lib/xcake/generator/target_dependency_generator.rb +1 -1
- data/lib/xcake/generator/target_file_reference_generator.rb +4 -5
- data/lib/xcake/generator/target_link_generator.rb +25 -0
- data/lib/xcake/informative.rb +0 -1
- data/lib/xcake/path_classifier.rb +5 -5
- data/lib/xcake/project/sugar.rb +7 -5
- data/lib/xcake/project.rb +0 -1
- data/lib/xcake/target/configurable.rb +2 -6
- data/lib/xcake/target/sugar.rb +28 -3
- data/lib/xcake/target.rb +34 -18
- data/lib/xcake/ui.rb +1 -4
- data/lib/xcake/version.rb +1 -1
- data/lib/xcake/xcode/project.rb +25 -13
- data/lib/xcake/xcode/scheme.rb +3 -0
- data/lib/xcake/xcode/scheme_list.rb +0 -23
- data/lib/xcake/xcodeproj_ext/PBXGroup.rb +3 -3
- data/lib/xcake/xcodeproj_ext/PBXNativeTarget.rb +0 -1
- data/lib/xcake.rb +10 -5
- data/rubocop.yml +0 -4
- data/xcake.gemspec +8 -7
- metadata +112 -80
- data/lib/xcake/generator/target_custom_build_phase_generator.rb +0 -16
- data/lib/xcake/shell_script_build_phase.rb +0 -15
data/lib/xcake/target.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Xcake
|
2
2
|
# This class is used to describe a target for a
|
3
3
|
# Xcode project; This forms part of the DSL
|
4
|
-
# and is
|
4
|
+
# and is usually stored in files named `Cakefile`.
|
5
5
|
#
|
6
6
|
class Target
|
7
7
|
include Configurable
|
@@ -36,8 +36,8 @@ module Xcake
|
|
36
36
|
#
|
37
37
|
attr_accessor :language
|
38
38
|
|
39
|
-
# @return [Array<
|
40
|
-
#
|
39
|
+
# @return [Array<BuildPhase>] the list
|
40
|
+
# of build phases for the project.
|
41
41
|
#
|
42
42
|
attr_accessor :build_phases
|
43
43
|
|
@@ -122,6 +122,10 @@ module Xcake
|
|
122
122
|
# Supports regular expressions,
|
123
123
|
# Defaults to: ["./<Target Name>/*\*/\*.*"]
|
124
124
|
#
|
125
|
+
#
|
126
|
+
# @note Xcake defaults to including files in the folder with the same name as
|
127
|
+
# the targt
|
128
|
+
#
|
125
129
|
# @example
|
126
130
|
#
|
127
131
|
# spec.include_files = "Classes/**/*.{h,m}"
|
@@ -162,8 +166,14 @@ module Xcake
|
|
162
166
|
#
|
163
167
|
attr_accessor :target_dependencies
|
164
168
|
|
169
|
+
# @return [Array<Target>] targets to link to, use this
|
170
|
+
# when you want to use a library or framework target
|
171
|
+
# in another target
|
172
|
+
#
|
173
|
+
attr_accessor :linked_targets
|
174
|
+
|
165
175
|
# @param [Proc] block
|
166
|
-
# an optional block that configures the
|
176
|
+
# an optional block that configures the target through the DSL.
|
167
177
|
#
|
168
178
|
# @example Creating a Target.
|
169
179
|
#
|
@@ -173,29 +183,26 @@ module Xcake
|
|
173
183
|
#
|
174
184
|
def initialize(project)
|
175
185
|
@project = project
|
186
|
+
|
176
187
|
@build_phases = []
|
188
|
+
@exclude_files = []
|
189
|
+
@linked_targets = []
|
190
|
+
@system_libraries = []
|
191
|
+
@target_dependencies = []
|
177
192
|
|
178
193
|
yield(self) if block_given?
|
179
194
|
end
|
180
195
|
|
196
|
+
## Getters
|
197
|
+
|
181
198
|
def include_files
|
199
|
+
# Import files in folder with same name as target by default
|
182
200
|
@include_files ||= ["./#{@name}/**/*.*"]
|
183
201
|
end
|
184
202
|
|
185
|
-
def exclude_files
|
186
|
-
@exclude_files ||= []
|
187
|
-
end
|
188
|
-
|
189
203
|
def system_frameworks
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
def system_libraries
|
194
|
-
@system_libraries ||= []
|
195
|
-
end
|
196
|
-
|
197
|
-
def target_dependencies
|
198
|
-
@target_dependencies ||= []
|
204
|
+
# Use default frameworks by default
|
205
|
+
@system_frameworks ||= default_system_frameworks_for(platform)
|
199
206
|
end
|
200
207
|
|
201
208
|
# @!group Conversion
|
@@ -206,12 +213,21 @@ module Xcake
|
|
206
213
|
|
207
214
|
protected
|
208
215
|
|
216
|
+
# Returns an array of default system frameworks
|
217
|
+
# to use for a given platform.
|
218
|
+
#
|
219
|
+
# @param [Symbol] platform
|
220
|
+
# platform the frameworks are for.
|
221
|
+
#
|
222
|
+
#
|
223
|
+
# @return [Array<String>] system frameworks to use
|
224
|
+
#
|
209
225
|
def default_system_frameworks_for(platform)
|
210
226
|
case platform
|
211
227
|
when :ios
|
212
228
|
%w(Foundation UIKit)
|
213
229
|
when :osx
|
214
|
-
|
230
|
+
%w(Cocoa)
|
215
231
|
when :tvos
|
216
232
|
%w(Foundation UIKit)
|
217
233
|
when :watchos
|
data/lib/xcake/ui.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
require 'cork'
|
2
2
|
|
3
|
-
# TODO: i18n this.
|
4
|
-
# TODO: Different modes depending on --verbose, and CI
|
5
|
-
# TODO: Split output and UI code into seperate concerns.
|
6
3
|
module Xcake
|
7
4
|
class UI
|
8
5
|
def self.register_ui_hooks
|
@@ -69,7 +66,7 @@ module Xcake
|
|
69
66
|
end
|
70
67
|
|
71
68
|
EventHooks.before_adding_custom_build_phase do |phase, target|
|
72
|
-
board.puts "- Adding
|
69
|
+
board.puts "- Adding \"#{phase}\" to #{target}"
|
73
70
|
end
|
74
71
|
|
75
72
|
EventHooks.before_adding_embed_watch_app_phase do
|
data/lib/xcake/version.rb
CHANGED
data/lib/xcake/xcode/project.rb
CHANGED
@@ -2,6 +2,9 @@ require 'xcodeproj'
|
|
2
2
|
|
3
3
|
module Xcake
|
4
4
|
module Xcode
|
5
|
+
# Special subclass of the Xcodeproj::Project which adds capabilities and
|
6
|
+
# helper methods xcake need
|
7
|
+
#
|
5
8
|
class Project < Xcodeproj::Project
|
6
9
|
# @return [Hash] the attributes of
|
7
10
|
# the project
|
@@ -42,21 +45,10 @@ module Xcake
|
|
42
45
|
attributes['ORGANIZATIONNAME'] = organization
|
43
46
|
end
|
44
47
|
|
45
|
-
# @return [SchemeList] the scheme list
|
46
|
-
#
|
47
|
-
def scheme_list
|
48
|
-
@scheme_list ||= SchemeList.new(self)
|
49
|
-
end
|
50
|
-
|
51
48
|
def object_version
|
52
49
|
Xcodeproj::Constants::DEFAULT_OBJECT_VERSION.to_s
|
53
50
|
end
|
54
51
|
|
55
|
-
def recreate_user_schemes(*)
|
56
|
-
scheme_list.recreate_schemes
|
57
|
-
scheme_list.save(path)
|
58
|
-
end
|
59
|
-
|
60
52
|
# Configures the Project for use with Xcake.
|
61
53
|
# This makes sure we have sensible defaults and
|
62
54
|
# it as clean as possible.
|
@@ -114,7 +106,7 @@ module Xcake
|
|
114
106
|
new(Xcodeproj::Project::Object::XCBuildConfiguration)
|
115
107
|
end
|
116
108
|
|
117
|
-
# Creates a new xcode file reference
|
109
|
+
# Creates a new xcode file reference for a path
|
118
110
|
#
|
119
111
|
# @param [Pathname] path
|
120
112
|
# => path of the file reference from the source root
|
@@ -124,11 +116,21 @@ module Xcake
|
|
124
116
|
def file_reference_for_path(path)
|
125
117
|
group = group_for_file_reference_path(path)
|
126
118
|
group_path = Pathname.new group.dirname
|
127
|
-
|
128
119
|
file_path = path.cleanpath.relative_path_from group_path
|
120
|
+
|
121
|
+
ref = group.find_file_by_path file_path.to_s
|
122
|
+
return ref if ref
|
123
|
+
|
129
124
|
group.new_reference(file_path.to_s)
|
130
125
|
end
|
131
126
|
|
127
|
+
# Finds or Creates a new xcode group for a path
|
128
|
+
#
|
129
|
+
# @param [Pathname] path
|
130
|
+
# => path of the group from the source root
|
131
|
+
#
|
132
|
+
# @return [PBXGroup] existing or new xcode group
|
133
|
+
#
|
132
134
|
def group_for_file_reference_path(path)
|
133
135
|
clean_path = path.cleanpath
|
134
136
|
group = variant_group_for_path(path)
|
@@ -138,6 +140,16 @@ module Xcake
|
|
138
140
|
|
139
141
|
private
|
140
142
|
|
143
|
+
# Creates or finds a new xcode variant group for a path
|
144
|
+
#
|
145
|
+
# @note this method will return nil if the path isn't a valid
|
146
|
+
# variant group path
|
147
|
+
#
|
148
|
+
# @param [Pathname] path
|
149
|
+
# => path of the variant group from the source root
|
150
|
+
#
|
151
|
+
# @return [PBXVariantGroup] existing or new xcode variant group
|
152
|
+
#
|
141
153
|
def variant_group_for_path(path)
|
142
154
|
group_path = path.dirname.cleanpath
|
143
155
|
base_name = group_path.basename
|
data/lib/xcake/xcode/scheme.rb
CHANGED
@@ -33,32 +33,12 @@ module Xcake
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
36
|
-
# Creates the schemes based on the targets.
|
37
|
-
#
|
38
|
-
def recreate_schemes
|
39
|
-
@project.targets.each do |t|
|
40
|
-
create_schemes_for_target(t)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
36
|
# Creates schemes based on a target.
|
45
37
|
#
|
46
38
|
# @param [Target] target
|
47
39
|
# target to create schemes for
|
48
40
|
#
|
49
41
|
def create_schemes_for_target(target)
|
50
|
-
case target.product_type
|
51
|
-
when Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]
|
52
|
-
create_schemes_for_application(target)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# Creates schemes based on a application target
|
57
|
-
#
|
58
|
-
# @param [Target] target
|
59
|
-
# target to create application schemes for
|
60
|
-
#
|
61
|
-
def create_schemes_for_application(target)
|
62
42
|
target.build_configurations.each do |c|
|
63
43
|
scheme = Scheme.new
|
64
44
|
|
@@ -74,7 +54,6 @@ module Xcake
|
|
74
54
|
scheme.analyze_action.build_configuration = c.name
|
75
55
|
scheme.archive_action.build_configuration = c.name
|
76
56
|
|
77
|
-
# TODO: We should structure this stuff out
|
78
57
|
if unit_test_target
|
79
58
|
unit_test_target.add_dependency(target)
|
80
59
|
@xcschememanagement['SuppressBuildableAutocreation'][unit_test_target.uuid] = { 'primary' => true }
|
@@ -89,8 +68,6 @@ module Xcake
|
|
89
68
|
# @param [String] writing_path
|
90
69
|
# path to write to.
|
91
70
|
#
|
92
|
-
# TODO: Move to a Generator
|
93
|
-
#
|
94
71
|
def save(writing_path)
|
95
72
|
schemes_dir = Scheme.user_data_dir(writing_path)
|
96
73
|
|
@@ -25,12 +25,12 @@ module Xcodeproj
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def dirname
|
28
|
-
return
|
29
|
-
return
|
28
|
+
return '.' if parent.is_a? Xcake::Xcode::Project
|
29
|
+
return '.' if parent.is_a? PBXProject
|
30
30
|
return parent.dirname.to_s if is_a? PBXVariantGroup
|
31
31
|
|
32
32
|
if display_name
|
33
|
-
"#{parent.dirname
|
33
|
+
"#{parent.dirname}/#{display_name}"
|
34
34
|
else
|
35
35
|
parent.dirname.to_s
|
36
36
|
end
|
data/lib/xcake.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
require 'xcake/core_ext/array'
|
2
2
|
require 'xcake/core_ext/object'
|
3
3
|
require 'xcake/core_ext/string'
|
4
|
+
|
5
|
+
require 'xcake/xcode/project'
|
6
|
+
require 'xcake/xcode/scheme'
|
7
|
+
require 'xcake/xcode/scheme_list'
|
8
|
+
|
4
9
|
require 'xcake/xcodeproj_ext/PBXGroup'
|
5
10
|
require 'xcake/xcodeproj_ext/PBXNativeTarget'
|
6
|
-
require 'xcake/modern_xcodeproj.rb'
|
7
11
|
|
12
|
+
require 'xcake/constants'
|
13
|
+
require 'xcake/modern_xcodeproj'
|
8
14
|
require 'xcake/version'
|
9
15
|
require 'xcake/event_hooks'
|
10
16
|
require 'xcake/ui'
|
@@ -30,15 +36,14 @@ require 'xcake/project'
|
|
30
36
|
require 'xcake/project/sugar'
|
31
37
|
require 'xcake/project/hooks'
|
32
38
|
require 'xcake/path_classifier'
|
33
|
-
require 'xcake/shell_script_build_phase'
|
34
39
|
|
35
40
|
require 'xcake/target'
|
36
41
|
require 'xcake/target/sugar'
|
37
42
|
require 'xcake/target/configurable'
|
38
43
|
|
39
|
-
require 'xcake/
|
40
|
-
require 'xcake/
|
41
|
-
require 'xcake/
|
44
|
+
require 'xcake/build_phase'
|
45
|
+
require 'xcake/build_phase/headers_build_phase'
|
46
|
+
require 'xcake/build_phase/shell_script_build_phase'
|
42
47
|
|
43
48
|
module Xcake
|
44
49
|
end
|
data/rubocop.yml
CHANGED
data/xcake.gemspec
CHANGED
@@ -21,6 +21,14 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.required_ruby_version = '>= 2.0.0'
|
23
23
|
|
24
|
+
spec.add_dependency 'claide', '< 2.0', '>= 0.9.1'
|
25
|
+
spec.add_dependency 'cork'
|
26
|
+
spec.add_dependency 'hooks', '~> 0.4.1'
|
27
|
+
spec.add_dependency 'xcodeproj', '< 2.0.0', '>= 0.21'
|
28
|
+
|
29
|
+
# Lock `activesupport` (transitive dependency via `xcodeproj`) to keep supporting system ruby
|
30
|
+
spec.add_dependency 'activesupport', '< 5'
|
31
|
+
|
24
32
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
25
33
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
34
|
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
@@ -28,11 +36,4 @@ Gem::Specification.new do |spec|
|
|
28
36
|
spec.add_development_dependency 'rubocop-git', '~> 0.1.1'
|
29
37
|
spec.add_development_dependency 'yard', '~> 0.8'
|
30
38
|
spec.add_development_dependency 'pry', '~> 0.10'
|
31
|
-
spec.add_dependency 'claide', '< 2.0', '>= 0.9.1'
|
32
|
-
spec.add_dependency 'hooks', '~> 0.4.1'
|
33
|
-
spec.add_dependency 'xcodeproj', '< 2.0.0', '>= 0.20'
|
34
|
-
spec.add_dependency 'cork'
|
35
|
-
|
36
|
-
# Lock `activesupport` (transitive depedency via `xcodeproj`) to keep supporting system ruby
|
37
|
-
spec.add_dependency 'activesupport', '< 5'
|
38
39
|
end
|