cocoapods-packager-qcloud 1.5.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.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +4 -0
  4. data/.idea/.rakeTasks +7 -0
  5. data/.idea/misc.xml +4 -0
  6. data/.idea/modules.xml +8 -0
  7. data/.idea/vcs.xml +6 -0
  8. data/.rubocop-cocoapods.yml +71 -0
  9. data/.rubocop.yml +38 -0
  10. data/.travis.yml +9 -0
  11. data/Gemfile +12 -0
  12. data/Gemfile.lock +121 -0
  13. data/LICENSE +22 -0
  14. data/README.md +42 -0
  15. data/Rakefile +12 -0
  16. data/cocoapods-packager.gemspec +23 -0
  17. data/lib/cocoapods-packager/builder.rb +298 -0
  18. data/lib/cocoapods-packager/framework.rb +66 -0
  19. data/lib/cocoapods-packager/mangle.rb +32 -0
  20. data/lib/cocoapods-packager/pod_utils.rb +265 -0
  21. data/lib/cocoapods-packager/spec_builder.rb +63 -0
  22. data/lib/cocoapods-packager/symbols.rb +35 -0
  23. data/lib/cocoapods-packager/user_interface/build_failed_report.rb +15 -0
  24. data/lib/cocoapods_packager.rb +5 -0
  25. data/lib/cocoapods_plugin.rb +8 -0
  26. data/lib/pod/command/package.rb +173 -0
  27. data/scripts/lstconst.sh +9 -0
  28. data/scripts/lstsym.sh +8 -0
  29. data/spec/command/error_spec.rb +74 -0
  30. data/spec/command/package_spec.rb +359 -0
  31. data/spec/command/rctl_spec.rb +13 -0
  32. data/spec/command/subspecs_spec.rb +30 -0
  33. data/spec/fixtures/Builder.podspec +25 -0
  34. data/spec/fixtures/CPDColors.podspec +19 -0
  35. data/spec/fixtures/FH.podspec +18 -0
  36. data/spec/fixtures/KFData.podspec +73 -0
  37. data/spec/fixtures/LibraryConsumerDemo/.gitignore +22 -0
  38. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.pbxproj +340 -0
  39. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  40. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/xcshareddata/xcschemes/LibraryConsumer.xcscheme +100 -0
  41. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.h +17 -0
  42. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.m +27 -0
  43. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/Info.plist +40 -0
  44. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/main.m +16 -0
  45. data/spec/fixtures/LibraryConsumerDemo/Podfile +5 -0
  46. data/spec/fixtures/LibraryDemo.podspec +14 -0
  47. data/spec/fixtures/NikeKit.podspec +19 -0
  48. data/spec/fixtures/OpenSans.podspec +18 -0
  49. data/spec/fixtures/PackagerTest/.gitignore +21 -0
  50. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.pbxproj +536 -0
  51. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  52. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/xcshareddata/xcschemes/PackagerTest.xcscheme +110 -0
  53. data/spec/fixtures/PackagerTest/PackagerTest.xcworkspace/contents.xcworkspacedata +1 -0
  54. data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.h +15 -0
  55. data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.m +49 -0
  56. data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
  57. data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
  58. data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Info.plist +38 -0
  59. data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Prefix.pch +16 -0
  60. data/spec/fixtures/PackagerTest/PackagerTest/en.lproj/InfoPlist.strings +2 -0
  61. data/spec/fixtures/PackagerTest/PackagerTest/main.m +18 -0
  62. data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests-Info.plist +22 -0
  63. data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests.m +34 -0
  64. data/spec/fixtures/PackagerTest/PackagerTestTests/en.lproj/InfoPlist.strings +2 -0
  65. data/spec/fixtures/PackagerTest/Podfile +10 -0
  66. data/spec/fixtures/PackagerTest/Podfile.lock +32 -0
  67. data/spec/fixtures/Weakly.podspec +13 -0
  68. data/spec/fixtures/a.podspec +19 -0
  69. data/spec/fixtures/foo-bar.podspec +19 -0
  70. data/spec/fixtures/layer-client-messaging-schema.podspec +13 -0
  71. data/spec/integration/project_spec.rb +70 -0
  72. data/spec/pod/utils_spec.rb +58 -0
  73. data/spec/spec_helper.rb +50 -0
  74. data/spec/specification/builder_spec.rb +40 -0
  75. data/spec/specification/spec_builder_spec.rb +61 -0
  76. data/spec/user_interface/build_failed_report_spec.rb +11 -0
  77. metadata +232 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fd15212d1367e8950b8fdb41f45157ba41c19e90
