Class: Jxedt::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-jxedt/binary/config.rb

Constant Summary collapse

APPLICABLE_DSL_CONFIG =
{
    :all_binary => '全部组件允许使用二进制。默认为false',
    :binary_dir => "framework的保存路径,相对于'Pods/Pods.xcodeproj'的相对路径。默认为'../_Prebuild'",
    :binary_switch => "二进制开关,关闭则不hook pre_install过程。默认为true",
    :prebuild_job => "开启编译任务,设置为false则不触发编译。默认为true",
    :dev_pods_enabled => "Development Pods是否支持binary。默认为false",
    :excluded_pods => "排除binary的pods",
    :xcconfig_configuration_alias => "xcconfig文件中configuration的别名,configurations设置为多个值的时候会用到,用于搜索替换。一般不需要设置,有默认值为'cocoapods-jxedt-binary'",
    :framework_header_search_enabled => "设置开启binary的framework是否配置framework的HEADER_SEARCH_PATH,兼容头文件引用的问题。默认为false",
    :silent_build => "静默编译。默认true",
    :configurations => "支持的configuration配置,可以写字符串'Debug'或'Release',也可以写多个'['Debug', 'Release']'。默认为'Release'",
    :xcframework => "编译结果是否为xcframework。默认false",
    :clean_build => "编译的时候是否clean。默认true",
    :bitcode_enabled => "开启bitcode。默认false",
    :device_build_enabled => "编译真机。默认true",
    :simulator_build_enabled => "编译模拟器。默认false",
    :disable_dsym => "禁止编译dsym产物。默认true",
    :build_log_path => "编译的log输出路径",
    :build_args => "编译的配置。了解xcodebuild命令的可以配置编译参数,例如配置 ARCHS='arm64 armv7'",
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



30
31
32
# File 'lib/cocoapods-jxedt/binary/config.rb', line 30

def initialize()
    @dsl_config = {}
end

Instance Attribute Details

#dsl_configObject

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

.instanceObject



34
35
36
# File 'lib/cocoapods-jxedt/binary/config.rb', line 34

def self.instance
  @instance ||= new()
end

Instance Method Details

#all_binary_enabled?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/cocoapods-jxedt/binary/config.rb', line 50

def all_binary_enabled?
    @dsl_config[:all_binary] || false
end

#binary_dirObject



74
75
76
# File 'lib/cocoapods-jxedt/binary/config.rb', line 74

def binary_dir
    @dsl_config[:binary_dir] || '../_Prebuild'
end

#binary_switch?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/cocoapods-jxedt/binary/config.rb', line 54

def binary_switch?
    @dsl_config[:binary_switch] || @dsl_config[:binary_switch].nil?
end

#bitcode_enabled?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/cocoapods-jxedt/binary/config.rb', line 98

def bitcode_enabled?
    @dsl_config[:bitcode_enabled] || false
end

#build_argsObject



118
119
120
121
122
123
124
125
126
# File 'lib/cocoapods-jxedt/binary/config.rb', line 118

def build_args
    @args ||= begin
        args = @dsl_config[:build_args] || {}
        args[:default] ||= ["ONLY_ACTIVE_ARCH=NO", "BUILD_LIBRARY_FOR_DISTRIBUTION=YES"]
        args[:device] ||= [] # ["ARCHS='arm64 armv7 armv7s'", "ONLY_ACTIVE_ARCH=NO"]
        args[:simulator] ||= [] # ["ARCHS='arm64 x86_64 i386'", "ONLY_ACTIVE_ARCH=NO"]
        args
    end
end

#build_log_pathObject



114
115
116
# File 'lib/cocoapods-jxedt/binary/config.rb', line 114

def build_log_path
    @dsl_config[:build_log_path]
end

#clean_build?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/cocoapods-jxedt/binary/config.rb', line 94

def clean_build?
    @dsl_config[:clean_build] || @dsl_config[:clean_build].nil?
end

#dev_pods_enabled?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/cocoapods-jxedt/binary/config.rb', line 62

def dev_pods_enabled?
    @dsl_config[:dev_pods_enabled] || false
end

#device_build_enabled?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/cocoapods-jxedt/binary/config.rb', line 106

def device_build_enabled?
    @dsl_config[:device_build_enabled] || @dsl_config[:device_build_enabled].nil?
end

#disable_dsym?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/cocoapods-jxedt/binary/config.rb', line 102

def disable_dsym?
    @dsl_config[:disable_dsym] || @dsl_config[:disable_dsym].nil?
end

#excluded_podsObject



66
67
68
# File 'lib/cocoapods-jxedt/binary/config.rb', line 66

def excluded_pods
    @dsl_config[:excluded_pods] || []
end

#framework_header_search_enabled?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/cocoapods-jxedt/binary/config.rb', line 70

def framework_header_search_enabled?
    @dsl_config[:framework_header_search_enabled] || false
end

#prebuild_job?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/cocoapods-jxedt/binary/config.rb', line 58

def prebuild_job?
    @dsl_config[:prebuild_job] || @dsl_config[:prebuild_job].nil?
end

#silent_build?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/cocoapods-jxedt/binary/config.rb', line 86

def silent_build?
    @dsl_config[:silent_build] || @dsl_config[:silent_build].nil?
end

#simulator_build_enabled?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/cocoapods-jxedt/binary/config.rb', line 110

def simulator_build_enabled?
    @dsl_config[:simulator_build_enabled] || false
end

#support_configurationsObject



128
129
130
131
132
133
134
135
136
137
# File 'lib/cocoapods-jxedt/binary/config.rb', line 128

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_configObject



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cocoapods-jxedt/binary/config.rb', line 38

def validate_dsl_config
    inapplicable_options = @dsl_config.keys - APPLICABLE_DSL_CONFIG.keys
    return if inapplicable_options.empty?
    
    message = "      [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_aliasObject



78
79
80
81
82
83
84
# File 'lib/cocoapods-jxedt/binary/config.rb', line 78

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

Returns:

  • (Boolean)


90
91
92
# File 'lib/cocoapods-jxedt/binary/config.rb', line 90

def xcframework?
    @dsl_config[:xcframework] || false
end