cocoapods-packager-pro 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +3 -0
- data/.rubocop-cocoapods.yml +71 -0
- data/.rubocop.yml +38 -0
- data/.travis.yml +9 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +129 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/Rakefile +12 -0
- data/cocoapods-packager.gemspec +22 -0
- data/lib/cocoapods-packager/builder.rb +339 -0
- data/lib/cocoapods-packager/framework.rb +66 -0
- data/lib/cocoapods-packager/mangle.rb +32 -0
- data/lib/cocoapods-packager/pod_utils.rb +232 -0
- data/lib/cocoapods-packager/spec_builder.rb +63 -0
- data/lib/cocoapods-packager/symbols.rb +42 -0
- data/lib/cocoapods-packager/user_interface/build_failed_report.rb +15 -0
- data/lib/cocoapods_packager.rb +5 -0
- data/lib/cocoapods_plugin.rb +8 -0
- data/lib/pod/command/package.rb +177 -0
- data/scripts/lstconst.sh +9 -0
- data/scripts/lstsym.sh +8 -0
- data/spec/command/error_spec.rb +81 -0
- data/spec/command/package_spec.rb +410 -0
- data/spec/command/subspecs_spec.rb +30 -0
- data/spec/fixtures/Archs.podspec +13 -0
- data/spec/fixtures/Builder.podspec +25 -0
- data/spec/fixtures/CPDColors.podspec +19 -0
- data/spec/fixtures/FH.podspec +18 -0
- data/spec/fixtures/KFData.podspec +73 -0
- data/spec/fixtures/LibraryConsumerDemo/.gitignore +22 -0
- data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.pbxproj +343 -0
- data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/xcshareddata/xcschemes/LibraryConsumer.xcscheme +100 -0
- data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.h +17 -0
- data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.m +27 -0
- data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/Info.plist +40 -0
- data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/main.m +16 -0
- data/spec/fixtures/LibraryConsumerDemo/Podfile +5 -0
- data/spec/fixtures/LibraryDemo.podspec +14 -0
- data/spec/fixtures/LocalSources/LICENSE +0 -0
- data/spec/fixtures/LocalSources/LocalNikeKit.h +4 -0
- data/spec/fixtures/LocalSources/LocalNikeKit.m +9 -0
- data/spec/fixtures/LocalSources/LocalNikeKit.podspec +19 -0
- data/spec/fixtures/NikeKit.podspec +19 -0
- data/spec/fixtures/OpenSans.podspec +18 -0
- data/spec/fixtures/PackagerTest/.gitignore +21 -0
- data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.pbxproj +539 -0
- data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/xcshareddata/xcschemes/PackagerTest.xcscheme +110 -0
- data/spec/fixtures/PackagerTest/PackagerTest.xcworkspace/contents.xcworkspacedata +1 -0
- data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.h +15 -0
- data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.m +49 -0
- data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Info.plist +38 -0
- data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Prefix.pch +16 -0
- data/spec/fixtures/PackagerTest/PackagerTest/en.lproj/InfoPlist.strings +2 -0
- data/spec/fixtures/PackagerTest/PackagerTest/main.m +18 -0
- data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests-Info.plist +22 -0
- data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests.m +34 -0
- data/spec/fixtures/PackagerTest/PackagerTestTests/en.lproj/InfoPlist.strings +2 -0
- data/spec/fixtures/PackagerTest/Podfile +10 -0
- data/spec/fixtures/PackagerTest/Podfile.lock +32 -0
- data/spec/fixtures/Weakly.podspec +13 -0
- data/spec/fixtures/a.podspec +19 -0
- data/spec/fixtures/foo-bar.podspec +19 -0
- data/spec/fixtures/layer-client-messaging-schema.podspec +13 -0
- data/spec/integration/project_spec.rb +70 -0
- data/spec/pod/utils_spec.rb +58 -0
- data/spec/spec_helper.rb +50 -0
- data/spec/specification/builder_spec.rb +43 -0
- data/spec/specification/spec_builder_spec.rb +61 -0
- data/spec/user_interface/build_failed_report_spec.rb +11 -0
- metadata +222 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1966d3ab78af7c1c6fad2135604ff730c751f968
|
4
|
+
data.tar.gz: 1372b9b2e6b096aa628d2ba00d4e1b7715dea5c6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2dd4caac65ea6c009116ae615ea9ca04bdd4923d3cbea91b9651b37fdb5f9a8a4f681cf7de87587c93c96d3cc275c6a08b7a868c7186f08bbbcf65e83cfb653d
|
7
|
+
data.tar.gz: ff89c0786e84dde2a31337dfb1b7b229ee54093ad3496983e4849f4bf0d40212399ffcd2f0a87c3000af2c1d36ebae53e56efe8f8c53a68822f75cd5e660c7b7
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- Rakefile
|
4
|
+
- Gemfile
|
5
|
+
- ./*.gemspec
|
6
|
+
Exclude:
|
7
|
+
- spec/fixtures/**/*
|
8
|
+
- vendor/**/*
|
9
|
+
|
10
|
+
# At the moment not ready to be used
|
11
|
+
# https://github.com/bbatsov/rubocop/issues/947
|
12
|
+
Documentation:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
#- CocoaPods -----------------------------------------------------------------#
|
16
|
+
|
17
|
+
# We adopted raise instead of fail.
|
18
|
+
SignalException:
|
19
|
+
EnforcedStyle: only_raise
|
20
|
+
|
21
|
+
# They are idiomatic
|
22
|
+
AssignmentInCondition:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
# Allow backticks
|
26
|
+
AsciiComments:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Indentation clarifies logic branches in implementations
|
30
|
+
IfUnlessModifier:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
# No enforced convention here.
|
34
|
+
SingleLineBlockParams:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
# We only add the comment when needed.
|
38
|
+
Encoding:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
#- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
|
42
|
+
|
43
|
+
HashSyntax:
|
44
|
+
EnforcedStyle: hash_rockets
|
45
|
+
|
46
|
+
Lambda:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
DotPosition:
|
50
|
+
EnforcedStyle: trailing
|
51
|
+
|
52
|
+
#- CocoaPods specs -----------------------------------------------------------#
|
53
|
+
|
54
|
+
# Allow for `should.match /regexp/`.
|
55
|
+
AmbiguousRegexpLiteral:
|
56
|
+
Exclude:
|
57
|
+
- spec/**/*
|
58
|
+
|
59
|
+
# Allow `object.should == object` syntax.
|
60
|
+
Void:
|
61
|
+
Exclude:
|
62
|
+
- spec/**/*
|
63
|
+
|
64
|
+
ClassAndModuleChildren:
|
65
|
+
Exclude:
|
66
|
+
- spec/**/*
|
67
|
+
|
68
|
+
UselessComparison:
|
69
|
+
Exclude:
|
70
|
+
- spec/**/*
|
71
|
+
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop-cocoapods.yml
|
3
|
+
|
4
|
+
#- Core -----------------------------------------------------------------------
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
Exclude:
|
8
|
+
- spec/**/*
|
9
|
+
- spec/fixtures/**/*
|
10
|
+
- vendor/**/*
|
11
|
+
|
12
|
+
Style/Tab:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
LineLength:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
ClassLength:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
MethodLength:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Metrics/CyclomaticComplexity:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Metrics/PerceivedComplexity:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Metrics/ParameterLists:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/SpecialGlobalVars:
|
37
|
+
EnforcedStyle: use_perl_names
|
38
|
+
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-packager (1.5.0)
|
5
|
+
cocoapods (>= 1.1.1, < 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
CFPropertyList (2.3.6)
|
11
|
+
activesupport (4.2.10)
|
12
|
+
i18n (~> 0.7)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
ast (2.2.0)
|
17
|
+
atomos (0.1.2)
|
18
|
+
bacon (1.2.0)
|
19
|
+
claide (1.0.2)
|
20
|
+
cocoapods (1.4.0)
|
21
|
+
activesupport (>= 4.0.2, < 5)
|
22
|
+
claide (>= 1.0.2, < 2.0)
|
23
|
+
cocoapods-core (= 1.4.0)
|
24
|
+
cocoapods-deintegrate (>= 1.0.2, < 2.0)
|
25
|
+
cocoapods-downloader (>= 1.1.3, < 2.0)
|
26
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
27
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
28
|
+
cocoapods-stats (>= 1.0.0, < 2.0)
|
29
|
+
cocoapods-trunk (>= 1.3.0, < 2.0)
|
30
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
31
|
+
colored2 (~> 3.1)
|
32
|
+
escape (~> 0.0.4)
|
33
|
+
fourflusher (~> 2.0.1)
|
34
|
+
gh_inspector (~> 1.0)
|
35
|
+
molinillo (~> 0.6.4)
|
36
|
+
nap (~> 1.0)
|
37
|
+
ruby-macho (~> 1.1)
|
38
|
+
xcodeproj (>= 1.5.4, < 2.0)
|
39
|
+
cocoapods-core (1.4.0)
|
40
|
+
activesupport (>= 4.0.2, < 6)
|
41
|
+
fuzzy_match (~> 2.0.4)
|
42
|
+
nap (~> 1.0)
|
43
|
+
cocoapods-deintegrate (1.0.2)
|
44
|
+
cocoapods-downloader (1.1.3)
|
45
|
+
cocoapods-plugins (1.0.0)
|
46
|
+
nap
|
47
|
+
cocoapods-search (1.0.0)
|
48
|
+
cocoapods-stats (1.0.0)
|
49
|
+
cocoapods-trunk (1.3.0)
|
50
|
+
nap (>= 0.8, < 2.0)
|
51
|
+
netrc (~> 0.11)
|
52
|
+
cocoapods-try (1.1.0)
|
53
|
+
colored2 (3.1.2)
|
54
|
+
concurrent-ruby (1.0.5)
|
55
|
+
coveralls (0.8.21)
|
56
|
+
json (>= 1.8, < 3)
|
57
|
+
simplecov (~> 0.14.1)
|
58
|
+
term-ansicolor (~> 1.3)
|
59
|
+
thor (~> 0.19.4)
|
60
|
+
tins (~> 1.6)
|
61
|
+
docile (1.1.5)
|
62
|
+
escape (0.0.4)
|
63
|
+
fourflusher (2.0.1)
|
64
|
+
fuzzy_match (2.0.4)
|
65
|
+
gh_inspector (1.1.2)
|
66
|
+
i18n (0.9.5)
|
67
|
+
concurrent-ruby (~> 1.0)
|
68
|
+
json (2.1.0)
|
69
|
+
metaclass (0.0.4)
|
70
|
+
minitest (5.11.3)
|
71
|
+
mocha (1.2.1)
|
72
|
+
metaclass (~> 0.0.1)
|
73
|
+
mocha-on-bacon (0.2.3)
|
74
|
+
mocha (>= 0.13.0)
|
75
|
+
molinillo (0.6.4)
|
76
|
+
nanaimo (0.2.3)
|
77
|
+
nap (1.1.0)
|
78
|
+
netrc (0.11.0)
|
79
|
+
parser (2.3.0.6)
|
80
|
+
ast (~> 2.2)
|
81
|
+
powerpack (0.1.1)
|
82
|
+
prettybacon (0.0.2)
|
83
|
+
bacon (~> 1.2)
|
84
|
+
rainbow (2.1.0)
|
85
|
+
rake (10.5.0)
|
86
|
+
rubocop (0.37.2)
|
87
|
+
parser (>= 2.3.0.4, < 3.0)
|
88
|
+
powerpack (~> 0.1)
|
89
|
+
rainbow (>= 1.99.1, < 3.0)
|
90
|
+
ruby-progressbar (~> 1.7)
|
91
|
+
unicode-display_width (~> 0.3)
|
92
|
+
ruby-macho (1.1.0)
|
93
|
+
ruby-progressbar (1.7.5)
|
94
|
+
simplecov (0.14.1)
|
95
|
+
docile (~> 1.1.0)
|
96
|
+
json (>= 1.8, < 3)
|
97
|
+
simplecov-html (~> 0.10.0)
|
98
|
+
simplecov-html (0.10.2)
|
99
|
+
term-ansicolor (1.6.0)
|
100
|
+
tins (~> 1.0)
|
101
|
+
thor (0.19.4)
|
102
|
+
thread_safe (0.3.6)
|
103
|
+
tins (1.16.3)
|
104
|
+
tzinfo (1.2.5)
|
105
|
+
thread_safe (~> 0.1)
|
106
|
+
unicode-display_width (0.3.1)
|
107
|
+
xcodeproj (1.5.6)
|
108
|
+
CFPropertyList (~> 2.3.3)
|
109
|
+
atomos (~> 0.1.2)
|
110
|
+
claide (>= 1.0.2, < 2.0)
|
111
|
+
colored2 (~> 3.1)
|
112
|
+
nanaimo (~> 0.2.3)
|
113
|
+
|
114
|
+
PLATFORMS
|
115
|
+
ruby
|
116
|
+
|
117
|
+
DEPENDENCIES
|
118
|
+
bacon
|
119
|
+
bundler (~> 1.3)
|
120
|
+
cocoapods-packager!
|
121
|
+
coveralls
|
122
|
+
mocha
|
123
|
+
mocha-on-bacon
|
124
|
+
prettybacon
|
125
|
+
rake
|
126
|
+
rubocop
|
127
|
+
|
128
|
+
BUNDLED WITH
|
129
|
+
1.16.1
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
This project is licensed under the MIT license.
|
2
|
+
|
3
|
+
Copyright (c) 2014 Kyle Fuller, Boris Bügling and CocoaPods Dev Team
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# CocoaPods Packager
|
2
|
+
|
3
|
+
[![Build Status](http://img.shields.io/travis/CocoaPods/cocoapods-packager/master.svg?style=flat)](https://travis-ci.org/CocoaPods/cocoapods-packager)
|
4
|
+
[![Coverage Status](https://img.shields.io/coveralls/CocoaPods/cocoapods-packager.svg)](https://coveralls.io/r/CocoaPods/cocoapods-packager?branch=master)
|
5
|
+
[![Gem Version](http://img.shields.io/gem/v/cocoapods-packager.svg?style=flat)](http://badge.fury.io/rb/cocoapods-packager)
|
6
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/CocoaPods/cocoapods-packager.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-packager)
|
7
|
+
|
8
|
+
CocoaPods plugin which allows you to generate a framework or static library from a podspec.
|
9
|
+
|
10
|
+
This plugin is for CocoaPods *developers*, who need to distribute their Pods not only via CocoaPods, but also as frameworks or static libraries for people who do not use Pods.
|
11
|
+
|
12
|
+
## Why should I use Pods if I'm targeting developers who don't use Pods?
|
13
|
+
|
14
|
+
There are still a number of advantages to developing against a `podspec`, even if your public distribution is closed-source:
|
15
|
+
|
16
|
+
1. You can easily use the Pod in-house in an open-source style. This makes step-by-step debugging and multi-project development a breeze.
|
17
|
+
2. You can pull in third-party dependencies using CocoaPods. (CocoaPods Packager is even capable of mangling symbols to improve compatibility with any symbols that might appear in the integrating app.)
|
18
|
+
3. You can declaratively specify build settings (e.g. frameworks, compiler flags) in your `podspec`. This is easier to maintain and replicate than build settings embedded in your Xcode project.
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
```sh
|
23
|
+
$ gem install cocoapods-packager
|
24
|
+
```
|
25
|
+
|
26
|
+
or add a line to your Gemfile:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
gem "cocoapods-packager"
|
30
|
+
```
|
31
|
+
|
32
|
+
then run `bundle install`.
|
33
|
+
|
34
|
+
This installs Packager as a CocoaPods plugin.
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
```bash
|
39
|
+
$ pod package KFData.podspec
|
40
|
+
```
|
41
|
+
|
42
|
+
See also `pod --help`.
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_packager.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-packager-pro'
|
8
|
+
spec.version = Pod::Packager::VERSION
|
9
|
+
spec.authors = ['Kyle Fuller', 'Boris Bügling']
|
10
|
+
spec.summary = 'CocoaPods plugin which allows you to generate a framework or static library from a podspec.'
|
11
|
+
spec.homepage = 'https://github.com/CocoaPods/cocoapods-packager'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
spec.files = `git ls-files`.split($/)
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_dependency "cocoapods", '>= 1.1.1', '< 2.0'
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
@@ -0,0 +1,339 @@
|
|
1
|
+
module Pod
|
2
|
+
class Builder
|
3
|
+
def initialize(platform, static_installer, source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps)
|
4
|
+
@platform = platform
|
5
|
+
@static_installer = static_installer
|
6
|
+
@source_dir = source_dir
|
7
|
+
@static_sandbox_root = static_sandbox_root
|
8
|
+
@dynamic_sandbox_root = dynamic_sandbox_root
|
9
|
+
@public_headers_root = public_headers_root
|
10
|
+
@spec = spec
|
11
|
+
@embedded = embedded
|
12
|
+
@mangle = mangle
|
13
|
+
@dynamic = dynamic
|
14
|
+
@config = config
|
15
|
+
@bundle_identifier = bundle_identifier
|
16
|
+
@exclude_deps = exclude_deps
|
17
|
+
|
18
|
+
@file_accessors = @static_installer.pod_targets.select { |t| t.pod_name == @spec.name }.flat_map(&:file_accessors)
|
19
|
+
end
|
20
|
+
|
21
|
+
def build(package_type)
|
22
|
+
case package_type
|
23
|
+
when :static_library
|
24
|
+
build_static_library
|
25
|
+
when :static_framework
|
26
|
+
build_static_framework
|
27
|
+
when :dynamic_framework
|
28
|
+
build_dynamic_framework
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_static_library
|
33
|
+
UI.puts("Building static library #{@spec} with configuration #{@config}")
|
34
|
+
|
35
|
+
defines = compile
|
36
|
+
build_sim_libraries(defines)
|
37
|
+
|
38
|
+
platform_path = Pathname.new(@platform.name.to_s)
|
39
|
+
platform_path.mkdir unless platform_path.exist?
|
40
|
+
|
41
|
+
output = platform_path + "lib#{@spec.name}.a"
|
42
|
+
|
43
|
+
if @platform.name == :ios
|
44
|
+
build_static_library_for_ios(output)
|
45
|
+
else
|
46
|
+
build_static_library_for_mac(output)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_static_framework
|
51
|
+
UI.puts("Building static framework #{@spec} with configuration #{@config}")
|
52
|
+
|
53
|
+
defines = compile
|
54
|
+
build_sim_libraries(defines)
|
55
|
+
|
56
|
+
create_framework
|
57
|
+
output = @fwk.versions_path + Pathname.new(@spec.name)
|
58
|
+
|
59
|
+
if @platform.name == :ios
|
60
|
+
build_static_library_for_ios(output)
|
61
|
+
else
|
62
|
+
build_static_library_for_mac(output)
|
63
|
+
end
|
64
|
+
|
65
|
+
copy_headers
|
66
|
+
copy_license
|
67
|
+
copy_resources
|
68
|
+
end
|
69
|
+
|
70
|
+
def link_embedded_resources
|
71
|
+
target_path = @fwk.root_path + Pathname.new('Resources')
|
72
|
+
target_path.mkdir unless target_path.exist?
|
73
|
+
|
74
|
+
Dir.glob(@fwk.resources_path.to_s + '/*').each do |resource|
|
75
|
+
resource = Pathname.new(resource).relative_path_from(target_path)
|
76
|
+
`ln -sf #{resource} #{target_path}`
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def build_dynamic_framework
|
81
|
+
UI.puts("Building dynamic framework #{@spec} with configuration #{@config}")
|
82
|
+
|
83
|
+
defines = compile
|
84
|
+
build_sim_libraries(defines)
|
85
|
+
|
86
|
+
if @bundle_identifier
|
87
|
+
defines = "#{defines} PRODUCT_BUNDLE_IDENTIFIER='#{@bundle_identifier}'"
|
88
|
+
end
|
89
|
+
|
90
|
+
output = "#{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name}"
|
91
|
+
|
92
|
+
clean_directory_for_dynamic_build
|
93
|
+
if @platform.name == :ios
|
94
|
+
build_dynamic_framework_for_ios(defines, output)
|
95
|
+
else
|
96
|
+
build_dynamic_framework_for_mac(defines, output)
|
97
|
+
end
|
98
|
+
|
99
|
+
copy_resources
|
100
|
+
end
|
101
|
+
|
102
|
+
def build_dynamic_framework_for_ios(defines, output)
|
103
|
+
# Specify frameworks to link and search paths
|
104
|
+
linker_flags = static_linker_flags_in_sandbox
|
105
|
+
defines = "#{defines} OTHER_LDFLAGS='$(inherited) #{linker_flags.join(' ')}'"
|
106
|
+
|
107
|
+
# Build Target Dynamic Framework for both device and Simulator
|
108
|
+
device_defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build\""
|
109
|
+
device_options = ios_build_options << ' -sdk iphoneos'
|
110
|
+
xcodebuild(device_defines, device_options, 'build', @spec.name.to_s, @dynamic_sandbox_root.to_s)
|
111
|
+
|
112
|
+
sim_defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build-sim\" ONLY_ACTIVE_ARCH=NO"
|
113
|
+
xcodebuild(sim_defines, '-sdk iphonesimulator', 'build-sim', @spec.name.to_s, @dynamic_sandbox_root.to_s)
|
114
|
+
|
115
|
+
# Combine architectures
|
116
|
+
`lipo #{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name} #{@dynamic_sandbox_root}/build-sim/#{@spec.name}.framework/#{@spec.name} -create -output #{output}`
|
117
|
+
|
118
|
+
FileUtils.mkdir(@platform.name.to_s)
|
119
|
+
`mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework #{@platform.name}`
|
120
|
+
`mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework.dSYM #{@platform.name}`
|
121
|
+
end
|
122
|
+
|
123
|
+
def build_dynamic_framework_for_mac(defines, _output)
|
124
|
+
# Specify frameworks to link and search paths
|
125
|
+
linker_flags = static_linker_flags_in_sandbox
|
126
|
+
defines = "#{defines} OTHER_LDFLAGS=\"#{linker_flags.join(' ')}\""
|
127
|
+
|
128
|
+
# Build Target Dynamic Framework for osx
|
129
|
+
defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build\""
|
130
|
+
xcodebuild(defines, nil, 'build', @spec.name.to_s, @dynamic_sandbox_root.to_s)
|
131
|
+
|
132
|
+
FileUtils.mkdir(@platform.name.to_s)
|
133
|
+
`mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework #{@platform.name}`
|
134
|
+
`mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework.dSYM #{@platform.name}`
|
135
|
+
end
|
136
|
+
|
137
|
+
def build_sim_libraries(defines)
|
138
|
+
if @platform.name == :ios
|
139
|
+
xcodebuild(defines, '-sdk iphonesimulator', 'build-sim')
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def build_static_library_for_ios(output)
|
144
|
+
static_libs = static_libs_in_sandbox('build') + static_libs_in_sandbox('build-sim') + vendored_libraries
|
145
|
+
libs = ios_architectures.map do |arch|
|
146
|
+
library = "#{@static_sandbox_root}/build/package-#{arch}.a"
|
147
|
+
`libtool -arch_only #{arch} -static -o #{library} #{static_libs.join(' ')}`
|
148
|
+
library
|
149
|
+
end
|
150
|
+
|
151
|
+
`lipo -create -output #{output} #{libs.join(' ')}`
|
152
|
+
end
|
153
|
+
|
154
|
+
def build_static_library_for_mac(output)
|
155
|
+
static_libs = static_libs_in_sandbox + vendored_libraries
|
156
|
+
`libtool -static -o #{output} #{static_libs.join(' ')}`
|
157
|
+
end
|
158
|
+
|
159
|
+
def build_with_mangling(options)
|
160
|
+
UI.puts 'Mangling symbols'
|
161
|
+
defines = Symbols.mangle_for_pod_dependencies(@spec.name, @static_sandbox_root)
|
162
|
+
defines << ' ' << @spec.consumer(@platform).compiler_flags.join(' ')
|
163
|
+
|
164
|
+
UI.puts 'Building mangled framework'
|
165
|
+
xcodebuild(defines, options)
|
166
|
+
defines
|
167
|
+
end
|
168
|
+
|
169
|
+
def clean_directory_for_dynamic_build
|
170
|
+
# Remove static headers to avoid duplicate declaration conflicts
|
171
|
+
FileUtils.rm_rf("#{@static_sandbox_root}/Headers/Public/#{@spec.name}")
|
172
|
+
FileUtils.rm_rf("#{@static_sandbox_root}/Headers/Private/#{@spec.name}")
|
173
|
+
|
174
|
+
# Equivalent to removing derrived data
|
175
|
+
FileUtils.rm_rf('Pods/build')
|
176
|
+
end
|
177
|
+
|
178
|
+
def compile
|
179
|
+
defines = "GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_#{@spec.name}=PodsDummy_PodPackage_#{@spec.name}'"
|
180
|
+
defines << ' ' << @spec.consumer(@platform).compiler_flags.join(' ')
|
181
|
+
|
182
|
+
if @platform.name == :ios
|
183
|
+
options = ios_build_options
|
184
|
+
end
|
185
|
+
|
186
|
+
xcodebuild(defines, options)
|
187
|
+
|
188
|
+
if @mangle
|
189
|
+
return build_with_mangling(options)
|
190
|
+
end
|
191
|
+
|
192
|
+
defines
|
193
|
+
end
|
194
|
+
|
195
|
+
def copy_headers
|
196
|
+
headers_source_root = "#{@public_headers_root}/#{@spec.name}"
|
197
|
+
|
198
|
+
Dir.glob("#{headers_source_root}/**/*.h").
|
199
|
+
each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }
|
200
|
+
|
201
|
+
# If custom 'module_map' is specified add it to the framework distribution
|
202
|
+
# otherwise check if a header exists that is equal to 'spec.name', if so
|
203
|
+
# create a default 'module_map' one using it.
|
204
|
+
if !@spec.module_map.nil?
|
205
|
+
module_map_file = @file_accessors.flat_map(&:module_map).first
|
206
|
+
module_map = File.read(module_map_file) if Pathname(module_map_file).exist?
|
207
|
+
elsif File.exist?("#{@public_headers_root}/#{@spec.name}/#{@spec.name}.h")
|
208
|
+
module_map = <<MAP
|
209
|
+
framework module #{@spec.name} {
|
210
|
+
umbrella header "#{@spec.name}.h"
|
211
|
+
|
212
|
+
export *
|
213
|
+
module * { export * }
|
214
|
+
}
|
215
|
+
MAP
|
216
|
+
end
|
217
|
+
|
218
|
+
unless module_map.nil?
|
219
|
+
@fwk.module_map_path.mkpath unless @fwk.module_map_path.exist?
|
220
|
+
File.write("#{@fwk.module_map_path}/module.modulemap", module_map)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def copy_license
|
225
|
+
license_file = @spec.license[:file] || 'LICENSE'
|
226
|
+
`cp "#{license_file}" .` if Pathname(license_file).exist?
|
227
|
+
end
|
228
|
+
|
229
|
+
def copy_resources
|
230
|
+
bundles = Dir.glob("#{@static_sandbox_root}/build/*.bundle")
|
231
|
+
|
232
|
+
if @dynamic
|
233
|
+
resources_path = "ios/#{@spec.name}.framework"
|
234
|
+
`cp -rp #{@static_sandbox_root}/build/*.bundle #{resources_path} 2>&1`
|
235
|
+
else
|
236
|
+
`cp -rp #{@static_sandbox_root}/build/*.bundle #{@fwk.resources_path} 2>&1`
|
237
|
+
dependency_names = @static_installer.podfile.dependencies.map(&:name)
|
238
|
+
resources = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
|
239
|
+
if (dependency_names & [spec.name, @spec.name]).any?
|
240
|
+
expand_paths(spec.consumer(@platform).resources)
|
241
|
+
end
|
242
|
+
end.compact.uniq
|
243
|
+
if resources.count == 0 && bundles.count == 0
|
244
|
+
@fwk.delete_resources
|
245
|
+
return
|
246
|
+
end
|
247
|
+
if resources.count > 0
|
248
|
+
`cp -rp #{resources.join(' ')} #{@fwk.resources_path}`
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
def create_framework
|
254
|
+
@fwk = Framework::Tree.new(@spec.name, @platform.name.to_s, @embedded)
|
255
|
+
@fwk.make
|
256
|
+
end
|
257
|
+
|
258
|
+
def dependency_count
|
259
|
+
count = @spec.dependencies.count
|
260
|
+
|
261
|
+
@spec.subspecs.each do |subspec|
|
262
|
+
count += subspec.dependencies.count
|
263
|
+
end
|
264
|
+
|
265
|
+
count
|
266
|
+
end
|
267
|
+
|
268
|
+
def expand_paths(path_specs)
|
269
|
+
path_specs.map do |path_spec|
|
270
|
+
Dir.glob(File.join(@source_dir, path_spec))
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
def static_libs_in_sandbox(build_dir = 'build')
|
275
|
+
if @exclude_deps
|
276
|
+
UI.puts 'Excluding dependencies'
|
277
|
+
Dir.glob("#{@static_sandbox_root}/#{build_dir}/lib#{@spec.name}.a")
|
278
|
+
else
|
279
|
+
Dir.glob("#{@static_sandbox_root}/#{build_dir}/lib*.a")
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
def vendored_libraries
|
284
|
+
if @vendored_libraries
|
285
|
+
@vendored_libraries
|
286
|
+
end
|
287
|
+
file_accessors = if @exclude_deps
|
288
|
+
@file_accessors
|
289
|
+
else
|
290
|
+
@static_installer.pod_targets.flat_map(&:file_accessors)
|
291
|
+
end
|
292
|
+
libs = file_accessors.flat_map(&:vendored_static_frameworks).map { |f| f + f.basename('.*') } || []
|
293
|
+
libs += file_accessors.flat_map(&:vendored_static_libraries)
|
294
|
+
@vendored_libraries = libs.compact.map(&:to_s)
|
295
|
+
@vendored_libraries
|
296
|
+
end
|
297
|
+
|
298
|
+
def static_linker_flags_in_sandbox
|
299
|
+
linker_flags = static_libs_in_sandbox.map do |lib|
|
300
|
+
lib.slice!('lib')
|
301
|
+
lib_flag = lib.chomp('.a').split('/').last
|
302
|
+
"-l#{lib_flag}"
|
303
|
+
end
|
304
|
+
linker_flags.reject { |e| e == "-l#{@spec.name}" || e == '-lPods-packager' }
|
305
|
+
end
|
306
|
+
|
307
|
+
def ios_build_options
|
308
|
+
"ARCHS=\'#{ios_architectures.join(' ')}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'"
|
309
|
+
end
|
310
|
+
|
311
|
+
def ios_architectures
|
312
|
+
archs = %w(x86_64 i386 arm64 armv7 armv7s)
|
313
|
+
vendored_libraries.each do |library|
|
314
|
+
archs = `lipo -info #{library}`.split & archs
|
315
|
+
end
|
316
|
+
archs
|
317
|
+
end
|
318
|
+
|
319
|
+
def xcodebuild(defines = '', args = '', build_dir = 'build', target = 'Pods-packager', project_root = @static_sandbox_root, config = @config)
|
320
|
+
if defined?(Pod::DONT_CODESIGN)
|
321
|
+
args = "#{args} CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO"
|
322
|
+
end
|
323
|
+
|
324
|
+
command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{config} -target #{target} -project #{project_root}/Pods.xcodeproj 2>&1"
|
325
|
+
output = `#{command}`.lines.to_a
|
326
|
+
|
327
|
+
if $?.exitstatus != 0
|
328
|
+
puts UI::BuildFailedReport.report(command, output)
|
329
|
+
|
330
|
+
# Note: We use `Process.exit` here because it fires a `SystemExit`
|
331
|
+
# exception, which gives the caller a chance to clean up before the
|
332
|
+
# process terminates.
|
333
|
+
#
|
334
|
+
# See http://ruby-doc.org/core-1.9.3/Process.html#method-c-exit
|
335
|
+
Process.exit
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|