class PodPrebuild::Config

Attributes

cli_config[RW]
dsl_config[RW]

Public Class Methods

instance() click to toggle source
# File lib/command/config.rb, line 18
def self.instance
  @instance ||= new("PodBinaryCacheConfig.json")
end
new(path) click to toggle source
# File lib/command/config.rb, line 11
def initialize(path)
  @deprecated_config = File.exist?(path) ? PodPrebuild::JSONFile.new(path).data : {}
  @dsl_config = {}
  @cli_config = {}
  @detected_config = {}
end

Public Instance Methods

bitcode_enabled?() click to toggle source
# File lib/command/config.rb, line 100
def bitcode_enabled?
  @dsl_config[:bitcode_enabled]
end
build_args() click to toggle source
# File lib/command/config.rb, line 124
def build_args
  @dsl_config[:build_args]
end
cache_path() click to toggle source
# File lib/command/config.rb, line 36
def cache_path
  @cache_path ||= File.expand_path(cache_repo_config["local"])
end
cache_repo() click to toggle source
# File lib/command/config.rb, line 28
def cache_repo
  @cache_repo ||= cache_repo_config["remote"]
end
dev_pods_enabled?() click to toggle source
# File lib/command/config.rb, line 96
def dev_pods_enabled?
  @dsl_config[:dev_pods_enabled]
end
device_build_enabled?() click to toggle source
# File lib/command/config.rb, line 104
def device_build_enabled?
  @dsl_config[:device_build_enabled]
end
disable_dsym?() click to toggle source
# File lib/command/config.rb, line 112
def disable_dsym?
  @dsl_config[:disable_dsym]
end
dont_remove_source_code?() click to toggle source
# File lib/command/config.rb, line 116
def dont_remove_source_code?
  @dsl_config[:dont_remove_source_code]
end
excluded_pods() click to toggle source
# File lib/command/config.rb, line 92
def excluded_pods
  ((@dsl_config[:excluded_pods] || Set.new) + (@detected_config[:excluded_pods] || Set.new)).to_set
end
generated_frameworks_dir(in_cache: false) click to toggle source
# File lib/command/config.rb, line 56
def generated_frameworks_dir(in_cache: false)
  root_dir(in_cache) + "/GeneratedFrameworks"
end
local_cache?() click to toggle source
# File lib/command/config.rb, line 32
def local_cache?
  cache_repo.nil?
end
manifest_path(in_cache: false) click to toggle source
# File lib/command/config.rb, line 48
def manifest_path(in_cache: false)
  root_dir(in_cache) + "/Manifest.lock"
end
prebuild_all_pods?() click to toggle source
# File lib/command/config.rb, line 88
def prebuild_all_pods?
  @cli_config[:prebuild_all_pods] || @dsl_config[:prebuild_all_pods]
end
prebuild_code_gen() click to toggle source
# File lib/command/config.rb, line 136
def prebuild_code_gen
  @dsl_config[:prebuild_code_gen]
end
prebuild_config() click to toggle source
# File lib/command/config.rb, line 80
def prebuild_config
  @cli_config[:prebuild_config] || @dsl_config[:prebuild_config] || "Debug"
end
prebuild_delta_path() click to toggle source
# File lib/command/config.rb, line 44
def prebuild_delta_path
  @dsl_config[:prebuild_delta_path] || @deprecated_config["prebuild_delta_path"] || "_Prebuild_delta/changes.json"
end
prebuild_job?() click to toggle source
# File lib/command/config.rb, line 84
def prebuild_job?
  @cli_config[:prebuild_job] || @dsl_config[:prebuild_job]
end
prebuild_sandbox_path() click to toggle source
# File lib/command/config.rb, line 40
def prebuild_sandbox_path
  @dsl_config[:prebuild_sandbox_path] || @deprecated_config["prebuild_path"] || "_Prebuild"
end
prebuilt_path(path: nil) click to toggle source
# File lib/command/config.rb, line 60
def prebuilt_path(path: nil)
  p = Pathname.new(path.nil? ? "_Prebuilt" : "_Prebuilt/#{path}")
  p = p.sub_ext(".xcframework") if xcframework? && p.extname == ".framework"
  p.to_s
end
prebuilt_pod_names() click to toggle source
# File lib/command/config.rb, line 160
def prebuilt_pod_names
  @detected_config[:prebuilt_pod_names] || Set.new
