Class: PodBuilder::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/pod_builder/configuration.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.allow_building_development_podsObject

Returns the value of attribute allow_building_development_pods.



48
49
50
# File 'lib/pod_builder/configuration.rb', line 48

def allow_building_development_pods
  @allow_building_development_pods
end

.base_pathObject

Returns the value of attribute base_path.



53
54
55
# File 'lib/pod_builder/configuration.rb', line 53

def base_path
  @base_path
end

.build_base_pathObject

Returns the value of attribute build_base_path.



61
62
63
# File 'lib/pod_builder/configuration.rb', line 61

def build_base_path
  @build_base_path
end

.build_pathObject

Returns the value of attribute build_path.



62
63
64
# File 'lib/pod_builder/configuration.rb', line 62

def build_path
  @build_path
end

.build_settingsObject

Returns the value of attribute build_settings.



49
50
51
# File 'lib/pod_builder/configuration.rb', line 49

def build_settings
  @build_settings
end

.build_settings_overridesObject

Returns the value of attribute build_settings_overrides.



50
51
52
# File 'lib/pod_builder/configuration.rb', line 50

def build_settings_overrides
  @build_settings_overrides
end

.build_systemObject

Returns the value of attribute build_system.



51
52
53
# File 'lib/pod_builder/configuration.rb', line 51

def build_system
  @build_system
end

.build_using_repo_pathsObject

Returns the value of attribute build_using_repo_paths.



73
74
75
# File 'lib/pod_builder/configuration.rb', line 73

def build_using_repo_paths
  @build_using_repo_paths
end

.build_xcframeworks_allObject

Returns the value of attribute build_xcframeworks_all.



76
77
78
# File 'lib/pod_builder/configuration.rb', line 76

def build_xcframeworks_all
  @build_xcframeworks_all
end

.build_xcframeworks_excludeObject

Returns the value of attribute build_xcframeworks_exclude.



78
79
80
# File 'lib/pod_builder/configuration.rb', line 78

def build_xcframeworks_exclude
  @build_xcframeworks_exclude
end

.build_xcframeworks_includeObject

Returns the value of attribute build_xcframeworks_include.



77
78
79
# File 'lib/pod_builder/configuration.rb', line 77

def build_xcframeworks_include
  @build_xcframeworks_include
end

.configuration_filenameObject

Returns the value of attribute configuration_filename.



63
64
65
# File 'lib/pod_builder/configuration.rb', line 63

def configuration_filename
  @configuration_filename
end

.deterministic_buildObject

Returns the value of attribute deterministic_build.



71
72
73
# File 'lib/pod_builder/configuration.rb', line 71

def deterministic_build
  @deterministic_build
end

.dev_pods_configuration_filenameObject

Returns the value of attribute dev_pods_configuration_filename.



64
65
66
# File 'lib/pod_builder/configuration.rb', line 64

def dev_pods_configuration_filename
  @dev_pods_configuration_filename
end

.development_languageObject

Returns the value of attribute development_language.



85
86
87
# File 'lib/pod_builder/configuration.rb', line 85

def development_language
  @development_language
end

.development_pods_pathsObject

Returns the value of attribute development_pods_paths.



60
61
62
# File 'lib/pod_builder/configuration.rb', line 60

def development_pods_paths
  @development_pods_paths
end

.development_teamObject

Returns the value of attribute development_team.



84
85
86
# File 'lib/pod_builder/configuration.rb', line 84

def development_team
  @development_team
end

.force_prebuild_podsObject

Returns the value of attribute force_prebuild_pods.



58
59
60
# File 'lib/pod_builder/configuration.rb', line 58

def force_prebuild_pods
  @force_prebuild_pods
end

.generate_coverageObject

Returns the value of attribute generate_coverage.



79
80
81
# File 'lib/pod_builder/configuration.rb', line 79

def generate_coverage
  @generate_coverage
end

.keep_swiftmodulesObject

Returns the value of attribute keep_swiftmodules.



81
82
83
# File 'lib/pod_builder/configuration.rb', line 81

def keep_swiftmodules
  @keep_swiftmodules
end

.library_evolution_supportObject

Returns the value of attribute library_evolution_support.



52
53
54
# File 'lib/pod_builder/configuration.rb', line 52

def library_evolution_support
  @library_evolution_support
end

.license_filenameObject

Returns the value of attribute license_filename.



59
60
61
# File 'lib/pod_builder/configuration.rb', line 59

