rswift 0.1.0
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/.gitignore +11 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +56 -0
- data/Rakefile +6 -0
- data/bin/rswift +7 -0
- data/lib/ext/array.rb +12 -0
- data/lib/ext/group.rb +24 -0
- data/lib/ext/native_target.rb +54 -0
- data/lib/ext/project.rb +68 -0
- data/lib/rswift.rb +22 -0
- data/lib/rswift/attributes_configurator.rb +20 -0
- data/lib/rswift/build_settings_configurator.rb +26 -0
- data/lib/rswift/build_settings_provider.rb +84 -0
- data/lib/rswift/cli.rb +33 -0
- data/lib/rswift/configuration.rb +41 -0
- data/lib/rswift/constants.rb +106 -0
- data/lib/rswift/device_provider.rb +25 -0
- data/lib/rswift/files_references_manager.rb +17 -0
- data/lib/rswift/group_references_manager.rb +114 -0
- data/lib/rswift/project_configurator.rb +41 -0
- data/lib/rswift/scheme_configurator.rb +10 -0
- data/lib/rswift/target_configurator.rb +22 -0
- data/lib/rswift/template_manager.rb +28 -0
- data/lib/rswift/templates/app/ios/.gitignore.erb +22 -0
- data/lib/rswift/templates/app/ios/Gemfile.erb +4 -0
- data/lib/rswift/templates/app/ios/Podfile.erb +11 -0
- data/lib/rswift/templates/app/ios/Rakefile.erb +1 -0
- data/lib/rswift/templates/app/ios/app/AppDelegate.swift.erb +15 -0
- data/lib/rswift/templates/app/ios/app/Assets.xcassets/AppIcon.appiconset/Contents.json.erb +73 -0
- data/lib/rswift/templates/app/ios/app/Info.plist.erb +45 -0
- data/lib/rswift/templates/app/ios/app/LaunchScreen.storyboard.erb +28 -0
- data/lib/rswift/templates/app/ios/package.json.erb +14 -0
- data/lib/rswift/templates/app/ios/spec/AppDelegateSpec.swift.erb +24 -0
- data/lib/rswift/templates/app/ios/spec/Info.plist.erb +24 -0
- data/lib/rswift/templates/app/osx/.gitignore.erb +21 -0
- data/lib/rswift/templates/app/osx/Gemfile.erb +4 -0
- data/lib/rswift/templates/app/osx/Podfile.erb +7 -0
- data/lib/rswift/templates/app/osx/Rakefile.erb +1 -0
- data/lib/rswift/templates/app/osx/app/AppDelegate.swift.erb +30 -0
- data/lib/rswift/templates/app/osx/app/Assets.xcassets/AppIcon.appiconset/Contents.json.erb +58 -0
- data/lib/rswift/templates/app/osx/app/Info.plist.erb +30 -0
- data/lib/rswift/templates/app/osx/app/main.swift.erb +5 -0
- data/lib/rswift/templates/app/osx/spec/AppDelegateSpec.swift.erb +24 -0
- data/lib/rswift/templates/app/osx/spec/Info.plist.erb +24 -0
- data/lib/rswift/templates/app/tvos/.gitignore.erb +21 -0
- data/lib/rswift/templates/app/tvos/Gemfile.erb +4 -0
- data/lib/rswift/templates/app/tvos/Podfile.erb +11 -0
- data/lib/rswift/templates/app/tvos/Rakefile.erb +1 -0
- data/lib/rswift/templates/app/tvos/app/AppDelegate.swift.erb +15 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json.erb +12 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json.erb +6 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Large.imagestack/Contents.json.erb +17 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json.erb +12 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json.erb +6 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json.erb +12 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json.erb +6 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json.erb +12 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json.erb +6 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Small.imagestack/Contents.json.erb +17 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json.erb +12 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json.erb +6 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json.erb +12 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json.erb +6 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/Contents.json.erb +26 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/AppIcon.brandassets/Top Shelf Image.imageset/Contents.json.erb +12 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/Contents.json.erb +6 -0
- data/lib/rswift/templates/app/tvos/app/Assets.xcassets/LaunchImage.launchimage/Contents.json.erb +15 -0
- data/lib/rswift/templates/app/tvos/app/Info.plist.erb +30 -0
- data/lib/rswift/templates/app/tvos/spec/AppDelegateSpec.swift.erb +24 -0
- data/lib/rswift/templates/app/tvos/spec/Info.plist.erb +24 -0
- data/lib/rswift/templates/app/watchos/wk_app/Assets.xcassets/AppIcon.appiconset/Contents.json.erb +55 -0
- data/lib/rswift/templates/app/watchos/wk_app/Info.plist.erb +35 -0
- data/lib/rswift/templates/app/watchos/wk_app/Interface.storyboard.erb +15 -0
- data/lib/rswift/templates/app/watchos/wk_ext/Assets.xcassets/README__ignoredByTemplate__ +1 -0
- data/lib/rswift/templates/app/watchos/wk_ext/ExtensionDelegate.swift.erb +4 -0
- data/lib/rswift/templates/app/watchos/wk_ext/Info.plist.erb +40 -0
- data/lib/rswift/templates/app/watchos/wk_ext/InterfaceController.swift.erb +6 -0
- data/lib/rswift/version.rb +3 -0
- data/lib/rswift/workspace_provider.rb +11 -0
- data/rswift.gemspec +26 -0
- metadata +227 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 853c99821b8eaf9ff8f1dd9719398374487d8a2e
|
|
4
|
+
data.tar.gz: 64732b0db9a6c44c116a7382afd3d1249160a8f0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 96e86d11c94720acd93a59e7be5eac3ef080ab669a015264a80411764ddc824403ec1e6b63a64f0e316b626708391e458e57a473ea957157c13fd4630332daf8
|
|
7
|
+
data.tar.gz: 99921353e1d96713d22c8c83ad35ca3ead49de2b4db3d36d57f3aeb3f6d73df4e67a7ce3b280b370cdb460b31d23913e034e356df0df24687a4e4801e2ace0eb
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Lukasz Wolanczyk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# RSwift
|
|
2
|
+
|
|
3
|
+
RSwift allows to create and develop iOS, OSX, tvOS and watchOS projects using CLI.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'rswift'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install rswift
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
To create iOS app run `rswift app MyAppName`.
|
|
24
|
+
|
|
25
|
+
Enter app directory `cd MyAppName`.
|
|
26
|
+
|
|
27
|
+
Install gems `bundle install`.
|
|
28
|
+
|
|
29
|
+
Install pods `pod install`.
|
|
30
|
+
|
|
31
|
+
Install node modules `npm install`.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
You can specify OSX, tvOS and watchOS template, for example `rswift app --template=osx MyOSXApp`.
|
|
35
|
+
|
|
36
|
+
Available templates are:
|
|
37
|
+
* `ios` (default)
|
|
38
|
+
* `osx`
|
|
39
|
+
* `tvos`
|
|
40
|
+
* `watchos` (still under development)
|
|
41
|
+
|
|
42
|
+
## Development
|
|
43
|
+
|
|
44
|
+
Run tests with `rake spec`.
|
|
45
|
+
|
|
46
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
47
|
+
|
|
48
|
+
## Contributing
|
|
49
|
+
|
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lukwol/rswift-ios.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
56
|
+
|
data/Rakefile
ADDED
data/bin/rswift
ADDED
data/lib/ext/array.rb
ADDED
data/lib/ext/group.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Xcodeproj
|
|
2
|
+
class Project
|
|
3
|
+
module Object
|
|
4
|
+
class PBXGroup
|
|
5
|
+
|
|
6
|
+
def file_for_path(path)
|
|
7
|
+
result_file = files.find do |file|
|
|
8
|
+
file.path == path
|
|
9
|
+
end
|
|
10
|
+
result_file = new_file(path) unless result_file
|
|
11
|
+
result_file
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def group_for_path(path)
|
|
15
|
+
result_group = groups.find do |group|
|
|
16
|
+
group.path == path
|
|
17
|
+
end
|
|
18
|
+
result_group = new_group(path, path) unless result_group
|
|
19
|
+
result_group
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module Xcodeproj
|
|
2
|
+
class Project
|
|
3
|
+
module Object
|
|
4
|
+
class PBXNativeTarget
|
|
5
|
+
|
|
6
|
+
def debug_build_configuration
|
|
7
|
+
build_configuration_name = RSwift::Configuration.new.debug_build_configuration
|
|
8
|
+
build_configuration_name ||= RSwift::Constants::CONFIGURATION_PROPERTIES[:debug][:name]
|
|
9
|
+
build_configurations.find do |build_configuration|
|
|
10
|
+
build_configuration.name.eql? build_configuration_name
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def release_build_configuration
|
|
15
|
+
build_configuration_name = RSwift::Configuration.new.release_build_configuration
|
|
16
|
+
build_configuration_name ||= RSwift::Constants::CONFIGURATION_PROPERTIES[:release][:name]
|
|
17
|
+
build_configurations.find do |build_configuration|
|
|
18
|
+
build_configuration.name.eql? build_configuration_name
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def product_name
|
|
23
|
+
product_name = RSwift::Configuration.new.product_name
|
|
24
|
+
product_name ||= super
|
|
25
|
+
product_name
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def product_type_uti
|
|
29
|
+
Xcodeproj::Constants::PRODUCT_TYPE_UTI.key(product_type)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def suffix
|
|
33
|
+
RSwift::Constants::TARGET_PROPERTIES[product_type_uti][:suffix]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def group_name
|
|
37
|
+
RSwift::Constants::TARGET_PROPERTIES[product_type_uti][:group_name]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def debug_product_bundle_identifier
|
|
41
|
+
product_bundle_identifier = RSwift::Configuration.new.debug_product_bundle_identifier
|
|
42
|
+
product_bundle_identifier ||= debug_build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
|
|
43
|
+
product_bundle_identifier
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def release_product_bundle_identifier
|
|
47
|
+
product_bundle_identifier = RSwift::Configuration.new.release_product_bundle_identifier
|
|
48
|
+
product_bundle_identifier ||= release_build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
|
|
49
|
+
product_bundle_identifier
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/ext/project.rb
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module Xcodeproj
|
|
2
|
+
class Project
|
|
3
|
+
|
|
4
|
+
def name
|
|
5
|
+
path.dirname.split.last.to_s
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def debug_build_configuration
|
|
9
|
+
build_configuration_name = RSwift::Configuration.new.debug_build_configuration
|
|
10
|
+
build_configuration_name ||= RSwift::Constants::CONFIGURATION_PROPERTIES[:debug][:name]
|
|
11
|
+
build_configurations.find do |build_configuration|
|
|
12
|
+
build_configuration.name.eql? build_configuration_name
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def release_build_configuration
|
|
17
|
+
build_configuration_name = RSwift::Configuration.new.release_build_configuration
|
|
18
|
+
build_configuration_name ||= RSwift::Constants::CONFIGURATION_PROPERTIES[:release][:name]
|
|
19
|
+
build_configurations.find do |build_configuration|
|
|
20
|
+
build_configuration.name.eql? build_configuration_name
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def app_target
|
|
25
|
+
targets.find { |target| target.product_type.eql? Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application] }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def spec_target
|
|
29
|
+
targets.find { |target| target.product_type.eql? Xcodeproj::Constants::PRODUCT_TYPE_UTI[:unit_test_bundle] }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def wk_app_target
|
|
33
|
+
targets.find { |target| target.product_type.eql? Xcodeproj::Constants::PRODUCT_TYPE_UTI[:watch2_app] }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def wk_ext_target
|
|
37
|
+
targets.find { |target| target.product_type.eql? Xcodeproj::Constants::PRODUCT_TYPE_UTI[:watch2_extension] }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def app_scheme_name
|
|
41
|
+
schemes_names = Xcodeproj::Project.schemes(path)
|
|
42
|
+
schemes_names.find do |scheme_name|
|
|
43
|
+
is_app_scheme(scheme_for_scheme_name(scheme_name))
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def app_scheme
|
|
48
|
+
scheme_name = RSwift::Configuration.new.app_scheme_name
|
|
49
|
+
scheme_name ||= app_scheme_name
|
|
50
|
+
scheme_for_scheme_name(scheme_name)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def scheme_for_scheme_name(scheme_name)
|
|
56
|
+
shared_data_dir = Xcodeproj::XCScheme.shared_data_dir path
|
|
57
|
+
scheme_file_path = "#{shared_data_dir}/#{scheme_name}.xcscheme"
|
|
58
|
+
scheme = Xcodeproj::XCScheme.new(scheme_file_path) if File.exist?(scheme_file_path)
|
|
59
|
+
scheme
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def is_app_scheme(scheme)
|
|
63
|
+
has_proper_launch_action = scheme.launch_action.buildable_product_runnable.buildable_reference.target_uuid.eql?(app_target.uuid)
|
|
64
|
+
has_proper_buildable_action = scheme.profile_action.buildable_product_runnable.buildable_reference.target_uuid.eql?(app_target.uuid)
|
|
65
|
+
has_proper_launch_action && has_proper_buildable_action
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
data/lib/rswift.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'rswift/cli'
|
|
2
|
+
require 'rswift/template_manager'
|
|
3
|
+
require 'rswift/project_configurator'
|
|
4
|
+
require 'rswift/target_configurator'
|
|
5
|
+
require 'rswift/build_settings_configurator'
|
|
6
|
+
require 'rswift/build_settings_provider'
|
|
7
|
+
require 'rswift/attributes_configurator'
|
|
8
|
+
require 'rswift/group_references_manager'
|
|
9
|
+
require 'rswift/constants'
|
|
10
|
+
require 'rswift/files_references_manager'
|
|
11
|
+
require 'rswift/scheme_configurator'
|
|
12
|
+
require 'rswift/device_provider'
|
|
13
|
+
require 'rswift/workspace_provider'
|
|
14
|
+
require 'rswift/configuration'
|
|
15
|
+
|
|
16
|
+
require 'ext/array'
|
|
17
|
+
require 'ext/group'
|
|
18
|
+
require 'ext/native_target'
|
|
19
|
+
require 'ext/project'
|
|
20
|
+
|
|
21
|
+
module RSwift
|
|
22
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module RSwift
|
|
2
|
+
class AttributesConfigurator
|
|
3
|
+
|
|
4
|
+
def configure_project_attributes(project)
|
|
5
|
+
project.root_object.attributes.merge! target_attributes(project)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def target_attributes(project)
|
|
11
|
+
{
|
|
12
|
+
'TargetAttributes' => {
|
|
13
|
+
project.spec_target.uuid => {
|
|
14
|
+
'TestTargetID' => project.app_target.uuid
|
|
15
|
+
}.freeze
|
|
16
|
+
}.freeze
|
|
17
|
+
}.freeze
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module RSwift
|
|
2
|
+
class BuildSettingsConfigurator
|
|
3
|
+
|
|
4
|
+
attr_accessor :build_settings_provider
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
7
|
+
@build_settings_provider = RSwift::BuildSettingsProvider.new
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def configure_project_settings(project, template)
|
|
11
|
+
project_debug_settings = @build_settings_provider.project_debug_settings(template)
|
|
12
|
+
project.debug_build_configuration.build_settings.merge! project_debug_settings
|
|
13
|
+
|
|
14
|
+
project_release_settings = @build_settings_provider.project_release_settings(template)
|
|
15
|
+
project.release_build_configuration.build_settings.merge! project_release_settings
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def configure_target_settings(project, target, template)
|
|
19
|
+
target_debug_settings = @build_settings_provider.target_debug_settings(project, target, template)
|
|
20
|
+
target.debug_build_configuration.build_settings.merge! target_debug_settings
|
|
21
|
+
|
|
22
|
+
target_release_settings = @build_settings_provider.target_release_settings(project, target, template)
|
|
23
|
+
target.release_build_configuration.build_settings.merge! target_release_settings
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
module RSwift
|
|
2
|
+
class BuildSettingsProvider
|
|
3
|
+
|
|
4
|
+
def project_debug_settings(template)
|
|
5
|
+
options = [template, :debug]
|
|
6
|
+
project_build_settings(options)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def project_release_settings(template)
|
|
10
|
+
options = [template, :release]
|
|
11
|
+
project_build_settings(options)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def target_debug_settings(project, target, template)
|
|
15
|
+
options = [template, target.product_type_uti, :debug]
|
|
16
|
+
target_build_settings(project, target, options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def target_release_settings(project, target, template)
|
|
20
|
+
options = [template, target.product_type_uti, :release]
|
|
21
|
+
target_build_settings(project, target, options)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def settings(constants, options)
|
|
27
|
+
all_constant_settings = {}
|
|
28
|
+
settings_combinations = options.all_combinations
|
|
29
|
+
settings_combinations.each do |combination|
|
|
30
|
+
constant_settings = constants[combination]
|
|
31
|
+
all_constant_settings.merge! constant_settings if constant_settings
|
|
32
|
+
end
|
|
33
|
+
all_constant_settings
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def project_build_settings(options)
|
|
37
|
+
project_settings = {
|
|
38
|
+
[:debug] => {
|
|
39
|
+
'ENABLE_TESTABILITY' => 'YES'
|
|
40
|
+
}.freeze
|
|
41
|
+
}.freeze
|
|
42
|
+
settings(project_settings, options)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def target_build_settings(project, target, options)
|
|
46
|
+
target_settings = {
|
|
47
|
+
[] => {
|
|
48
|
+
'INFOPLIST_FILE' => "#{target.group_name}/Info.plist"
|
|
49
|
+
}.freeze,
|
|
50
|
+
[:ios] => {
|
|
51
|
+
'TARGETED_DEVICE_FAMILY' => '1,2'
|
|
52
|
+
}.freeze,
|
|
53
|
+
[:application] => {
|
|
54
|
+
'PRODUCT_BUNDLE_IDENTIFIER' => "com.rswift.#{target.name}"
|
|
55
|
+
}.freeze,
|
|
56
|
+
[:unit_test_bundle] => {
|
|
57
|
+
'PRODUCT_BUNDLE_IDENTIFIER' => "com.rswift.#{target.name}",
|
|
58
|
+
'BUNDLE_LOADER' => '$(TEST_HOST)',
|
|
59
|
+
}.freeze,
|
|
60
|
+
[:watch2_app] => {
|
|
61
|
+
'PRODUCT_BUNDLE_IDENTIFIER' => "com.rswift.#{project.app_target}.watchkitapp"
|
|
62
|
+
}.freeze,
|
|
63
|
+
[:watch2_extension] => {
|
|
64
|
+
'PRODUCT_BUNDLE_IDENTIFIER' => "com.rswift.#{project.app_target}.watchkitapp.watchkitextension"
|
|
65
|
+
}.freeze,
|
|
66
|
+
[:ios, :unit_test_bundle] => {
|
|
67
|
+
'TEST_HOST' => "$(BUILT_PRODUCTS_DIR)/#{project.app_target.name}.app/#{project.app_target.name}"
|
|
68
|
+
}.freeze,
|
|
69
|
+
[:osx, :unit_test_bundle] => {
|
|
70
|
+
'TEST_HOST' => "$(BUILT_PRODUCTS_DIR)/#{project.app_target.name}.app/Contents/MacOS/#{project.app_target.name}",
|
|
71
|
+
'LD_RUNPATH_SEARCH_PATHS' => %w($(inherited) @loader_path/../Frameworks @executable_path/../Frameworks),
|
|
72
|
+
'COMBINE_HIDPI_IMAGES' => 'YES'
|
|
73
|
+
}.freeze,
|
|
74
|
+
[:tvos, :application] => {
|
|
75
|
+
'LD_RUNPATH_SEARCH_PATHS' => %w($(inherited) @executable_path/Frameworks)
|
|
76
|
+
}.freeze,
|
|
77
|
+
[:tvos, :unit_test_bundle] => {
|
|
78
|
+
'TEST_HOST' => "$(BUILT_PRODUCTS_DIR)/#{project.app_target.name}.app/#{project.app_target.name}"
|
|
79
|
+
}.freeze
|
|
80
|
+
}.freeze
|
|
81
|
+
settings(target_settings, options)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|