cocoapods-xcframework 0.0.4
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 +7 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +50 -0
- data/Rakefile +13 -0
- data/cocoapods-framework.gemspec +24 -0
- data/lib/cocoapods-framework.rb +1 -0
- data/lib/cocoapods-framework/command.rb +1 -0
- data/lib/cocoapods-framework/command/framework.rb +59 -0
- data/lib/cocoapods-framework/config.rb +6 -0
- data/lib/cocoapods-framework/frameworker.rb +63 -0
- data/lib/cocoapods-framework/gem_version.rb +3 -0
- data/lib/cocoapods-framework/util.rb +2 -0
- data/lib/cocoapods-framework/util/dir_util.rb +25 -0
- data/lib/cocoapods-framework/util/pod_util.rb +109 -0
- data/lib/cocoapods-framework/xbuilder.rb +104 -0
- data/lib/cocoapods-framework/xbuilder/xcode_xbuild.rb +20 -0
- data/lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb +45 -0
- data/lib/cocoapods_plugin.rb +9 -0
- data/pic/allplatform.png +0 -0
- data/pkg/cocoapods-framework-0.0.1.gem +0 -0
- data/pkg/cocoapods-framework-0.0.2.gem +0 -0
- data/pkg/cocoapods-framework-0.0.3.gem +0 -0
- data/spec/command/framework_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 21eebd4159dfb6bb5f9ce1ff183edec5ec27f03711cecc7acf5d8d709083c537
|
4
|
+
data.tar.gz: 36505a48d941b64cfd935fe51879abc4d463128aed8ff8452f8eb35c13a1ef81
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2f5591a1b65359fbc2fbff1d2a9a2158634ef95cb7e0c999d8a489c58276a6954ed30895676f13964fec0e0f29750ce3dcee412b38121ad786266902bd419249
|
7
|
+
data.tar.gz: a79c9b4b557543cf890b19fe9148853f0e64b497ec513cb7bf9f9ad1232fe544e4fcc4b4f643df4f830e89098af44cf4521679a553128f6ea6d49e2185b579db
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2021 戴易超 <daiyichao@corp.netease.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,50 @@
|
|
1
|
+
# cocoapods-framework
|
2
|
+
|
3
|
+
- 你是不是发现 `cocoapods-packager` 不能支持 `Swift`?
|
4
|
+
- 你是不是发现 `cocoapods-packager` 不能支持 `m1`?
|
5
|
+
- 你是不是发现 `cocoapods-packager` 不能支持 `GCC module`?
|
6
|
+
- 你是不是发现 `cocoapods-packager` 不能支持 `watch` 和 `tv`?
|
7
|
+
- 那你不妨试试我们这个插件~,美滋滋哦~
|
8
|
+
本插件可以帮助开发者快速的创建一个`OC`/`Swift`的`xcframework`。
|
9
|
+
|
10
|
+
## feat
|
11
|
+
- 支持 `Swift`/`Object-C` 生成 `framework`
|
12
|
+
- 支持 `Xcode` 新特性: `xcframework`
|
13
|
+
- 支持 `cocoapods` 绝大多数属性
|
14
|
+
- 支持 `subspec` 打包
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
$ gem install cocoapods-framework
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
$ pod framework NAME [SOURCE]
|
21
|
+
更多请看
|
22
|
+
$pod framework --help
|
23
|
+
|
24
|
+
## Q&A
|
25
|
+
### 而且本插件支持`apple`的全平台的`framework`创建,如下图
|
26
|
+
|
27
|
+

