cocoapods-xcframework 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: e585d673b3955cf72fabe8215902f92f47634ada97c293bd2acdf3a8e42a9622
4
- data.tar.gz: 27d5a9e175c71b1701ec24bc0abaf31de9a57b396662574c08e5d485f81d085d
3
+ metadata.gz: 03bcb80dd7866167ac26bd68b27aa441079ab56b7508b123708aa3bb2d014bd7
4
+ data.tar.gz: af1b92eb7982834a3b24163e38e330a4e61a507beb51588aa84db321fefb7505
5
5
  SHA512:
6
- metadata.gz: 62df3f2b4a90787a7101851ebe5e1d78dbac8685d7edf6e2e3543879cee31ff37c05d9365bfd08e95dbdb6acdf53a0f799397a916b1fcac02e68a244012ecf7c
7
- data.tar.gz: ea585449d6726c1ac2c5a493dfce82cc04cf58f8bc3b848c35bd779517cd111f61f883163cc4bf248c9e7b0382f30fb5de912759699ecfcaf4b090238efc68a1
6
+ metadata.gz: 7b603436f5a79f74957eade0f2cbc18d6c6aa4eff461186a338522499df98e35cb9ec0ba07c6c766e5141d4348e59b175d82201fdba0a96ceb1a0b66d6a44278
7
+ data.tar.gz: d6e6d4721e635eef0d9ad30be3bf4fb8629d88eca559a09f8bda42150eb4cf2db890f771a91b55c3015aba66dea2a7bd994dc9210f23a36a8ce4d45c6fdf9857
@@ -1,3 +1,3 @@
1
1
  module CocoapodsFramework
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -49,7 +49,7 @@ module Pod
49
49
  unless installer.nil?
50
50
  installer.pods_project.targets.each do |target|
51
51
  target.build_configurations.each do |configuration|
52
- # configuration.build_settings['CLANG_MODULES_AUTOLINK'] = 'NO'
52
+ configuration.build_settings['CLANG_MODULES_AUTOLINK'] = 'NO'
53
53
  end
54
54
  end
55
55
  installer.pods_project.save
@@ -14,7 +14,7 @@ module Pod
14
14
  @sandbox_root = sandbox_root
15
15
  @spec = spec
16
16
  @configuration = configuration
17
- @outputs = nil
17
+ @outputs = {}
18
18
  end
19
19
 
20
20
  def build
@@ -31,12 +31,29 @@ module Pod
31
31
  build_all_device defines
32
32
 
33
33
  collect_xc_frameworks
34
+
35
+ collect_bundles
34
36
  end
35
37
 
36
38
  def collect_xc_frameworks
37
39
  export_dir = "#{@sandbox_root}/export/**/#{@spec.name}.framework"
38
40
  frameworks = Pathname.glob(export_dir)
39
- @outputs = create_xc_framework_by_frameworks frameworks
41
+ @outputs[:xcframework] = create_xc_framework_by_frameworks frameworks
42
+ end
43
+
44
+ def collect_bundles
45
+ ["iphoneos","macOS","appletvos","watchos"].each do |plat|
46
+ export_dir = "#{@sandbox_root}/export/*-#{plat}/**/#{@spec.name}.bundle"
47
+ Pathname.glob(export_dir).each do |bundle|
48
+ @outputs[:bundle] = "#{@sandbox_root}/bundle"
49
+ native_platform = to_native_platform plat
50
+ path = Pathname.new "#{@sandbox_root}/bundle/#{native_platform}"
51
+ if not path.exist?
52
+ path.mkpath
53
+ end
54
+ FileUtils.cp_r(Dir["#{bundle}"],"#{path}")
55
+ end
56
+ end
40
57
  end
41
58
 
42
59
  def create_xc_framework_by_frameworks frameworks
@@ -83,8 +100,10 @@ module Pod
83
100
  Pathname.new(target_dir).mkdir
84
101
  end
85
102
  outputs_xcframework target_dir
103
+ outputs_bundle target_dir
86
104
  new_spec_hash = generic_new_podspec_hash @spec
87
105
  new_spec_hash[:vendored_frameworks] = "#{@spec.name}.xcframework"
106
+ new_spec_hash[:resource_bundles] = find_bundles target_dir
88
107
  require 'json'
89
108
  spec_json = JSON.pretty_generate(new_spec_hash) << "\n"
90
109
  File.open("#{target_dir}/#{@spec.name}.podspec.json",'wb+') do |f|
@@ -92,15 +111,36 @@ module Pod
92
111
  end
93
112
  UI.puts "result export at :#{target_dir}"
94
113
  target_dir
114
+ exit -1
115
+ end
116
+
117
+ def find_bundles target_dir
118
+ bundle_root = "#{target_dir}/bundle/"
119
+ bundle_name = "/#{@spec.name}.bundle"
120
+ pattern = "#{bundle_root}*#{bundle_name}"
121
+ result = {}
122
+ Pathname.glob(pattern).each do |bundle|
123
+ bundle_relative_path = bundle.to_s.gsub(bundle_root, "")
124
+ plat = bundle_relative_path.gsub(bundle_name,"")
125
+ result[plat] = "bundle/" + bundle_relative_path
126
+ end
127
+ puts result
128
+ result
95
129
  end
96
130
 
97
131
  def outputs_xcframework target_dir
98
- command = "cp -rp #{@outputs} #{target_dir} 2>&1"
132
+ command = "cp -rp #{@outputs[:xcframework]} #{target_dir} 2>&1"
99
133
  output = `#{command}`.lines.to_a
100
134
  if $?.exitstatus != 0
101
135
  Pod::ErrorUtil.error_report command,output
102
136
  Process.exit -1
103
137
  end
104
138
  end
139
+
140
+ def outputs_bundle target_dir
141
+ if @outputs[:bundle]
142
+ FileUtils.cp_r(Dir[@outputs[:bundle]],target_dir)
143
+ end
144
+ end
105
145
  end
106
146
  end
@@ -18,6 +18,17 @@ module Pod
18
18
  project.save
19
19
  end
20
20
 
21
+ def to_native_platform name
22
+ case name
23
+ when 'iphoneos' then 'ios'
24
+ when 'macOS' then 'osx'
25
+ when 'appletvos' then 'tvos'
26
+ when 'watchos' then 'watchos'
27
+ else
28
+ name
29
+ end
30
+ end
31
+
21
32
  private
22
33
  def xcode_sdks
23
34
  return @x_sdks if @x_sdks
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-xcframework
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
  - 戴易超
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-30 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods