cocoapods-binary 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +51 -4
- data/lib/cocoapods-binary/Integration.rb +21 -6
- data/lib/cocoapods-binary/Prebuild.rb +15 -0
- data/lib/cocoapods-binary/gem_version.rb +1 -1
- data/lib/cocoapods-binary/helper/feature_switches.rb +1 -1
- data/lib/cocoapods-binary/helper/passer.rb +11 -0
- data/lib/cocoapods-binary/helper/podfile_options.rb +2 -2
- data/lib/cocoapods-binary/helper/prebuild_sandbox.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f3ca295ef8ca0f206daca84dd83b7aa29364789dccb0e0fe70b13e36f6fa545
|
4
|
+
data.tar.gz: 39bc2744054bc2b240f983510b961dc472f7f065011733dc18d45dd98245d5a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a6a94e57f3c4b5b5a4419902cb828b0080ef67b57a250f80903a198d4a4ca0c763f95809b9acb47c4be6995c9a3fe4689327797f7449bd529d41e4b46450d0e
|
7
|
+
data.tar.gz: 5e4b01a22a7a08bbf74dc5c3daeb95c269c796a1c713fc5976eff5f4c8ad4d521d9e93f5dbb4d0953e7a9768986e83ac7a4d7fac356d70d16da41433cb21c6ee
|
data/README.md
CHANGED
@@ -1,8 +1,32 @@
|
|
1
1
|
# cocoapods-binary
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/leavez/cocoapods-binary.svg?branch=master)](https://travis-ci.org/leavez/cocoapods-binary)
|
4
4
|
|
5
|
-
|
5
|
+
A CocoaPods plugin to integrate pods in form of prebuilt frameworks, not source code, by adding **just one flag** in podfile. Speed up compiling dramatically.
|
6
|
+
|
7
|
+
## Why
|
8
|
+
|
9
|
+
You may wonder why CocoaPods doesn't have a function to integrate libs in form of binaries, if there are dozens or hundreds of pods your podfile and compile them for a great many times meaninglessly. Too many source code of libs slow down your compile and the response of IDE (e.g. code completion), and then reduce work efficiency, leaving us time to think about the meaning of life.
|
10
|
+
|
11
|
+
This plugin implements this simple wish. Replace the source code in pod target with prebuilt frameworks.
|
12
|
+
|
13
|
+
Why don't use Carthage? While Carthage also integrates libs in form of frameworks, there several reasons to use CocoaPods with this plugin:
|
14
|
+
|
15
|
+
- Pod is a good simple form to organize files, manage dependencies. (private or local pods)
|
16
|
+
- Fast switch between source code and binary, or partial source code, partial binaries.
|
17
|
+
- Some libs don't support Carthage.
|
18
|
+
|
19
|
+
## How it works
|
20
|
+
|
21
|
+
It will compile the source code of pods during the pod install process, and make CocoaPods use them. Which pod should be compiled is controlled by the flag in Podfile.
|
22
|
+
|
23
|
+
#### Under the hood
|
24
|
+
|
25
|
+
( You could leave this paragraph for further reading, and try it now. )
|
26
|
+
|
27
|
+
The plugin will do a separated completed 'Pod install' in the standard pre-install hook. But we filter the pods by the flag in Podfile here. Then build frameworks with this generated project by using xcodebuild. Store the frameworks in `Pods/_Prebuild` and save the manifest.lock file for the next pod install.
|
28
|
+
|
29
|
+
Then in the flowing normal install process, we hook the integration functions to modify pod specification to using our frameworks.
|
6
30
|
|
7
31
|
## Installation
|
8
32
|
|
@@ -10,12 +34,35 @@ A cocoapods plugin that enables to integrate pod in form of prebuilt framework,
|
|
10
34
|
|
11
35
|
## Usage
|
12
36
|
|
13
|
-
Add this in the podfile:
|
14
|
-
|
15
37
|
``` ruby
|
16
38
|
plugin 'cocoapods-binary'
|
17
39
|
|
40
|
+
use_frameworks!
|
41
|
+
# all_binary!
|
42
|
+
|
18
43
|
target "HP" do
|
19
44
|
pod "ExpectoPatronum", :binary => true
|
20
45
|
end
|
21
46
|
```
|
47
|
+
|
48
|
+
- Add `plugin 'cocoapods-binary'` in the head of Podfile
|
49
|
+
- 2 ways:
|
50
|
+
- Add `:binary => true` as a option of one specific pod.
|
51
|
+
- Or add `all_binary!` before all targets. This makes all pods binaries.
|
52
|
+
|
53
|
+
if you want to disable binary for a specific pod when using `all_binary!`, place a `:binary => false` to it.
|
54
|
+
|
55
|
+
**Note**: cocoapods-binary require `use_frameworks!`. If your worry about the boot time and other problems introduced by dynamic framework, static framework is a good choice. Another [plugin](https://github.com/leavez/cocoapods-static-swift-framework) made by me to make all pods static frameworks is recommended.
|
56
|
+
|
57
|
+
#### Known Issue
|
58
|
+
|
59
|
+
- doesn't support watchos now
|
60
|
+
- dSYM files is missing for dynamic frameworks using this plugin
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
MIT
|
65
|
+
|
66
|
+
Appreciate a 🌟 if you like it.
|
67
|
+
|
68
|
+
|
@@ -24,7 +24,7 @@ module Pod
|
|
24
24
|
|
25
25
|
# make a symlink to target folder
|
26
26
|
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
|
27
|
-
|
27
|
+
real_file_folder = prebuild_sandbox.framework_folder_path_for_pod_name(self.name)
|
28
28
|
|
29
29
|
target_folder = standard_sanbox.pod_dir(self.name)
|
30
30
|
target_folder.rmtree if target_folder.exist?
|
@@ -39,26 +39,41 @@ module Pod
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
-
def make_link(source,
|
43
|
-
|
42
|
+
def make_link(source, target)
|
43
|
+
source = Pathname.new(source)
|
44
|
+
target = Pathname.new(target)
|
44
45
|
target.parent.mkpath unless target.parent.exist?
|
45
46
|
relative_source = source.relative_path_from(target.parent)
|
46
47
|
FileUtils.ln_sf(relative_source, target)
|
47
48
|
end
|
49
|
+
def mirror_with_symlink(source, basefolder, target_folder)
|
50
|
+
target = target_folder + source.relative_path_from(basefolder)
|
51
|
+
make_link(source, target)
|
52
|
+
end
|
48
53
|
|
49
|
-
|
54
|
+
# symbol link copy all substructure
|
55
|
+
walk(real_file_folder) do |child|
|
50
56
|
source = child
|
51
57
|
# only make symlink to file and `.framework` folder
|
52
58
|
if child.directory? and child.extname == ".framework"
|
53
|
-
|
59
|
+
mirror_with_symlink(source, real_file_folder, target_folder)
|
54
60
|
next false # return false means don't go deeper
|
55
61
|
elsif child.file?
|
56
|
-
|
62
|
+
mirror_with_symlink(source, real_file_folder, target_folder)
|
57
63
|
next true
|
58
64
|
else
|
59
65
|
next true
|
60
66
|
end
|
61
67
|
end
|
68
|
+
|
69
|
+
# symbol link copy resource for static framework
|
70
|
+
hash = Prebuild::Passer.resources_to_copy_for_static_framework || {}
|
71
|
+
path_objects = hash[self.name]
|
72
|
+
if path_objects != nil
|
73
|
+
path_objects.each do |object|
|
74
|
+
make_link(object.real_file_path, object.target_file_path)
|
75
|
+
end
|
76
|
+
end
|
62
77
|
end
|
63
78
|
|
64
79
|
end
|
@@ -128,9 +128,24 @@ module Pod
|
|
128
128
|
Pod::Prebuild.remove_build_dir(sandbox_path)
|
129
129
|
targets.each do |target|
|
130
130
|
next unless target.should_build?
|
131
|
+
|
131
132
|
output_path = sandbox.framework_folder_path_for_pod_name(target.name)
|
132
133
|
output_path.mkpath unless output_path.exist?
|
133
134
|
Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled)
|
135
|
+
|
136
|
+
# save the resource paths for later installing
|
137
|
+
if target.static_framework? and !target.resource_paths.empty?
|
138
|
+
framework_path = output_path + target.framework_name
|
139
|
+
standard_sandbox_path = sandbox.standard_sanbox_path
|
140
|
+
path_objects = target.resource_paths.select{|f| f.start_with? "${PODS_ROOT}"}.map do |path|
|
141
|
+
object = Prebuild::Passer::ResourcePath.new
|
142
|
+
object.real_file_path = framework_path + File.basename(path)
|
143
|
+
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s)
|
144
|
+
object
|
145
|
+
end
|
146
|
+
Prebuild::Passer.resources_to_copy_for_static_framework ||= {}
|
147
|
+
Prebuild::Passer.resources_to_copy_for_static_framework[target.name] = path_objects
|
148
|
+
end
|
134
149
|
end
|
135
150
|
Pod::Prebuild.remove_build_dir(sandbox_path)
|
136
151
|
|
@@ -38,7 +38,7 @@ module Pod
|
|
38
38
|
end
|
39
39
|
|
40
40
|
if should_prebuild and (not local)
|
41
|
-
if current_target_definition.platform
|
41
|
+
if current_target_definition.platform == :watchos
|
42
42
|
# watchos isn't supported currently
|
43
43
|
Pod::UI.warn "Binary doesn't support watchos currently: #{name}. You can manually set `binary => false` for this pod to suppress this warning."
|
44
44
|
return
|
@@ -15,6 +15,17 @@ module Pod
|
|
15
15
|
#
|
16
16
|
class_attr_accessor :prebuild_pods_changes
|
17
17
|
|
18
|
+
|
19
|
+
# represent the path of resurces to copy
|
20
|
+
class ResourcePath
|
21
|
+
attr_accessor :real_file_path
|
22
|
+
attr_accessor :target_file_path
|
23
|
+
end
|
24
|
+
# Save the resoures for static framework, and used when installing the prebuild framework
|
25
|
+
# static framework needs copy the resurces mannully
|
26
|
+
#
|
27
|
+
# @return [Hash<String, [Passer::ResourcePath]>]
|
28
|
+
class_attr_accessor :resources_to_copy_for_static_framework
|
18
29
|
end
|
19
30
|
end
|
20
31
|
end
|
@@ -24,7 +24,7 @@ module Pod
|
|
24
24
|
|
25
25
|
if should_prebuild == true
|
26
26
|
# watchos isn't supported currently
|
27
|
-
return if self.platform
|
27
|
+
return if self.platform == :watchos
|
28
28
|
|
29
29
|
@prebuild_framework_names ||= []
|
30
30
|
@prebuild_framework_names.push pod_name
|
@@ -71,7 +71,7 @@ module Pod
|
|
71
71
|
|
72
72
|
all = []
|
73
73
|
|
74
|
-
aggregate_targets = self.aggregate_targets.select { |a| a.platform
|
74
|
+
aggregate_targets = self.aggregate_targets.select { |a| a.platform != :watchos }
|
75
75
|
aggregate_targets.each do |aggregate_target|
|
76
76
|
target_definition = aggregate_target.target_definition
|
77
77
|
targets = aggregate_target.pod_targets || []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-binary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leavez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|