Class: Pod::Command::JxedtCommand::Binary::Build
- Inherits:
-
Pod::Command::JxedtCommand::Binary
- Object
- Pod::Command
- Pod::Command::JxedtCommand
- Pod::Command::JxedtCommand::Binary
- Pod::Command::JxedtCommand::Binary::Build
- Defined in:
- lib/cocoapods-jxedt/command/binary/command/build.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Build
constructor
A new instance of Build.
- #log_section(message) ⇒ Object
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Build
Returns a new instance of Build.
22 23 24 25 26 27 28 |
# File 'lib/cocoapods-jxedt/command/binary/command/build.rb', line 22 def initialize(argv) @names = argv.option('name', '').split(',') @output_path = argv.option('output-path') @force_push = argv.flag?('force-push', false) @should_push = argv.flag?('push', false) || @force_push super end |
Class Method Details
.options ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/cocoapods-jxedt/command/binary/command/build.rb', line 14 def self. [ ['--name', '编译的组件name,多个以,分隔'], ['--output-path', '编译的二进制文件输出路径'], ['--push', '编译的组件二进制推送到远程'], ['--force-push', '强制推送编译的组件二进制到远程'] ] end |
Instance Method Details
#log_section(message) ⇒ Object
76 77 78 79 80 |
# File 'lib/cocoapods-jxedt/command/binary/command/build.rb', line 76 def log_section() Pod::UI.puts "-----------------------------------------" Pod::UI.puts Pod::UI.puts "-----------------------------------------" end |
#run ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/cocoapods-jxedt/command/binary/command/build.rb', line 34 def run podfile = Pod::Config.instance.podfile lockfile = Pod::Config.instance.lockfile sandbox = Pod::Config.instance.sandbox help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil? || lockfile.nil? || sandbox.nil? # 修改config配置 = { :keep_source_project => true, # 保留源码工程 } Jxedt.config.dsl_config.merge!() require 'cocoapods-jxedt/binary/helper/target_definition' require 'cocoapods-jxedt/binary/helper/prebuild_sandbox' require 'cocoapods-jxedt/binary/helper/podfile_post_install_hook' require 'cocoapods-jxedt/binary/helper/prebuild_installer' # 获取原始的installer对象,必须先获取对象 prebuild_sandbox = Pod::JxedtPrebuildSandbox.from_standard_sandbox(sandbox) source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, podfile, lockfile) # 执行install source_installer.install! # 保存首次`pod install`的lockfile结果,用来验证二进制文件和后面做结果校验 sandbox.source_lockfile = prebuild_sandbox.source_lockfile = source_installer.lockfile require 'cocoapods-jxedt/binary/helper/podfile_options' require 'cocoapods-jxedt/binary/prebuild' # prebuild_job log_section "🚀 Prebuild frameworks" # 默认放在Pods源码工程同级目录下 @output_path = prebuild_sandbox.project_path.parent + '.command_build' if @output_path.nil? build_targets = Jxedt::Prebuild.new(source_installer).build_targets :names => @names, :binary_output => @output_path if @should_push && Jxedt.config.cache_repo_enabled? require 'cocoapods-jxedt/git_helper/cache_pucher' output_dir = Pathname.new(@output_path) Jxedt::CachePucher.push(output_dir, build_targets, @force_push) end prebuild_sandbox.clean_source_project! end |
#validate! ⇒ Object
30 31 32 |
# File 'lib/cocoapods-jxedt/command/binary/command/build.rb', line 30 def validate! super end |