4
+ data.tar.gz: 1082281ae83ff5e3a82132207a405b69b7534fe2
5
+ SHA512:
6
+ metadata.gz: 6b050ad065cf9186936a2b471972f03955f19747066da3426412b82c0de3711064e640e4e7c44b6d364236af9d994ee3ef6897c1bd99060d7ba5a1d67ee36906
7
+ data.tar.gz: f61027a7e2c4936e9ff0906ab0a5af06186bd171cd23a40c89b87faa46d6d3536e4e99b5872544022c1062c1cfca18fc0c328865c9e7b2f6bb2266690a0ed290
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ coverage
2
+ pkg
3
+ .DS_Store
4
+ cocoapods-packager-1.5.0.gem
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build cocoapods-packager-qcloud-1.5.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install cocoapods-packager-qcloud-1.5.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install cocoapods-packager-qcloud-1.5.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v1.5.0 and build and push cocoapods-packager-qcloud-1.5.0.gem to Rubygems" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Runs all the specs" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.4.0" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/cocoapods-packager.iml" filepath="$PROJECT_DIR$/.idea/cocoapods-packager.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -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
@@ -0,0 +1,9 @@
1
+ osx_image: xcode7.3
2
+ language: objective-c
3
+ cache: bundler
4
+ before_install:
5
+ - bundle install
6
+ - bundle exec pod repo update --silent
7
+ script:
8
+ - bundle exec rake spec
9
+ - bundle exec rubocop
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'bacon'
7
+ gem 'mocha-on-bacon'
8
+ gem 'mocha', '~> 0.11.4'
9
+ gem 'prettybacon'
10
+ gem 'coveralls', :require => false
11
+ gem 'rubocop'
12
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,121 @@
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
+ activesupport (4.2.7.1)
11
+ i18n (~> 0.7)
12
+ json (~> 1.7, >= 1.7.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ ast (2.3.0)
17
+ bacon (1.2.0)
18
+ claide (1.0.1)
19
+ cocoapods (1.1.1)
20
+ activesupport (>= 4.0.2, < 5)
21
+ claide (>= 1.0.1, < 2.0)
22
+ cocoapods-core (= 1.1.1)
23
+ cocoapods-deintegrate (>= 1.0.1, < 2.0)
24
+ cocoapods-downloader (>= 1.1.2, < 2.0)
25
+ cocoapods-plugins (>= 1.0.0, < 2.0)
26
+ cocoapods-search (>= 1.0.0, < 2.0)
27
+ cocoapods-stats (>= 1.0.0, < 2.0)
28
+ cocoapods-trunk (>= 1.1.1, < 2.0)
29
+ cocoapods-try (>= 1.1.0, < 2.0)
30
+ colored (~> 1.2)
31
+ escape (~> 0.0.4)
32
+ fourflusher (~> 2.0.1)
33
+ gh_inspector (~> 1.0)
34
+ molinillo (~> 0.5.1)
35
+ nap (~> 1.0)
36
+ xcodeproj (>= 1.3.3, < 2.0)
37
+ cocoapods-core (1.1.1)
38
+ activesupport (>= 4.0.2, < 5)
39
+ fuzzy_match (~> 2.0.4)
40
+ nap (~> 1.0)
41
+ cocoapods-deintegrate (1.0.1)
42
+ cocoapods-downloader (1.1.2)
43
+ cocoapods-plugins (1.0.0)
44
+ nap
45
+ cocoapods-search (1.0.0)
46
+ cocoapods-stats (1.0.0)
47
+ cocoapods-trunk (1.1.1)
48
+ nap (>= 0.8, < 2.0)
49
+ netrc (= 0.7.8)
50
+ cocoapods-try (1.1.0)
51
+ colored (1.2)
52
+ coveralls (0.8.14)
53
+ json (>= 1.8, < 3)
54
+ simplecov (~> 0.12.0)
55
+ term-ansicolor (~> 1.3)
56
+ thor (~> 0.19.1)
57
+ tins (~> 1.6.0)
58
+ docile (1.1.5)
59
+ escape (0.0.4)
60
+ fourflusher (2.0.1)
61
+ fuzzy_match (2.0.4)
62
+ gh_inspector (1.0.2)
63
+ i18n (0.7.0)
64
+ json (1.8.3)
65
+ metaclass (0.0.4)
66
+ minitest (5.9.1)
67
+ mocha (0.11.4)
68
+ metaclass (~> 0.0.1)
69
+ mocha-on-bacon (0.2.1)
70
+ mocha (>= 0.9.8)
71
+ molinillo (0.5.2)
72
+ nap (1.1.0)
73
+ netrc (0.7.8)
74
+ parser (2.3.1.2)
75
+ ast (~> 2.2)
76
+ powerpack (0.1.1)
77
+ prettybacon (0.0.2)
78
+ bacon (~> 1.2)
79
+ rainbow (2.1.0)
80
+ rake (11.2.2)
81
+ rubocop (0.41.2)
82
+ parser (>= 2.3.1.1, < 3.0)
83
+ powerpack (~> 0.1)
84
+ rainbow (>= 1.99.1, < 3.0)
85
+ ruby-progressbar (~> 1.7)
86
+ unicode-display_width (~> 1.0, >= 1.0.1)
87
+ ruby-progressbar (1.8.1)
88
+ simplecov (0.12.0)
89
+ docile (~> 1.1.0)
90
+ json (>= 1.8, < 3)
91
+ simplecov-html (~> 0.10.0)
92
+ simplecov-html (0.10.0)
93
+ term-ansicolor (1.3.2)
94
+ tins (~> 1.0)
95
+ thor (0.19.1)
96
+ thread_safe (0.3.5)
97
+ tins (1.6.0)
98
+ tzinfo (1.2.2)
99
+ thread_safe (~> 0.1)
100
+ unicode-display_width (1.1.0)
101
+ xcodeproj (1.3.3)
102
+ activesupport (>= 3)
103
+ claide (>= 1.0.1, < 2.0)
104
+ colored (~> 1.2)
105
+
106
+ PLATFORMS
107
+ ruby
108
+
109
+ DEPENDENCIES
110
+ bacon
111
+ bundler (~> 1.3)
112
+ cocoapods-packager!
113
+ coveralls
114
+ mocha (~> 0.11.4)
115
+ mocha-on-bacon
116
+ prettybacon
117
+ rake
118
+ rubocop
119
+
120
+ BUNDLED WITH
121
+ 1.13.5
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,12 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :spec do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task :default => :spec
@@ -0,0 +1,23 @@
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-qcloud'
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
+ spec.add_dependency "qricker", "~> 0"
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,298 @@
1
+ module Pod
2
+ class Builder
3
+ def initialize(source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps)
4
+ @source_dir = source_dir
5
+ @static_sandbox_root = static_sandbox_root
6
+ @dynamic_sandbox_root = dynamic_sandbox_root
7
+ @public_headers_root = public_headers_root
8
+ @spec = spec
9
+ @embedded = embedded
10
+ @mangle = mangle
11
+ @dynamic = dynamic
12
+ @config = config
13
+ @bundle_identifier = bundle_identifier
14
+ @exclude_deps = exclude_deps
15
+ end
16
+
17
+ def build(platform, library)
18
+ if library
19
+ build_static_library(platform)
20
+ else
21
+ build_framework(platform)
22
+ end
23
+ end
24
+
25
+ def build_static_library(platform)
26
+ UI.puts("Building static library #{@spec} with configuration #{@config}")
27
+
28
+ defines = compile(platform)
29
+ build_sim_libraries(platform, defines)
30
+
31
+ platform_path = Pathname.new(platform.name.to_s)
32
+ platform_path.mkdir unless platform_path.exist?
33
+ build_library(platform, defines, platform_path + Pathname.new("lib#{@spec.name}.a"))
34
+ end
35
+
36
+ def build_framework(platform)
37
+ UI.puts("Building framework #{@spec} with configuration #{@config}")
38
+
39
+ defines = compile(platform)
40
+ build_sim_libraries(platform, defines)
41
+
42
+ if @dynamic
43
+ build_dynamic_framework(platform, defines, "#{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name}")
44
+ else
45
+ create_framework(platform.name.to_s)
46
+ build_library(platform, defines, @fwk.versions_path + Pathname.new(@spec.name))
47
+ copy_headers
48
+ copy_license
49
+ end
50
+
51
+ copy_resources(platform)
52
+ end
53
+
54
+ def link_embedded_resources
55
+ target_path = @fwk.root_path + Pathname.new('Resources')
56
+ target_path.mkdir unless target_path.exist?
57
+
58
+ Dir.glob(@fwk.resources_path.to_s + '/*').each do |resource|
59
+ resource = Pathname.new(resource).relative_path_from(target_path)
60
+ `ln -sf #{resource} #{target_path}`
61
+ end
62
+ end
63
+
64
+ private
65
+
66
+ def build_dynamic_framework(platform, defines, output)
67
+ UI.puts("Building dynamic Framework #{@spec} with configuration #{@config}")
68
+
69
+ if @bundle_identifier
70
+ defines = "#{defines} PRODUCT_BUNDLE_IDENTIFIER='#{@bundle_identifier}'"
71
+ end
72
+
73
+ clean_directory_for_dynamic_build
74
+ if platform.name == :ios
75
+ build_dynamic_framework_for_ios(platform, defines, output)
76
+ else
77
+ build_dynamic_framework_for_mac(platform, defines, output)
78
+ end
79
+ end
80
+
81
+ def build_library(platform, defines, output)
82
+ static_libs = static_libs_in_sandbox
83
+
84
+ if platform.name == :ios
85
+ build_static_lib_for_ios(static_libs, defines, output)
86
+ else
87
+ build_static_lib_for_mac(static_libs, output)
88
+ end
89
+ end
90
+
91
+ def build_dynamic_framework_for_ios(platform, defines, output)
92
+ # Specify frameworks to link and search paths
93
+ linker_flags = static_linker_flags_in_sandbox
94
+ defines = "#{defines} OTHER_LDFLAGS='$(inherited) #{linker_flags.join(' ')}'"
95
+
96
+ # Build Target Dynamic Framework for both device and Simulator
97
+ device_defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build\""
98
+ device_options = ios_build_options << ' -sdk iphoneos'
99
+ xcodebuild(device_defines, device_options, 'build', @spec.name.to_s, @dynamic_sandbox_root.to_s)
100
+
101
+ sim_defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build-sim\" ONLY_ACTIVE_ARCH=NO"
102
+ xcodebuild(sim_defines, '-sdk iphonesimulator', 'build-sim', @spec.name.to_s, @dynamic_sandbox_root.to_s)
103
+
104
+ # Combine architectures
105
+ `lipo #{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name} #{@dynamic_sandbox_root}/build-sim/#{@spec.name}.framework/#{@spec.name} -create -output #{output}`
106
+
107
+ FileUtils.mkdir(platform.name.to_s)
108
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework #{platform.name}`
109
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework.dSYM #{platform.name}`
110
+ end
111
+
112
+ def build_dynamic_framework_for_mac(platform, defines, _output)
113
+ # Specify frameworks to link and search paths
114
+ linker_flags = static_linker_flags_in_sandbox
115
+ defines = "#{defines} OTHER_LDFLAGS=\"#{linker_flags.join(' ')}\""
116
+
117
+ # Build Target Dynamic Framework for osx
118
+ defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build\""
119
+ xcodebuild(defines, nil, 'build', @spec.name.to_s, @dynamic_sandbox_root.to_s)
120
+
121
+ FileUtils.mkdir(platform.name.to_s)
122
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework #{platform.name}`
123
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework.dSYM #{platform.name}`
124
+ end
125
+
126
+ def build_sim_libraries(platform, defines)
127
+ if platform.name == :ios
128
+ xcodebuild(defines, '-sdk iphonesimulator', 'build-sim')
129
+ end
130
+ end
131
+
132
+ def build_static_lib_for_ios(static_libs, _defines, output)
133
+ return if static_libs.count == 0
134
+ `libtool -static -o #{@static_sandbox_root}/build/package.a #{static_libs.join(' ')}`
135
+
136
+ sim_libs = static_libs_in_sandbox('build-sim')
137
+ `libtool -static -o #{@static_sandbox_root}/build-sim/package.a #{sim_libs.join(' ')}`
138
+
139
+ `lipo #{@static_sandbox_root}/build/package.a #{@static_sandbox_root}/build-sim/package.a -create -output #{output}`
140
+ end
141
+
142
+ def build_static_lib_for_mac(static_libs, output)
143
+ return if static_libs.count == 0
144
+ `libtool -static -o #{output} #{static_libs.join(' ')}`
145
+ end
146
+
147
+ def build_with_mangling(platform, options)
148
+ UI.puts 'Mangling symbols'
149
+ defines = Symbols.mangle_for_pod_dependencies(@spec.name, @static_sandbox_root)
150
+ defines << ' ' << @spec.consumer(platform).compiler_flags.join(' ')
151
+
152
+ UI.puts 'Building mangled framework'
153
+ xcodebuild(defines, options)
154
+ defines
155
+ end
156
+
157
+ def clean_directory_for_dynamic_build
158
+ # Remove static headers to avoid duplicate declaration conflicts
159
+ FileUtils.rm_rf("#{@static_sandbox_root}/Headers/Public/#{@spec.name}")
160
+ FileUtils.rm_rf("#{@static_sandbox_root}/Headers/Private/#{@spec.name}")
161
+
162
+ # Equivalent to removing derrived data
163
+ FileUtils.rm_rf('Pods/build')
164
+ end
165
+
166
+ def compile(platform)
167
+ defines = "GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_#{@spec.name}=PodsDummy_PodPackage_#{@spec.name}'"
168
+ defines << ' ' << @spec.consumer(platform).compiler_flags.join(' ')
169
+
170
+ if platform.name == :ios
171
+ options = ios_build_options
172
+ end
173
+
174
+ xcodebuild(defines, options)
175
+
176
+ if @mangle
177
+ return build_with_mangling(platform, options)
178
+ end
179
+
180
+ defines
181
+ end
182
+
183
+ def copy_headers
184
+ headers_source_root = "#{@public_headers_root}/#{@spec.name}"
185
+
186
+ Dir.glob("#{headers_source_root}/**/*.h").
187
+ each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }
188
+
189
+ # If custom 'module_map' is specified add it to the framework distribution
190
+ # otherwise check if a header exists that is equal to 'spec.name', if so
191
+ # create a default 'module_map' one using it.
192
+ if !@spec.module_map.nil?
193
+ module_map_file = "#{@static_sandbox_root}/#{@spec.name}/#{@spec.module_map}"
194
+ module_map = File.read(module_map_file) if Pathname(module_map_file).exist?
195
+ elsif File.exist?("#{@public_headers_root}/#{@spec.name}/#{@spec.name}.h")
196
+ module_map = <<MAP
197
+ framework module #{@spec.name} {
198
+ umbrella header "#{@spec.name}.h"
199
+
200
+ export *
201
+ module * { export * }
202
+ }
203
+ MAP
204
+ end
205
+
206
+ unless module_map.nil?
207
+ @fwk.module_map_path.mkpath unless @fwk.module_map_path.exist?
208
+ File.write("#{@fwk.module_map_path}/module.modulemap", module_map)
209
+ end
210
+ end
211
+
212
+ def copy_license
213
+ license_file = @spec.license[:file] || 'LICENSE'
214
+ `cp "#{license_file}" .` if Pathname(license_file).exist?
215
+ end
216
+
217
+ def copy_resources(platform)
218
+ bundles = Dir.glob("#{@static_sandbox_root}/build/*.bundle")
219
+ if @dynamic
220
+ resources_path = "ios/#{@spec.name}.framework"
221
+ `cp -rp #{@static_sandbox_root}/build/*.bundle #{resources_path} 2>&1`
222
+ else
223
+ `cp -rp #{@static_sandbox_root}/build/*.bundle #{@fwk.resources_path} 2>&1`
224
+ resources = expand_paths(@spec.consumer(platform).resources)
225
+ if resources.count == 0 && bundles.count == 0
226
+ @fwk.delete_resources
227
+ return
228
+ end
229
+ if resources.count > 0
230
+ `cp -rp #{resources.join(' ')} #{@fwk.resources_path}`
231
+ end
232
+ end
233
+ end
234
+
235
+ def create_framework(platform)
236
+ @fwk = Framework::Tree.new(@spec.name, platform, @embedded)
237
+ @fwk.make
238
+ end
239
+
240
+ def dependency_count
241
+ count = @spec.dependencies.count
242
+
243
+ @spec.subspecs.each do |subspec|
244
+ count += subspec.dependencies.count
245
+ end
246
+
247
+ count
248
+ end
249
+
250
+ def expand_paths(path_specs)
251
+ path_specs.map do |path_spec|
252
+ Dir.glob(File.join(@source_dir, path_spec))
253
+ end
254
+ end
255
+
256
+ def static_libs_in_sandbox(build_dir = 'build')
257
+ if @exclude_deps
258
+ UI.puts 'Excluding dependencies'
259
+ Dir.glob("#{@static_sandbox_root}/#{build_dir}/lib#{@spec.name}.a")
260
+ else
261
+ Dir.glob("#{@static_sandbox_root}/#{build_dir}/lib*.a")
262
+ end
263
+ end
264
+
265
+ def static_linker_flags_in_sandbox
266
+ linker_flags = static_libs_in_sandbox.map do |lib|
267
+ lib.slice!('lib')
268
+ lib_flag = lib.chomp('.a').split('/').last
269
+ "-l#{lib_flag}"
270
+ end
271
+ linker_flags.reject { |e| e == "-l#{@spec.name}" || e == '-lPods-packager' }
272
+ end
273
+
274
+ def ios_build_options
275
+ "ARCHS=\'x86_64 i386 arm64 armv7 armv7s\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'"
276
+ end
277
+
278
+ def xcodebuild(defines = '', args = '', build_dir = 'build', target = 'Pods-packager', project_root = @static_sandbox_root, config = @config)
279
+ if defined?(Pod::DONT_CODESIGN)
280
+ args = "#{args} CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO"
281
+ end
282
+
283
+ command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{config} -target #{target} -project #{project_root}/Pods.xcodeproj 2>&1"
284
+ output = `#{command}`.lines.to_a
285
+
286
+ if $?.exitstatus != 0
287
+ puts UI::BuildFailedReport.report(command, output)
288
+
289
+ # Note: We use `Process.exit` here because it fires a `SystemExit`
290
+ # exception, which gives the caller a chance to clean up before the
291
+ # process terminates.
292
+ #
293
+ # See http://ruby-doc.org/core-1.9.3/Process.html#method-c-exit
294
+ Process.exit
295
+ end
296
+ end
297
+ end
298
+ end