cocoapods-linkline 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 +7 -0
- data/.gitignore +3 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +11 -0
- data/Rakefile +13 -0
- data/cocoapods-linkline.gemspec +24 -0
- data/lib/cocoapods-linkline/command/linkline.rb +68 -0
- data/lib/cocoapods-linkline/command/target-linkline.rb +9 -0
- data/lib/cocoapods-linkline/command/targetdefinition-linkline.rb +34 -0
- data/lib/cocoapods-linkline/command.rb +3 -0
- data/lib/cocoapods-linkline/gem_version.rb +3 -0
- data/lib/cocoapods-linkline.rb +1 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/spec/command/linkline_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ab7f21e27d58bd3b2f8c5ecec4d567ff0b25c4eb668def39640aee0f2be245be
|
4
|
+
data.tar.gz: eb9db46eaafc49463a22a437d67baf1dc371adf691d389254b44fe6b60b6eccc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d09df3041f81a60ef5c4e03903da62b2dc06af28b23e8b00e0889d4c778ba05ddc0f4af3b8db3b891ba2b38558c0538ffddd5ea070e6a43db0ba159885db8e1c
|
7
|
+
data.tar.gz: d9aafd0fb18a78923c4ed7011626a31678061e4ab405610beb7c5623eb68d521bc96e2ab12340ed62678b669a0e9e52cde5569a7ac7d10dd65e07793222261d4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2023 youhui <youhui@babybus.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
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods-linkline/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-linkline'
|
8
|
+
spec.version = CocoapodsLinkline::VERSION
|
9
|
+
spec.authors = ['youhui']
|
10
|
+
spec.email = ['developer_yh@163.com']
|
11
|
+
spec.description = %q{A plug-in that can customize component dependencies, static libraries/dynamic libraries.}
|
12
|
+
spec.summary = %q{use :linkages => dynimic to define component all child dependencies with dynimic framework. \
|
13
|
+
use :linkage => static to component self with static framework.}
|
14
|
+
spec.homepage = 'https://github.com/ymoyao/cocoapods-linkline'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
spec.add_development_dependency 'rake'
|
24
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods/user_interface'
|
3
|
+
|
4
|
+
class Pod::Installer::Analyzer
|
5
|
+
alias_method :original_generate_pod_targets, :generate_pod_targets
|
6
|
+
def generate_pod_targets(resolver_specs_by_target, target_inspections)
|
7
|
+
targets = original_generate_pod_targets(resolver_specs_by_target, target_inspections)
|
8
|
+
targets.each { |target|
|
9
|
+
ll_rebuild_linkage(target,target,nil)
|
10
|
+
}
|
11
|
+
targets
|
12
|
+
end
|
13
|
+
|
14
|
+
def ll_rebuild_linkage(pod_target,root_pod_target,build_type)
|
15
|
+
ll_linkage,is_linkage_all = ll_fetch_linkage_from(pod_target)
|
16
|
+
if ll_linkage
|
17
|
+
build_type = ll_create_build_type_from(pod_target,ll_linkage)
|
18
|
+
is_need_rewrite = ll_is_need_rewrite_build_type(pod_target,ll_linkage)
|
19
|
+
pod_target.ll_rewrite_build_type(build_type) if is_need_rewrite
|
20
|
+
ll_rebuild_linkage_in_dependencies(pod_target,root_pod_target,build_type) if is_linkage_all
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def ll_rebuild_linkage_in_dependencies(pod_target,root_pod_target,build_type)
|
25
|
+
return if pod_target.dependencies.empty?
|
26
|
+
pod_target.dependent_targets.each { |sub_pod_target|
|
27
|
+
ll_rebuild_linkage_sub(sub_pod_target,root_pod_target,build_type)
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def ll_rebuild_linkage_sub(pod_target,root_pod_target,build_type)
|
32
|
+
exit -9090 if !build_type
|
33
|
+
ll_linkage,a = ll_fetch_linkage_from(pod_target)
|
34
|
+
if ll_linkage && ll_linkage != build_type.linkage
|
35
|
+
err_msg = "- Error: [#{pod_target.pod_name}] is define :linkage => #{ll_linkage} confict to it's parent [#{root_pod_target.pod_name}] :linkage => #{build_type}"
|
36
|
+
# raise Informative, err_msg
|
37
|
+
Pod::UI.puts "#{err_msg}".send(:red)
|
38
|
+
exit -9090
|
39
|
+
else
|
40
|
+
is_need_rewrite = ll_is_need_rewrite_build_type(pod_target,build_type.linkage)
|
41
|
+
pod_target.ll_rewrite_build_type(build_type) if is_need_rewrite
|
42
|
+
ll_rebuild_linkage_in_dependencies(pod_target,root_pod_target,build_type)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def ll_fetch_linkage_from(pod_target)
|
47
|
+
linkage = pod_target.target_definitions.map { |t| t.ll_linkages(false)[pod_target.pod_name] }.compact.first
|
48
|
+
is_linkage_all = false
|
49
|
+
if !linkage
|
50
|
+
linkage = pod_target.target_definitions.map { |t| t.ll_linkages(true)[pod_target.pod_name] }.compact.first
|
51
|
+
is_linkage_all = true if linkage
|
52
|
+
end
|
53
|
+
[linkage,is_linkage_all]
|
54
|
+
end
|
55
|
+
|
56
|
+
def ll_create_build_type_from(pod_target,linkage)
|
57
|
+
return nil if !linkage
|
58
|
+
if pod_target.build_as_framework?
|
59
|
+
Pod::BuildType.new(:linkage => linkage, :packaging => :framework)
|
60
|
+
else
|
61
|
+
Pod::BuildType.new(:linkage => linkage, :packaging => :library)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def ll_is_need_rewrite_build_type(pod_target,linkage)
|
66
|
+
((linkage == :static && pod_target.build_as_dynamic?) || (linkage == :dynamic && pod_target.build_as_static?))
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods/user_interface'
|
3
|
+
class Pod::Target
|
4
|
+
#define a func to rewrite target build_type, the build_type property is private
|
5
|
+
def ll_rewrite_build_type(build_type)
|
6
|
+
Pod::UI.puts "#{name} rebuild :linkage => #{build_type}"
|
7
|
+
@build_type = build_type
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods-core'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Podfile
|
6
|
+
class TargetDefinition
|
7
|
+
|
8
|
+
# linklines is a array to save data if you directy define :linkage => static or :linkage => dynimic
|
9
|
+
def ll_expedition_linkages(name, requirements,key)
|
10
|
+
linklines ||= {}
|
11
|
+
options = requirements.last || {}
|
12
|
+
linklines[Specification.root_name(name)] = options[key] if options.is_a?(Hash) && options[key]
|
13
|
+
options.delete(key) if options.is_a?(Hash)
|
14
|
+
requirements.pop if options.empty?
|
15
|
+
linklines
|
16
|
+
end
|
17
|
+
|
18
|
+
def ll_linkages(is_linkage_all)
|
19
|
+
pod_linkage = (is_linkage_all == true ? @linkages : @linkage) || {}
|
20
|
+
pod_linkage.merge!(parent.ll_linkages(is_linkage_all)) { |key, v1, v2| v1 } if !parent.nil? && parent.is_a?(TargetDefinition)
|
21
|
+
pod_linkage
|
22
|
+
end
|
23
|
+
|
24
|
+
original_parse_inhibit_warnings = instance_method(:parse_inhibit_warnings)
|
25
|
+
define_method(:parse_inhibit_warnings) do |name, requirements|
|
26
|
+
@linkage ||= {}
|
27
|
+
@linkages ||= {}
|
28
|
+
@linkage = @linkage.merge(ll_expedition_linkages(name, requirements,:linkage))
|
29
|
+
@linkages = @linkages.merge(ll_expedition_linkages(name, requirements,:linkages))
|
30
|
+
original_parse_inhibit_warnings.bind(self).call(name, requirements)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-linkline/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-linkline/command'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$:.unshift((ROOT + 'lib').to_s)
|
4
|
+
$:.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'bacon'
|
8
|
+
require 'mocha-on-bacon'
|
9
|
+
require 'pretty_bacon'
|
10
|
+
require 'pathname'
|
11
|
+
require 'cocoapods'
|
12
|
+
|
13
|
+
Mocha::Configuration.prevent(:stubbing_non_existent_method)
|
14
|
+
|
15
|
+
require 'cocoapods_plugin'
|
16
|
+
|
17
|
+
#-----------------------------------------------------------------------------#
|
18
|
+
|
19
|
+
module Pod
|
20
|
+
|
21
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
22
|
+
#
|
23
|
+
UI.disable_wrap = true
|
24
|
+
|
25
|
+
# Redirects the messages to an internal store.
|
26
|
+
#
|
27
|
+
module UI
|
28
|
+
@output = ''
|
29
|
+
@warnings = ''
|
30
|
+
|
31
|
+
class << self
|
32
|
+
attr_accessor :output
|
33
|
+
attr_accessor :warnings
|
34
|
+
|
35
|
+
def puts(message = '')
|
36
|
+
@output << "#{message}\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
def warn(message = '', actions = [])
|
40
|
+
@warnings << "#{message}\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
def print(message)
|
44
|
+
@output << message
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
#-----------------------------------------------------------------------------#
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-linkline
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- youhui
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-07-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A plug-in that can customize component dependencies, static libraries/dynamic
|
42
|
+
libraries.
|
43
|
+
email:
|
44
|
+
- developer_yh@163.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- cocoapods-linkline.gemspec
|
55
|
+
- lib/cocoapods-linkline.rb
|
56
|
+
- lib/cocoapods-linkline/command.rb
|
57
|
+
- lib/cocoapods-linkline/command/linkline.rb
|
58
|
+
- lib/cocoapods-linkline/command/target-linkline.rb
|
59
|
+
- lib/cocoapods-linkline/command/targetdefinition-linkline.rb
|
60
|
+
- lib/cocoapods-linkline/gem_version.rb
|
61
|
+
- lib/cocoapods_plugin.rb
|
62
|
+
- spec/command/linkline_spec.rb
|
63
|
+
- spec/spec_helper.rb
|
64
|
+
homepage: https://github.com/ymoyao/cocoapods-linkline
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.1.2
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: use :linkages => dynimic to define component all child dependencies with
|
87
|
+
dynimic framework. \ use :linkage => static to component self with static framework.
|
88
|
+
test_files:
|
89
|
+
- spec/command/linkline_spec.rb
|
90
|
+
- spec/spec_helper.rb
|