cocoapods-static-swift-framework 0.0.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e4eee36a7897dac2a656b51549ef584cdc8cfa63acbf17fbca7098013e8c324
4
- data.tar.gz: f2a0b8c2dcadb5373e73c926351ae57ae997533921ea060aaecda11ec879d63a
3
+ metadata.gz: c2bd3fdd0ab9c9caa374446e5b0a306df2ee042064e82eb78ea1abc47e19085b
4
+ data.tar.gz: 48c81f56fe7daf71b161834bb6e1480b8b4b6a2a93a0be018756034853841b29
5
5
  SHA512:
6
- metadata.gz: af7ee46aaad225e8cbb91fc4bb41304a142813f749db1eeb6666c7f0e08ebbb998fc42cc77c90f8a806acc0aaf6422ed43c47e02b09cbea63c7a569fd4c50b15
7
- data.tar.gz: c57ac440e830a4b9e04436ebb6817ac4e82604eb3f6956a53dbad768602f5e4f64501907fa14016709a48824e73d467170f67f5732a6e1e9d1b53835e149ca1b
6
+ metadata.gz: 3cfc87d9967f7bd4ad847c93f36a9d8c69575e99a6332eb8e920a4788c44e0e8063e1b832cff86f009f8a8e3b8a3734edfed3b5149d490617b30da1cd18baeb6
7
+ data.tar.gz: a17bc5cfb1bbec251af8825be64db0a584c0aec6d14338a5137c4998badc0bd4675d218332749f90b5dc2884a363c1ba0380f476801ce79d5a65a8007d1e4069
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 GaoJi <gaoji@mobike.com>
1
+ Copyright (c) 2018 leavez <gaojiji@gmail.com>
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,11 +1,46 @@
1
1
  # cocoapods-static-swift-framework
2
2
 
3
- A description of cocoapods-static-swift-framework.
3
+ A cocoapods plugin that enables static frameworks for all pods.
4
4
 
5
- ## Installation
5
+ Cocoapods only supports static framework at pod level, which means an option in podspec and just valid for that pod. By using this plugin, we can make all pod to static framework with only one word!
6
+
7
+
8
+ NOTE:
9
+
10
+ Please use cocoapods 1.5. Static framework support on cocoapods 1.4 is totally a disaster.
6
11
 
7
- $ gem install cocoapods-static-swift-framework
8
12
 
9
13
  ## Usage
14
+ Install via gem:
15
+
16
+ ```
17
+ $ gem install cocoapods-static-swift-framework
18
+ ```
19
+
20
+ Add the following to your podfile:
21
+
22
+ ```ruby
23
+ plugin 'cocoapods-static-swift-framework'
24
+ all_static!
25
+
26
+ ```
27
+
28
+ NOTE: Static frameworks is still using framework, not static library. So don't forget to add `use_frameworks!`
29
+
30
+ ## Why use static framework
31
+
32
+ When turning on `use_framworks!` in podfile, libraries will be used in form of (dynamic) framework. App boot time will be affected dramatically when there're too many frameworks ( like 100 ), also a dyld [crash](https://github.com/Ruenzuo/cocoapods-amimono#why-would-you-want-this-plugin-in-your-podfile) and an obvious time in copy framework script.
33
+
34
+ There's no benefit from using dynamic framework on a private lib. So when static library for swift introduced in Xcode 9, we desperately want to adopt it for swift integration. Along with this plugin, cocoapods and xcode would statically link the libs and the problem is solved.
35
+
36
+
37
+ #### requirement
38
+ - Xcode 9
39
+ - cocoapods 1.5 ( tested on 1.5.0.beta.1 )
40
+
41
+
42
+
43
+ ## License
44
+ MIT
10
45
 
