Class: Jxedt::Config
- Inherits:
-
Object
- Object
- Jxedt::Config
- Defined in:
- lib/cocoapods-jxedt/binary/config.rb
Constant Summary collapse
- APPLICABLE_DSL_CONFIG =
{ :all_binary => '全部组件使用二进制。默认为false', :binary_dir => "二进制文件的保存路径,'Pods/Pods.xcodeproj'文件的相对路径。默认为'../_Prebuild'", :binary_switch => "插件开关,设置为false则关闭插件二进制功能。默认为true", :prebuild_job => "开启编译任务,设置为false则不触发编译功能。默认为true", :keep_source_project => "保留源码的pods工程,方便查看源码,文件目录为Podfile文件同级目录下'Pods-Source'。默认为false", :dev_pods_enabled => "Development Pods是否支持二进制。默认为false", :excluded_pods => "排除binary的pods,是一个数组。默认是[]", :xcconfig_configuration_alias => "xcconfig文件中配置多configuration的别名(一定要唯一),用于搜索替换,我们用来支持多configuration的二进制。一般不需要设置,默认值为'cocoapods-jxedt-binary'", :framework_header_search_enabled => "开启binary的组件是否配置HEADER_SEARCH_PATH头文件搜索,兼容头文件引用的问题。默认为false", :silent_build => "静默编译,即不输出编译命令。默认true", :configurations => "支持的configuration配置,可以写字符串'Debug'或'Release',也可以写多个'['Debug', 'Release']'。默认为'Release'", :xcframework => "编译结果是否为xcframework。默认false", :clean_build => "编译的时候是否clean build。默认true", :bitcode_enabled => "开启bitcode。默认false", :device_build_enabled => "编译真机架构。默认true", :simulator_build_enabled => "编译模拟器架构。默认false", :disable_dsym => "禁止DSYM产物。默认true", :disable_resource_compilable_pods => "禁止编译有特殊resource文件(xib、xcdatamodeld等)的pod。默认为false", :build_log_path => "编译的log输出路径。", :prebuild_sandbox_path => '预编译的sandbox(源码)路径,可以配置一个多台电脑都可访问的路径,做源码和二进制的link。必须以`/Users/cocoapods-jxedt`开头,否则插件认为无效。', :build_args => "编译的配置。了解xcodebuild命令的可以配置编译参数,例如配置 ARCHS='arm64 armv7'", :git_cache => 'git缓存配置。A Hash. 详情查看 GIT_CACHE_CONFIG' }.freeze
- GIT_CACHE_CONFIG =
{ :repo => '配置缓存仓库地址,如:{:remote => "https://github.com/user/cocoapods-cache.git", :local => "~/.cocoapods-jxedt/cocoapods-cache"},或者直接写远程仓库地址"https://github.com/user/cocoapods-cache.git"', :branch => 'git cache的branch,默认是master分支', :auto_fetch => '预编译过程是否自动拉取远程的二进制。默认true', :auto_push => '预编译过程是否自动同步二进制结果到远程。默认false' }.freeze
Instance Attribute Summary collapse
-
#dsl_config ⇒ Object
Returns the value of attribute dsl_config.
Class Method Summary collapse
Instance Method Summary collapse
- #all_binary_enabled? ⇒ Boolean
- #auto_fetch? ⇒ Boolean
- #auto_push? ⇒ Boolean
- #binary_dir ⇒ Object
- #binary_switch? ⇒ Boolean
- #bitcode_enabled? ⇒ Boolean
- #build_args ⇒ Object
- #build_log_path ⇒ Object
- #cache_branch ⇒ Object
- #cache_repo ⇒ Object
- #cache_repo_enabled? ⇒ Boolean
- #clean_build? ⇒ Boolean
- #dev_pods_enabled? ⇒ Boolean
- #device_build_enabled? ⇒ Boolean
- #disable_dsym? ⇒ Boolean
- #disable_resource_compilable_pods? ⇒ Boolean
- #excluded_pods ⇒ Object
- #framework_header_search_enabled? ⇒ Boolean
-
#git_cache_config ⇒ Object
git配置 ======================================= git配置.
- #git_cache_path ⇒ Object
- #git_remote_repo ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #keep_source_project? ⇒ Boolean
- #prebuild_job? ⇒ Boolean
- #prebuild_sandbox_path ⇒ Object
- #silent_build? ⇒ Boolean
- #simulator_build_enabled? ⇒ Boolean
- #support_configurations ⇒ Object
- #validate_dsl_config ⇒ Object
- #xcconfig_configuration_alias ⇒ Object
- #xcframework? ⇒ Boolean
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
41 42 43 44 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 41 def initialize() @dsl_config = {} @git_config = {} end |
Instance Attribute Details
#dsl_config ⇒ Object
Returns the value of attribute dsl_config.
7 8 9 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 7 def dsl_config @dsl_config end |
Class Method Details
.instance ⇒ Object
46 47 48 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 46 def self.instance @instance ||= new() end |
Instance Method Details
#all_binary_enabled? ⇒ Boolean
62 63 64 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 62 def all_binary_enabled? @dsl_config[:all_binary] || false end |
#auto_fetch? ⇒ Boolean
207 208 209 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 207 def auto_fetch? git_cache_config[:auto_fetch] || git_cache_config[:auto_fetch].nil? end |
#auto_push? ⇒ Boolean
211 212 213 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 211 def auto_push? git_cache_config[:auto_push] end |
#binary_dir ⇒ Object
90 91 92 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 90 def binary_dir @dsl_config[:binary_dir] || '../_Prebuild' end |
#binary_switch? ⇒ Boolean
66 67 68 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 66 def binary_switch? @dsl_config[:binary_switch] || @dsl_config[:binary_switch].nil? end |
#bitcode_enabled? ⇒ Boolean
114 115 116 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 114 def bitcode_enabled? @dsl_config[:bitcode_enabled] || false end |
#build_args ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 147 def build_args @args ||= begin args = @dsl_config[:build_args] || {} # 可选的配置项 = [] << "ONLY_ACTIVE_ARCH=NO" << "BUILD_LIBRARY_FOR_DISTRIBUTION=YES" args[:default] ||= args[:device] ||= ["ARCHS='arm64'"] # ["ARCHS='arm64 armv7 armv7s'"] args[:simulator] ||= ["ARCHS='x86_64'"] # ["ARCHS='arm64 x86_64 i386'"] args end end |
#build_log_path ⇒ Object
134 135 136 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 134 def build_log_path @dsl_config[:build_log_path] end |
#cache_branch ⇒ Object
215 216 217 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 215 def cache_branch git_cache_config[:branch] || 'master' end |
#cache_repo ⇒ Object
177 178 179 180 181 182 183 184 185 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 177 def cache_repo @cache_repo ||= begin cache_repo = {} user_config = git_cache_config[:repo] cache_repo[:remote] = user_config if user_config.is_a?(String) cache_repo.merge!(user_config) if user_config.is_a?(Hash) cache_repo end end |
#cache_repo_enabled? ⇒ Boolean
191 192 193 194 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 191 def cache_repo_enabled? remote = git_remote_repo remote && remote.is_a?(String) && remote =~ /.*\.git$/ end |
#clean_build? ⇒ Boolean
110 111 112 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 110 def clean_build? @dsl_config[:clean_build] || @dsl_config[:clean_build].nil? end |
#dev_pods_enabled? ⇒ Boolean
78 79 80 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 78 def dev_pods_enabled? @dsl_config[:dev_pods_enabled] || false end |
#device_build_enabled? ⇒ Boolean
126 127 128 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 126 def device_build_enabled? @dsl_config[:device_build_enabled] || @dsl_config[:device_build_enabled].nil? end |
#disable_dsym? ⇒ Boolean
118 119 120 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 118 def disable_dsym? @dsl_config[:disable_dsym] || @dsl_config[:disable_dsym].nil? end |
#disable_resource_compilable_pods? ⇒ Boolean
122 123 124 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 122 def disable_resource_compilable_pods? @dsl_config[:disable_resource_compilable_pods] || false end |
#excluded_pods ⇒ Object
82 83 84 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 82 def excluded_pods @dsl_config[:excluded_pods] || [] end |
#framework_header_search_enabled? ⇒ Boolean
86 87 88 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 86 def framework_header_search_enabled? @dsl_config[:framework_header_search_enabled] || false end |
#git_cache_config ⇒ Object
git配置 ======================================= git配置
173 174 175 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 173 def git_cache_config @git_cache ||= @dsl_config[:git_cache] || {} end |
#git_cache_path ⇒ Object
196 197 198 199 200 201 202 203 204 205 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 196 def git_cache_path return nil unless cache_repo_enabled? local = cache_repo[:local] return File.(local) if local && local.is_a?(String) && local.split('/').size > 1 remote = git_remote_repo repo_name = Pathname.new(remote).basename.sub_ext('').to_s File.("~/.cocoapods-jxedt/#{repo_name}") end |
#git_remote_repo ⇒ Object
187 188 189 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 187 def git_remote_repo @remote ||= cache_repo[:remote] end |
#keep_source_project? ⇒ Boolean
74 75 76 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 74 def keep_source_project? @dsl_config[:keep_source_project] || false end |
#prebuild_job? ⇒ Boolean
70 71 72 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 70 def prebuild_job? @dsl_config[:prebuild_job] || @dsl_config[:prebuild_job].nil? end |
#prebuild_sandbox_path ⇒ Object
138 139 140 141 142 143 144 145 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 138 def prebuild_sandbox_path @sandbox_path ||= begin sandbox_path = @dsl_config[:prebuild_sandbox_path] sandbox_path = nil unless sandbox_path =~ /^\/Users\/cocoapods-jxedt\/.{1,}$/ sandbox_path = nil unless File.exist?('/Users/cocoapods-jxedt') sandbox_path end end |
#silent_build? ⇒ Boolean
102 103 104 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 102 def silent_build? @dsl_config[:silent_build] || @dsl_config[:silent_build].nil? end |
#simulator_build_enabled? ⇒ Boolean
130 131 132 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 130 def simulator_build_enabled? @dsl_config[:simulator_build_enabled] || false end |
#support_configurations ⇒ Object
161 162 163 164 165 166 167 168 169 170 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 161 def support_configurations @configurations ||= begin configurations = [] user_config = @dsl_config[:configurations] configurations << user_config if user_config.is_a?(String) configurations += user_config if user_config.is_a?(Array) configurations = ["Release"] if configurations.empty? configurations end end |
#validate_dsl_config ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 50 def validate_dsl_config = @dsl_config.keys - APPLICABLE_DSL_CONFIG.keys return if .empty? = " [WARNING] The following options (in `config_cocoapods_util`) are not correct: \#{inapplicable_options}.\n Available options: \#{APPLICABLE_DSL_CONFIG}.\n HEREDOC\n \n Pod::UI.puts message.yellow\nend\n" |
#xcconfig_configuration_alias ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 94 def xcconfig_configuration_alias @val ||= begin val = @dsl_config[:xcconfig_configuration_alias] val = "cocoapods-jxedt-binary" if val.nil? || val.empty? val end end |
#xcframework? ⇒ Boolean
106 107 108 |
# File 'lib/cocoapods-jxedt/binary/config.rb', line 106 def xcframework? @dsl_config[:xcframework] || false end |