cocoapods-use-frameworks-dynamic-wrapper 0.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8edf6a49d74d9df4787db8fc3d652acd6c2c3a9b527fb217ad5c87b098d3c916
4
+ data.tar.gz: 627d4363baeb5708ef1f94a415a75be9d39c977d4ad7a82feceae0aaae77feab
5
+ SHA512:
6
+ metadata.gz: b257164eed049e64e6da95f4860281b1198e78c542812acb5e3dbbd0ea20a8b44c433bf8f51429a84237f6bd6079735ee78ad7c212872241e5509188a1f2ae9a
7
+ data.tar.gz: 67507595d665f81a7c3ab1f280116261b374cbc70baff78ce22a0370fb9e97a47b1233f446ff932203d4b5cd30e8f9bfe41cabc6cc03d407b2155f64d83c5de9
data/.bundle/config ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_PATH: "vendor"
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
4
+ vendor/
5
+ example/
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-use-frameworks-dynamic-wrapper.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'bundle'
8
+ gem 'rake'
9
+ gem 'test-unit'
10
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cocoapods-use-frameworks-dynamic-wrapper (0.0.1)
5
+ cocoapods (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ CFPropertyList (3.0.5)
11
+ rexml
12
+ activesupport (6.1.4.1)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ addressable (2.8.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ algoliasearch (1.27.5)
21
+ httpclient (~> 2.8, >= 2.8.3)
22
+ json (>= 1.5.1)
23
+ atomos (0.1.3)
24
+ bundle (0.0.1)
25
+ bundler
26
+ claide (1.0.3)
27
+ cocoapods (1.11.2)
28
+ addressable (~> 2.8)
29
+ claide (>= 1.0.2, < 2.0)
30
+ cocoapods-core (= 1.11.2)
31
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
32
+ cocoapods-downloader (>= 1.4.0, < 2.0)
33
+ cocoapods-plugins (>= 1.0.0, < 2.0)
34
+ cocoapods-search (>= 1.0.0, < 2.0)
35
+ cocoapods-trunk (>= 1.4.0, < 2.0)
36
+ cocoapods-try (>= 1.1.0, < 2.0)
37
+ colored2 (~> 3.1)
38
+ escape (~> 0.0.4)
39
+ fourflusher (>= 2.3.0, < 3.0)
40
+ gh_inspector (~> 1.0)
41
+ molinillo (~> 0.8.0)
42
+ nap (~> 1.0)
43
+ ruby-macho (>= 1.0, < 3.0)
44
+ xcodeproj (>= 1.21.0, < 2.0)
45
+ cocoapods-core (1.11.2)
46
+ activesupport (>= 5.0, < 7)
47
+ addressable (~> 2.8)
48
+ algoliasearch (~> 1.0)
49
+ concurrent-ruby (~> 1.1)
50
+ fuzzy_match (~> 2.0.4)
51
+ nap (~> 1.0)
52
+ netrc (~> 0.11)
53
+ public_suffix (~> 4.0)
54
+ typhoeus (~> 1.0)
55
+ cocoapods-deintegrate (1.0.5)
56
+ cocoapods-downloader (1.5.1)
57
+ cocoapods-plugins (1.0.0)
58
+ nap
59
+ cocoapods-search (1.0.1)
60
+ cocoapods-trunk (1.6.0)
61
+ nap (>= 0.8, < 2.0)
62
+ netrc (~> 0.11)
63
+ cocoapods-try (1.2.0)
64
+ colored2 (3.1.2)
65
+ concurrent-ruby (1.1.9)
66
+ escape (0.0.4)
67
+ ethon (0.15.0)
68
+ ffi (>= 1.15.0)
69
+ ffi (1.15.4)
70
+ fourflusher (2.3.1)
71
+ fuzzy_match (2.0.4)
72
+ gh_inspector (1.1.3)
73
+ httpclient (2.8.3)
74
+ i18n (1.8.11)
75
+ concurrent-ruby (~> 1.0)
76
+ json (2.6.1)
77
+ minitest (5.14.4)
78
+ molinillo (0.8.0)
79
+ nanaimo (0.3.0)
80
+ nap (1.1.0)
81
+ netrc (0.11.0)
82
+ power_assert (2.0.1)
83
+ public_suffix (4.0.6)
84
+ rake (13.0.6)
85
+ rexml (3.2.5)
86
+ ruby-macho (2.5.1)
87
+ test-unit (3.5.1)
88
+ power_assert
89
+ typhoeus (1.4.0)
90
+ ethon (>= 0.9.0)
91
+ tzinfo (2.0.4)
92
+ concurrent-ruby (~> 1.0)
93
+ xcodeproj (1.21.0)
94
+ CFPropertyList (>= 2.3.3, < 4.0)
95
+ atomos (~> 0.1.3)
96
+ claide (>= 1.0.2, < 2.0)
97
+ colored2 (~> 3.1)
98
+ nanaimo (~> 0.3.0)
99
+ rexml (~> 3.2.4)
100
+ zeitwerk (2.5.1)
101
+
102
+ PLATFORMS
103
+ arm64-darwin-20
104
+ x86_64-darwin-20
105
+
106
+ DEPENDENCIES
107
+ bundle
108
+ cocoapods-use-frameworks-dynamic-wrapper!
109
+ rake
110
+ test-unit
111
+
112
+ BUNDLED WITH
113
+ 2.2.31
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2021 nakahira <1021057927@qq.com>
2
+
3
+ MIT License
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,20 @@
1
+ # cocoapods-use-frameworks-dynamic-wrapper
2
+
3
+ The CocoaPods plugin can automatically fix static framework transitive dependencies problems.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-use-frameworks-dynamic-wrapper
8
+
9
+ ## Usage
10
+
11
+ ```ruby
12
+ plugin 'cocoapods-use-frameworks-dynamic-wrapper'
13
+
14
+ target :ExampleTarget do
15
+ use_frameworks! :dynamic_wrapper => true
16
+
17
+ pod 'SomePod'
18
+ end
19
+ ```
20
+
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "rake/testtask"
2
+ require 'bundler/gem_tasks'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "lib"
6
+ t.test_files = FileList["test/**/*_test.rb"]
7
+ end
8
+ task :default => :test
9
+
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods-use-frameworks-dynamic-wrapper/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-use-frameworks-dynamic-wrapper'
8
+ spec.version = CocoapodsUseFrameworksDynamicWrapper::VERSION
9
+ spec.authors = ['nakahira']
10
+ spec.email = ['1021057927@qq.com']
11
+ spec.summary = %q{The CocoaPods plugin can automatically fix static framework transitive dependencies problems.}
12
+ spec.homepage = 'https://github.com/xuzhongping/cocoapods-use-frameworks-dynamic-wrapper'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.test_files = spec.files.grep(%r{^(test|cocoapods-use-frameworks-dynamic-wrapper)/})
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_runtime_dependency 'cocoapods', '~> 1.0'
20
+ end
@@ -0,0 +1,82 @@
1
+ require 'cocoapods-use-frameworks-dynamic-wrapper/gem_version'
2
+
3
+ module Pod
4
+ class PodTarget < Target
5
+ def real_should_build
6
+ return @real_should_build if defined? @real_should_build
7
+ accessors = file_accessors.select { |fa| fa.spec.library_specification? }
8
+ source_files = accessors.flat_map(&:source_files)
9
+ source_files -= accessors.flat_map(&:headers)
10
+ @real_should_build = !source_files.empty?
11
+ end
12
+
13
+ def should_dynamic_wrapper?
14
+ real_should_build == false && target_definitions.select(&:dynamic_wrapper).length > 0 && file_accessors.flat_map(&:vendored_static_artifacts).length > 0
15
+ end
16
+ end
17
+
18
+ class Podfile
19
+ class TargetDefinition
20
+ attr_accessor :dynamic_wrapper
21
+ alias_method :original_use_frameworks!, :use_frameworks!
22
+ def use_frameworks!(option = true)
23
+ case option
24
+ when true, false
25
+ original_use_frameworks! option
26
+ when Hash
27
+ @dynamic_wrapper = option.delete(:dynamic_wrapper) if option[:dynamic_wrapper] && option[:linkage] != :static
28
+ original_use_frameworks!(option.empty? ? true : option)
29
+ end
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+ class Installer
36
+ class Xcode
37
+ class TargetValidator
38
+ alias_method :original_verify_no_static_framework_transitive_dependencies, :verify_no_static_framework_transitive_dependencies
39
+ def verify_no_static_framework_transitive_dependencies
40
+ aggregate_targets.each do |aggregate_target|
41
+ aggregate_target.user_build_configurations.each_key do |config|
42
+ pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
43
+ built_targets, unbuilt_targets = pod_targets.partition(&:should_build?)
44
+ dynamic_pod_targets = built_targets.select(&:build_as_dynamic?)
45
+ dependencies = dynamic_pod_targets.flat_map(&:dependent_targets).uniq
46
+ depended_upon_targets = unbuilt_targets & dependencies
47
+ wrapper_targets = depended_upon_targets.select(&:should_dynamic_wrapper?)
48
+ dynamic_wrapper_flush(wrapper_targets)
49
+ original_verify_no_static_framework_transitive_dependencies
50
+ end
51
+ end
52
+ end
53
+
54
+ def dynamic_wrapper_flush(pod_targets)
55
+ pod_targets.each do |pod_target|
56
+ pod_target.instance_variable_set(:@should_build, true)
57
+ module_name = pod_target.root_spec.attributes_hash['module_name'] || pod_target.root_spec.attributes_hash['name']
58
+ pod_target.root_spec.attributes_hash['module_name'] = module_name + '_dynamic_wrapper_pod'
59
+ pod_target.build_settings.each_value do |setting|
60
+ def setting.requires_objc_linker_flag?; true; end
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ class PodsProjectGenerator
67
+ class PodTargetInstaller < TargetInstaller
68
+ alias_method :original_initialize, :initialize
69
+ def initialize(sandbox, project, target, umbrella_header_paths = nil)
70
+ original_initialize(sandbox, project, target, umbrella_header_paths)
71
+ dynamic_wrapper_flush(self ) if target.should_dynamic_wrapper?
72
+ end
73
+
74
+ def dynamic_wrapper_flush(pod_target_installer)
75
+ def pod_target_installer.validate_targets_contain_sources(native_targets); end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsUseFrameworksDynamicWrapper
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-use-frameworks-dynamic-wrapper/cocoapods-use-frameworks-dynamic-wrapper'
@@ -0,0 +1,48 @@
1
+ require 'test/unit'
2
+ require 'cocoapods'
3
+ require 'cocoapods_plugin'
4
+
5
+ class TestTargetDefinition < Test::Unit::TestCase
6
+ def setup
7
+ @app = Pod::Podfile::TargetDefinition.new('MyApp', nil)
8
+ end
9
+
10
+ def test_dynamic_wrapper_only
11
+ @app.use_frameworks! :dynamic_wrapper => true
12
+ assert_equal(@app.dynamic_wrapper, true )
13
+ end
14
+
15
+ def test_dynamic_wrapper_linkage_static
16
+ @app.use_frameworks! :linkage => :static, :dynamic_wrapper => true
17
+ assert_nil(@app.dynamic_wrapper)
18
+ end
19
+
20
+ def test_dynamic_wrapper_linkage_dynamic
21
+ @app.use_frameworks! :linkage => :dynamic, :dynamic_wrapper => true
22
+ assert_equal(@app.dynamic_wrapper, true)
23
+ end
24
+ end
25
+
26
+ class TestTargetValidator < Test::Unit::TestCase
27
+ def setup
28
+ app = Pod::Podfile::TargetDefinition.new('MyApp', nil)
29
+ spec_a = Pod::Specification.new(nil, 'ModuleA')
30
+ pod_target_a = Pod::PodTarget.new(nil, nil, {'Debug' => :debug}, nil, nil, [spec_a], [app])
31
+ spec_b = Pod::Specification.new(nil, 'ModuleB')
32
+ pod_target_b = Pod::PodTarget.new(nil, nil, {'Debug' => :debug}, nil, nil, [spec_b], [app])
33
+ @pod_targets = [pod_target_a, pod_target_b]
34
+ @target_validator = Pod::Installer::Xcode::TargetValidator.new(nil, nil, nil)
35
+ end
36
+ def test_dynamic_wrapper_flush
37
+ @target_validator.dynamic_wrapper_flush(@pod_targets)
38
+ @pod_targets.each do |pod_target|
39
+ assert_equal(pod_target.should_build?, true)
40
+ name = pod_target.root_spec.attributes_hash['name']
41
+ module_name = pod_target.root_spec.attributes_hash['module_name']
42
+ assert_equal(module_name, name + '_dynamic_wrapper_pod')
43
+ pod_target.build_settings.each_value do |setting|
44
+ assert_equal(setting.requires_objc_linker_flag?, true )
45
+ end
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-use-frameworks-dynamic-wrapper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - nakahira
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-12-02 00:00:00.000000000 Z
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.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description:
28
+ email:
29
+ - 1021057927@qq.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".bundle/config"
35
+ - ".gitignore"
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - cocoapods-use-frameworks-dynamic-wrapper.gemspec
42
+ - lib/cocoapods-use-frameworks-dynamic-wrapper/cocoapods-use-frameworks-dynamic-wrapper.rb
43
+ - lib/cocoapods-use-frameworks-dynamic-wrapper/gem_version.rb
44
+ - lib/cocoapods_plugin.rb
45
+ - test/cocoapods-use-frameworks-dynamic-wrapper/dynamic-wrapper_test.rb
46
+ homepage: https://github.com/xuzhongping/cocoapods-use-frameworks-dynamic-wrapper
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 3.0.3.1
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: The CocoaPods plugin can automatically fix static framework transitive dependencies
69
+ problems.
70
+ test_files:
71
+ - test/cocoapods-use-frameworks-dynamic-wrapper/dynamic-wrapper_test.rb