cocoapods-rn-toolkit 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fde37df6cb9ee9b7db545f40d1c7eb771378c48aef0d3a797a66fca2294a10a
4
- data.tar.gz: ccd93a2f4016faf278013e1073b4418f90f541fa423e9e668c445715e0517d33
3
+ metadata.gz: b953c07fdbfcef36ab5675a8a9bf80d48f92f9329394c1d6c2308b3acadbf0f7
4
+ data.tar.gz: 49508903c44ef4d9b6fc5af232e43afdaf196a5247bf420f9f0f8077ca4b5231
5
5
  SHA512:
6
- metadata.gz: 0b312cb4f6e2c1055549cf2a422040298eab13d12c65eaf00d0ee12bb75449a45763e021c378ac48af09d7981d8293f39bbb6d583ab77459140b6235e6dc0a91
7
- data.tar.gz: fc8d7acc5778012054972db8ba7d1ba9cbdbf2085a5f27463584afc0e2d4778ecab1caf1238af0e57ea73e71872629c30286bfe42c2f0d5739635e2a5addd9fb
6
+ metadata.gz: 98c49fa008fb0ade3bd6230eee83430733d4a00d87f7deeb5ecdecdcbb749e419e5393faec911245f5e5330ff78333216719573bc015aeda896bf73837ee29c1
7
+ data.tar.gz: 4e8d09738a52ab6c3083d2337ca64ecc519404a7e76861f507ac480e788051812d2836662aa17546d5ac7cd7a2a6dd30c189bdbffce0fd30087e1fbe1c600017
data/README.md CHANGED
@@ -6,6 +6,9 @@ A description of cocoapods-rn-toolkit.
6
6
 
7
7
  $ gem install cocoapods-rn-toolkit
8
8
 
9
+ # gem install -s https://rubygems.org cocoapods-rn-toolkit -V
10
+
9
11
  ## Usage
10
12
 
11
13
  $ pod spec toolkit POD_NAME
14
+
@@ -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
@@ -1,3 +1,3 @@
1
1
  module CocoapodsRnToolkit
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  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
@@ -1,5 +1,34 @@
1
- require 'cocoapods-rn-toolkit/command'
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.5
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: