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.



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

def build_base_path
  @build_base_path
end

.build_pathObject

Returns the value of attribute build_path.



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

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.



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

def build_using_repo_paths
  @build_using_repo_paths
end

.build_xcframeworks_allObject

Returns the value of attribute build_xcframeworks_all.



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

def build_xcframeworks_all
  @build_xcframeworks_all
end

.build_xcframeworks_excludeObject

Returns the value of attribute build_xcframeworks_exclude.



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

def build_xcframeworks_exclude
  @build_xcframeworks_exclude
end

.build_xcframeworks_includeObject

Returns the value of attribute build_xcframeworks_include.



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

def build_xcframeworks_include
  @build_xcframeworks_include
end

.configuration_filenameObject

Returns the value of attribute configuration_filename.



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

def configuration_filename
  @configuration_filename
end

.deterministic_buildObject

Returns the value of attribute deterministic_build.



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

def deterministic_build
  @deterministic_build
end

.dev_pods_configuration_filenameObject

Returns the value of attribute dev_pods_configuration_filename.



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

def dev_pods_configuration_filename
  @dev_pods_configuration_filename
end

.development_pods_pathsObject

Returns the value of attribute development_pods_paths.



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

def development_pods_paths
  @development_pods_paths
end

.force_prebuild_podsObject

Returns the value of attribute force_prebuild_pods.



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

def force_prebuild_pods
  @force_prebuild_pods
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.



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

def license_filename
  @license_filename
end

.lldbinit_nameObject

Returns the value of attribute lldbinit_name.



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

def lldbinit_name
  @lldbinit_name
end

.lockfile_nameObject

Returns the value of attribute lockfile_name.



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

def lockfile_name
  @lockfile_name
end

.lockfile_pathObject

Returns the value of attribute lockfile_path.



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

def lockfile_path
  @lockfile_path
end

.post_actionsObject

Returns the value of attribute post_actions.



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

def post_actions
  @post_actions
end

.prebuilt_info_filenameObject

Returns the value of attribute prebuilt_info_filename.



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

def prebuilt_info_filename
  @prebuilt_info_filename
end

.project_nameObject

Returns the value of attribute project_name.



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

def project_name
  @project_name
end

.react_native_projectObject

Returns the value of attribute react_native_project.



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

def react_native_project
  @react_native_project
end

.restore_enabledObject

Returns the value of attribute restore_enabled.



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

def restore_enabled
  @restore_enabled
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.



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

def supported_platforms
  @supported_platforms
end

.use_bundlerObject

Returns the value of attribute use_bundler.



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

def use_bundler
  @use_bundler
end

Class Method Details

.check_initedObject



118
119
120
# File 'lib/pod_builder/configuration.rb', line 118

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

.existsObject



122
123
124
# File 'lib/pod_builder/configuration.rb', line 122

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

.loadObject



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
# File 'lib/pod_builder/configuration.rb', line 126

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

    if value = json["spec_overrides"]
      if value.is_a?(Hash) && value.keys.count > 0
        Configuration.spec_overrides = value
      end
    end
    if value = json["skip_licenses"]
      if value.is_a?(Array)
        Configuration.skip_licenses = value
      end
    end
    if value = json["skip_pods"]
      if value.is_a?(Array)
        Configuration.skip_pods = value
      end
    end
    if value = json["force_prebuild_pods"]
      if value.is_a?(Array)
        Configuration.force_prebuild_pods = value
      end
    end
    if value = json["build_settings"]
      if value.is_a?(Hash) && value.keys.count > 0
        Configuration.build_settings = value
      end
    end
    if value = json["build_settings_overrides"]
      if value.is_a?(Hash) && value.keys.count > 0
        Configuration.build_settings_overrides = value
      end
    end
    if value = json["build_system"]
      if value.is_a?(String) && ["Latest", "Legacy"].include?(value)
        Configuration.build_system = value
      end
    end
    if value = json["library_evolution_support"]
      if [TrueClass, FalseClass].include?(value.class)
        Configuration.library_evolution_support = value
      end
    end
    if value = json["license_filename"]
      if value.is_a?(String) && value.length > 0
        Configuration.license_filename = value
      end
    end
    if value = json["project_name"]
      if value.is_a?(String) && value.length > 0
        Configuration.project_name = value
      end
    end
    if value = json["restore_enabled"]
      if [TrueClass, FalseClass].include?(value.class)
        Configuration.restore_enabled = value
      end
    end
    if value = json["allow_building_development_pods"]
      if [TrueClass, FalseClass].include?(value.class)
        Configuration.allow_building_development_pods = value
      end
    end
    if value = json["use_bundler"]
      if [TrueClass, FalseClass].include?(value.class)
        Configuration.use_bundler = value
      end
    end
    if value = json["deterministic_build"]
      if [TrueClass, FalseClass].include?(value.class)
        Configuration.deterministic_build = value
      end
    end
    if value = json["build_using_repo_paths"]
      if [TrueClass, FalseClass].include?(value.class)
        Configuration.build_using_repo_paths = value
      end
    end
    if value = json["react_native_project"]
      if [TrueClass, FalseClass].include?(value.class)
        Configuration.react_native_project = value
      end
    end
    if value = json["build_xcframeworks_all"]
      if [TrueClass, FalseClass].include?(value.class)
        Configuration.build_xcframeworks_all = value
      end
    end
    if value = json["build_xcframeworks_include"]
      if value.is_a?(Array)
        Configuration.build_xcframeworks_include = value
      end
    end
    if value = json["build_xcframeworks_exclude"]
      if value.is_a?(Array)
        Configuration.build_xcframeworks_exclude = value
      end
    end
    if value = json["post_actions"]
      if value.is_a?(Hash)
        Configuration.post_actions = PodBuilder::PostActions.load(value)
      end
    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



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/pod_builder/configuration.rb', line 265

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["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
  
  File.write(config_path, JSON.pretty_generate(config))
end