cocoapods-jxedt 0.0.10 → 0.0.12

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: 777002b95ef4f80296a0e6289a5a90ad04c2f71e49d2e647fd21e145c872b871
4
- data.tar.gz: 0dc4fee30c433a0e07c89c114c61e9f2355746618fd3cf2055f011e9e767b4b4
3
+ metadata.gz: ad01cd6bd2da4418b03764271caab2236a186ea81f3c9f77a885910d12263d78
4
+ data.tar.gz: aa9f410bbbea81420a9d04f01c379428aece86e8449c9ec10a461a79d03825fe
5
5
  SHA512:
6
- metadata.gz: 239b4f5621619a359f42159c0d14bad1402e75b56862af836ae297b6ff88667b0bf8fc6b2bbdc5a1f65d31fade8b04895de910f2d50c99e2ba7f03f19e12ce14
7
- data.tar.gz: 198b0e23d430d4788b3fe14cee2562041b8323ac9ad68ac12b215613a9ea443caa6c427e6d49f51fb539687f81c2e0caab8de2290362227ab268de8e34ea0472
6
+ metadata.gz: a0a5d962b702c2fde4f3ac10a81e027ba555f72310b31fee0530e94587eb7e56019ddf0d5e64951dd8f3c0e50626afbf286aa3c15b31a678bbb99413dcc5e8d1
7
+ data.tar.gz: 60e70a3f5be60178cf721b4d69b113d065275eb415f70655feb718279b9b2ad9de3bfb8a9ce0a01050b2972a7c2346ef7bbcd723849054d40bf79dc7b84db124
@@ -11,6 +11,7 @@ module Jxedt
11
11
  :binary_dir => "framework的保存路径,相对于'Pods/Pods.xcodeproj'的相对路径。默认为'../_Prebuild'",
12
12
  :binary_switch => "二进制开关,关闭则不hook pre_install过程。默认为true",
13
13
  :prebuild_job => "开启编译任务,设置为false则不触发编译。默认为true",
14
+ :keep_source_project => "保留源码的pods工程,默认保留,方便查看源码",
14
15
  :dev_pods_enabled => "Development Pods是否支持binary。默认为false",
15
16
  :excluded_pods => "排除binary的pods",
16
17
  :xcconfig_configuration_alias => "xcconfig文件中configuration的别名,configurations设置为多个值的时候会用到,用于搜索替换。一般不需要设置,有默认值为'cocoapods-jxedt-binary'",
@@ -59,6 +60,10 @@ module Jxedt
59
60
  @dsl_config[:prebuild_job] || @dsl_config[:prebuild_job].nil?
60
61
  end
61
62
 
63
+ def keep_source_project?
64
+ @dsl_config[:keep_source_project] || false
65
+ end
66
+
62
67
  def dev_pods_enabled?
63
68
  @dsl_config[:dev_pods_enabled] || false
64
69
  end
@@ -1,4 +1,46 @@
1
1
  module Pod
2
+ # The sandbox provides support for the directory that CocoaPods uses for an
3
+ # installation. In this directory the Pods projects, the support files and
4
+ # the sources of the Pods are stored.
5
+ #
6
+ # CocoaPods assumes to have control of the sandbox.
7
+ #
8
+ # Once completed the sandbox will have the following file structure:
9
+ #
10
+ # Pods
11
+ # |
12
+ # +-- Headers
13
+ # | +-- Private
14
+ # | | +-- [Pod Name]
15
+ # | +-- Public
16
+ # | +-- [Pod Name]
17
+ # |
18
+ # +-- Local Podspecs
19
+ # | +-- External Sources
20
+ # | +-- Normal Sources
21
+ # |
22
+ # +-- Target Support Files
23
+ # | +-- [Target Name]
24
+ # | +-- Pods-acknowledgements.markdown
25
+ # | +-- Pods-acknowledgements.plist
26
+ # | +-- Pods-dummy.m
27
+ # | +-- Pods-prefix.pch
28
+ # | +-- Pods.xcconfig
29
+ # |
30
+ # +-- [Pod Name]
31
+ # |
32
+ # +-- Manifest.lock
33
+ # |
34
+ # +-- Pods.xcodeproj
35
+ # (if installation option 'generate_multiple_pod_projects' is enabled)
36
+ # |
37
+ # +-- PodTarget1.xcodeproj
38
+ # |
39
+ # ...
40
+ # |
41
+ # +-- PodTargetN.xcodeproj
42
+ #
43
+ #
2
44
  class PrebuildSandbox < Sandbox
3
45
  # [String] standard_sandbox_path
4
46
  def self.from_standard_sandbox_path(path)
@@ -10,9 +52,77 @@ module Pod
10
52
  from_standard_sandbox_path(sandbox.root)
11
53
  end
12
54
 
55
+ def make_source_link(source, target)
56
+ source = Pathname.new(source)
57
+ target = Pathname.new(target)
58
+ target.parent.mkpath unless target.parent.exist?
59
+ target.rmtree if target.exist?
60
+ relative_source = source.relative_path_from(target.parent)
61
+ FileUtils.ln_sf(relative_source, target)
62
+ end
63
+
64
+ def source_path
65
+ '../Pods-Source'
66
+ end
67
+
68
+ def headers_root
69
+ root + source_path + 'Headers'
70
+ end
71
+
13
72
  def project_path
