xcake 0.5.3 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +11 -23
- data/lib/xcake.rb +34 -18
- data/lib/xcake/command/init.rb +1 -1
- data/lib/xcake/command/make.rb +17 -4
- data/lib/xcake/configurable.rb +4 -0
- data/lib/xcake/context.rb +15 -0
- data/lib/xcake/context/xcodeproj_context.rb +49 -0
- data/lib/xcake/core_ext/string.rb +8 -0
- data/lib/xcake/dependency.rb +23 -0
- data/lib/xcake/dependency_provider.rb +28 -0
- data/lib/xcake/file_reference_installer.rb +54 -0
- data/lib/xcake/file_reference_installer/compile_source_file_reference_installer.rb +16 -0
- data/lib/xcake/file_reference_installer/compile_xcdatamodeld_file_reference_installer.rb +25 -0
- data/lib/xcake/file_reference_installer/copy_resources_file_reference_installer.rb +21 -0
- data/lib/xcake/file_reference_installer/copy_xcassets_file_reference_installer.rb +25 -0
- data/lib/xcake/file_reference_installer/header_file_reference_installer.rb +11 -0
- data/lib/xcake/generator.rb +16 -0
- data/lib/xcake/generator/configuration_generator.rb +36 -0
- data/lib/xcake/generator/project_generator.rb +17 -0
- data/lib/xcake/generator/project_metadata_generator.rb +11 -0
- data/lib/xcake/{project_structure_resolver.rb → generator/project_structure_generator.rb} +1 -6
- data/lib/xcake/generator/scheme_generator.rb +16 -0
- data/lib/xcake/generator/target_build_phase_generator.rb +49 -0
- data/lib/xcake/generator/target_custom_build_phase_generator.rb +16 -0
- data/lib/xcake/generator/target_dependency_generator.rb +15 -0
- data/lib/xcake/generator/target_file_reference_generator.rb +59 -0
- data/lib/xcake/generator/target_framework_generator.rb +14 -0
- data/lib/xcake/generator/target_generator.rb +12 -0
- data/lib/xcake/informative.rb +2 -0
- data/lib/xcake/plugin.rb +25 -0
- data/lib/xcake/project.rb +13 -9
- data/lib/xcake/project/sugar.rb +2 -3
- data/lib/xcake/shell_script_build_phase.rb +15 -0
- data/lib/xcake/target.rb +24 -15
- data/lib/xcake/target/sugar.rb +13 -0
- data/lib/xcake/ui.rb +7 -0
- data/lib/xcake/version.rb +1 -1
- data/lib/xcake/visitor.rb +2 -2
- data/lib/xcake/xcode/project.rb +25 -2
- data/xcake.gemspec +1 -0
- metadata +43 -17
- data/LICENSE +0 -201
- data/lib/fastlane_plugin.rb +0 -5
- data/lib/xcake/generator/build_phase.rb +0 -78
- data/lib/xcake/generator/build_phase/compile_source_build_phase.rb +0 -18
- data/lib/xcake/generator/build_phase/compile_xcdatamodeld_build_phase.rb +0 -20
- data/lib/xcake/generator/build_phase/copy_resources_build_phase.rb +0 -17
- data/lib/xcake/generator/build_phase/copy_xcassets_build_phase.rb +0 -21
- data/lib/xcake/generator/build_phase/header_file_build_phase.rb +0 -13
- data/lib/xcake/generator/build_phase_registry.rb +0 -40
- data/lib/xcake/generator/configuration.rb +0 -46
- data/lib/xcake/generator/path.rb +0 -41
- data/lib/xcake/generator/project.rb +0 -64
- data/lib/xcake/generator/target.rb +0 -48
data/lib/fastlane_plugin.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
module Xcake
|
2
|
-
module Generator
|
3
|
-
# This generator handles adding nodes
|
4
|
-
# to the project and creating a build phase
|
5
|
-
# for it.
|
6
|
-
#
|
7
|
-
class BuildPhase
|
8
|
-
|
9
|
-
include Visitor
|
10
|
-
|
11
|
-
# @return [Project] the xcode project
|
12
|
-
#
|
13
|
-
attr_accessor :project
|
14
|
-
|
15
|
-
# This should be overidden
|
16
|
-
# by subclasses.
|
17
|
-
#
|
18
|
-
# @param [Node] the node
|
19
|
-
#
|
20
|
-
# @return [Boolean] true if build phase can handle the node.
|
21
|
-
#
|
22
|
-
def self.can_install_node(node)
|
23
|
-
true
|
24
|
-
end
|
25
|
-
|
26
|
-
# @return [Project] the xcode project
|
27
|
-
#
|
28
|
-
def initialize(project)
|
29
|
-
@project = project
|
30
|
-
end
|
31
|
-
|
32
|
-
# Find the group which this node
|
33
|
-
# should be added to.
|
34
|
-
#
|
35
|
-
# This dictates where it shows up
|
36
|
-
# in the groups structure.
|
37
|
-
#
|
38
|
-
# @param [Node] the node
|
39
|
-
#
|
40
|
-
# @return [PBXGroup] the group
|
41
|
-
#
|
42
|
-
def group_for_node(node)
|
43
|
-
return @project.main_group unless node.parent
|
44
|
-
|
45
|
-
@project.main_group.find_subpath(node.parent.path, true)
|
46
|
-
end
|
47
|
-
|
48
|
-
# Adds file reference to the target.
|
49
|
-
#
|
50
|
-
# This should be overidden in subclasses
|
51
|
-
# to add the file reference the correct
|
52
|
-
# build phase.
|
53
|
-
#
|
54
|
-
# @param [PBXFileReference] the file reference
|
55
|
-
#
|
56
|
-
# @param [PBXTarget] the xcode target
|
57
|
-
#
|
58
|
-
def add_file_reference_to_target(_file_reference, _target)
|
59
|
-
end
|
60
|
-
|
61
|
-
protected
|
62
|
-
|
63
|
-
def visit_node(node)
|
64
|
-
|
65
|
-
group = group_for_node(node)
|
66
|
-
file_reference = group.new_reference(node.path)
|
67
|
-
|
68
|
-
node.targets.each do |t|
|
69
|
-
add_file_reference_to_target(file_reference, t)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def leave_node(node)
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Xcake
|
2
|
-
module Generator
|
3
|
-
# This build phase generator detects source
|
4
|
-
# files and adds them to the compile build phase.
|
5
|
-
#
|
6
|
-
class CompileSourceBuildPhase < BuildPhase
|
7
|
-
|
8
|
-
def self.can_install_node(node)
|
9
|
-
!File.directory?(node.path) &&
|
10
|
-
%w(.c .m .mm .cpp .swift).include?(File.extname(node.path))
|
11
|
-
end
|
12
|
-
|
13
|
-
def add_file_reference_to_target(file_reference, target)
|
14
|
-
target.source_build_phase.add_file_reference(file_reference)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Xcake
|
2
|
-
module Generator
|
3
|
-
# This build phase generator detects XCDataModeld bundles
|
4
|
-
# and adds them to the compile source phase.
|
5
|
-
#
|
6
|
-
class CompileXCDataModeldBuildPhase < CompileSourceBuildPhase
|
7
|
-
def self.can_install_node(node)
|
8
|
-
File.directory?(node.path) &&
|
9
|
-
[".xcdatamodeld"].include?(File.extname(node.path))
|
10
|
-
end
|
11
|
-
|
12
|
-
def visit_node(node)
|
13
|
-
super
|
14
|
-
|
15
|
-
# Ignore all files inside of the XCDataModel
|
16
|
-
node.children = []
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Xcake
|
2
|
-
module Generator
|
3
|
-
# This build phase generator detects
|
4
|
-
# files and adds them to the copy resources phase.
|
5
|
-
#
|
6
|
-
class CopyResourcesBuildPhase < BuildPhase
|
7
|
-
|
8
|
-
def self.can_install_node(node)
|
9
|
-
!File.directory?(node.path)
|
10
|
-
end
|
11
|
-
|
12
|
-
def add_file_reference_to_target(file_reference, target)
|
13
|
-
target.resources_build_phase.add_file_reference(file_reference)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Xcake
|
2
|
-
module Generator
|
3
|
-
# This build phase generator detects XCAsset bundles
|
4
|
-
# and adds them to the copy resources phase.
|
5
|
-
#
|
6
|
-
class CopyXCAssetsBuildPhase < CopyResourcesBuildPhase
|
7
|
-
|
8
|
-
def self.can_install_node(node)
|
9
|
-
File.directory?(node.path) &&
|
10
|
-
[".xcassets"].include?(File.extname(node.path))
|
11
|
-
end
|
12
|
-
|
13
|
-
def visit_node(node)
|
14
|
-
super
|
15
|
-
|
16
|
-
#Ignore all files inside of the XCAssets
|
17
|
-
node.children = []
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Xcake
|
2
|
-
module Generator
|
3
|
-
class HeaderFileBuildPhase < BuildPhase
|
4
|
-
# This build phase generator detects header files
|
5
|
-
# and ignores them.
|
6
|
-
#
|
7
|
-
def self.can_install_node(node)
|
8
|
-
!File.directory?(node.path) &&
|
9
|
-
[".h", ".hpp"].include?(File.extname(node.path))
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module Xcake
|
2
|
-
module Generator
|
3
|
-
class BuildPhase
|
4
|
-
# This namespace contains methods
|
5
|
-
# for working with Build Phase generators.
|
6
|
-
#
|
7
|
-
module Registry
|
8
|
-
|
9
|
-
# This returns all the build phase generators
|
10
|
-
# the order of these is important so that files
|
11
|
-
# are added correctly.
|
12
|
-
#
|
13
|
-
# @return [Array<BuildPhase>] the build phase generators
|
14
|
-
#
|
15
|
-
def self.build_phase_generators
|
16
|
-
[
|
17
|
-
CompileSourceBuildPhase,
|
18
|
-
CompileXCDataModeldBuildPhase,
|
19
|
-
HeaderFileBuildPhase,
|
20
|
-
CopyXCAssetsBuildPhase,
|
21
|
-
CopyResourcesBuildPhase
|
22
|
-
]
|
23
|
-
end
|
24
|
-
|
25
|
-
# This returns a build phase generator
|
26
|
-
# designed to handle the node
|
27
|
-
#
|
28
|
-
# @param [Node] node for the build phase generator
|
29
|
-
#
|
30
|
-
# @return [BuildPhase] the build phase generator
|
31
|
-
#
|
32
|
-
def self.generator_for_node(node)
|
33
|
-
generator_class = self.build_phase_generators.find do |g|
|
34
|
-
g.can_install_node(node)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'xcodeproj'
|
2
|
-
|
3
|
-
module Xcake
|
4
|
-
module Generator
|
5
|
-
# This generator processes the configuraions
|
6
|
-
# and creates xcode build configurations.
|
7
|
-
#
|
8
|
-
class Configuration
|
9
|
-
|
10
|
-
include Visitor
|
11
|
-
|
12
|
-
# @return [Project] project for the configuration
|
13
|
-
#
|
14
|
-
attr_accessor :project
|
15
|
-
|
16
|
-
# @return [Object] object from xcode project the configuration is for
|
17
|
-
#
|
18
|
-
attr_accessor :configuration_target
|
19
|
-
|
20
|
-
# @param [Project] project for the configuration
|
21
|
-
#
|
22
|
-
# @param [Object] object from xcode project the configuration is for
|
23
|
-
#
|
24
|
-
def initialize(project, configuration_target)
|
25
|
-
@project = project
|
26
|
-
@configuration_target = configuration_target
|
27
|
-
end
|
28
|
-
|
29
|
-
protected
|
30
|
-
|
31
|
-
def visit_configuration(configuration)
|
32
|
-
puts "Creating build configuration #{configuration.name} for #{@configuration_target}..."
|
33
|
-
|
34
|
-
build_configuration = @project.new(Xcodeproj::Project::Object::XCBuildConfiguration)
|
35
|
-
|
36
|
-
build_configuration.name = configuration.name
|
37
|
-
build_configuration.build_settings = configuration.settings
|
38
|
-
|
39
|
-
@configuration_target.build_configurations << build_configuration
|
40
|
-
end
|
41
|
-
|
42
|
-
def leave_configuration(configuration)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/xcake/generator/path.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
module Xcake
|
2
|
-
module Generator
|
3
|
-
# This generator processes the include and
|
4
|
-
# exclude paths, and adds them to the
|
5
|
-
# root node to be added to the project.
|
6
|
-
#
|
7
|
-
class Path
|
8
|
-
|
9
|
-
include Visitor
|
10
|
-
|
11
|
-
# @return [Project] the xcode project
|
12
|
-
#
|
13
|
-
attr_accessor :project
|
14
|
-
|
15
|
-
# @param [Project] project for the file path
|
16
|
-
#
|
17
|
-
def initialize(project)
|
18
|
-
@project = project
|
19
|
-
end
|
20
|
-
|
21
|
-
protected
|
22
|
-
|
23
|
-
def visit_node(node)
|
24
|
-
|
25
|
-
return unless node.path
|
26
|
-
|
27
|
-
puts "Adding #{node.path}..."
|
28
|
-
|
29
|
-
generator_class = BuildPhase::Registry.generator_for_node(node)
|
30
|
-
|
31
|
-
if generator_class
|
32
|
-
generator = generator_class.new(@project)
|
33
|
-
node.accept(generator)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def leave_node(node)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'xcodeproj'
|
2
|
-
|
3
|
-
module Xcake
|
4
|
-
module Generator
|
5
|
-
class Project
|
6
|
-
|
7
|
-
include Visitor
|
8
|
-
|
9
|
-
attr_accessor :project
|
10
|
-
attr_accessor :root_node
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@root_node = Node.new
|
14
|
-
end
|
15
|
-
|
16
|
-
def output_filepath_for_project(project)
|
17
|
-
"./#{project.project_name}.xcodeproj"
|
18
|
-
end
|
19
|
-
|
20
|
-
def visit_project(project)
|
21
|
-
|
22
|
-
puts "Creating Project..."
|
23
|
-
|
24
|
-
output_filepath = output_filepath_for_project(project)
|
25
|
-
|
26
|
-
@project = Xcode::Project.new(output_filepath, true)
|
27
|
-
@project.setup_for_xcake
|
28
|
-
|
29
|
-
@project.class_prefix = project.class_prefix if project.class_prefix
|
30
|
-
@project.organization = project.organization if project.organization
|
31
|
-
end
|
32
|
-
|
33
|
-
def leave_project(project)
|
34
|
-
|
35
|
-
generator = Path.new(@project)
|
36
|
-
@root_node.accept(generator)
|
37
|
-
|
38
|
-
puts "Writing Project..."
|
39
|
-
|
40
|
-
@project.recreate_user_schemes
|
41
|
-
@project.save
|
42
|
-
project.run_hook :after_save
|
43
|
-
|
44
|
-
puts "Done!"
|
45
|
-
end
|
46
|
-
|
47
|
-
def visit_target(target)
|
48
|
-
generator = Target.new(@project, @root_node)
|
49
|
-
target.accept(generator)
|
50
|
-
end
|
51
|
-
|
52
|
-
def leave_target(target)
|
53
|
-
end
|
54
|
-
|
55
|
-
def visit_configuration(configuration)
|
56
|
-
generator = Configuration.new(@project, @project)
|
57
|
-
configuration.accept(generator)
|
58
|
-
end
|
59
|
-
|
60
|
-
def leave_configuration(configuration)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'xcodeproj'
|
2
|
-
|
3
|
-
module Xcake
|
4
|
-
module Generator
|
5
|
-
class Target
|
6
|
-
|
7
|
-
include Visitor
|
8
|
-
|
9
|
-
attr_accessor :project
|
10
|
-
attr_accessor :root_node
|
11
|
-
attr_accessor :target
|
12
|
-
attr_accessor :native_target
|
13
|
-
|
14
|
-
def initialize(project, root_node)
|
15
|
-
@project = project
|
16
|
-
@root_node = root_node
|
17
|
-
end
|
18
|
-
|
19
|
-
def visit_target(target)
|
20
|
-
|
21
|
-
puts "Creating target #{target.name}..."
|
22
|
-
|
23
|
-
@target = target
|
24
|
-
@native_target = @project.new_target(target)
|
25
|
-
|
26
|
-
Dir.glob(target.include_files).each do |file|
|
27
|
-
@root_node.create_children_with_path(file, @native_target)
|
28
|
-
end if target.include_files
|
29
|
-
|
30
|
-
Dir.glob(target.exclude_files).each do |file|
|
31
|
-
@root_node.remove_children_with_path(file, @native_target)
|
32
|
-
end if target.exclude_files
|
33
|
-
end
|
34
|
-
|
35
|
-
def leave_target(target)
|
36
|
-
@native_target.add_system_frameworks(target.system_frameworks) if target.system_frameworks
|
37
|
-
end
|
38
|
-
|
39
|
-
def visit_configuration(configuration)
|
40
|
-
generator = Configuration.new(@project, @native_target)
|
41
|
-
configuration.accept(generator)
|
42
|
-
end
|
43
|
-
|
44
|
-
def leave_configuration(configuration)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|