end
reset!() click to toggle source
# File lib/command/config.rb, line 22
def reset!
  @deprecated_config = {}
  @dsl_config = {}
  @cli_config = {}
end
root_dir(in_cache) click to toggle source
# File lib/command/config.rb, line 52
def root_dir(in_cache)
  in_cache ? cache_path : prebuild_sandbox_path
end
save_cache_validation_to() click to toggle source
# File lib/command/config.rb, line 128
def save_cache_validation_to
  @dsl_config[:save_cache_validation_to]
end
silent_build?() click to toggle source
# File lib/command/config.rb, line 144
def silent_build?
  @dsl_config[:silent_build]
end
strict_diagnosis?() click to toggle source
# File lib/command/config.rb, line 140
def strict_diagnosis?
  @dsl_config[:strict_diagnosis]
end
targets_to_prebuild_from_cli() click to toggle source
# File lib/command/config.rb, line 148
def targets_to_prebuild_from_cli
  @cli_config[:prebuild_targets] || []
end
tracked_prebuilt_pod_names() click to toggle source
# File lib/command/config.rb, line 164
def tracked_prebuilt_pod_names
  prebuilt_pod_names - excluded_pods
end
update_detected_excluded_pods!(value) click to toggle source
# File lib/command/config.rb, line 156
def update_detected_excluded_pods!(value)
  @detected_config[:excluded_pods] = value
end
update_detected_prebuilt_pod_names!(value) click to toggle source
# File lib/command/config.rb, line 152
def update_detected_prebuilt_pod_names!(value)
  @detected_config[:prebuilt_pod_names] = value
end
validate_dsl_config() click to toggle source
# File lib/command/config.rb, line 66
    def validate_dsl_config
      inapplicable_options = @dsl_config.keys - applicable_dsl_config
      return if inapplicable_options.empty?

      message = <<~HEREDOC
        [WARNING] The following options (in `config_cocoapods_binary_cache`) are not correct: #{inapplicable_options}.
        Available options: #{applicable_dsl_config}.
        Check out the following doc for more details
          https://github.com/grab/cocoapods-binary-cache/blob/master/docs/configure_cocoapods_binary_cache.md
      HEREDOC

      Pod::UI.puts message.yellow
    end
validate_prebuilt_settings() click to toggle source
# File lib/command/config.rb, line 132
def validate_prebuilt_settings
  @dsl_config[:validate_prebuilt_settings]
end
xcframework?() click to toggle source
# File lib/command/config.rb, line 108
def xcframework?
  @dsl_config[:xcframework]
end
xcodebuild_log_path() click to toggle source
# File lib/command/config.rb, line 120
def xcodebuild_log_path
  @dsl_config[:xcodebuild_log_path]
end

Private Instance Methods

applicable_dsl_config() click to toggle source
# File lib/command/config.rb, line 170
def applicable_dsl_config
  [
    :cache_repo,
    :prebuild_sandbox_path,
    :prebuild_delta_path,
    :prebuild_config,
    :prebuild_job,
    :prebuild_all_pods,
    :excluded_pods,
    :dev_pods_enabled,
    :bitcode_enabled,
    :device_build_enabled,
    :xcframework,
    :disable_dsym,
    :dont_remove_source_code,
    :xcodebuild_log_path,
    :build_args,
    :save_cache_validation_to,
    :validate_prebuilt_settings,
    :prebuild_code_gen,
    :strict_diagnosis,
    :silent_build
  ]
end
cache_repo_config() click to toggle source
# File lib/command/config.rb, line 195
    def cache_repo_config
      @cache_repo_config ||= begin
        repo = @cli_config[:repo] || "default"
        config_ = @dsl_config[:cache_repo] || {}
        if config_[repo].nil?
          message = <<~HEREDOC
            [Deprecated] Configs in `PodBinaryCacheConfig.json` are deprecated.
            Declare option `cache_repo` in `config_cocoapods_binary_cache` instead.
            Check out the following doc for more details
              https://github.com/grab/cocoapods-binary-cache/blob/master/docs/configure_cocoapods_binary_cache.md
          HEREDOC
          Pod::UI.puts message.yellow
        end
        config_[repo] || {
          "remote" => @deprecated_config["cache_repo"] || @deprecated_config["prebuilt_cache_repo"],
          "local" => @deprecated_config["cache_path"] || "~/.cocoapods-binary-cache/prebuilt-frameworks"
        }
      end
    end