cocoapods-mangle 1.0.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/cocoapods_mangle/defines.rb +48 -1
- data/lib/cocoapods_mangle/gem_version.rb +1 -1
- data/spec/integration/integration_spec.rb +95 -44
- data/spec/unit/defines_spec.rb +1 -0
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8e3e5ea98b00fef6e6fe353b1d5af1a3cea60e8754232da6e68af0f963672b3a
|
4
|
+
data.tar.gz: 1acb90d8e00f8067719da05d0be65b06fed8c53260e311c07ac23e93a274b80f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47e25cb2dc8d9472883d9015d696b551ff4ddbb282f818081bcf63a9b0d961c2ee64e029d0524984df558ae6ff17ddc40a626be9f1553cc5664df3911092c364
|
7
|
+
data.tar.gz: 335dc5007733d490e97bb3f8d06dab0d122ffea13575a6b684f921286e9f4d22291697083ef5e36a7b53376ec36166e6f36bdb573f206b01c89f41b124268120
|
@@ -23,6 +23,8 @@ module CocoapodsMangle
|
|
23
23
|
# @return [Array<String>] The classes defined in the binaries
|
24
24
|
def self.classes(binaries)
|
25
25
|
all_symbols = run_nm(binaries, '-gU')
|
26
|
+
all_symbols = all_symbols.reject { |symbol| swift_symbol?(symbol) }
|
27
|
+
|
26
28
|
class_symbols = all_symbols.select do |symbol|
|
27
29
|
symbol[/OBJC_CLASS_\$_/]
|
28
30
|
end
|
@@ -36,6 +38,8 @@ module CocoapodsMangle
|
|
36
38
|
# @return [Array<String>] The constants defined in the binaries
|
37
39
|
def self.constants(binaries)
|
38
40
|
all_symbols = run_nm(binaries, '-gU')
|
41
|
+
all_symbols = all_symbols.reject { |symbol| swift_symbol?(symbol) }
|
42
|
+
|
39
43
|
consts = all_symbols.select { |const| const[/ S /] }
|
40
44
|
consts = consts.reject { |const| const[/_OBJC_/] }
|
41
45
|
consts = consts.reject { |const| const[/__block_descriptor.*/] }
|
@@ -110,8 +114,51 @@ module CocoapodsMangle
|
|
110
114
|
defines
|
111
115
|
end
|
112
116
|
|
117
|
+
# Is symbol a Swift symbol? This is used to avoid mangling Swift.
|
118
|
+
# @param [String] symbol
|
119
|
+
# The symbol to check
|
120
|
+
# @return [Boolean] true if it is a Swift symbol, false otherwise
|
121
|
+
def self.swift_symbol?(symbol)
|
122
|
+
# Swift binaries have many symbols starting with $s_ that should be excluded
|
123
|
+
# e.g. '0000000000000258 S _$s9ManglePod9SomeClassCMF'
|
124
|
+
symbol[/\$s/] ||
|
125
|
+
# Internal Swift symbols starting with __swift or ___swift such as should not be mangled
|
126
|
+
# e.g. '00000000000050ac S ___swift_reflection_version'
|
127
|
+
symbol[/ __(_)?swift/] ||
|
128
|
+
# Internal Swift symbols starting with Swift such as should not be mangled
|
129
|
+
# e.g. 'Swift51Override'
|
130
|
+
symbol[/Swift/] ||
|
131
|
+
# Swift symbols starting with symbolic should be ignored
|
132
|
+
# e.g. '0000000000000248 S symbolic _____ 9ManglePod9SomeClassC'
|
133
|
+
symbol[/symbolic /] ||
|
134
|
+
# Swift symbol references to Objective-C symbols should not be mangled
|
135
|
+
# e.g. '00000000000108ca S _associated conformance So26SCNetworkReachabilityFlagsVs10SetAlgebraSCSQ'
|
136
|
+
symbol[/associated conformance/] ||
|
137
|
+
# " globalinit" symbols should be skipped
|
138
|
+
# e.g. 0000000000000000 T " globalinit_33_A313450CFC1FC3D0CBEF4411412DB9E8_func0"
|
139
|
+
symbol[/ globalinit/] ||
|
140
|
+
# "globalinit" symbols should be skipped
|
141
|
+
# e.g. 0000000000000000 T "globalinit_33_A313450CFC1FC3D0CBEF4411412DB9E8_func0"
|
142
|
+
symbol[/globalinit/] ||
|
143
|
+
# Swift classes inheriting from Objective-C classes should not be mangled
|
144
|
+
# e.g. '0000000000000290 S _OBJC_CLASS_$__TtC9ManglePod19SomeFoundationClass'
|
145
|
+
symbol[/_OBJC_CLASS_\$__/] ||
|
146
|
+
# Swift symbols starting with ____ should be ignored
|
147
|
+
# e.g. ' ____ 6Lottie15AnimatedControlCC'
|
148
|
+
symbol[/____ /] ||
|
149
|
+
# _PROTOCOL symbols should be skipped
|
150
|
+
# e.g. 0000000000000000 _PROTOCOL_METHOD_TYPES_CAAction
|
151
|
+
symbol[/_PROTOCOL/] ||
|
152
|
+
# _swiftoverride_ symbols should be skipped
|
153
|
+
# e.g. _swiftoverride_
|
154
|
+
symbol[/_\w+_swiftoverride_/] ||
|
155
|
+
# _Zxxxswift symbols should be skipped
|
156
|
+
# e.g. _ZN5swift34swift50override_conformsToProtocolEPKNS
|
157
|
+
symbol[/_Z\w+swift/]
|
158
|
+
end
|
159
|
+
|
113
160
|
def self.run_nm(binaries, flags)
|
114
161
|
`nm #{flags} #{binaries.join(' ')}`.split("\n")
|
115
162
|
end
|
116
163
|
end
|
117
|
-
end
|
164
|
+
end
|
@@ -36,60 +36,111 @@ describe CocoapodsMangle do
|
|
36
36
|
before(:each) do
|
37
37
|
fixtures_dir = File.expand_path("#{File.dirname(__FILE__)}/../fixtures")
|
38
38
|
FileUtils.copy_entry(File.join(fixtures_dir, 'project'), project_dir)
|
39
|
-
FileUtils.copy_entry(File.join(fixtures_dir,
|
39
|
+
FileUtils.copy_entry(File.join(fixtures_dir, podpsec_fixture_dir), pod_dir)
|
40
40
|
File.open(File.join(project_dir, 'Podfile'), 'w') do |podfile|
|
41
41
|
podfile.write(podfile_contents)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
context
|
46
|
-
let(:
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
45
|
+
context "with a Swift pod" do
|
46
|
+
let(:podpsec_fixture_dir) { "swift-pod" }
|
47
|
+
|
48
|
+
context 'without frameworks' do
|
49
|
+
let(:podfile_contents) do
|
50
|
+
<<~PODFILE
|
51
|
+
platform :ios, '10.0'
|
52
|
+
plugin 'cocoapods-mangle'
|
53
|
+
target 'Mangle Integration' do
|
54
|
+
pod 'ManglePod', path: '../pod'
|
55
|
+
pod 'lottie-ios'
|
56
|
+
end
|
57
|
+
PODFILE
|
58
|
+
end
|
59
|
+
let(:expected_defines) do
|
60
|
+
%w[
|
61
|
+
PodsDummy_ManglePod=Mangle_Integration_PodsDummy_ManglePod
|
62
|
+
PodsDummy_lottie_ios=Mangle_Integration_PodsDummy_lottie_ios
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
include_examples 'mangling integration'
|
64
67
|
end
|
65
68
|
|
66
|
-
|
69
|
+
context 'with frameworks' do
|
70
|
+
let(:podfile_contents) do
|
71
|
+
<<~PODFILE
|
72
|
+
platform :ios, '10.0'
|
73
|
+
use_frameworks!
|
74
|
+
plugin 'cocoapods-mangle'
|
75
|
+
target 'Mangle Integration' do
|
76
|
+
pod 'ManglePod', path: '../pod'
|
77
|
+
end
|
78
|
+
PODFILE
|
79
|
+
end
|
80
|
+
let(:expected_defines) do
|
81
|
+
%w[
|
82
|
+
ManglePodVersionNumber=Mangle_Integration_ManglePodVersionNumber
|
83
|
+
ManglePodVersionString=Mangle_Integration_ManglePodVersionString
|
84
|
+
PodsDummy_ManglePod=Mangle_Integration_PodsDummy_ManglePod
|
85
|
+
]
|
86
|
+
end
|
87
|
+
|
88
|
+
include_examples 'mangling integration'
|
89
|
+
end
|
67
90
|
end
|
68
91
|
|
69
|
-
context
|
70
|
-
let(:
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
92
|
+
context "with an Objective-C pod" do
|
93
|
+
let(:podpsec_fixture_dir) { "objc-pod" }
|
94
|
+
|
95
|
+
context 'without frameworks' do
|
96
|
+
let(:podfile_contents) do
|
97
|
+
<<~PODFILE
|
98
|
+
platform :ios, '10.0'
|
99
|
+
plugin 'cocoapods-mangle'
|
100
|
+
target 'Mangle Integration' do
|
101
|
+
pod 'ManglePod', path: '../pod'
|
102
|
+
end
|
103
|
+
PODFILE
|
104
|
+
end
|
105
|
+
let(:expected_defines) do
|
106
|
+
%w[
|
107
|
+
PodsDummy_ManglePod=Mangle_Integration_PodsDummy_ManglePod
|
108
|
+
CPMObject=Mangle_Integration_CPMObject
|
109
|
+
CPMConstant=Mangle_Integration_CPMConstant
|
110
|
+
CPMStringFromIntegerFunction=Mangle_Integration_CPMStringFromIntegerFunction
|
111
|
+
cpm_doSomethingWithoutParams=Mangle_Integration_cpm_doSomethingWithoutParams
|
112
|
+
cpm_doSomethingWithParam=Mangle_Integration_cpm_doSomethingWithParam
|
113
|
+
]
|
114
|
+
end
|
115
|
+
|
116
|
+
include_examples 'mangling integration'
|
79
117
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
118
|
+
|
119
|
+
context 'with frameworks' do
|
120
|
+
let(:podfile_contents) do
|
121
|
+
<<~PODFILE
|
122
|
+
platform :ios, '10.0'
|
123
|
+
use_frameworks!
|
124
|
+
plugin 'cocoapods-mangle'
|
125
|
+
target 'Mangle Integration' do
|
126
|
+
pod 'ManglePod', path: '../pod'
|
127
|
+
end
|
128
|
+
PODFILE
|
129
|
+
end
|
130
|
+
let(:expected_defines) do
|
131
|
+
%w[
|
132
|
+
ManglePodVersionNumber=Mangle_Integration_ManglePodVersionNumber
|
133
|
+
ManglePodVersionString=Mangle_Integration_ManglePodVersionString
|
134
|
+
PodsDummy_ManglePod=Mangle_Integration_PodsDummy_ManglePod
|
135
|
+
CPMObject=Mangle_Integration_CPMObject
|
136
|
+
CPMConstant=Mangle_Integration_CPMConstant
|
137
|
+
CPMStringFromIntegerFunction=Mangle_Integration_CPMStringFromIntegerFunction
|
138
|
+
cpm_doSomethingWithoutParams=Mangle_Integration_cpm_doSomethingWithoutParams
|
139
|
+
cpm_doSomethingWithParam=Mangle_Integration_cpm_doSomethingWithParam
|
140
|
+
]
|
141
|
+
end
|
142
|
+
|
143
|
+
include_examples 'mangling integration'
|
91
144
|
end
|
92
|
-
|
93
|
-
include_examples 'mangling integration'
|
94
145
|
end
|
95
146
|
end
|
data/spec/unit/defines_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-mangle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Treanor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.11.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.11.3
|
27
27
|
description: Mangling your dependencies symbols allows more than one copy of a dependency
|
28
28
|
to exist without errors. This plugin mangles your dependecies to make this possible
|
29
29
|
email:
|
@@ -72,8 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
|
76
|
-
rubygems_version: 2.5.2.1
|
75
|
+
rubygems_version: 3.1.6
|
77
76
|
signing_key:
|
78
77
|
specification_version: 4
|
79
78
|
summary: A CocoaPods plugin which mangles the symbols of your dependencies
|