Class: Xcake::Target
- Includes:
- Configurable, Visitable
- Defined in:
- lib/xcake/target.rb,
lib/xcake/target/sugar.rb,
lib/xcake/target/configurable.rb
Overview
This class is used to describe a target for a
Xcode project; This forms part of the DSL
and is usally stored in files named Cakefile.
Frameworks collapse
-
#exclude_files ⇒ Array or String
Files to exclude for the target.
-
#include_files ⇒ Array or String
Files to include for the target.
-
#system_frameworks ⇒ Array<String>
System frameworks to include for the target Defaults to: - ["Foundation", "UIKit"] for iOS - ["Cocoa"] for OSX.
-
#system_libraries ⇒ Array<String>
System libraries to include for the target.
-
#target_dependencies ⇒ Array<Target>
Targets to use as dependencies.
Instance Attribute Summary collapse
-
#build_phases ⇒ Array<Xcodeproj::Project::Object::AbstractBuildPhase>
The list of custom build phases for the project.
-
#deployment_target ⇒ String
The minimum deployment version for the target's platform.
-
#language ⇒ String
The language for the target.
-
#name ⇒ String
The name of the target.
-
#platform ⇒ String
The platform for the target.
-
#project ⇒ Project
The project for the target.
-
#type ⇒ String
The type of the target.
Attributes included from Configurable
Frameworks collapse
-
#initialize(project) {|_self| ... } ⇒ Target
constructor
A new instance of Target.
Conversion collapse
Instance Method Summary collapse
- #default_debug_settings ⇒ Object
- #default_release_settings ⇒ Object
-
#default_settings ⇒ Object
TODO: Move this to a constant, maybe Xcodeproj ones should be brought into here?.
- #parent_configurable ⇒ Object
- #shell_script_build_phase(name, script) ⇒ Object
Methods included from Visitable
Methods included from Configurable
#all_configurations, #all_configurations=, #configuration, #configurations_of_type, #copy_parent_configurations, #debug_configuration, #default_settings_for_type, #release_configuration
Constructor Details
#initialize(project) {|_self| ... } ⇒ Target
Returns a new instance of Target.
174 175 176 177 178 179 |
# File 'lib/xcake/target.rb', line 174 def initialize(project) @project = project @build_phases = [] yield(self) if block_given? end |
Instance Attribute Details
#build_phases ⇒ Array<Xcodeproj::Project::Object::AbstractBuildPhase>
Returns the list of custom build phases for the project.
42 43 44 |
# File 'lib/xcake/target.rb', line 42 def build_phases @build_phases end |
#deployment_target ⇒ String
Returns the minimum deployment version for the target's platform.
32 33 34 |
# File 'lib/xcake/target.rb', line 32 def deployment_target @deployment_target end |
#exclude_files ⇒ Array or String
Returns files to exclude for the target. Supports regular expressions.
138 139 140 |
# File 'lib/xcake/target.rb', line 138 def exclude_files @exclude_files end |
#include_files ⇒ Array or String
Returns files to include for the target.
Supports regular expressions,
Defaults to: ["./
129 130 131 |
# File 'lib/xcake/target.rb', line 129 def include_files @include_files end |
#language ⇒ String
Returns the language for the target.
Can be :objc, :swift.
37 38 39 |
# File 'lib/xcake/target.rb', line 37 def language @language end |
#name ⇒ String
Returns the name of the target.
16 17 18 |
# File 'lib/xcake/target.rb', line 16 def name @name end |
#platform ⇒ String
Returns the platform for the target.
Can be :ios, :osx, :tvos, :watchos.
27 28 29 |
# File 'lib/xcake/target.rb', line 27 def platform @platform end |
#project ⇒ Project
Returns the project for the target.
12 13 14 |
# File 'lib/xcake/target.rb', line 12 def project @project end |
#system_frameworks ⇒ Array<String>
Returns system frameworks to include for the target Defaults to:
- ["Foundation", "UIKit"] for iOS
- ["Cocoa"] for OSX.
151 152 153 |
# File 'lib/xcake/target.rb', line 151 def system_frameworks @system_frameworks end |
#system_libraries ⇒ Array<String>
Returns system libraries to include for the target.
159 160 161 |
# File 'lib/xcake/target.rb', line 159 def system_libraries @system_libraries end |
#target_dependencies ⇒ Array<Target>
Returns targets to use as dependencies.
163 164 165 |
# File 'lib/xcake/target.rb', line 163 def target_dependencies @target_dependencies end |
#type ⇒ String
Returns the type of the target.
Can be :application, :dynamic_library,
framework or :static_library.
22 23 24 |
# File 'lib/xcake/target.rb', line 22 def type @type end |
Instance Method Details
#default_debug_settings ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/xcake/target/configurable.rb', line 17 def default_debug_settings Xcodeproj::Project::ProjectHelper .common_build_settings(:debug, platform, deployment_target.to_s, type, language) .merge!(default_settings) .merge('SWIFT_OPTIMIZATION_LEVEL' => '-Onone') end |
#default_release_settings ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/xcake/target/configurable.rb', line 28 def default_release_settings Xcodeproj::Project::ProjectHelper .common_build_settings(:release, platform, deployment_target.to_s, type, language) .merge!(default_settings) end |
#default_settings ⇒ Object
TODO: Move this to a constant, maybe Xcodeproj ones should be brought into here?
Perhaps these could be made into a Gem itself?
11 12 13 14 15 |
# File 'lib/xcake/target/configurable.rb', line 11 def default_settings { 'INFOPLIST_FILE' => "#{name}/Supporting Files/Info.plist" } end |
#parent_configurable ⇒ Object
3 4 5 |
# File 'lib/xcake/target/configurable.rb', line 3 def parent_configurable @project end |
#shell_script_build_phase(name, script) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/xcake/target/sugar.rb', line 5 def shell_script_build_phase(name, script) phase = ShellScriptBuildPhase.new phase.name = name phase.script = script.strip_heredoc build_phases << phase phase end |
#to_s ⇒ Object
203 204 205 |
# File 'lib/xcake/target.rb', line 203 def to_s "Target<#{name}>" end |