lib/cocoapods-jxedt/command/options/options.rb in cocoapods-jxedt-0.0.12 vs lib/cocoapods-jxedt/command/options/options.rb in cocoapods-jxedt-0.0.13
- old
+ new
@@ -8,25 +8,108 @@
DESC
self.command = 'options'
self.arguments = [
]
def self.options
- []
+ [
+ ['--more-config', '获取cocoapods-jxedt插件的完整配置'],
+ ['--config', '获取cocoapods-jxedt插件的基础配置']
+ ]
end
def initialize(argv)
+ @config = argv.flag?('config', false)
+ @more_config = argv.flag?('more-config', false)
super
end
def validate!
super
end
def run
require 'cocoapods-jxedt/binary/config'
+
+ return print_options_config if @more_config
+ return print_base_options_config if @config
+
require 'json'
+ log_section "🌹 APPLICABLE_DSL_CONFIG"
dsl_config = Jxedt::Config::APPLICABLE_DSL_CONFIG
- puts JSON.pretty_generate(dsl_config)
+ Pod::UI.puts JSON.pretty_generate(dsl_config)
+
+ log_section "🌹 GIT_CACHE_CONFIG"
+ git_config = Jxedt::Config::GIT_CACHE_CONFIG
+ Pod::UI.puts JSON.pretty_generate(git_config)
+ end
+
+ def print_base_options_config
+ config = <<CONFIG
+use_frameworks! :linkage => :static
+# use_modular_headers!
+
+plugin 'cocoapods-jxedt'
+options = {
+ 'all_binary': true, # 所有组件开启binary
+ 'keep_source_project': true, # 保留源码pod工程,所在目录`Pods-Source`
+ 'excluded_pods': [], # 排除binary的组件名称
+ 'framework_header_search_enabled': true, # 兼容头文件引用`#import "xxx.h"`
+ 'configurations': ['Release'], # 支持的configurations ['Release', 'Debug']
+ 'device_build_enabled': true, # 真机
+ 'simulator_build_enabled': false # 模拟器
+}
+cocoapods_jxedt_config(options)
+CONFIG
+ Pod::UI.puts config
+ end
+
+ def print_options_config
+ dsl_config = Jxedt::Config::APPLICABLE_DSL_CONFIG
+ git_config = Jxedt::Config::GIT_CACHE_CONFIG
+
+ config = <<CONFIG
+use_frameworks! :linkage => :static # 插件是支持使用library的,插件会把编译后的.a生成framework。如果你的工程不支持module,可以删掉或者注释掉这一行。不影响使用
+# use_modular_headers!
+
+plugin 'cocoapods-jxedt'
+
+# 这里默认配置了大部分常用的配置参数,只需要简单修改就可以使用了
+options = {
+ 'all_binary': true, # #{dsl_config[:all_binary]}
+ 'binary_dir': '../_Prebuild', # #{dsl_config[:binary_dir]}
+ 'binary_switch': true, # #{dsl_config[:binary_switch]}
+ 'prebuild_job': true, # #{dsl_config[:prebuild_job]}
+ 'keep_source_project': false, # #{dsl_config[:keep_source_project]}
+ 'excluded_pods': [], # #{dsl_config[:excluded_pods]}
+ 'framework_header_search_enabled': false, # #{dsl_config[:framework_header_search_enabled]}
+ 'configurations': ['Release'], # #{dsl_config[:configurations]}
+ 'xcframework': false, # #{dsl_config[:xcframework]}
+ 'clean_build': true, # #{dsl_config[:clean_build]}
+ 'device_build_enabled': true, # #{dsl_config[:device_build_enabled]}
+ 'simulator_build_enabled': false, # #{dsl_config[:simulator_build_enabled]}
+ 'disable_resource_compilable_pods': false, # #{dsl_config[:disable_resource_compilable_pods]}
+ 'build_args': { # 下面是默认的配置,如果没有改动可删除节点
+ 'default': ["ONLY_ACTIVE_ARCH=NO", "BUILD_LIBRARY_FOR_DISTRIBUTION=YES"],
+ 'device': ["ARCHS='arm64'"],
+ 'simulator': ["ARCHS='x86_64'"]
+ },
+ 'git_cache': { # 如果不需要git缓存,直接删掉这个节点即可
+ 'repo': '', # #{git_config[:repo]}
+ 'branch': 'develop', # #{git_config[:branch]}
+ 'auto_fetch': true, # #{git_config[:auto_fetch]}
+ 'auto_push': false # #{git_config[:auto_push]}
+ }
+}
+cocoapods_jxedt_config(options)
+CONFIG
+
+ Pod::UI.puts config
+ end
+
+ def log_section(message)
+ Pod::UI.puts "-----------------------------------------"
+ Pod::UI.puts message
+ Pod::UI.puts "-----------------------------------------"
end
end
end
end
end
\ No newline at end of file