|
28
|
+
|
29
|
+
所以如果我们的库不是全平台都支持的话,可以选取支持的平台来打包,如下
|
30
|
+
|
31
|
+
```
|
32
|
+
Pod::Spec do |spec|
|
33
|
+
# @param [Array<Symbol, String>] args
|
34
|
+
# A tuple where the first value is the name of the platform,
|
35
|
+
# (either `:ios` or `:osx`) and the second is the deployment
|
36
|
+
# target.
|
37
|
+
spec.platform = :osx, '10.8'
|
38
|
+
end
|
39
|
+
```
|
40
|
+
### 动态库和静态库
|
41
|
+
|
42
|
+
```
|
43
|
+
Pod::Spec do |spec|
|
44
|
+
spec.static_framework = true
|
45
|
+
#spec.static_framework = false
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
### 其他
|
50
|
+
请提`issue`,我会尽力更新。
|
data/Rakefile
ADDED
@@ -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-framework/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-xcframework'
|
8
|
+
spec.version = CocoapodsFramework::VERSION
|
9
|
+
spec.authors = ['戴易超']
|
10
|
+
spec.email = ['daiyichao@corp.netease.com']
|
11
|
+
spec.description = %q{A short description of cocoapods-xcframework.}
|
12
|
+
spec.summary = %q{A longer description of cocoapods-xcframework.}
|
13
|
+
spec.homepage = 'https://github.com/TyrantDante/cocoapods-framework'
|
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
|
+
spec.add_dependency "cocoapods", '>= 1.10.0', '< 2.0'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
spec.add_development_dependency 'rake'
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-framework/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-framework/command/framework'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
# This is an example of a cocoapods plugin adding a top-level subcommand
|
4
|
+
# to the 'pod' command.
|
5
|
+
#
|
6
|
+
# You can also create subcommands of existing or new commands. Say you
|
7
|
+
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
8
|
+
# (e.g. `pod list deprecated`), there are a few things that would need
|
9
|
+
# to change.
|
10
|
+
#
|
11
|
+
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
12
|
+
# the class to exist in the the Pod::Command::List namespace
|
13
|
+
# - change this class to extend from `List` instead of `Command`. This
|
14
|
+
# tells the plugin system that it is a subcommand of `list`.
|
15
|
+
# - edit `lib/cocoapods_plugins.rb` to require this file
|
16
|
+
#
|
17
|
+
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
18
|
+
# in the `plugins.json` file, once your plugin is released.
|
19
|
+
#
|
20
|
+
class Framework < Command
|
21
|
+
self.summary = 'Package a podspec into a xcframework.'
|
22
|
+
self.arguments = [
|
23
|
+
CLAide::Argument.new('NAME', true),
|
24
|
+
CLAide::Argument.new('SOURCE', false)
|
25
|
+
]
|
26
|
+
include Config::Mixin
|
27
|
+
|
28
|
+
def self.options
|
29
|
+
[
|
30
|
+
['--no-force', 'Overwrite existing files.'],
|
31
|
+
['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
|
32
|
+
['--spec-sources=private,https://github.com/CocoaPods/Specs.git', 'The sources to pull dependent pods from (defaults to https://github.com/CocoaPods/Specs.git)'],
|
33
|
+
['--subspecs', 'Only include the given subspecs']
|
34
|
+
].concat super
|
35
|
+
end
|
36
|
+
|
37
|
+
def initialize(argv)
|
38
|
+
@name = argv.shift_argument
|
39
|
+
@source = argv.shift_argument
|
40
|
+
@spec_sources = argv.option('spec-sources', 'https://github.com/CocoaPods/Specs.git').split(',')
|
41
|
+
subspecs = argv.option('subspecs')
|
42
|
+
@subspecs = subspecs.split(',') unless subspecs.nil?
|
43
|
+
@configuration = argv.option('configuration', 'Release')
|
44
|
+
@force = argv.flag?('force', true)
|
45
|
+
super
|
46
|
+
end
|
47
|
+
|
48
|
+
def validate!
|
49
|
+
super
|
50
|
+
help! 'A Pod name is required.' unless @name
|
51
|
+
end
|
52
|
+
|
53
|
+
def run
|
54
|
+
frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force)
|
55
|
+
frameworker.run
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Pod
|
2
|
+
class Frameworker
|
3
|
+
include PodUtil
|
4
|
+
include DirUtil
|
5
|
+
include Config::Mixin
|
6
|
+
def initialize(name, source, spec_sources, subspecs, configuration, force)
|
7
|
+
@name = name
|
8
|
+
@source = source
|
9
|
+
@spec_sources = spec_sources
|
10
|
+
@subspecs = subspecs
|
11
|
+
@configuration = configuration
|
12
|
+
@force = force
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
spec = spec_with_path @name
|
17
|
+
@is_spec_from_path = true if spec
|
18
|
+
spec ||= spec_with_name @name
|
19
|
+
|
20
|
+
target_dir, work_dir = create_working_directory_by_spec spec, @force
|
21
|
+
build_framework spec, work_dir, target_dir
|
22
|
+
end
|
23
|
+
|
24
|
+
def build_framework spec, work_dir, target_dir
|
25
|
+
build_in_sandbox(work_dir, spec, target_dir)
|
26
|
+
end
|
27
|
+
|
28
|
+
def build_in_sandbox work_dir, spec, target_dir
|
29
|
+
config.installation_root = Pathname.new work_dir
|
30
|
+
config.sandbox_root = "#{work_dir}/Pods"
|
31
|
+
sandbox = build_static_sandbox
|
32
|
+
|
33
|
+
sandbox_installer = installation_root(
|
34
|
+
sandbox,
|
35
|
+
spec,
|
36
|
+
@subspecs,
|
37
|
+
@spec_sources,
|
38
|
+
)
|
39
|
+
|
40
|
+
perform_build(
|
41
|
+
sandbox,
|
42
|
+
sandbox_installer,
|
43
|
+
spec,
|
44
|
+
target_dir
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
# def perform_build platform, sandbox, installer, spec
|
49
|
+
def perform_build sandbox, installer, spec, target_dir
|
50
|
+
sandbox_root = config.sandbox_root.to_s
|
51
|
+
builder = Pod::XBuilder.new(
|
52
|
+
installer,
|
53
|
+
Dir.pwd,
|
54
|
+
sandbox_root,
|
55
|
+
spec,
|
56
|
+
@configuration
|
57
|
+
)
|
58
|
+
builder.build
|
59
|
+
builder.outputs target_dir
|
60
|
+
target_dir
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Pod
|
2
|
+
module DirUtil
|
3
|
+
def create_target_directory_path_by_spec spec,force
|
4
|
+
target_dir = "#{Dir.pwd}/#{spec.name}-#{spec.version}"
|
5
|
+
|
6
|
+
if File.exist? target_dir
|
7
|
+
if @force
|
8
|
+
Pathname.new(target_dir).rmtree
|
9
|
+
else
|
10
|
+
UI.warn "Target directory '#{target_dir}' already exists."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
target_dir
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_working_directory_by_spec spec,force
|
17
|
+
target_dir = create_target_directory_path_by_spec spec,force
|
18
|
+
# Pathname.new(target_dir).mkdir
|
19
|
+
work_dir = Dir.tmpdir + '/frameworks-' + Array.new(8) { rand(36).to_s(36) }.join
|
20
|
+
|
21
|
+
Pathname.new(work_dir).mkdir
|
22
|
+
[target_dir, work_dir]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module Pod
|
2
|
+
module PodUtil
|
3
|
+
def spec_with_path(path)
|
4
|
+
return if path.nil?
|
5
|
+
path = Pathname.new(path)
|
6
|
+
path = Pathname.new(Dir.pwd).join(path) unless path.absolute?
|
7
|
+
return unless path.exist?
|
8
|
+
@path = path.expand_path
|
9
|
+
|
10
|
+
if @path.directory?
|
11
|
+
help! @path + ': is a directory.'
|
12
|
+
return
|
13
|
+
end
|
14
|
+
|
15
|
+
unless ['.podspec', '.json'].include? @path.extname
|
16
|
+
help! @path + ': is not a podspec.'
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
20
|
+
Specification.from_file(@path)
|
21
|
+
end
|
22
|
+
|
23
|
+
def spec_with_name(name)
|
24
|
+
return if name.nil?
|
25
|
+
|
26
|
+
set = Pod::Config.instance.sources_manager.search(Dependency.new(name))
|
27
|
+
return nil if set.nil?
|
28
|
+
|
29
|
+
set.specification.root
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_static_sandbox
|
33
|
+
Sandbox.new(config.sandbox_root)
|
34
|
+
end
|
35
|
+
|
36
|
+
def installation_root sandbox, spec, subspecs, sources,use_frameworks = true
|
37
|
+
podfile = podfile_from_spec(
|
38
|
+
@path,
|
39
|
+
spec,
|
40
|
+
# platform,
|
41
|
+
subspecs,
|
42
|
+
sources,
|
43
|
+
use_frameworks
|
44
|
+
)
|
45
|
+
|
46
|
+
installer = Installer.new(sandbox, podfile)
|
47
|
+
puts podfile.to_hash.to_json
|
48
|
+
installer.install!
|
49
|
+
|
50
|
+
unless installer.nil?
|
51
|
+
installer.pods_project.targets.each do |target|
|
52
|
+
target.build_configurations.each do |configuration|
|
53
|
+
configuration.build_settings['CLANG_MODULES_AUTOLINK'] = 'NO'
|
54
|
+
configuration.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
installer.pods_project.save
|
58
|
+
end
|
59
|
+
installer
|
60
|
+
end
|
61
|
+
|
62
|
+
def podfile_from_spec path, spec, subspecs, sources, use_frameworks = true
|
63
|
+
options = Hash.new
|
64
|
+
options[:podspec] = path.to_s
|
65
|
+
options[:subspecs] = subspecs if subspecs
|
66
|
+
|
67
|
+
Pod::Podfile.new do
|
68
|
+
sources.each {|s| source s}
|
69
|
+
spec.available_platforms.each do |plt|
|
70
|
+
target "#{spec.name}-#{plt.name}" do
|
71
|
+
platform(plt.name, spec.deployment_target(plt.name))
|
72
|
+
pod(spec.name, options)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
install!('cocoapods',
|
77
|
+
:integrate_targets => false,
|
78
|
+
:deterministic_uuids => false)
|
79
|
+
|
80
|
+
use_frameworks! if use_frameworks
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def generic_new_podspec_hash spec
|
85
|
+
spec_hash = spec.to_hash
|
86
|
+
[
|
87
|
+
"source_files",
|
88
|
+
"resources",
|
89
|
+
"resource_bundles",
|
90
|
+
"prefix_header_contents",
|
91
|
+
"prefix_header_file",
|
92
|
+
"header_dir",
|
93
|
+
"header_mappings_dir",
|
94
|
+
"script_phase",
|
95
|
+
"public_header_files",
|
96
|
+
"private_header_files",
|
97
|
+
"vendored_frameworks",
|
98
|
+
"vendored_libraries",
|
99
|
+
"exclude_files",
|
100
|
+
"preserve_paths",
|
101
|
+
"module_map",
|
102
|
+
"subspec"
|
103
|
+
].each do |key|
|
104
|
+
spec_hash.delete "#{key}"
|
105
|
+
end
|
106
|
+
spec_hash
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'cocoapods-framework/xbuilder/xcode_xbuild'
|
2
|
+
require 'cocoapods-framework/xbuilder/xcodeproj_helper'
|
3
|
+
module Pod
|
4
|
+
class XBuilder
|
5
|
+
include XcodeXBuilder
|
6
|
+
include XcodeProjHelper
|
7
|
+
include PodUtil
|
8
|
+
include Config::Mixin
|
9
|
+
def initialize(installer, source_dir, sandbox_root, spec, configuration)
|
10
|
+
# def initialize(platform, installer, source_dir, sandbox_root, spec, config)
|
11
|
+
# @platform = platform
|
12
|
+
@installer = installer
|
13
|
+
@source_dir = source_dir
|
14
|
+
@sandbox_root = sandbox_root
|
15
|
+
@spec = spec
|
16
|
+
@configuration = configuration
|
17
|
+
@outputs = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def build
|
21
|
+
UI.puts("Building framework #{@spec} with configuration #{@configuration}")
|
22
|
+
UI.puts "Work dir is :#{@sandbox_root}"
|
23
|
+
defines = "GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_#{@spec.name}=PodsDummy_PodPackage_#{@spec.name}'"
|
24
|
+
# defines << ' ' << @spec.consumer(@platform).compiler_flags.join(' ')
|
25
|
+
|
26
|
+
if @configuration == 'Debug'
|
27
|
+
defines << 'GCC_GENERATE_DEBUGGING_SYMBOLS=YES ONLY_ACTIVE_ARCH=NO'
|
28
|
+
end
|
29
|
+
|
30
|
+
build_all_device defines
|
31
|
+
|
32
|
+
collect_xc_frameworks
|
33
|
+
end
|
34
|
+
|
35
|
+
def collect_xc_frameworks
|
36
|
+
export_dir = "#{@sandbox_root}/export/**/#{@spec.name}.framework"
|
37
|
+
frameworks = Pathname.glob(export_dir)
|
38
|
+
@outputs = create_xc_framework_by_frameworks frameworks
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_xc_framework_by_frameworks frameworks
|
42
|
+
command = 'xcodebuild -create-xcframework '
|
43
|
+
frameworks.each do |framework|
|
44
|
+
command << "-framework #{framework} "
|
45
|
+
end
|
46
|
+
command << "-output #{@sandbox_root}/#{@spec.name}.xcframework 2>&1"
|
47
|
+
UI.puts `#{command}`
|
48
|
+
if $?.exitstatus != 0
|
49
|
+
UI.puts(output)
|
50
|
+
Process.exit
|
51
|
+
end
|
52
|
+
"#{@sandbox_root}/#{@spec.name}.xcframework"
|
53
|
+
end
|
54
|
+
|
55
|
+
def build_all_device defines
|
56
|
+
# build general first because simulator will exchange SDKROOT to simulat sdk
|
57
|
+
build_general_device defines
|
58
|
+
build_simulator_device defines
|
59
|
+
end
|
60
|
+
|
61
|
+
def build_general_device defines
|
62
|
+
UI.puts("--- Building framework #{@spec} with general device")
|
63
|
+
xcode_xbuild(
|
64
|
+
defines,
|
65
|
+
@configuration,
|
66
|
+
@sandbox_root
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def build_simulator_device defines
|
71
|
+
UI.puts("--- Building framework #{@spec} with simulator device")
|
72
|
+
modify_xcode_project_sdk_to_simullator "#{@sandbox_root}/Pods.xcodeproj"
|
73
|
+
xcode_xbuild(
|
74
|
+
defines,
|
75
|
+
@configuration,
|
76
|
+
@sandbox_root
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
def outputs target_dir
|
81
|
+
if not File.exist? target_dir
|
82
|
+
Pathname.new(target_dir).mkdir
|
83
|
+
end
|
84
|
+
outputs_xcframework target_dir
|
85
|
+
new_spec_hash = generic_new_podspec_hash @spec
|
86
|
+
new_spec_hash[:vendored_frameworks] = "#{@spec.name}.xcframework"
|
87
|
+
require 'json'
|
88
|
+
spec_json = JSON.pretty_generate(new_spec_hash) << "\n"
|
89
|
+
File.open("#{target_dir}/#{@spec.name}.podspec.json",'wb+') do |f|
|
90
|
+
f.write(spec_json)
|
91
|
+
end
|
92
|
+
UI.puts "result export at :#{target_dir}"
|
93
|
+
target_dir
|
94
|
+
end
|
95
|
+
|
96
|
+
def outputs_xcframework target_dir
|
97
|
+
`cp -rp #{@outputs} #{target_dir} 2>&1`
|
98
|
+
if $?.exitstatus != 0
|
99
|
+
UI.puts output
|
100
|
+
Process.exit
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Pod
|
2
|
+
class XBuilder
|
3
|
+
module XcodeXBuilder
|
4
|
+
def xcode_xbuild(defines, configuration, work_dir, build_dir = 'export')
|
5
|
+
if defined?(Pod::DONT_CODESIGN)
|
6
|
+
args = "#{args} CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO"
|
7
|
+
end
|
8
|
+
pwd = Pathname.pwd
|
9
|
+
Dir.chdir work_dir
|
10
|
+
command = "xcodebuild #{defines} BUILD_DIR=#{build_dir} BUILD_LIBRARY_FOR_DISTRIBUTION=YES clean build -configuration #{configuration} -alltargets 2>&1"
|
11
|
+
outputs = `#{command}`.lines.to_s
|
12
|
+
Dir.chdir pwd
|
13
|
+
if $?.exitstatus != 0
|
14
|
+
UI.puts output
|
15
|
+
Process.exit
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'xcodeproj'
|
2
|
+
module Pod
|
3
|
+
class XBuilder
|
4
|
+
module XcodeProjHelper
|
5
|
+
def modify_xcode_project_sdk_to_simullator path
|
6
|
+
sdks = xcode_sdks
|
7
|
+
project = Xcodeproj::Project.open path
|
8
|
+
|
9
|
+
project.targets.each do |target|
|
10
|
+
simulator_sdk = to_native_simulator_platform target.sdk
|
11
|
+
if not simulator_sdk.nil?
|
12
|
+
canonicalName = sdks[simulator_sdk]["canonicalName"]
|
13
|
+
target.build_configurations.each do |configuration|
|
14
|
+
configuration.build_settings["SDKROOT"] = canonicalName
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
project.save
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def xcode_sdks
|
23
|
+
return @x_sdks if @x_sdks
|
24
|
+
outputs = `xcodebuild -showsdks -json`
|
25
|
+
sdks = JSON.parse outputs
|
26
|
+
@x_sdks = {}
|
27
|
+
sdks.each do |sdk|
|
28
|
+
@x_sdks[sdk["platform"]] = sdk
|
29
|
+
end
|
30
|
+
@x_sdks
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_native_simulator_platform name
|
34
|
+
case name
|
35
|
+
when 'iphoneos' then 'iphonesimulator'
|
36
|
+
when 'macOS' then nil
|
37
|
+
when 'appletvos' then 'appletvsimulator'
|
38
|
+
when 'watchos' then 'watchsimulator'
|
39
|
+
else
|
40
|
+
name
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/pic/allplatform.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
describe Command::Framework do
|
5
|
+
describe 'CLAide' do
|
6
|
+
it 'registers it self' do
|
7
|
+
Command.parse(%w{ framework }).should.be.instance_of Command::Framework
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -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,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-xcframework
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 戴易超
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cocoapods
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.10.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.10.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.3'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.3'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
description: A short description of cocoapods-xcframework.
|
62
|
+
email:
|
63
|
+
- daiyichao@corp.netease.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- Gemfile
|
69
|
+
- LICENSE.txt
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- cocoapods-framework.gemspec
|
73
|
+
- lib/cocoapods-framework.rb
|
74
|
+
- lib/cocoapods-framework/command.rb
|
75
|
+
- lib/cocoapods-framework/command/framework.rb
|
76
|
+
- lib/cocoapods-framework/config.rb
|
77
|
+
- lib/cocoapods-framework/frameworker.rb
|
78
|
+
- lib/cocoapods-framework/gem_version.rb
|
79
|
+
- lib/cocoapods-framework/util.rb
|
80
|
+
- lib/cocoapods-framework/util/dir_util.rb
|
81
|
+
- lib/cocoapods-framework/util/pod_util.rb
|
82
|
+
- lib/cocoapods-framework/xbuilder.rb
|
83
|
+
- lib/cocoapods-framework/xbuilder/xcode_xbuild.rb
|
84
|
+
- lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb
|
85
|
+
- lib/cocoapods_plugin.rb
|
86
|
+
- pic/allplatform.png
|
87
|
+
- pkg/cocoapods-framework-0.0.1.gem
|
88
|
+
- pkg/cocoapods-framework-0.0.2.gem
|
89
|
+
- pkg/cocoapods-framework-0.0.3.gem
|
90
|
+
- spec/command/framework_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
homepage: https://github.com/TyrantDante/cocoapods-framework
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubygems_version: 3.0.3
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: A longer description of cocoapods-xcframework.
|
115
|
+
test_files:
|
116
|
+
- spec/command/framework_spec.rb
|
117
|
+
- spec/spec_helper.rb
|