14
- super
15
- # root + 'Pods.xcodeproj'
73
+ root + source_path + 'Pods-Source.xcodeproj'
74
+ end
75
+
76
+ def specifications_root
77
+ # root + source_path + 'Local Podspecs'
78
+ super
79
+ end
80
+
81
+ def target_support_files_root
82
+ root + source_path + 'Target Support Files'
83
+ end
84
+
85
+ def link_source_project!
86
+ root.children.each do |child|
87
+ next if ['Headers', 'Local Podspecs', 'Target Support Files'].include? child.basename.to_s
88
+ next if ['.lock', '.xcodeproj'].include? child.extname.to_s
89
+ make_source_link(child, root + source_path + child.basename)
90
+ end
91
+ end
92
+
93
+ def clean_source_project!
94
+ return if Jxedt.config.keep_source_project?
95
+
96
+ source_project_path = root + source_path
97
+ source_project_path.rmtree if source_project_path.exist?
98
+ end
99
+ end
100
+ end
101
+
102
+ module Pod
103
+ class Installer
104
+ # The {UserProjectIntegrator} integrates the libraries generated by
105
+ # TargetDefinitions of the {Podfile} with their correspondent user
106
+ # projects.
107
+ #
108
+ class UserProjectIntegrator
109
+ alias_method :old_create_workspace, :create_workspace
110
+ def create_workspace
111
+ old_create_workspace unless sandbox.is_a?(Pod::PrebuildSandbox)
112
+ end
113
+ end
114
+ end
115
+ end
116
+
117
+ module Pod
118
+ class Installer
119
+ # Cleans up the sandbox directory by removing stale target support files and headers.
120
+ #
121
+ class SandboxDirCleaner
122
+ alias_method :old_clean!, :clean!
123
+ def clean!
124
+ old_clean! unless @sandbox.is_a?(Pod::PrebuildSandbox)
125
+ end
16
126
  end
17
127
  end
18
128
  end
@@ -44,8 +44,12 @@ module Jxedt
44
44
  require_relative '../prebuild'
45
45
 
46
46
  # prebuild_job
47
- log_section "🚀 Prebuild frameworks" if Jxedt.config.prebuild_job?
48
- Jxedt::Prebuild.new(source_installer).build if Jxedt.config.prebuild_job?
47
+ sandbox.link_source_project!
48
+ if Jxedt.config.prebuild_job?
49
+ log_section "🚀 Prebuild frameworks"
50
+ Jxedt::Prebuild.new(source_installer).build
51
+ end
52
+ sandbox.clean_source_project!
49
53
 
50
54
  log_section "🤖 Resume pod installation"
51
55
  require_relative '../targets/pod_target'
@@ -1,4 +1,54 @@
1
1
  module Pod
2
+ class PodTarget < Target
3
+ alias_method :old_resource_paths, :resource_paths
4
+ def resource_paths
5
+ resource_paths = old_resource_paths
6
+ # 没有使用二进制不处理
7
+ return resource_paths unless self.use_binary
8
+
9
+ # 遍历所有的resources
10
+ resource_paths.each do |name, resources|
11
+ resources.map! {|resource_file|
12
+ resource_extname = Pathname.new(resource_file).basename.extname
13
+ # 如果文件不需要编译,跳过
14
+ next resource_file unless self.class.resource_extension_compilable?(resource_extname)
15
+
16
+ # 确定编译后的文件名称
17
+ output_extname = self.class.output_extension_for_resource(resource_extname)
18
+ output_file_name = "#{Pathname.new(resource_file).basename.sub_ext('')}#{output_extname}"
19
+ # 从framework中查找编译后的文件
20
+ file_accessors.each do |file_accessor|
21
+ file_accessor.vendored_frameworks.each do |framework_file|
22
+ framework_name = Pathname.new(framework_file).basename.sub_ext('').to_s
23
+ # 只处理和当前target module_name相同的framework,否则跳过
24
+ next if self.product_module_name != framework_name
25
+
26
+ # xcframework和framework文件分别处理,而且只查找.framework根目录下的文件
27
+ if '.xcframework' == Pathname.new(framework_file).basename.extname
28
+ files = Dir.glob("#{framework_file}/**/#{framework_name}.framework/#{output_file_name}")
29
+ next if files.size == 0 # 没有查找到文件跳过
30
+
31
+ if Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
32
+ resource_file = "${PODS_XCFRAMEWORKS_BUILD_DIR}/#{self.name}/#{framework_name}.framework/#{output_file_name}"
33
+ else
34
+ resource_file = "${PODS_CONFIGURATION_BUILD_DIR}/#{framework_name}.framework/#{output_file_name}"
35
+ end
36
+ else
37
+ files = Dir.glob("#{framework_file}/#{output_file_name}")
38
+ next if files.size == 0 # 没有查找到文件跳过
39
+
40
+ resource_path = Pathname.new("#{framework_file}/#{output_file_name}") # 真实路径
41
+ resource_file = "${PODS_ROOT}/#{resource_path.relative_path_from(self.sandbox.root)}"
42
+ end
43
+ end
44
+ end
45
+ resource_file
46
+ }.reject!(&:nil?)
47
+ end
48
+ resource_paths
49
+ end
50
+ end
51
+
2
52
  class Target
3
53
  # @since 1.5.0
4
54
  class BuildSettings
@@ -59,7 +59,7 @@ module Pod
59
59
 
60
60
  # print
61
61
  index, failed = 0, []
62
- used_binary.sort_by {|hash| hash[:name] }.each do |hash|
62
+ used_binary.sort_by {|hash| hash[:name].capitalize }.each do |hash|
63
63
  name = hash[:name]
64
64
 
65
65
  checksum = lockfile.spec_checksums_hash_key(name)
@@ -1,3 +1,3 @@
1
1
  module CocoapodsJxedt
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.12"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-jxedt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - guojiashuang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-20 00:00:00.000000000 Z
11
+ date: 2023-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods