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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 99a4a91204cd3726ab80fc803b00c604bc03ba07ccbbbcf3fba4c8728988cba9
|
4
|
+
data.tar.gz: eb423e8051caa38c89502e06cc968354ab2fae5e584dc63bfc5a4cd1d15ddade
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eb8daf92c6bbba4de52cf3d8e461b02731f49d319e444eb24af887ccc58d6c4d56bdda8f09b9923ca76d5db09e03010f4b2b63f560b29dd11295c19599b6332a
|
7
|
+
data.tar.gz: 7853926e3813c3fac9a1e9db280d2908a94ea2d5b4b97eb998523558db8be702ccbc5a587a713dd216b28e260a634873d17fed2d36aa24843ba14fdbcb1d538f
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2012 Eloy Durán <eloy.de.enige@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Xcodeproj
|
2
|
+
|
3
|
+
[](https://github.com/CocoaPods/Xcodeproj/actions)
|
4
|
+
[](https://codeclimate.com/github/CocoaPods/Xcodeproj/maintainability)
|
5
|
+
[](https://codeclimate.com/github/CocoaPods/Xcodeproj/test_coverage)
|
6
|
+
|
7
|
+
Xcodeproj lets you create and modify Xcode projects from [Ruby][ruby].
|
8
|
+
Script boring management tasks or build Xcode-friendly libraries. Also includes
|
9
|
+
support for Xcode workspaces (`.xcworkspace`), configuration files (`.xcconfig`) and
|
10
|
+
Xcode Scheme files (`.xcscheme`).
|
11
|
+
|
12
|
+
It is used in [CocoaPods](https://github.com/CocoaPods/CocoaPods) to create a
|
13
|
+
collection of supplemental libraries or frameworks, for all platforms Xcode supports.
|
14
|
+
|
15
|
+
The API reference can be found [here](http://www.rubydoc.info/gems/xcodeproj).
|
16
|
+
|
17
|
+
## Installing Xcodeproj
|
18
|
+
|
19
|
+
Xcodeproj itself installs through RubyGems, the Ruby package manager. Install it
|
20
|
+
by performing the following command:
|
21
|
+
|
22
|
+
$ [sudo] gem install xcodeproj
|
23
|
+
|
24
|
+
## Quickstart
|
25
|
+
|
26
|
+
To begin editing an xcodeproj file start by opening it as an Xcodeproj with:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'xcodeproj'
|
30
|
+
project_path = '/your_path/your_project.xcodeproj'
|
31
|
+
project = Xcodeproj::Project.open(project_path)
|
32
|
+
```
|
33
|
+
|
34
|
+
#### Some Small Examples To Get You Started
|
35
|
+
|
36
|
+
> Look through all targets
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
project.targets.each do |target|
|
40
|
+
puts target.name
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
> Get all source files for a target
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
target = project.targets.first
|
48
|
+
files = target.source_build_phase.files.to_a.map do |pbx_build_file|
|
49
|
+
pbx_build_file.file_ref.real_path.to_s
|
50
|
+
|
51
|
+
end.select do |path|
|
52
|
+
path.end_with?(".m", ".mm", ".swift")
|
53
|
+
|
54
|
+
end.select do |path|
|
55
|
+
File.exists?(path)
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
> Set a specific build configuration to all targets
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
project.targets.each do |target|
|
63
|
+
target.build_configurations.each do |config|
|
64
|
+
config.build_settings['MY_CUSTOM_FLAG'] ||= 'TRUE'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
project.save
|
68
|
+
```
|
69
|
+
|
70
|
+
## Command Line Tool
|
71
|
+
|
72
|
+
Installing the Xcodeproj gem will also install a command-line tool `xcodeproj` which you can
|
73
|
+
use to generate project diffs, target diffs, output all configurations and show a YAML representation.
|
74
|
+
|
75
|
+
For more information consult `xcodeproj --help`.
|
76
|
+
|
77
|
+
## Collaborate
|
78
|
+
|
79
|
+
All Xcodeproj development happens on [GitHub][xcodeproj]. Contributing patches
|
80
|
+
is really easy and gratifying.
|
81
|
+
|
82
|
+
Follow [@CocoaPods][twitter] to get up to date information about what's
|
83
|
+
going on in the CocoaPods world.
|
84
|
+
|
85
|
+
|
86
|
+
## LICENSE
|
87
|
+
|
88
|
+
These works are available under the MIT license. See the [LICENSE][license] file
|
89
|
+
for more info.
|
90
|
+
|
91
|
+
[twitter]: http://twitter.com/CocoaPods
|
92
|
+
[ruby]: http://www.ruby-lang.org/en/
|
93
|
+
[xcodeproj]: https://github.com/cocoapods/xcodeproj
|
94
|
+
[tickets]: https://github.com/cocoapods/xcodeproj/issues
|
95
|
+
[license]: LICENSE
|
data/bin/xcodeproj
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Command
|
3
|
+
class ConfigDump < Command
|
4
|
+
self.description = <<-eos
|
5
|
+
Dumps the build settings of all project targets for all configurations in
|
6
|
+
directories named by the target in given output directory.
|
7
|
+
|
8
|
+
It extracts common build settings in a per target base.xcconfig file.
|
9
|
+
|
10
|
+
If no `PROJECT` is specified then the current work directory is searched
|
11
|
+
for one.
|
12
|
+
|
13
|
+
If no `OUTPUT` is specified then the project directory will be used.
|
14
|
+
eos
|
15
|
+
|
16
|
+
self.summary = 'Dumps the build settings of all project targets for ' \
|
17
|
+
'all configurations in directories named by the target ' \
|
18
|
+
'in the given output directory.'
|
19
|
+
|
20
|
+
self.arguments = [
|
21
|
+
CLAide::Argument.new('PROJECT', false),
|
22
|
+
CLAide::Argument.new('OUTPUT', false),
|
23
|
+
]
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
self.xcodeproj_path = argv.shift_argument
|
27
|
+
@output_path = Pathname(argv.shift_argument || '.')
|
28
|
+
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate!
|
33
|
+
super
|
34
|
+
|
35
|
+
raise Informative, 'The output path must be a directory.' unless @output_path.directory?
|
36
|
+
open_project!
|
37
|
+
end
|
38
|
+
|
39
|
+
def run
|
40
|
+
dump_all_configs(xcodeproj, 'Project')
|
41
|
+
|
42
|
+
xcodeproj.targets.each do |target|
|
43
|
+
dump_all_configs(target, target.name)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def dump_all_configs(configurable, name)
|
48
|
+
path = Pathname(name)
|
49
|
+
|
50
|
+
# Dump base configuration to file
|
51
|
+
base_settings = extract_common_settings!(configurable.build_configurations)
|
52
|
+
base_file_path = path + "#{name}_base.xcconfig"
|
53
|
+
dump_config_to_file(base_settings, base_file_path)
|
54
|
+
|
55
|
+
# Dump each configuration to file
|
56
|
+
configurable.build_configurations.each do |config|
|
57
|
+
settings = config.build_settings
|
58
|
+
dump_config_to_file(settings, path + "#{name}_#{config.name.downcase}.xcconfig", [base_file_path])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def extract_common_settings!(build_configurations)
|
63
|
+
# Grasp all common build settings
|
64
|
+
all_build_settings = build_configurations.map(&:build_settings)
|
65
|
+
common_build_settings = all_build_settings.reduce do |settings, config_build_settings|
|
66
|
+
settings.select { |key, value| value == config_build_settings[key] }
|
67
|
+
end
|
68
|
+
|
69
|
+
# Remove all common build settings from each configuration specific build settings
|
70
|
+
build_configurations.each do |config|
|
71
|
+
config.build_settings.reject! { |key| !common_build_settings[key].nil? }
|
72
|
+
end
|
73
|
+
|
74
|
+
common_build_settings
|
75
|
+
end
|
76
|
+
|
77
|
+
def dump_config_to_file(settings, file_path, includes = [])
|
78
|
+
dir = @output_path + file_path + '..'
|
79
|
+
dir.mkpath
|
80
|
+
|
81
|
+
settings = Hash[settings.map do |k, v|
|
82
|
+
[k, Array(v).join(' ')]
|
83
|
+
end]
|
84
|
+
|
85
|
+
config = Config.new(settings)
|
86
|
+
config.includes = includes
|
87
|
+
config.save_as(@output_path + file_path)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Command
|
3
|
+
class ProjectDiff < Command
|
4
|
+
self.summary = 'Shows the difference between two projects'
|
5
|
+
|
6
|
+
self.description = summary + <<-EOS.gsub(/ {8}/, '')
|
7
|
+
|
8
|
+
It shows the difference in a UUID agnostic fashion.
|
9
|
+
|
10
|
+
To reduce the noise (and to simplify implementation) differences in the
|
11
|
+
order of arrays are ignored.
|
12
|
+
EOS
|
13
|
+
|
14
|
+
def self.options
|
15
|
+
[
|
16
|
+
['--ignore=KEY', 'A key to ignore in the comparison. Can be specified multiple times.'],
|
17
|
+
].concat(super)
|
18
|
+
end
|
19
|
+
|
20
|
+
self.arguments = [
|
21
|
+
CLAide::Argument.new('PROJECT1', true),
|
22
|
+
CLAide::Argument.new('PROJECT2', true),
|
23
|
+
]
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@path_project1 = argv.shift_argument
|
27
|
+
@path_project2 = argv.shift_argument
|
28
|
+
@keys_to_ignore = argv.all_options('ignore')
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate!
|
33
|
+
super
|
34
|
+
@project1, @project2 = open_project!(@path_project1, @path_project2)
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
hash_1 = @project1.to_tree_hash.dup
|
39
|
+
hash_2 = @project2.to_tree_hash.dup
|
40
|
+
@keys_to_ignore.each do |key|
|
41
|
+
Differ.clean_hash!(hash_1, key)
|
42
|
+
Differ.clean_hash!(hash_2, key)
|
43
|
+
end
|
44
|
+
|
45
|
+
diff = Differ.project_diff(hash_1, hash_2, @path_project1, @path_project2)
|
46
|
+
|
47
|
+
require 'yaml'
|
48
|
+
yaml = diff.to_yaml
|
49
|
+
yaml.gsub!(@path_project1, @path_project1.cyan)
|
50
|
+
yaml.gsub!(@path_project2, @path_project2.magenta)
|
51
|
+
yaml.gsub!(':diff:', 'diff:'.yellow)
|
52
|
+
puts yaml
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Command
|
3
|
+
class Show < Command
|
4
|
+
self.summary = 'Shows an overview of a project in a YAML representation.'
|
5
|
+
|
6
|
+
def self.options
|
7
|
+
[
|
8
|
+
['--format=[hash|tree_hash|raw]', 'YAML output format'],
|
9
|
+
].concat(super)
|
10
|
+
end
|
11
|
+
|
12
|
+
self.arguments = [
|
13
|
+
CLAide::Argument.new('PROJECT', false),
|
14
|
+
]
|
15
|
+
|
16
|
+
def initialize(argv)
|
17
|
+
self.xcodeproj_path = argv.shift_argument
|
18
|
+
@output_format = argv.option('format')
|
19
|
+
@output_format &&= @output_format.to_sym
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def validate
|
24
|
+
super
|
25
|
+
unless [nil, :hash, :tree_hash, :raw].include?(@output_format)
|
26
|
+
help! "Unknown format `#{@output_format}`"
|
27
|
+
end
|
28
|
+
open_project!
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
require 'yaml'
|
33
|
+
|
34
|
+
if @output_format
|
35
|
+
case @output_format
|
36
|
+
when :hash
|
37
|
+
puts xcodeproj.to_hash.to_yaml
|
38
|
+
when :tree_hash
|
39
|
+
puts xcodeproj.to_tree_hash.to_yaml
|
40
|
+
when :raw
|
41
|
+
puts xcodeproj.to_yaml
|
42
|
+
end
|
43
|
+
return
|
44
|
+
end
|
45
|
+
|
46
|
+
pretty_print = xcodeproj.pretty_print
|
47
|
+
sections = []
|
48
|
+
pretty_print.each do |key, value|
|
49
|
+
section = key.green
|
50
|
+
yaml = value.to_yaml
|
51
|
+
yaml.gsub!(/^---$/, '')
|
52
|
+
yaml.gsub!(/^-/, "\n-")
|
53
|
+
yaml.prepend(section)
|
54
|
+
sections << yaml
|
55
|
+
end
|
56
|
+
puts sections * "\n\n"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Command
|
3
|
+
class Sort < Command
|
4
|
+
self.description = <<-eos
|
5
|
+
Sorts the given project.
|
6
|
+
|
7
|
+
If no `PROJECT' is specified then the current work directory is searched for one.
|
8
|
+
eos
|
9
|
+
|
10
|
+
self.summary = 'Sorts the given project.'
|
11
|
+
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
['--group-option=[above|below]', 'The position of the groups when sorting. If no option is specified, sorting will interleave groups and files.'],
|
15
|
+
].concat(super)
|
16
|
+
end
|
17
|
+
|
18
|
+
self.arguments = [
|
19
|
+
CLAide::Argument.new('PROJECT', false),
|
20
|
+
]
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
self.xcodeproj_path = argv.shift_argument
|
24
|
+
@group_option = argv.option('group-option')
|
25
|
+
@group_option &&= @group_option.to_sym
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate!
|
30
|
+
super
|
31
|
+
unless [nil, :above, :below].include?(@group_option)
|
32
|
+
help! "Unknown format `#{@group_option}`"
|
33
|
+
end
|
34
|
+
open_project!
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
xcodeproj.sort(:groups_position => @group_option)
|
39
|
+
xcodeproj.save
|
40
|
+
puts "The `#{File.basename(xcodeproj_path)}` project was sorted"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Command
|
3
|
+
class TargetDiff < Command
|
4
|
+
self.summary = 'Shows the difference between two targets'
|
5
|
+
|
6
|
+
def self.options
|
7
|
+
[
|
8
|
+
['--project PATH', 'The Xcode project document to use.'],
|
9
|
+
].concat(super)
|
10
|
+
end
|
11
|
+
|
12
|
+
self.arguments = [
|
13
|
+
CLAide::Argument.new('TARGET1', true),
|
14
|
+
CLAide::Argument.new('TARGET2', true),
|
15
|
+
]
|
16
|
+
|
17
|
+
def initialize(argv)
|
18
|
+
@target1 = argv.shift_argument
|
19
|
+
@target2 = argv.shift_argument
|
20
|
+
self.xcodeproj_path = argv.option('--project')
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def validate!
|
25
|
+
super
|
26
|
+
open_project!
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
require 'yaml'
|
31
|
+
differ = Helper::TargetDiff.new(xcodeproj, @target1, @target2)
|
32
|
+
files = differ.new_source_build_files.map do |build_file|
|
33
|
+
{
|
34
|
+
'Name' => build_file.file_ref.name,
|
35
|
+
'Path' => build_file.file_ref.path,
|
36
|
+
'Build settings' => build_file.settings,
|
37
|
+
}
|
38
|
+
end
|
39
|
+
puts files.to_yaml
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
require 'colored2'
|
3
|
+
require 'claide'
|
4
|
+
|
5
|
+
class Command < CLAide::Command
|
6
|
+
require 'xcodeproj/command/config_dump'
|
7
|
+
require 'xcodeproj/command/target_diff'
|
8
|
+
require 'xcodeproj/command/project_diff'
|
9
|
+
require 'xcodeproj/command/show'
|
10
|
+
require 'xcodeproj/command/sort'
|
11
|
+
|
12
|
+
self.abstract_command = true
|
13
|
+
self.command = 'xcodeproj'
|
14
|
+
self.version = VERSION
|
15
|
+
self.description = 'Xcodeproj lets you create and modify Xcode projects from Ruby.'
|
16
|
+
self.plugin_prefixes = %w(claide xcodeproj)
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
super
|
20
|
+
unless self.ansi_output?
|
21
|
+
Colored2.disable!
|
22
|
+
String.send(:define_method, :colorize) { |string, _| string }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def xcodeproj_path
|
29
|
+
unless @xcodeproj_path
|
30
|
+
projects = Dir.glob('*.xcodeproj')
|
31
|
+
if projects.size == 1
|
32
|
+
xcodeproj_path = projects.first
|
33
|
+
elsif projects.size > 1
|
34
|
+
raise Informative, 'There are more than one Xcode project documents ' \
|
35
|
+
'in the current working directory. Please specify ' \
|
36
|
+
'which to use with the `--project` option.'
|
37
|
+
else
|
38
|
+
raise Informative, 'No Xcode project document found in the current ' \
|
39
|
+
'working directory. Please specify which to use ' \
|
40
|
+
'with the `--project` option.'
|
41
|
+
end
|
42
|
+
@xcodeproj_path = Pathname.new(xcodeproj_path).expand_path
|
43
|
+
end
|
44
|
+
@xcodeproj_path
|
45
|
+
end
|
46
|
+
|
47
|
+
def open_project!(*paths)
|
48
|
+
if paths.empty?
|
49
|
+
[xcodeproj]
|
50
|
+
else
|
51
|
+
paths.map { |path| Project.open(path) }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def xcodeproj_path=(path)
|
56
|
+
@xcodeproj_path = path && Pathname.new(path).expand_path
|
57
|
+
end
|
58
|
+
|
59
|
+
def xcodeproj
|
60
|
+
@xcodeproj ||= Project.open(xcodeproj_path)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
module Xcodeproj
|
4
|
+
class Config
|
5
|
+
# Parses other linker flags values.
|
6
|
+
#
|
7
|
+
module OtherLinkerFlagsParser
|
8
|
+
# @return [Hash{Symbol, Array[String]}] Splits the given
|
9
|
+
# other linker flags value by type.
|
10
|
+
#
|
11
|
+
# @param [String, Array] flags
|
12
|
+
# The other linker flags value.
|
13
|
+
#
|
14
|
+
def self.parse(flags)
|
15
|
+
result = {
|
16
|
+
:frameworks => [],
|
17
|
+
:weak_frameworks => [],
|
18
|
+
:libraries => [],
|
19
|
+
:arg_files => [],
|
20
|
+
:simple => [],
|
21
|
+
:force_load => [],
|
22
|
+
}
|
23
|
+
|
24
|
+
key = nil
|
25
|
+
if flags.is_a? String
|
26
|
+
flags = split(flags)
|
27
|
+
end
|
28
|
+
flags.each do |token|
|
29
|
+
case token
|
30
|
+
when '-framework'
|
31
|
+
key = :frameworks
|
32
|
+
when '-weak_framework'
|
33
|
+
key = :weak_frameworks
|
34
|
+
when '-l'
|
35
|
+
key = :libraries
|
36
|
+
when '@'
|
37
|
+
key = :arg_files
|
38
|
+
when '-force_load'
|
39
|
+
key = :force_load
|
40
|
+
else
|
41
|
+
if key
|
42
|
+
result[key] << token
|
43
|
+
key = nil
|
44
|
+
else
|
45
|
+
result[:simple] << token
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
result
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Array<String>] Split the given other linker
|
53
|
+
# flags value, taking into account quoting and
|
54
|
+
# the fact that the `-l` flag might omit the
|
55
|
+
# space.
|
56
|
+
#
|
57
|
+
# @param [String] flags
|
58
|
+
# The other linker flags value.
|
59
|
+
#
|
60
|
+
def self.split(flags)
|
61
|
+
flags.strip.shellsplit.flat_map do |string|
|
62
|
+
if string =~ /\A-l.+/
|
63
|
+
['-l', string[2..-1]]
|
64
|
+
elsif string =~ /\A@.+/
|
65
|
+
['@', string[1..-1]]
|
66
|
+
else
|
67
|
+
string
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|