plasmo_xcodeproj 1.21.1
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 +7 -0
- data/LICENSE +19 -0
- data/README.md +95 -0
- data/bin/xcodeproj +10 -0
- data/lib/xcodeproj/command/config_dump.rb +91 -0
- data/lib/xcodeproj/command/project_diff.rb +56 -0
- data/lib/xcodeproj/command/show.rb +60 -0
- data/lib/xcodeproj/command/sort.rb +44 -0
- data/lib/xcodeproj/command/target_diff.rb +43 -0
- data/lib/xcodeproj/command.rb +63 -0
- data/lib/xcodeproj/config/other_linker_flags_parser.rb +73 -0
- data/lib/xcodeproj/config.rb +386 -0
- data/lib/xcodeproj/constants.rb +465 -0
- data/lib/xcodeproj/differ.rb +239 -0
- data/lib/xcodeproj/gem_version.rb +5 -0
- data/lib/xcodeproj/helper.rb +30 -0
- data/lib/xcodeproj/plist.rb +94 -0
- data/lib/xcodeproj/project/case_converter.rb +90 -0
- data/lib/xcodeproj/project/object/build_configuration.rb +255 -0
- data/lib/xcodeproj/project/object/build_file.rb +84 -0
- data/lib/xcodeproj/project/object/build_phase.rb +369 -0
- data/lib/xcodeproj/project/object/build_rule.rb +109 -0
- data/lib/xcodeproj/project/object/configuration_list.rb +117 -0
- data/lib/xcodeproj/project/object/container_item_proxy.rb +116 -0
- data/lib/xcodeproj/project/object/file_reference.rb +338 -0
- data/lib/xcodeproj/project/object/group.rb +506 -0
- data/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb +72 -0
- data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +245 -0
- data/lib/xcodeproj/project/object/helpers/groupable_helper.rb +260 -0
- data/lib/xcodeproj/project/object/native_target.rb +751 -0
- data/lib/xcodeproj/project/object/reference_proxy.rb +86 -0
- data/lib/xcodeproj/project/object/root_object.rb +100 -0
- data/lib/xcodeproj/project/object/swift_package_product_dependency.rb +29 -0
- data/lib/xcodeproj/project/object/swift_package_remote_reference.rb +33 -0
- data/lib/xcodeproj/project/object/target_dependency.rb +94 -0
- data/lib/xcodeproj/project/object.rb +534 -0
- data/lib/xcodeproj/project/object_attributes.rb +522 -0
- data/lib/xcodeproj/project/object_dictionary.rb +210 -0
- data/lib/xcodeproj/project/object_list.rb +223 -0
- data/lib/xcodeproj/project/project_helper.rb +341 -0
- data/lib/xcodeproj/project/uuid_generator.rb +132 -0
- data/lib/xcodeproj/project.rb +874 -0
- data/lib/xcodeproj/scheme/abstract_scheme_action.rb +100 -0
- data/lib/xcodeproj/scheme/analyze_action.rb +19 -0
- data/lib/xcodeproj/scheme/archive_action.rb +59 -0
- data/lib/xcodeproj/scheme/build_action.rb +298 -0
- data/lib/xcodeproj/scheme/buildable_product_runnable.rb +55 -0
- data/lib/xcodeproj/scheme/buildable_reference.rb +129 -0
- data/lib/xcodeproj/scheme/command_line_arguments.rb +162 -0
- data/lib/xcodeproj/scheme/environment_variables.rb +170 -0
- data/lib/xcodeproj/scheme/execution_action.rb +86 -0
- data/lib/xcodeproj/scheme/launch_action.rb +179 -0
- data/lib/xcodeproj/scheme/location_scenario_reference.rb +49 -0
- data/lib/xcodeproj/scheme/macro_expansion.rb +34 -0
- data/lib/xcodeproj/scheme/profile_action.rb +57 -0
- data/lib/xcodeproj/scheme/remote_runnable.rb +92 -0
- data/lib/xcodeproj/scheme/send_email_action_content.rb +84 -0
- data/lib/xcodeproj/scheme/shell_script_action_content.rb +77 -0
- data/lib/xcodeproj/scheme/test_action.rb +394 -0
- data/lib/xcodeproj/scheme/xml_element_wrapper.rb +82 -0
- data/lib/xcodeproj/scheme.rb +375 -0
- data/lib/xcodeproj/user_interface.rb +22 -0
- data/lib/xcodeproj/workspace/file_reference.rb +79 -0
- data/lib/xcodeproj/workspace/group_reference.rb +67 -0
- data/lib/xcodeproj/workspace/reference.rb +40 -0
- data/lib/xcodeproj/workspace.rb +277 -0
- data/lib/xcodeproj/xcodebuild_helper.rb +108 -0
- data/lib/xcodeproj.rb +29 -0
- metadata +208 -0
@@ -0,0 +1,109 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Project
|
3
|
+
module Object
|
4
|
+
# This class represents a custom build rule of a Target.
|
5
|
+
#
|
6
|
+
class PBXBuildRule < AbstractObject
|
7
|
+
# @!group Attributes
|
8
|
+
|
9
|
+
# @return [String] the name of the rule.
|
10
|
+
#
|
11
|
+
attribute :name, String
|
12
|
+
|
13
|
+
# @return [String] a string representing what compiler to use.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# `com.apple.compilers.proxy.script`.
|
17
|
+
#
|
18
|
+
attribute :compiler_spec, String
|
19
|
+
|
20
|
+
# @return [String] the discovered dependency file to use.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# `$(DERIVED_FILES_DIR)/$(INPUT_FILE_NAME).d`.
|
24
|
+
#
|
25
|
+
attribute :dependency_file, String
|
26
|
+
|
27
|
+
# @return [String] the type of the files that should be processed by
|
28
|
+
# this rule.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# `pattern.proxy`.
|
32
|
+
#
|
33
|
+
attribute :file_type, String
|
34
|
+
|
35
|
+
# @return [String] the pattern of the files that should be processed by
|
36
|
+
# this rule. This attribute is an alternative to to
|
37
|
+
# `file_type`.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# `*.css`.
|
41
|
+
#
|
42
|
+
attribute :file_patterns, String
|
43
|
+
|
44
|
+
# @return [String] whether the rule is editable.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# `1`.
|
48
|
+
#
|
49
|
+
attribute :is_editable, String, '1'
|
50
|
+
|
51
|
+
# @return [ObjectList<PBXFileReference>] the file references for the
|
52
|
+
# input files files.
|
53
|
+
#
|
54
|
+
attribute :input_files, Array
|
55
|
+
|
56
|
+
# @return [ObjectList<PBXFileReference>] the file references for the
|
57
|
+
# output files.
|
58
|
+
#
|
59
|
+
attribute :output_files, Array
|
60
|
+
|
61
|
+
# @return [ObjectList<String>] the compiler flags used when creating the
|
62
|
+
# respective output files.
|
63
|
+
#
|
64
|
+
attribute :output_files_compiler_flags, Array
|
65
|
+
|
66
|
+
# @return [String] whether the rule should be run once per architecture.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# `0`.
|
70
|
+
#
|
71
|
+
attribute :run_once_per_architecture, String
|
72
|
+
|
73
|
+
# @return [String] the content of the script to use for the build rule.
|
74
|
+
#
|
75
|
+
# @note This attribute is present if the #{#compiler_spec} is
|
76
|
+
# `com.apple.compilers.proxy.script`
|
77
|
+
#
|
78
|
+
attribute :script, String
|
79
|
+
|
80
|
+
# @!group Helpers
|
81
|
+
|
82
|
+
# Adds an output file with the specified compiler flags.
|
83
|
+
#
|
84
|
+
# @param [PBXFileReference] file the file to add.
|
85
|
+
#
|
86
|
+
# @param [String] compiler_flags the compiler flags for the file.
|
87
|
+
#
|
88
|
+
# @return [Void]
|
89
|
+
#
|
90
|
+
def add_output_file(file, compiler_flags = '')
|
91
|
+
(self.output_files ||= []) << file
|
92
|
+
(self.output_files_compiler_flags ||= []) << compiler_flags
|
93
|
+
end
|
94
|
+
|
95
|
+
# @return [Array<[PBXFileReference, String]>]
|
96
|
+
# An array containing tuples of output files and their compiler
|
97
|
+
# flags.
|
98
|
+
#
|
99
|
+
def output_files_and_flags
|
100
|
+
(output_files || []).zip(output_files_compiler_flags || [])
|
101
|
+
end
|
102
|
+
|
103
|
+
def ascii_plist_annotation
|
104
|
+
" #{isa} "
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Project
|
3
|
+
module Object
|
4
|
+
# The primary purpose of this class is to maintain a collection of
|
5
|
+
# related build configurations of a {PBXProject} or a {PBXNativeTarget}.
|
6
|
+
#
|
7
|
+
class XCConfigurationList < AbstractObject
|
8
|
+
# @!group Attributes
|
9
|
+
|
10
|
+
# @return [String] whether the default configuration is visible.
|
11
|
+
# Usually `0`. The purpose of this flag and how Xcode displays
|
12
|
+
# it in the UI is unknown.
|
13
|
+
#
|
14
|
+
attribute :default_configuration_is_visible, String, '0'
|
15
|
+
|
16
|
+
# @return [String] the name of the default configuration.
|
17
|
+
# Usually `Release`. Xcode exposes this attribute as the
|
18
|
+
# configuration for the command line tools and only allows to
|
19
|
+
# set it at the project level.
|
20
|
+
#
|
21
|
+
attribute :default_configuration_name, String, 'Release'
|
22
|
+
|
23
|
+
# @return [ObjectList<XCBuildConfiguration>] the build
|
24
|
+
# configurations of the target.
|
25
|
+
#
|
26
|
+
has_many :build_configurations, XCBuildConfiguration
|
27
|
+
|
28
|
+
public
|
29
|
+
|
30
|
+
# @!group Helpers
|
31
|
+
# --------------------------------------------------------------------#
|
32
|
+
|
33
|
+
# Returns the build configuration with the given name.
|
34
|
+
#
|
35
|
+
# @param [String] name
|
36
|
+
# The name of the build configuration.
|
37
|
+
#
|
38
|
+
# @return [XCBuildConfiguration] The build configuration.
|
39
|
+
# @return [Nil] If not build configuration with the given name is found.
|
40
|
+
#
|
41
|
+
def [](name)
|
42
|
+
build_configurations.find { |bc| bc.name == name }
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns the build settings of the build configuration with
|
46
|
+
# the given name.
|
47
|
+
#
|
48
|
+
# @param [String] build_configuration_name
|
49
|
+
# The name of the build configuration.
|
50
|
+
#
|
51
|
+
# @return [Hash {String=>String}] the build settings
|
52
|
+
#
|
53
|
+
def build_settings(build_configuration_name)
|
54
|
+
if config = self[build_configuration_name]
|
55
|
+
config.build_settings
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Gets the value for the given build setting in all the build
|
60
|
+
# configurations.
|
61
|
+
#
|
62
|
+
# @param [String] key
|
63
|
+
# the key of the build setting.
|
64
|
+
#
|
65
|
+
# @param [Bool] resolve_against_xcconfig
|
66
|
+
# wether the retrieved setting should take in consideration any
|
67
|
+
# configuration file present.
|
68
|
+
#
|
69
|
+
# @param [PBXNativeTarget] root_target
|
70
|
+
# use this to resolve complete recursion between project and targets
|
71
|
+
#
|
72
|
+
# @return [Hash{String => String}] The value of the build setting
|
73
|
+
# grouped by the name of the build configuration.
|
74
|
+
#
|
75
|
+
def get_setting(key, resolve_against_xcconfig = false, root_target = nil)
|
76
|
+
result = {}
|
77
|
+
build_configurations.each do |bc|
|
78
|
+
result[bc.name] = resolve_against_xcconfig ? bc.resolve_build_setting(key, root_target) : bc.build_settings[key]
|
79
|
+
end
|
80
|
+
result
|
81
|
+
end
|
82
|
+
|
83
|
+
# Sets the given value for the build setting associated with the given
|
84
|
+
# key across all the build configurations.
|
85
|
+
#
|
86
|
+
# @param [String] key
|
87
|
+
# the key of the build setting.
|
88
|
+
#
|
89
|
+
# @param [String] value
|
90
|
+
# the value for the build setting.
|
91
|
+
#
|
92
|
+
# @return [void]
|
93
|
+
#
|
94
|
+
def set_setting(key, value)
|
95
|
+
build_configurations.each do |bc|
|
96
|
+
bc.build_settings[key] = value
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def target
|
101
|
+
return project.root_object if project.build_configuration_list.uuid == uuid
|
102
|
+
project.targets.find { |t| t.build_configuration_list.uuid == uuid }
|
103
|
+
end
|
104
|
+
|
105
|
+
#---------------------------------------------------------------------#
|
106
|
+
|
107
|
+
def ascii_plist_annotation
|
108
|
+
if target.nil?
|
109
|
+
' Build configuration list for <deleted target> '
|
110
|
+
else
|
111
|
+
" Build configuration list for #{target.isa} \"#{target}\" "
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Project
|
3
|
+
module Object
|
4
|
+
# Apparently a proxy for another object which might belong another
|
5
|
+
# project contained in the same workspace of the project document.
|
6
|
+
#
|
7
|
+
# This class is referenced by {PBXTargetDependency} for information about
|
8
|
+
# it usage see the specs of that class.
|
9
|
+
#
|
10
|
+
# @note This class references the other objects by UUID instead of
|
11
|
+
# creating proper relationships because the other objects might be
|
12
|
+
# part of another project. This implies that the references to
|
13
|
+
# other objects should not increase the retain count of the
|
14
|
+
# targets.
|
15
|
+
#
|
16
|
+
# @todo: This class needs some work to support targets across workspaces,
|
17
|
+
# as the container portal might not be initialized leading
|
18
|
+
# xcodeproj to raise because ti can't find the UUID.
|
19
|
+
#
|
20
|
+
class PBXContainerItemProxy < AbstractObject
|
21
|
+
# @!group Attributes
|
22
|
+
|
23
|
+
# @return [String] apparently the UUID of the root object
|
24
|
+
# {PBXProject} of the project containing the represented
|
25
|
+
# object.
|
26
|
+
#
|
27
|
+
# @todo this is an attribute because a it is usually a reference to
|
28
|
+
# the root object or to a file reference to another project.
|
29
|
+
# The reference to the root object causes a retain cycle that
|
30
|
+
# could cause issues (e.g. in to_tree_hash). Usually those
|
31
|
+
# objects are retained by at least another object (the
|
32
|
+
# {Project} for the root object and a {PBXGroup} for the
|
33
|
+
# reference to another project) and so the referenced object
|
34
|
+
# should be serialized.
|
35
|
+
#
|
36
|
+
# If this assumption is incorrect, there could be loss of
|
37
|
+
# information opening and saving an existing project.
|
38
|
+
#
|
39
|
+
# @todo This is the external reference that 'contains' other proxy
|
40
|
+
# items.
|
41
|
+
attribute :container_portal, String
|
42
|
+
|
43
|
+
# @return [String] the type of the proxy.
|
44
|
+
#
|
45
|
+
# @note @see {Constants::PROXY_TYPE.values} for valid values.
|
46
|
+
#
|
47
|
+
attribute :proxy_type, String
|
48
|
+
|
49
|
+
# @return [String] apparently the UUID of the represented
|
50
|
+
# object.
|
51
|
+
#
|
52
|
+
# @note If the object is in another project the UUID would not be
|
53
|
+
# present in the {Project#objects_by_uuid} hash. For this
|
54
|
+
# reason this is not an `has_one` attribute. It is assumes that
|
55
|
+
# if the object belongs to the project at least another object
|
56
|
+
# should be retaining it. This assumption is reasonable because
|
57
|
+
# this is a proxy class.
|
58
|
+
#
|
59
|
+
# If this assumption is incorrect, there could be loss of
|
60
|
+
# information opening and saving an existing project.
|
61
|
+
#
|
62
|
+
attribute :remote_global_id_string, String
|
63
|
+
|
64
|
+
# @return [String] apparently the name of the object represented by
|
65
|
+
# the proxy.
|
66
|
+
#
|
67
|
+
attribute :remote_info, String
|
68
|
+
|
69
|
+
# Checks whether the reference points to a remote project.
|
70
|
+
#
|
71
|
+
# @return [Bool]
|
72
|
+
#
|
73
|
+
def remote?
|
74
|
+
project.root_object.uuid != container_portal
|
75
|
+
end
|
76
|
+
|
77
|
+
# Get the proxied object
|
78
|
+
#
|
79
|
+
# @return [AbstractObject]
|
80
|
+
#
|
81
|
+
def proxied_object
|
82
|
+
container_portal_object.objects_by_uuid[remote_global_id_string]
|
83
|
+
end
|
84
|
+
|
85
|
+
def container_portal_object
|
86
|
+
if remote?
|
87
|
+
container_portal_file_ref = project.objects_by_uuid[container_portal]
|
88
|
+
Project.open(container_portal_file_ref.real_path)
|
89
|
+
else
|
90
|
+
project
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def container_portal_annotation
|
95
|
+
if remote?
|
96
|
+
" #{File.basename(project.objects_by_uuid[container_portal].real_path)} "
|
97
|
+
else
|
98
|
+
project.root_object.ascii_plist_annotation
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def to_hash_as(method = :to_hash)
|
103
|
+
hash = super
|
104
|
+
if method == :to_ascii_plist
|
105
|
+
hash['containerPortal'] = Nanaimo::String.new(container_portal, container_portal_annotation)
|
106
|
+
end
|
107
|
+
hash
|
108
|
+
end
|
109
|
+
|
110
|
+
def ascii_plist_annotation
|
111
|
+
" #{isa} "
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,338 @@
|
|
1
|
+
require 'xcodeproj/project/object/helpers/groupable_helper'
|
2
|
+
|
3
|
+
module Xcodeproj
|
4
|
+
class Project
|
5
|
+
module Object
|
6
|
+
# This class represents a reference to a file in the file system.
|
7
|
+
#
|
8
|
+
class PBXFileReference < AbstractObject
|
9
|
+
# @!group Attributes
|
10
|
+
|
11
|
+
# @return [String] the name of the reference, often not present.
|
12
|
+
#
|
13
|
+
attribute :name, String
|
14
|
+
|
15
|
+
# @return [String] the path to the file relative to the source tree
|
16
|
+
#
|
17
|
+
attribute :path, String
|
18
|
+
|
19
|
+
# @return [String] the directory to which the path is relative.
|
20
|
+
#
|
21
|
+
# @note The accepted values are:
|
22
|
+
# - `<absolute>` for absolute paths
|
23
|
+
# - `<group>` for paths relative to the group
|
24
|
+
# - `SOURCE_ROOT` for paths relative to the project
|
25
|
+
# - `DEVELOPER_DIR` for paths relative to the developer
|
26
|
+
# directory.
|
27
|
+
# - `BUILT_PRODUCTS_DIR` for paths relative to the build
|
28
|
+
# products directory.
|
29
|
+
# - `SDKROOT` for paths relative to the SDK directory.
|
30
|
+
#
|
31
|
+
attribute :source_tree, String, 'SOURCE_ROOT'
|
32
|
+
|
33
|
+
# @return [String] the file type (apparently) used for products
|
34
|
+
# generated by Xcode (i.e. applications, libraries).
|
35
|
+
#
|
36
|
+
attribute :explicit_file_type, String
|
37
|
+
|
38
|
+
# @return [String] the file type guessed by Xcode.
|
39
|
+
#
|
40
|
+
# @note This attribute is not present if there is an
|
41
|
+
# `explicit_file_type`.
|
42
|
+
#
|
43
|
+
attribute :last_known_file_type, String
|
44
|
+
|
45
|
+
# @return [String] whether this file should be indexed. It can
|
46
|
+
# be either `0` or `1`.
|
47
|
+
#
|
48
|
+
# @note Apparently present only for products generated by Xcode with
|
49
|
+
# a value of `0`.
|
50
|
+
#
|
51
|
+
attribute :include_in_index, String, '1'
|
52
|
+
|
53
|
+
# @return [String] a string containing a number which represents the
|
54
|
+
# encoding format of the file.
|
55
|
+
#
|
56
|
+
attribute :fileEncoding, String
|
57
|
+
|
58
|
+
# @return [String] a string that specifies the UTI for the syntax
|
59
|
+
# highlighting.
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
# `xcode.lang.ruby`
|
63
|
+
#
|
64
|
+
attribute :xc_language_specification_identifier, String
|
65
|
+
|
66
|
+
# @return [String] a string that specifies the UTI for the structure of
|
67
|
+
# a plist file.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# `com.apple.xcode.plist.structure-definition.iphone.info-plist`
|
71
|
+
#
|
72
|
+
attribute :plist_structure_definition_identifier, String
|
73
|
+
|
74
|
+
# @return [String] Whether Xcode should use tabs for text alignment.
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# `1`
|
78
|
+
#
|
79
|
+
attribute :uses_tabs, String
|
80
|
+
|
81
|
+
# @return [String] The width of the indent.
|
82
|
+
#
|
83
|
+
# @example
|
84
|
+
# `2`
|
85
|
+
#
|
86
|
+
attribute :indent_width, String
|
87
|
+
|
88
|
+
# @return [String] The width of the tabs.
|
89
|
+
#
|
90
|
+
# @example
|
91
|
+
# `2`
|
92
|
+
#
|
93
|
+
attribute :tab_width, String
|
94
|
+
|
95
|
+
# @return [String] Whether Xcode should wrap lines.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
# `1`
|
99
|
+
#
|
100
|
+
attribute :wraps_lines, String
|
101
|
+
|
102
|
+
# @return [String] Apparently whether Xcode should add, if needed, a
|
103
|
+
# new line feed before saving the file.
|
104
|
+
#
|
105
|
+
# @example
|
106
|
+
# `0`
|
107
|
+
#
|
108
|
+
attribute :line_ending, String
|
109
|
+
|
110
|
+
# @return [String] Comments associated with this file.
|
111
|
+
#
|
112
|
+
# @note This is apparently no longer used by Xcode.
|
113
|
+
#
|
114
|
+
attribute :comments, String
|
115
|
+
|
116
|
+
#---------------------------------------------------------------------#
|
117
|
+
|
118
|
+
public
|
119
|
+
|
120
|
+
# @!group Helpers
|
121
|
+
|
122
|
+
# @return [String] the name of the file taking into account the path if
|
123
|
+
# needed.
|
124
|
+
#
|
125
|
+
def display_name
|
126
|
+
if name
|
127
|
+
name
|
128
|
+
elsif (class << GroupableHelper; self; end)::SOURCE_TREES_BY_KEY[:built_products] == source_tree
|
129
|
+
path
|
130
|
+
elsif path
|
131
|
+
File.basename(path)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# @return [PBXGroup, PBXProject] the parent of the file.
|
136
|
+
#
|
137
|
+
def parent
|
138
|
+
GroupableHelper.parent(self)
|
139
|
+
end
|
140
|
+
|
141
|
+
# @return [Array<PBXGroup, PBXProject>] The list of the parents of the
|
142
|
+
# reference.
|
143
|
+
#
|
144
|
+
def parents
|
145
|
+
GroupableHelper.parents(self)
|
146
|
+
end
|
147
|
+
|
148
|
+
# @return [String] A representation of the reference hierarchy.
|
149
|
+
#
|
150
|
+
def hierarchy_path
|
151
|
+
GroupableHelper.hierarchy_path(self)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Moves the reference to a new parent.
|
155
|
+
#
|
156
|
+
# @param [PBXGroup] new_parent
|
157
|
+
# The new parent.
|
158
|
+
#
|
159
|
+
# @return [void]
|
160
|
+
#
|
161
|
+
def move(new_parent)
|
162
|
+
GroupableHelper.move(self, new_parent)
|
163
|
+
end
|
164
|
+
|
165
|
+
# @return [Pathname] the absolute path of the file resolving the
|
166
|
+
# source tree.
|
167
|
+
#
|
168
|
+
def real_path
|
169
|
+
GroupableHelper.real_path(self)
|
170
|
+
end
|
171
|
+
|
172
|
+
# @return [Pathname] the path of the file without resolving the
|
173
|
+
# source tree.
|
174
|
+
#
|
175
|
+
def full_path
|
176
|
+
GroupableHelper.full_path(self)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Sets the source tree of the reference.
|
180
|
+
#
|
181
|
+
# @param [Symbol, String] source_tree
|
182
|
+
# The source tree, either a string or a symbol.
|
183
|
+
#
|
184
|
+
# @return [void]
|
185
|
+
#
|
186
|
+
def set_source_tree(source_tree)
|
187
|
+
GroupableHelper.set_source_tree(self, source_tree)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Allows to set the path according to the source tree of the reference.
|
191
|
+
#
|
192
|
+
# @param [#to_s] the path for the reference.
|
193
|
+
#
|
194
|
+
# @return [void]
|
195
|
+
#
|
196
|
+
def set_path(path)
|
197
|
+
if path
|
198
|
+
GroupableHelper.set_path_with_source_tree(self, path, source_tree)
|
199
|
+
else
|
200
|
+
self.path = nil
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# @return [Array<PBXBuildFile>] the build files associated with the
|
205
|
+
# current file reference.
|
206
|
+
#
|
207
|
+
def build_files
|
208
|
+
referrers.grep(PBXBuildFile)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Sets the last known file type according to the extension of the path.
|
212
|
+
#
|
213
|
+
# @return [void]
|
214
|
+
#
|
215
|
+
def set_last_known_file_type(type = nil)
|
216
|
+
if type
|
217
|
+
self.last_known_file_type = type
|
218
|
+
elsif path
|
219
|
+
extension = Pathname(path).extname[1..-1]
|
220
|
+
self.last_known_file_type = Constants::FILE_TYPES_BY_EXTENSION[extension]
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
# Sets the explicit file type according to the extension of the path,
|
225
|
+
# and clears the last known file type.
|
226
|
+
#
|
227
|
+
# @return [void]
|
228
|
+
#
|
229
|
+
def set_explicit_file_type(type = nil)
|
230
|
+
self.last_known_file_type = nil
|
231
|
+
if type
|
232
|
+
self.explicit_file_type = type
|
233
|
+
elsif path
|
234
|
+
extension = Pathname(path).extname[1..-1]
|
235
|
+
self.explicit_file_type = Constants::FILE_TYPES_BY_EXTENSION[extension]
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
#---------------------------------------------------------------------#
|
240
|
+
|
241
|
+
# Checks whether the reference is a proxy.
|
242
|
+
#
|
243
|
+
# @return [Bool] always false for this ISA.
|
244
|
+
#
|
245
|
+
def proxy?
|
246
|
+
false
|
247
|
+
end
|
248
|
+
|
249
|
+
# If this file reference represents an external Xcode project reference
|
250
|
+
# then this will return metadata about it which includes the reference
|
251
|
+
# to the 'Products' group that's created in this project (the project
|
252
|
+
# that includes the external project).
|
253
|
+
#
|
254
|
+
# @return [ObjectDictionary, nil] The external project metadata for
|
255
|
+
# this file reference or `nil` if it's not an external project.
|
256
|
+
#
|
257
|
+
def project_reference_metadata
|
258
|
+
project.root_object.project_references.find do |project_reference|
|
259
|
+
project_reference[:project_ref] == self
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
# If this file reference represents an external Xcode project reference
|
264
|
+
# then this will return the objects that are 'containers' for items
|
265
|
+
# contained in the external Xcode project.
|
266
|
+
#
|
267
|
+
# @return [Array<PBXContainerItemProxy>] The containers for items in
|
268
|
+
# the external Xcode project.
|
269
|
+
#
|
270
|
+
def proxy_containers
|
271
|
+
project.objects.select do |object|
|
272
|
+
object.isa == 'PBXContainerItemProxy' &&
|
273
|
+
object.container_portal == uuid
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
# If this file reference represents an external Xcode project reference
|
278
|
+
# then this will return proxies for file references contained in the
|
279
|
+
# external Xcode project.
|
280
|
+
#
|
281
|
+
# @return [Array<PBXReferenceProxy>] The file reference proxies for
|
282
|
+
# items located in the external Xcode project.
|
283
|
+
#
|
284
|
+
def file_reference_proxies
|
285
|
+
containers = proxy_containers
|
286
|
+
if containers.empty?
|
287
|
+
[]
|
288
|
+
else
|
289
|
+
project.objects.select do |object|
|
290
|
+
object.isa == 'PBXReferenceProxy' &&
|
291
|
+
containers.include?(object.remote_ref)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
# If this file reference represents an external Xcode project reference
|
297
|
+
# then this will return dependencies on targets contained in the
|
298
|
+
# external Xcode project.
|
299
|
+
#
|
300
|
+
# @return [Array<PBXTargetDependency>] The dependencies on targets
|
301
|
+
# located in the external Xcode project.
|
302
|
+
#
|
303
|
+
def target_dependency_proxies
|
304
|
+
containers = proxy_containers
|
305
|
+
if containers.empty?
|
306
|
+
[]
|
307
|
+
else
|
308
|
+
project.objects.select do |object|
|
309
|
+
object.isa == 'PBXTargetDependency' &&
|
310
|
+
containers.include?(object.target_proxy)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
# In addition to removing the file reference, this will also remove any
|
316
|
+
# items related to this reference.
|
317
|
+
#
|
318
|
+
# @see AbstractObject#remove_from_project
|
319
|
+
#
|
320
|
+
# @return [void]
|
321
|
+
#
|
322
|
+
def remove_from_project
|
323
|
+
if project_reference = project_reference_metadata
|
324
|
+
file_reference_proxies.each(&:remove_from_project)
|
325
|
+
target_dependency_proxies.each(&:remove_from_project)
|
326
|
+
project_reference[:product_group].remove_from_project
|
327
|
+
project.root_object.project_references.delete(project_reference)
|
328
|
+
end
|
329
|
+
|
330
|
+
build_files.each(&:remove_from_project)
|
331
|
+
super
|
332
|
+
end
|
333
|
+
|
334
|
+
#---------------------------------------------------------------------#
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|