cocoapods-rn-toolkit 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/cocoapods-rn-toolkit/common_build_settings.rb +12 -0
- data/lib/cocoapods-rn-toolkit/gem_version.rb +1 -1
- data/lib/cocoapods-rn-toolkit/ios17_uigraphics.rb +50 -0
- data/lib/cocoapods-rn-toolkit/library_search_paths.rb +37 -0
- data/lib/cocoapods-rn-toolkit/xcode16_rnziparchive.rb +15 -0
- data/lib/cocoapods_plugin.rb +31 -2
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b953c07fdbfcef36ab5675a8a9bf80d48f92f9329394c1d6c2308b3acadbf0f7
|
4
|
+
data.tar.gz: 49508903c44ef4d9b6fc5af232e43afdaf196a5247bf420f9f0f8077ca4b5231
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98c49fa008fb0ade3bd6230eee83430733d4a00d87f7deeb5ecdecdcbb749e419e5393faec911245f5e5330ff78333216719573bc015aeda896bf73837ee29c1
|
7
|
+
data.tar.gz: 4e8d09738a52ab6c3083d2337ca64ecc519404a7e76861f507ac480e788051812d2836662aa17546d5ac7cd7a2a6dd30c189bdbffce0fd30087e1fbe1c600017
|
data/README.md
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
module CocoapodsRnToolkit
|
2
|
+
class CommonBuildSettings
|
3
|
+
def self.apply(installer)
|
4
|
+
installer.pods_project.targets.each do |target|
|
5
|
+
target.build_configurations.each do |config|
|
6
|
+
config.build_settings['ENABLE_BITCODE'] = "NO"
|
7
|
+
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module CocoapodsRnToolkit
|
2
|
+
module IOS17UIGraphics
|
3
|
+
def self.apply(installer)
|
4
|
+
installer.pod_targets.each do |pod_target|
|
5
|
+
update_prefix_header(pod_target)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def self.update_prefix_header(pod_target)
|
12
|
+
prefix_path = pod_target.prefix_header_path
|
13
|
+
return unless File.exist?(prefix_path)
|
14
|
+
|
15
|
+
content = File.read(prefix_path)
|
16
|
+
return if content.include?(macro)
|
17
|
+
|
18
|
+
content = content + "\n" + macro
|
19
|
+
File.open(prefix_path, 'w') { |file| file.write(content) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.macro
|
23
|
+
<<~MACRO
|
24
|
+
#ifndef UIGraphicsBeginImageContextWithOptions
|
25
|
+
#define UIGraphicsBeginImageContextWithOptions(size, opaque, scale) \\
|
26
|
+
do {\\
|
27
|
+
if (@available(iOS 17.0, *)) {\\
|
28
|
+
CGSize _size = CGSizeMake(size.width < 0.01 ? 0.01 : size.width, size.height < 0.01 ? 0.01 : size.height);\\
|
29
|
+
UIGraphicsBeginImageContextWithOptions(_size, opaque, scale);\\
|
30
|
+
} else {\\
|
31
|
+
UIGraphicsBeginImageContextWithOptions(size, opaque, scale);\\
|
32
|
+
}\\
|
33
|
+
} while(0)
|
34
|
+
#endif
|
35
|
+
|
36
|
+
#ifndef UIGraphicsBeginImageContext
|
37
|
+
#define UIGraphicsBeginImageContext(size) \\
|
38
|
+
do {\\
|
39
|
+
if (@available(iOS 17.0, *)) {\\
|
40
|
+
CGSize _size = CGSizeMake(size.width < 0.01 ? 0.01 : size.width, size.height < 0.01 ? 0.01 : size.height);\\
|
41
|
+
UIGraphicsBeginImageContext(_size);\\
|
42
|
+
} else {\\
|
43
|
+
UIGraphicsBeginImageContext(size);\\
|
44
|
+
}\\
|
45
|
+
} while(0)
|
46
|
+
#endif
|
47
|
+
MACRO
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module CocoapodsRnToolkit
|
2
|
+
module LibrarySearchPaths
|
3
|
+
def self.apply(installer)
|
4
|
+
projects = installer.aggregate_targets
|
5
|
+
.map{ |t| t.user_project }
|
6
|
+
.uniq{ |p| p.path }
|
7
|
+
.push(installer.pods_project)
|
8
|
+
|
9
|
+
projects.each do |project|
|
10
|
+
project.build_configurations.each do |config|
|
11
|
+
fix_config(config)
|
12
|
+
end
|
13
|
+
project.native_targets.each do |target|
|
14
|
+
target.build_configurations.each do |config|
|
15
|
+
fix_config(config)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
project.save()
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def self.fix_config(config)
|
25
|
+
lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
|
26
|
+
if lib_search_paths
|
27
|
+
if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
|
28
|
+
lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
|
29
|
+
lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
|
30
|
+
if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
|
31
|
+
lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CocoapodsRnToolkit
|
2
|
+
module Xcode16RNZipArchive
|
3
|
+
def self.apply(installer)
|
4
|
+
installer.pods_project.targets.each do |target|
|
5
|
+
if target.name == 'RNZipArchive'
|
6
|
+
target.source_build_phase.files.each do |file|
|
7
|
+
if file.settings && file.settings['COMPILER_FLAGS']
|
8
|
+
file.settings['COMPILER_FLAGS'] = ''
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1,5 +1,34 @@
|
|
1
|
-
require 'cocoapods-rn-toolkit/
|
1
|
+
require 'cocoapods-rn-toolkit/xcode16_rnziparchive'
|
2
|
+
require 'cocoapods-rn-toolkit/ios17_uigraphics'
|
3
|
+
require 'cocoapods-rn-toolkit/library_search_paths'
|
4
|
+
require 'cocoapods-rn-toolkit/common_build_settings'
|
2
5
|
|
3
6
|
module CocoapodsRnToolkit
|
4
|
-
|
7
|
+
Pod::HooksManager.register('cocoapods-rn-toolkit', :post_install) do |context|
|
8
|
+
installer = context.installer
|
9
|
+
|
10
|
+
puts "[cocoapods-rn-toolkit] 开始应用 React Native 修复..."
|
11
|
+
|
12
|
+
puts "[cocoapods-rn-toolkit] 应用通用构建设置..."
|
13
|
+
CocoapodsRnToolkit::CommonBuildSettings.apply(installer)
|
14
|
+
|
15
|
+
puts "[cocoapods-rn-toolkit] 应用 Xcode 16 RNZipArchive 修复..."
|
16
|
+
CocoapodsRnToolkit::Xcode16RNZipArchive.apply(installer)
|
17
|
+
|
18
|
+
puts "[cocoapods-rn-toolkit] 应用 iOS 17 UIGraphics 修复..."
|
19
|
+
CocoapodsRnToolkit::IOS17UIGraphics.apply(installer)
|
20
|
+
|
21
|
+
puts "[cocoapods-rn-toolkit] 应用库搜索路径修复..."
|
22
|
+
CocoapodsRnToolkit::LibrarySearchPaths.apply(installer)
|
23
|
+
|
24
|
+
puts "[cocoapods-rn-toolkit] React Native 修复应用完成。"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module Pod
|
29
|
+
class Podfile
|
30
|
+
def apply_rn_fixes!
|
31
|
+
plugin 'cocoapods-rn-toolkit'
|
32
|
+
end
|
33
|
+
end
|
5
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-rn-toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nx
|
@@ -77,7 +77,11 @@ files:
|
|
77
77
|
- lib/cocoapods-rn-toolkit.rb
|
78
78
|
- lib/cocoapods-rn-toolkit/command.rb
|
79
79
|
- lib/cocoapods-rn-toolkit/command/toolkit.rb
|
80
|
+
- lib/cocoapods-rn-toolkit/common_build_settings.rb
|
80
81
|
- lib/cocoapods-rn-toolkit/gem_version.rb
|
82
|
+
- lib/cocoapods-rn-toolkit/ios17_uigraphics.rb
|
83
|
+
- lib/cocoapods-rn-toolkit/library_search_paths.rb
|
84
|
+
- lib/cocoapods-rn-toolkit/xcode16_rnziparchive.rb
|
81
85
|
- lib/cocoapods_plugin.rb
|
82
86
|
homepage: https://github.com/your_username/cocoapods-rn-toolkit
|
83
87
|
licenses:
|
@@ -91,12 +95,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
95
|
requirements:
|
92
96
|
- - ">="
|
93
97
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
98
|
+
version: 2.6.0
|
95
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
100
|
requirements:
|
97
101
|
- - ">="
|
98
102
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
103
|
+
version: 2.7.0
|
100
104
|
requirements: []
|
101
105
|
rubygems_version: 3.1.2
|
102
106
|
signing_key:
|