cocoapods-pod-linkage 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bb73c00fc8ed5f51a036f4016a5976cbd8c9d13bc4870b4cba9fb52f34d4a3ec
4
+ data.tar.gz: 284febd37873ae09b9c33c00f342ef398d459eedad150e1c9d265349af5b40e7
5
+ SHA512:
6
+ metadata.gz: 281531ed1b335751e1be656ea86761843659c6bea7a419c47e94d8e235467877dd1137f5eebb20840fc63f4d76dacdc5c042f6c05c6c22f3c47ab3ff3d304b61
7
+ data.tar.gz: 11db8132fd3e54cb92ac88af97bd02260277ac5b985086dbb9e90fff6839af5d788b65f53d640b1915a19f1e2154a4f94b48617a7ca37eac60d60eb2aaea3065
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # CocoaPods Pod Linkage plugin
2
+
3
+ This project is a [CocoaPods](https://github.com/CocoaPods/CocoaPods) plugin that allows to set a `:linkage` option for a specific pod.
4
+
5
+ ## Usage
6
+
7
+ Add to your Podfile
8
+ ```Ruby
9
+ plugin 'cocoapods-pod-linkage'
10
+ ```
11
+
12
+ Then, use the `:linkage` option to change the linking style of that pod
13
+ ```Ruby
14
+ target :MyTarget do
15
+ use_frameworks! :linkage => :static
16
+
17
+ pod 'MyStaticPod', '1.2.3'
18
+ pod 'MyDynamicPod', '1.2.3', :linkage => :dynamic
19
+ end
20
+ ```
21
+
22
+ ## Run tests for this plugin
23
+
24
+ To run the tests, use
25
+ ```shell
26
+ rake tests
27
+ ```
28
+
29
+ ## Contributing
30
+
31
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
32
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
33
+ the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
34
+
35
+ When you submit a pull request, a CLA bot will automatically determine whether you need to provide
36
+ a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
37
+ provided by the bot. You will only need to do this once across all repos using our CLA.
38
+
39
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
40
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
41
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
42
+
43
+ ## Trademarks
44
+
45
+ This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
46
+ trademarks or logos is subject to and must follow
47
+ [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
48
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
49
+ Any use of third-party trademarks or logos are subject to those third-party's policies.
@@ -0,0 +1,2 @@
1
+ require 'cocoapods-pod-linkage/gem_version'
2
+ require 'cocoapods-pod-linkage/patched_analyzer'
@@ -0,0 +1,3 @@
1
+ module CocoapodsPodLinkage
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,108 @@
1
+ require 'cocoapods'
2
+
3
+ class Pod::Installer::Analyzer
4
+
5
+ alias_method :original_generate_pod_targets, :generate_pod_targets
6
+
7
+ def generate_pod_targets(resolver_specs_by_target, target_inspections)
8
+ targets = original_generate_pod_targets(resolver_specs_by_target, target_inspections)
9
+
10
+ pod_targets = []
11
+ targets.each { |target|
12
+ explicit_linkage = target.target_definitions.map { |t| t.explicit_pod_linkage[target.pod_name] }.compact.first
13
+
14
+ # We need to update the target only if we specified an explicit linkage
15
+ if explicit_linkage
16
+ override_target = ((explicit_linkage == :static && target.build_as_dynamic?) || (explicit_linkage == :dynamic && target.build_as_static?))
17
+
18
+ # Create the correct Pod::BuildType because Pod::PodTarget doesn't expose it
19
+ if target.build_as_framework?
20
+ build_type = Pod::BuildType.new(:linkage => explicit_linkage, :packaging => :framework)
21
+ else
22
+ build_type = Pod::BuildType.new(:linkage => explicit_linkage, :packaging => :library)
23
+ end
24
+
25
+ # Pods are de-duplicated before this function, we need to merge them remove the scope suffix
26
+ scope_suffix = target.scope_suffix
27
+ if scope_suffix == 'static' || scope_suffix == 'dynamic'
28
+ override_target = true
29
+ scope_suffix = nil
30
+ end
31
+
32
+ if override_target
33
+ # Create the new target
34
+ target = Pod::PodTarget.new(
35
+ target.sandbox,
36
+ build_type,
37
+ target.user_build_configurations,
38
+ target.archs,
39
+ target.platform,
40
+ target.specs,
41
+ target.target_definitions,
42
+ target.file_accessors,
43
+ scope_suffix,
44
+ target.swift_version
45
+ )
46
+
47
+ # If we already have a target with the same name we just merge the target defitions
48
+ # TODO: Check that all the other properties are really the same!
49
+ existing_target = pod_targets.find { |t| t.label == target.label }
50
+ if existing_target
51
+ Pod::UserInterface.message "- Merging #{target.pod_name} target definitions"
52
+
53
+ target = Pod::PodTarget.new(
54
+ existing_target.sandbox,
55
+ build_type,
56
+ existing_target.user_build_configurations,
57
+ existing_target.archs,
58
+ existing_target.platform,
59
+ existing_target.specs,
60
+ existing_target.target_definitions + target.target_definitions,
61
+ existing_target.file_accessors,
62
+ existing_target.scope_suffix,
63
+ existing_target.swift_version
64
+ )
65
+
66
+ pod_targets.delete existing_target
67
+ else
68
+ Pod::UserInterface.message "- Updating #{target.pod_name}"
69
+ end
70
+ end
71
+ end
72
+
73
+ pod_targets.append target
74
+ }
75
+
76
+ all_specs = resolver_specs_by_target.values.flatten.map(&:spec).uniq.group_by(&:name)
77
+ compute_pod_target_dependencies(pod_targets, all_specs)
78
+ end
79
+
80
+ end
81
+
82
+ module Pod
83
+ class Podfile
84
+ class TargetDefinition
85
+
86
+ def detect_explicit_pod_linkage(name, requirements)
87
+ @explicit_pod_linkage ||= {}
88
+ options = requirements.last || {}
89
+ @explicit_pod_linkage[Specification.root_name(name)] = options[:linkage] if options.is_a?(Hash) && options[:linkage]
90
+ options.delete(:linkage) if options.is_a?(Hash)
91
+ requirements.pop if options.empty?
92
+ end
93
+
94
+ def explicit_pod_linkage
95
+ pod_linkage = @explicit_pod_linkage || {}
96
+ pod_linkage.merge!(parent.explicit_pod_linkage) { |key, v1, v2| v1 } if !parent.nil? && parent.is_a?(TargetDefinition)
97
+ pod_linkage
98
+ end
99
+
100
+ original_parse_inhibit_warnings = instance_method(:parse_inhibit_warnings)
101
+ define_method(:parse_inhibit_warnings) do |name, requirements|
102
+ detect_explicit_pod_linkage(name, requirements)
103
+ original_parse_inhibit_warnings.bind(self).call(name, requirements)
104
+ end
105
+
106
+ end
107
+ end
108
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-pod-linkage'
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-pod-linkage
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Microsoft Corporation
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-02-19 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
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.11'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.11'
69
+ description:
70
+ email:
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - LICENSE
76
+ - README.md
77
+ - lib/cocoapods-pod-linkage.rb
78
+ - lib/cocoapods-pod-linkage/gem_version.rb
79
+ - lib/cocoapods-pod-linkage/patched_analyzer.rb
80
+ - lib/cocoapods_plugin.rb
81
+ homepage: https://github.com/microsoft/cocoapods-pod-linkage
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubygems_version: 3.0.3
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: CocoaPods plugin for configuring the linkage type of a specific pod.
104
+ test_files: []