This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add amimono fork (again?), move everything up a level
- Loading branch information
Showing
120 changed files
with
560 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
osx_image: xcode10.1 | ||
language: objective-c | ||
script: cd Akku && CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ./build.sh | ||
script: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ./build.sh |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Submodule cocoapods-amimono
deleted from
8e3225
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
pkg | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in cocoapods-amimono.gemspec | ||
gemspec | ||
|
||
group :development do | ||
gem 'cocoapods', '>= 1.2.0' | ||
|
||
gem 'mocha' | ||
gem 'bacon' | ||
gem 'mocha-on-bacon' | ||
gem 'prettybacon' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
cocoapods-amimono (0.0.10) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
CFPropertyList (2.3.4) | ||
activesupport (4.2.7.1) | ||
i18n (~> 0.7) | ||
json (~> 1.7, >= 1.7.7) | ||
minitest (~> 5.1) | ||
thread_safe (~> 0.3, >= 0.3.4) | ||
tzinfo (~> 1.1) | ||
bacon (1.2.0) | ||
claide (1.0.1) | ||
cocoapods (1.2.0) | ||
activesupport (>= 4.0.2, < 5) | ||
claide (>= 1.0.1, < 2.0) | ||
cocoapods-core (= 1.2.0) | ||
cocoapods-deintegrate (>= 1.0.1, < 2.0) | ||
cocoapods-downloader (>= 1.1.3, < 2.0) | ||
cocoapods-plugins (>= 1.0.0, < 2.0) | ||
cocoapods-search (>= 1.0.0, < 2.0) | ||
cocoapods-stats (>= 1.0.0, < 2.0) | ||
cocoapods-trunk (>= 1.1.2, < 2.0) | ||
cocoapods-try (>= 1.1.0, < 2.0) | ||
colored (~> 1.2) | ||
escape (~> 0.0.4) | ||
fourflusher (~> 2.0.1) | ||
gh_inspector (~> 1.0) | ||
molinillo (~> 0.5.5) | ||
nap (~> 1.0) | ||
ruby-macho (~> 0.2.5) | ||
xcodeproj (>= 1.4.1, < 2.0) | ||
cocoapods-core (1.2.0) | ||
activesupport (>= 4.0.2, < 5) | ||
fuzzy_match (~> 2.0.4) | ||
nap (~> 1.0) | ||
cocoapods-deintegrate (1.0.1) | ||
cocoapods-downloader (1.1.3) | ||
cocoapods-plugins (1.0.0) | ||
nap | ||
cocoapods-search (1.0.0) | ||
cocoapods-stats (1.0.0) | ||
cocoapods-trunk (1.1.2) | ||
nap (>= 0.8, < 2.0) | ||
netrc (= 0.7.8) | ||
cocoapods-try (1.1.0) | ||
colored (1.2) | ||
escape (0.0.4) | ||
fourflusher (2.0.1) | ||
fuzzy_match (2.0.4) | ||
gh_inspector (1.0.2) | ||
i18n (0.7.0) | ||
json (1.8.3) | ||
metaclass (0.0.4) | ||
minitest (5.10.1) | ||
mocha (1.1.0) | ||
metaclass (~> 0.0.1) | ||
mocha-on-bacon (0.2.2) | ||
mocha (>= 0.13.0) | ||
molinillo (0.5.5) | ||
nanaimo (0.2.3) | ||
nap (1.1.0) | ||
netrc (0.7.8) | ||
prettybacon (0.0.2) | ||
bacon (~> 1.2) | ||
rake (11.2.2) | ||
ruby-macho (0.2.6) | ||
thread_safe (0.3.5) | ||
tzinfo (1.2.2) | ||
thread_safe (~> 0.1) | ||
xcodeproj (1.4.1) | ||
CFPropertyList (~> 2.3.3) | ||
activesupport (>= 3) | ||
claide (>= 1.0.1, < 2.0) | ||
colored (~> 1.2) | ||
nanaimo (~> 0.2.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bacon | ||
bundler (~> 1.3) | ||
cocoapods (>= 1.2.0) | ||
cocoapods-amimono! | ||
mocha | ||
mocha-on-bacon | ||
prettybacon | ||
rake | ||
|
||
BUNDLED WITH | ||
1.14.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2016 Renzo Crisóstomo <[email protected]> | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# cocoapods-amimono | ||
|
||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/Ruenzuo/res/master/amimono.gif" alt="amimono"/> | ||
</p> | ||
|
||
Move all dynamic frameworks symbols into the main executable. | ||
|
||
## Why would you want this plugin in your Podfile? | ||
|
||
Apple introduced dynamic linking on iOS 8 alongside with Swift. Shortly after, this was adopted by CocoaPods as a requirement to use Pods that contain Swift, because Xcode can't use static libraries with Swift. | ||
|
||
On iOS 9.1, a dyld crash affected the vast majority of apps that used a high number of dynamic frameworks. You can learn more about the issue on [artsy/eigen#1246](https://github.com/artsy/eigen/issues/1246). Although the issue was fixed on iOS 9.3.2, it was clear that having a high number of dynamic frameworks was not a good idea. During WWDC 2016, someone asked what would be the optimal number of dynamic frameworks on an iOS application and we got the following response: | ||
|
||
> Apple advises to use about half a dozen dynamic frameworks in an app. Hard to achieve with external & internal deps. | ||
> -- from [Twitter](https://twitter.com/arekholko/status/743135179514978304) | ||
This is hardly an option for some. If you think you might be in that group, then continue reading. | ||
|
||
## What is this plugin doing? | ||
|
||
This plugin is based on [dyld-image-loading-performance](https://github.com/stepanhruda/dyld-image-loading-performance). In a nutshell, it copies all symbols of your CocoaPods dependencies into your main app executable, so the dynamic linker doesn't have to load the frameworks. You can verify this yourself by enabling | ||
|
||
 | ||
|
||
and looking at the log output you shouldn't find any `dlopen` call of your CocoaPods frameworks. | ||
|
||
## Limitations | ||
|
||
Currently this plugin has the following limitations: | ||
|
||
* You will have modify your `post_install` hook. This is necessary because the CocoaPods plugin API currently doesn't offer everything that the gem needs. | ||
|
||
## Installation | ||
|
||
```bash | ||
gem install cocoapods-amimono | ||
```` | ||
|
||
## Usage | ||
|
||
Add the following to your Podfile: | ||
|
||
```ruby | ||
plugin 'cocoapods-amimono' | ||
``` | ||
|
||
Add the following to your `post_install` hook: | ||
|
||
```ruby | ||
post_install do |installer| | ||
require 'cocoapods-amimono/patcher' | ||
Amimono::Patcher.patch!(installer) | ||
... | ||
``` | ||
|
||
## Example project | ||
|
||
[Here](https://github.com/Ruenzuo/cocoapods-amimono-example). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'bundler/gem_tasks' | ||
|
||
def specs(dir) | ||
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ') | ||
end | ||
|
||
desc 'Runs all the specs' | ||
task :specs do | ||
sh "bundle exec bacon #{specs('**')}" | ||
end | ||
|
||
task :default => :specs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env ruby | ||
|
||
$:.push File.expand_path("../lib", File.dirname(__FILE__)) | ||
require "cocoapods-amimono" | ||
require "cocoapods-amimono/command" | ||
|
||
Amimono::run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'cocoapods-amimono/gem_version.rb' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = 'cocoapods-amimono' | ||
spec.version = CocoapodsAmimono::VERSION | ||
spec.authors = ['Renzo Crisostomo'] | ||
spec.email = ['[email protected]'] | ||
spec.description = %q{Move all dynamic frameworks symbols into the main executable.} | ||
spec.summary = %q{Move all dynamic frameworks symbols into the main executable.} | ||
spec.homepage = 'https://github.com/Ruenzuo/cocoapods-amimono' | ||
spec.license = 'MIT' | ||
|
||
spec.files = `git ls-files`.split($/) | ||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } | ||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | ||
spec.require_paths = ['lib'] | ||
|
||
spec.add_development_dependency 'bundler', '~> 1.3' | ||
spec.add_development_dependency 'rake' | ||
|
||
spec.rubygems_version = "1.6.2" | ||
spec.required_rubygems_version = Gem::Requirement.new(">= 0") if spec.respond_to? :required_rubygems_version= | ||
spec.required_ruby_version = '>= 2.0.0' | ||
spec.specification_version = 3 if spec.respond_to? :specification_version | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'cocoapods-amimono/gem_version' | ||
|
||
module Amimono | ||
def self.run | ||
Command.run(ARGV) | ||
end | ||
end |
71 changes: 71 additions & 0 deletions
71
cocoapods-amimono/lib/cocoapods-amimono/build_phases_updater.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
module Amimono | ||
class BuildPhasesUpdater | ||
|
||
FILELIST_SCRIPT = <<-SCRIPT.strip_heredoc | ||
IFS=" " read -r -a SPLIT <<< "$ARCHS" | ||
for ARCH in "${SPLIT[@]}"; do | ||
cd "$OBJROOT/Pods.build" | ||
filelist="" | ||
for dependency in "${DEPENDENCIES[@]}"; do | ||
path="${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/${dependency}.build/Objects-normal/${ARCH}" | ||
if [ -d "$path" ]; then | ||
search_path="$path/*.o" | ||
for obj_file in $search_path; do | ||
filelist+="${OBJROOT}/Pods.build/${obj_file}" | ||
filelist+=$'\\n' | ||
done | ||
fi | ||
done | ||
filelist=${filelist\%$'\\n'} | ||
echo "$filelist" > "${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}-${TARGET_NAME}-${ARCH}.objects.filelist" | ||
done | ||
SCRIPT | ||
|
||
AMIMONO_FILELIST_BUILD_PHASE = '[Amimono] Create filelist per architecture' | ||
|
||
def update_build_phases(installer_context, aggregated_targets) | ||
# All user projects should be the same I hope | ||
user_project = aggregated_targets.first.user_project | ||
aggregated_targets.each do |aggregated_target| | ||
# This pick is probably wrong, but works for most of the simple cases | ||
user_target = aggregated_target.user_targets.first | ||
# Remove the `Embed Pods Frameworks` build phase | ||
remove_embed_pods_frameworks(user_target) | ||
# Create or update [Amimono] build phase | ||
create_or_update_amimono_phase(user_target, AMIMONO_FILELIST_BUILD_PHASE, generate_filelist_script(installer_context, aggregated_target)) | ||
puts "[Amimono] Build phases updated for target #{aggregated_target.cocoapods_target_label}" | ||
end | ||
user_project.save | ||
end | ||
|
||
private | ||
|
||
def remove_embed_pods_frameworks(user_target) | ||
embed_pods_frameworks_build_phase = user_target.build_phases.find { |build_phase| build_phase.display_name.include? 'Embed Pods Frameworks' } | ||
return if embed_pods_frameworks_build_phase.nil? | ||
embed_pods_frameworks_build_phase.remove_from_project | ||
end | ||
|
||
def create_or_update_amimono_phase(user_target, phase_name, script) | ||
amimono_filelist_build_phase = user_target.build_phases.find { |build_phase| build_phase.display_name.include? phase_name } || user_target.new_shell_script_build_phase(phase_name) | ||
amimono_filelist_build_phase.shell_path = '/bin/bash' | ||
amimono_filelist_build_phase.shell_script = script | ||
user_target.build_phases.insert(1, amimono_filelist_build_phase) | ||
user_target.build_phases.uniq! | ||
end | ||
|
||
def generate_filelist_script(installer_context, aggregated_target) | ||
dependencies = [] | ||
installer_context.pods_project.targets.select { |target| target.name == aggregated_target.cocoapods_target_label }.first.dependencies.each do |dependency| | ||
case dependency.target.product_type | ||
when 'com.apple.product-type.framework' | ||
dependencies << "'#{dependency.name}'" | ||
when 'com.apple.product-type.bundle' | ||
# ignore | ||
end | ||
end | ||
puts "[Amimono] #{dependencies.count} dependencies found" | ||
"declare -a DEPENDENCIES=(#{dependencies.join(' ')});\n" + FILELIST_SCRIPT | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'cocoapods-amimono/command/amimono' |
18 changes: 18 additions & 0 deletions
18
cocoapods-amimono/lib/cocoapods-amimono/command/amimono.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'claide' | ||
require 'cocoapods-amimono/gem_version' | ||
|
||
module Amimono | ||
class Command < CLAide::Command | ||
|
||
self.abstract_command = true | ||
self.command = 'amimono' | ||
self.version = CocoapodsAmimono::VERSION | ||
self.description = <<-DESC | ||
Move all dynamic frameworks symbols into the main executable. | ||
DESC | ||
|
||
def self.run(argv) | ||
super(argv) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module CocoapodsAmimono | ||
VERSION = "0.0.10" | ||
end |
Oops, something went wrong.