cocoapods-fix-xcframework-slice 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cf595940b1c6b0ebe51897df3db8bbb2638ffda9971819c297b78b188ddfbe6a
4
+ data.tar.gz: 91d6a1ce6ece1ef727a66120a72079ed28ec16db93f457f907543a276172c756
5
+ SHA512:
6
+ metadata.gz: '080c59ef5916694bdc50771cb3ff412d0a8d5ca2a9bee7abe0c3fce3035adbcb2090daf959b9275c320d95ebc7ac61eb5cefff194c653dea5e053d43383bd0a9'
7
+ data.tar.gz: 43a522151b910a46870a3ec0fb3eb9cb6b9bd181a605cd8c5990033fbdb57897da5b5404f7b931fb05ddc6839602a4c589dc17615ccf772edf2bbd10b259c60f
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
4
+ example/
5
+ vendor/
6
+ .bundle/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-fix-xcframework-slice.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'cocoapods'
8
+
9
+ gem 'mocha'
10
+ gem 'bacon'
11
+ gem 'mocha-on-bacon'
12
+ gem 'prettybacon'
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,110 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cocoapods-fix-xcframework-slice (0.0.1)
5
+ cocoapods (= 1.9.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ CFPropertyList (3.0.3)
11
+ activesupport (4.2.11.3)
12
+ i18n (~> 0.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ algoliasearch (1.27.5)
17
+ httpclient (~> 2.8, >= 2.8.3)
18
+ json (>= 1.5.1)
19
+ atomos (0.1.3)
20
+ bacon (1.2.0)
21
+ claide (1.0.3)
22
+ cocoapods (1.9.3)
23
+ activesupport (>= 4.0.2, < 5)
24
+ claide (>= 1.0.2, < 2.0)
25
+ cocoapods-core (= 1.9.3)
26
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
27
+ cocoapods-downloader (>= 1.2.2, < 2.0)
28
+ cocoapods-plugins (>= 1.0.0, < 2.0)
29
+ cocoapods-search (>= 1.0.0, < 2.0)
30
+ cocoapods-stats (>= 1.0.0, < 2.0)
31
+ cocoapods-trunk (>= 1.4.0, < 2.0)
32
+ cocoapods-try (>= 1.1.0, < 2.0)
33
+ colored2 (~> 3.1)
34
+ escape (~> 0.0.4)
35
+ fourflusher (>= 2.3.0, < 3.0)
36
+ gh_inspector (~> 1.0)
37
+ molinillo (~> 0.6.6)
38
+ nap (~> 1.0)
39
+ ruby-macho (~> 1.4)
40
+ xcodeproj (>= 1.14.0, < 2.0)
41
+ cocoapods-core (1.9.3)
42
+ activesupport (>= 4.0.2, < 6)
43
+ algoliasearch (~> 1.0)
44
+ concurrent-ruby (~> 1.1)
45
+ fuzzy_match (~> 2.0.4)
46
+ nap (~> 1.0)
47
+ netrc (~> 0.11)
48
+ typhoeus (~> 1.0)
49
+ cocoapods-deintegrate (1.0.4)
50
+ cocoapods-downloader (1.4.0)
51
+ cocoapods-plugins (1.0.0)
52
+ nap
53
+ cocoapods-search (1.0.0)
54
+ cocoapods-stats (1.1.0)
55
+ cocoapods-trunk (1.5.0)
56
+ nap (>= 0.8, < 2.0)
57
+ netrc (~> 0.11)
58
+ cocoapods-try (1.2.0)
59
+ colored2 (3.1.2)
60
+ concurrent-ruby (1.1.8)
61
+ escape (0.0.4)
62
+ ethon (0.14.0)
63
+ ffi (>= 1.15.0)
64
+ ffi (1.15.0)
65
+ fourflusher (2.3.1)
66
+ fuzzy_match (2.0.4)
67
+ gh_inspector (1.1.3)
68
+ httpclient (2.8.3)
69
+ i18n (0.9.5)
70
+ concurrent-ruby (~> 1.0)
71
+ json (2.5.1)
72
+ minitest (5.14.4)
73
+ mocha (1.12.0)
74
+ mocha-on-bacon (0.2.3)
75
+ mocha (>= 0.13.0)
76
+ molinillo (0.6.6)
77
+ nanaimo (0.3.0)
78
+ nap (1.1.0)
79
+ netrc (0.11.0)
80
+ prettybacon (0.0.2)
81
+ bacon (~> 1.2)
82
+ rake (13.0.3)
83
+ ruby-macho (1.4.0)
84
+ thread_safe (0.3.6)
85
+ typhoeus (1.4.0)
86
+ ethon (>= 0.9.0)
87
+ tzinfo (1.2.9)
88
+ thread_safe (~> 0.1)
89
+ xcodeproj (1.19.0)
90
+ CFPropertyList (>= 2.3.3, < 4.0)
91
+ atomos (~> 0.1.3)
92
+ claide (>= 1.0.2, < 2.0)
93
+ colored2 (~> 3.1)
94
+ nanaimo (~> 0.3.0)
95
+
96
+ PLATFORMS
97
+ ruby
98
+
99
+ DEPENDENCIES
100
+ bacon
101
+ bundler (~> 1.3)
102
+ cocoapods
103
+ cocoapods-fix-xcframework-slice!
104
+ mocha
105
+ mocha-on-bacon
106
+ prettybacon
107
+ rake
108
+
109
+ BUNDLED WITH
110
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2021 nakahira <1021057927@qq.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # cocoapods-fix-xcframework-slice
2
+
3
+ A description of cocoapods-fix-xcframework-slice.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-fix-xcframework-slice
8
+
9
+ ## Usage
10
+
11
+ $ pod spec slice POD_NAME
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :specs do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task :default => :specs
13
+
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods-fix-xcframework-slice/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-fix-xcframework-slice'
8
+ spec.version = CocoapodsFixXcframeworkSlice::VERSION
9
+ spec.authors = ['nakahira']
10
+ spec.email = ['1021057927@qq.com']
11
+ spec.description = %q{A short description of cocoapods-fix-xcframework-slice.}
12
+ spec.summary = %q{A longer description of cocoapods-fix-xcframework-slice.}
13
+ spec.homepage = 'https://github.com/xuzhongping/cocoapods-fix-xcframework-slice'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_dependency 'cocoapods', '1.9.3'
24
+ end
@@ -0,0 +1,179 @@
1
+ require 'cocoapods-fix-xcframework-slice/gem_version'
2
+ require 'cocoapods/xcode'
3
+
4
+ module Pod
5
+ module Generator
6
+ class PrepareArtifactsScript
7
+ private
8
+ # @!group Private Helpers
9
+
10
+ # @return [String] The contents of the prepare artifacts script.
11
+ #
12
+ def script
13
+ script = <<-SH.strip_heredoc
14
+ #!/bin/sh
15
+ set -e
16
+ set -u
17
+ set -o pipefail
18
+
19
+ function on_error {
20
+ echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
21
+ }
22
+ trap 'on_error $LINENO' ERR
23
+
24
+ if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
25
+ # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
26
+ # frameworks to, so exit 0 (signalling the script phase was successful).
27
+ exit 0
28
+ fi
29
+
30
+ # This protects against multiple targets copying the same framework dependency at the same time. The solution
31
+ # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
32
+ RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
33
+
34
+ ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt"
35
+ cat > $ARTIFACT_LIST_FILE
36
+
37
+ BCSYMBOLMAP_DIR="BCSymbolMaps"
38
+
39
+ record_artifact()
40
+ {
41
+ echo "$1" >> $ARTIFACT_LIST_FILE
42
+ }
43
+
44
+ install_artifact()
45
+ {
46
+ local source="$1"
47
+ local destination="$2"
48
+ local record=${3:-false}
49
+
50
+ # Use filter instead of exclude so missing patterns don't throw errors.
51
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" \\"${source}\\" \\"${destination}\\""
52
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" "${source}" "${destination}"
53
+
54
+ if [[ "$record" == "true" ]]; then
55
+ artifact="${destination}/$(basename "$source")"
56
+ record_artifact "$artifact"
57
+ fi
58
+ }
59
+
60
+ # Copies a framework to derived data for use in later build phases
61
+ install_framework()
62
+ {
63
+ if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
64
+ local source="${BUILT_PRODUCTS_DIR}/$1"
65
+ elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
66
+ local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
67
+ elif [ -r "$1" ]; then
68
+ local source="$1"
69
+ fi
70
+
71
+ local record_artifact=${2:-true}
72
+ local destination="${CONFIGURATION_BUILD_DIR}"
73
+
74
+ if [ -L "${source}" ]; then
75
+ echo "Symlinked..."
76
+ source="$(readlink "${source}")"
77
+ fi
78
+
79
+ install_artifact "$source" "$destination" "$record_artifact"
80
+
81
+ if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then
82
+ # Locate and install any .bcsymbolmaps if present
83
+ find "${source}/${BCSYMBOLMAP_DIR}/" -name "*.bcsymbolmap"|while read f; do
84
+ install_artifact "$f" "$destination" "true"
85
+ done
86
+ fi
87
+ }
88
+
89
+ install_xcframework() {
90
+ local basepath="$1"
91
+ local dsym_folder="$2"
92
+ local embed="$3"
93
+ shift
94
+ local paths=("$@")
95
+
96
+ # Locate the correct slice of the .xcframework for the current architectures
97
+ local target_path=""
98
+ local target_arch="$ARCHS"
99
+
100
+ # Replace spaces in compound architectures with _ to match slice format
101
+ target_arch=${target_arch//\ /_}
102
+
103
+ local target_variant="physical"
104
+ if [[ "$PLATFORM_NAME" == *"simulator" ]]; then
105
+ target_variant="simulator"
106
+ fi
107
+ if [[ ! -z ${EFFECTIVE_PLATFORM_NAME+x} && "$EFFECTIVE_PLATFORM_NAME" == *"maccatalyst" ]]; then
108
+ target_variant="maccatalyst"
109
+ fi
110
+ for i in ${!paths[@]}; do
111
+ local info="${paths[$i]%%/*}"
112
+ if [[ $info != *"simulator" ]] && [[ $info != *"maccatalyst" ]]; then
113
+ info="${info}-physical"
114
+ fi
115
+ if [[ $info == *"$target_arch"* ]] && [[ $info == *"$target_variant" ]]; then
116
+ # Found a matching slice
117
+ echo "Selected xcframework slice ${paths[$i]}"
118
+ target_path=${paths[$i]}
119
+ break;
120
+ fi
121
+ done
122
+
123
+ if [[ -z "$target_path" ]]; then
124
+ echo "warning: [CP] Unable to find matching .xcframework slice in '${paths[@]}' for the current build architectures ($ARCHS)."
125
+ return
126
+ fi
127
+
128
+ install_framework "$basepath/$target_path" "$embed"
129
+
130
+ if [[ -z "$dsym_folder" || ! -d "$dsym_folder" ]]; then
131
+ return
132
+ fi
133
+
134
+ dsyms=($(ls "$dsym_folder"))
135
+
136
+ local target_dsym=""
137
+ for i in ${!dsyms[@]}; do
138
+ install_artifact "$dsym_folder/${dsyms[$i]}" "$CONFIGURATION_BUILD_DIR" "true"
139
+ done
140
+ }
141
+
142
+ SH
143
+ contents_by_config = Hash.new do |hash, key|
144
+ hash[key] = ''
145
+ end
146
+ xcframeworks_by_config.each do |config, xcframeworks|
147
+ next if xcframeworks.empty?
148
+ xcframeworks.each do |xcframework|
149
+ slices = xcframework.slices.select { |f| f.platform.symbolic_name == platform.symbolic_name }
150
+ dynamic_slices, static_slices = slices.partition { |slice| Xcode::LinkageAnalyzer.dynamic_binary?(slice.binary_path) }
151
+ next if dynamic_slices.empty? && static_slices.empty?
152
+ unless dynamic_slices.empty?
153
+ args = install_xcframework_args(xcframework.path, dynamic_slices, false)
154
+ contents_by_config[config] << %( install_xcframework #{args}\n)
155
+ end
156
+
157
+ unless static_slices.empty?
158
+ args = install_xcframework_args(xcframework.path, static_slices, true)
159
+ contents_by_config[config] << %( install_xcframework #{args}\n)
160
+ end
161
+ end
162
+ end
163
+
164
+ script << "\n" unless contents_by_config.empty?
165
+ contents_by_config.keys.sort.each do |config|
166
+ contents = contents_by_config[config]
167
+ next if contents.empty?
168
+ script << %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
169
+ script << contents
170
+ script << "fi\n"
171
+ end
172
+
173
+ script << "\necho \"Artifact list stored at $ARTIFACT_LIST_FILE\"\n"
174
+ script << "\ncat \"$ARTIFACT_LIST_FILE\"\n"
175
+ script
176
+ end
177
+ end
178
+ end
179
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ module CocoapodsFixXcframeworkSlice
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,8 @@
1
+ require 'cocoapods-fix-xcframework-slice/command'
2
+
3
+
4
+ module CocoapodsFixXcframeworkSlice
5
+ Pod::HooksManager.register('cocoapods-fix-xcframework-slice', :pre_install) do
6
+ load File.expand_path('../cocoapods-fix-xcframework-slice/cocoapods-fix-xcframework-slice.rb', __FILE__)
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Slice do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ slice }).should.be.instance_of Command::Slice
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,50 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $:.unshift((ROOT + 'lib').to_s)
4
+ $:.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'bacon'
8
+ require 'mocha-on-bacon'
9
+ require 'pretty_bacon'
10
+ require 'pathname'
11
+ require 'cocoapods'
12
+
13
+ Mocha::Configuration.prevent(:stubbing_non_existent_method)
14
+
15
+ require 'cocoapods_plugin'
16
+
17
+ #-----------------------------------------------------------------------------#
18
+
19
+ module Pod
20
+
21
+ # Disable the wrapping so the output is deterministic in the tests.
22
+ #
23
+ UI.disable_wrap = true
24
+
25
+ # Redirects the messages to an internal store.
26
+ #
27
+ module UI
28
+ @output = ''
29
+ @warnings = ''
30
+
31
+ class << self
32
+ attr_accessor :output
33
+ attr_accessor :warnings
34
+
35
+ def puts(message = '')
36
+ @output << "#{message}\n"
37
+ end
38
+
39
+ def warn(message = '', actions = [])
40
+ @warnings << "#{message}\n"
41
+ end
42
+
43
+ def print(message)
44
+ @output << message
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ #-----------------------------------------------------------------------------#
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-fix-xcframework-slice
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - nakahira
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-05-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cocoapods
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.9.3
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.9.3
55
+ description: A short description of cocoapods-fix-xcframework-slice.
56
+ email:
57
+ - 1021057927@qq.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - cocoapods-fix-xcframework-slice.gemspec
69
+ - lib/cocoapods-fix-xcframework-slice/cocoapods-fix-xcframework-slice.rb
70
+ - lib/cocoapods-fix-xcframework-slice/command.rb
71
+ - lib/cocoapods-fix-xcframework-slice/gem_version.rb
72
+ - lib/cocoapods_plugin.rb
73
+ - spec/command/slice_spec.rb
74
+ - spec/spec_helper.rb
75
+ homepage: https://github.com/xuzhongping/cocoapods-fix-xcframework-slice
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubygems_version: 3.0.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: A longer description of cocoapods-fix-xcframework-slice.
98
+ test_files:
99
+ - spec/command/slice_spec.rb
100
+ - spec/spec_helper.rb