def license_filename
  @license_filename
end

.lldbinit_nameObject

Returns the value of attribute lldbinit_name.



75
76
77
# File 'lib/pod_builder/configuration.rb', line 75

def lldbinit_name
  @lldbinit_name
end

.lockfile_nameObject

Returns the value of attribute lockfile_name.



68
69
70
# File 'lib/pod_builder/configuration.rb', line 68

def lockfile_name
  @lockfile_name
end

.lockfile_pathObject

Returns the value of attribute lockfile_path.



69
70
71
# File 'lib/pod_builder/configuration.rb', line 69

def lockfile_path
  @lockfile_path
end

.post_actionsObject

Returns the value of attribute post_actions.



83
84
85
# File 'lib/pod_builder/configuration.rb', line 83

def post_actions
  @post_actions
end

.pre_actionsObject

Returns the value of attribute pre_actions.



82
83
84
# File 'lib/pod_builder/configuration.rb', line 82

def pre_actions
  @pre_actions
end

.prebuilt_info_filenameObject

Returns the value of attribute prebuilt_info_filename.



67
68
69
# File 'lib/pod_builder/configuration.rb', line 67

def prebuilt_info_filename
  @prebuilt_info_filename
end

.project_nameObject

Returns the value of attribute project_name.



65
66
67
# File 'lib/pod_builder/configuration.rb', line 65

def project_name
  @project_name
end

.react_native_projectObject

Returns the value of attribute react_native_project.



74
75
76
# File 'lib/pod_builder/configuration.rb', line 74

def react_native_project
  @react_native_project
end

.remap_coverage_to_project_rootObject

Returns the value of attribute remap_coverage_to_project_root.



80
81
82
# File 'lib/pod_builder/configuration.rb', line 80

def remap_coverage_to_project_root
  @remap_coverage_to_project_root
end

.restore_enabledObject

Returns the value of attribute restore_enabled.



66
67
68
# File 'lib/pod_builder/configuration.rb', line 66

def restore_enabled
  @restore_enabled
end

.skip_build_configuration_checkObject

Returns the value of attribute skip_build_configuration_check.



57
58
59
# File 'lib/pod_builder/configuration.rb', line 57

def skip_build_configuration_check
  @skip_build_configuration_check
end

.skip_licensesObject

Returns the value of attribute skip_licenses.



55
56
57
# File 'lib/pod_builder/configuration.rb', line 55

def skip_licenses
  @skip_licenses
end

.skip_podsObject

Returns the value of attribute skip_pods.



56
57
58
# File 'lib/pod_builder/configuration.rb', line 56

def skip_pods
  @skip_pods
end

.spec_overridesObject

Returns the value of attribute spec_overrides.



54
55
56
# File 'lib/pod_builder/configuration.rb', line 54

def spec_overrides
  @spec_overrides
end

.supported_platformsObject

Returns the value of attribute supported_platforms.



72
73
74
# File 'lib/pod_builder/configuration.rb', line 72

def supported_platforms
  @supported_platforms
end

.use_bundlerObject

Returns the value of attribute use_bundler.



70
71
72
# File 'lib/pod_builder/configuration.rb', line 70

def use_bundler
  @use_bundler
end

Class Method Details

.check_initedObject



135
136
137
# File 'lib/pod_builder/configuration.rb', line 135

def self.check_inited
  raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil?
end

.existsObject



139
140
141
# File 'lib/pod_builder/configuration.rb', line 139

def self.exists
  return !config_path.nil? && File.exist?(config_path)
end

.loadObject



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/pod_builder/configuration.rb', line 143