11
- $ pod spec framework POD_NAME
46
+ Appreciate a 🌟 if you like it. Another cocoapods plugin made by me [cocoapod-developing-folder](https://github.com/leavez/cocoapods-developing-folder)
@@ -6,11 +6,11 @@ require 'cocoapods-static-swift-framework/gem_version.rb'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'cocoapods-static-swift-framework'
8
8
  spec.version = CocoapodsStaticSwiftFramework::VERSION
9
- spec.authors = ['GaoJi']
10
- spec.email = ['gaoji@mobike.com']
11
- spec.description = %q{A short description of cocoapods-static-swift-framework.}
12
- spec.summary = %q{A longer description of cocoapods-static-swift-framework.}
13
- spec.homepage = 'https://github.com/EXAMPLE/cocoapods-static-swift-framework'
9
+ spec.authors = ['leavez']
10
+ spec.email = ['gaojiji@gmail.com']
11
+ spec.description = %q{use static framework for Swift}
12
+ spec.summary = %q{use static framework for Swift for cocoapods when use_frameworks!}
13
+ spec.homepage = 'https://github.com/leavez/cocoapods-static-swift-framework'
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
+ spec.add_dependency "cocoapods", ">= 1.5.0.beta.1", "< 2.0"
22
+
21
23
  spec.add_development_dependency 'bundler', '~> 1.3'
22
24
  spec.add_development_dependency 'rake'
23
25
  end
@@ -1,8 +1,7 @@
1
1
  module Pod
2
2
  class Podfile
3
- def static_frameworks
3
+ def all_static!
4
4
  require 'cocoapods-static-swift-framework/command/patch/static_pod.rb'
5
- require 'cocoapods-static-swift-framework/command/patch/add_generated_objc_header.rb'
6
5
  end
7
6
  end
8
7
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsStaticSwiftFramework
2
- VERSION = "0.0.2"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-static-swift-framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
- - GaoJi
7
+ - leavez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-03 00:00:00.000000000 Z
11
+ date: 2018-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cocoapods
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.0.beta.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.0.beta.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: bundler
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -38,9 +58,9 @@ dependencies:
38
58
  - - ">="
39
59
  - !ruby/object:Gem::Version
40
60
  version: '0'
41
- description: A short description of cocoapods-static-swift-framework.
61
+ description: use static framework for Swift
42
62
  email:
43
- - gaoji@mobike.com
63
+ - gaojiji@gmail.com
44
64
  executables: []
45
65
  extensions: []
46
66
  extra_rdoc_files: []
@@ -54,13 +74,12 @@ files:
54
74
  - lib/cocoapods-static-swift-framework.rb
55
75
  - lib/cocoapods-static-swift-framework/command.rb
56
76
  - lib/cocoapods-static-swift-framework/command/framework.rb
57
- - lib/cocoapods-static-swift-framework/command/patch/add_generated_objc_header.rb
58
77
  - lib/cocoapods-static-swift-framework/command/patch/static_pod.rb
59
78
  - lib/cocoapods-static-swift-framework/gem_version.rb
60
79
  - lib/cocoapods_plugin.rb
61
80
  - spec/command/framework_spec.rb
62
81
  - spec/spec_helper.rb
63
- homepage: https://github.com/EXAMPLE/cocoapods-static-swift-framework
82
+ homepage: https://github.com/leavez/cocoapods-static-swift-framework
64
83
  licenses:
65
84
  - MIT
66
85
  metadata: {}
@@ -80,10 +99,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
99
  version: '0'
81
100
  requirements: []
82
101
  rubyforge_project:
83
- rubygems_version: 2.7.4
102
+ rubygems_version: 2.7.6
84
103
  signing_key:
85
104
  specification_version: 4
86
- summary: A longer description of cocoapods-static-swift-framework.
105
+ summary: use static framework for Swift for cocoapods when use_frameworks!
87
106
  test_files:
88
107
  - spec/command/framework_spec.rb
89
108
  - spec/spec_helper.rb
@@ -1,52 +0,0 @@
1
- require 'cocoapods/installer'
2
-
3
- module Pod
4
- class Installer
5
- class Xcode
6
- class PodsProjectGenerator
7
- class PodTargetInstaller
8
- # add build phase to copy `PRODUCTNAME-Swift.h` to framwork/Headers
9
- # reference to https://github.com/CocoaPods/CocoaPods/blob/3fe4b32a9c3a00635383521affe9484c48cf5add/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb line 161
10
- def add_build_phase_to_copy_swift_generated_header()
11
-
12
- # add build phase
13
- build_phase = native_target.new_shell_script_build_phase('Copy Swift Generated Header')
14
- build_phase.shell_script = <<-eos.strip_heredoc
15
- rsync -t "${DERIVED_SOURCES_DIR}/${PRODUCT_NAME}-Swift.h" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Headers"
16
- eos
17
- end
18
-
19
- # add module map content
20
- def append_module_map(target)
21
- module_map_path = target.module_map_path
22
- content = <<-eos.strip_heredoc
23
-
24
- module #{target.product_module_name}.Swift {
25
- header "#{target.product_module_name}-Swift.h"
26
- requires objc
27
- }
28
- eos
29
- File.open(module_map_path, 'a') { |f| f.write(content) }
30
- end
31
-
32
- # ---- patch ----
33
- old_method = instance_method(:create_build_phase_to_move_static_framework_archive)
34
-
35
- define_method(:create_build_phase_to_move_static_framework_archive) do
36
- old_method.bind(self).()
37
- if target.uses_swift? and target.static_framework?
38
- add_build_phase_to_copy_swift_generated_header
39
- append_module_map target
40
- end
41
- end
42
-
43
-
44
-
45
-
46
- end
47
- end
48
- end
49
- end
50
- end
51
-
52
-