def self.load
  unless podbuilder_path
    return
  end

  Configuration.base_path = podbuilder_path

  if exists
    begin
      json = JSON.parse(File.read(config_path))
    rescue => exception
      raise "\n\n#{File.basename(config_path)} is an invalid JSON\n".red
    end

    value = json["spec_overrides"]
    if value.is_a?(Hash) && value.keys.count > 0
      Configuration.spec_overrides = value
    end
    value = json["skip_licenses"]
    if value.is_a?(Array)
      Configuration.skip_licenses = value
    end
    value = json["skip_pods"]
    if value.is_a?(Array)
      Configuration.skip_pods = value
    end
    value = json["skip_build_configuration_check"]
    if value.is_a?(Array)
      Configuration.skip_build_configuration_check = value
    end
    value = json["force_prebuild_pods"]
    if value.is_a?(Array)
      Configuration.force_prebuild_pods = value
    end
    value = json["build_settings"]
    if value.is_a?(Hash) && value.keys.count > 0
      Configuration.build_settings = value
    end
    value = json["build_settings_overrides"]
    if value.is_a?(Hash) && value.keys.count > 0
      Configuration.build_settings_overrides = value
    end
    value = json["build_system"]
    if value.is_a?(String) && ["Latest", "Legacy"].include?(value)
      Configuration.build_system = value
    end
    value = json["library_evolution_support"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.library_evolution_support = value
    end
    value = json["license_filename"]
    if value.is_a?(String) && value.length > 0
      Configuration.license_filename = value
    end
    value = json["project_name"]
    if value.is_a?(String) && value.length > 0
      Configuration.project_name = value
    end
    value = json["restore_enabled"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.restore_enabled = value
    end
    value = json["allow_building_development_pods"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.allow_building_development_pods = value
    end
    value = json["use_bundler"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.use_bundler = value
    end
    value = json["deterministic_build"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.deterministic_build = value
    end
    value = json["build_using_repo_paths"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.build_using_repo_paths = value
    end
    value = json["react_native_project"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.react_native_project = value
    end
    value = json["build_xcframeworks_all"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.build_xcframeworks_all = value
    end
    value = json["build_xcframeworks_include"]
    if value.is_a?(Array)
      Configuration.build_xcframeworks_include = value
    end
    value = json["build_xcframeworks_exclude"]
    if value.is_a?(Array)
      Configuration.build_xcframeworks_exclude = value
    end
    value = json["generate_coverage"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.generate_coverage = value
    end
    value = json["remap_coverage_to_project_root"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.remap_coverage_to_project_root = value
    end
    value = json["keep_swiftmodules"]
    if [TrueClass, FalseClass].include?(value.class)
      Configuration.keep_swiftmodules = value
    end
    value = json["pre_actions"]
    if value.is_a?(Hash)
      Configuration.pre_actions = PodBuilder::Actions.load(value)
    end
    value = json["post_actions"]
    if value.is_a?(Hash)
      Configuration.post_actions = PodBuilder::Actions.load(value)
    end
    value = json["development_team"]
    if value.is_a?(String) && value.length > 0
      Configuration.development_team = value
    end
    value = json["development_language"]
    if value.is_a?(String) && value.length > 0
      Configuration.development_language = value
    end
    Configuration.build_settings.freeze

    sanity_check()
  end

  dev_pods_configuration_path = File.join(Configuration.base_path, Configuration.dev_pods_configuration_filename)

  if File.exist?(dev_pods_configuration_path)
    begin
      json = JSON.parse(File.read(dev_pods_configuration_path))
    rescue => exception
      raise "\n\n#{File.basename(dev_pods_configuration_path)} is an invalid JSON\n".red
    end

    Configuration.development_pods_paths = json || []
    Configuration.development_pods_paths.freeze
  end

  if !deterministic_build
    build_path = "#{build_base_path}#{(Time.now.to_f * 1000).to_i}"
    lockfile_path = File.join(PodBuilder::home, lockfile_name)
  end
end

.writeObject



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/pod_builder/configuration.rb', line 289

def self.write
  config = {}

  config["project_name"] = Configuration.project_name
  config["spec_overrides"] = Configuration.spec_overrides
  config["skip_licenses"] = Configuration.skip_licenses
  config["skip_pods"] = Configuration.skip_pods
  config["skip_build_configuration_check"] = Configuration.skip_build_configuration_check
  config["force_prebuild_pods"] = Configuration.force_prebuild_pods
  config["build_settings"] = Configuration.build_settings
  config["build_settings_overrides"] = Configuration.build_settings_overrides
  config["build_system"] = Configuration.build_system
  config["library_evolution_support"] = Configuration.library_evolution_support
  config["license_filename"] = Configuration.license_filename
  config["restore_enabled"] = Configuration.restore_enabled
  config["allow_building_development_pods"] = Configuration.allow_building_development_pods
  config["use_bundler"] = Configuration.use_bundler
  config["deterministic_build"] = Configuration.deterministic_build
  config["build_using_repo_paths"] = Configuration.build_using_repo_paths
  config["react_native_project"] = Configuration.react_native_project
  config["development_team"] = Configuration.development_team
  config["development_language"] = Configuration.development_language || "en"

  File.write(config_path, JSON.pretty_generate(config))
end