grab / cocoapods-binary-cache

MIT License
477 stars 69 forks source link

Not able to use IS_POD_BINARY_CACHE_ENABLED ENV in pod file #82

Closed GOKUXGOD closed 3 years ago

GOKUXGOD commented 3 years ago

Checklist

Thanks for such a nice work

I have successfully integrated it for my external dependencies Now as I can see that you guys are doing it only for Debug Builds

I want to do the same I checked out the example projects pod file I saw an environment variable IS_POD_BINARY_CACHE_ENABLED But I am not able to use that since as per my Understanding Xcode ENV variables are only available during RUN phase due to which after adding this

def is_pod_binary_cache_enabled
  ENV['IS_POD_BINARY_CACHE_ENABLED'] == 'true'
end

puts is_pod_binary_cache_enabled

if is_pod_binary_cache_enabled
  plugin 'cocoapods-binary-cache'
  config_cocoapods_binary_cache(
    cache_repo: {
      "default" => {
        "remote" => "https://github.com/bigbangvn/demo-pod-binary-cache-prebuilt-libs.git",
        "local" => "~/.cocoapods-binary-cache/PodBinaryCacheExample-libs"
      }
    },
    prebuild_config: "Debug",
    dev_pods_enabled: true
  )
end

I am not able to use this feature and also puts is_pod_binary_cache_enabled -> gives me false

And also PodGroups do not take the CocoaPods configuration attribute

def DebugPods
  pod 'FirebaseCore', '7.8.0', :binary => true
  pod 'GoogleUtilities', '7.2.2', :binary => true
  pod 'FirebaseMessaging', '7.8.0', :binary => true
  pod 'FirebaseCrashlytics', '7.8.0', :binary => true
  pod 'FirebaseAnalytics', '7.8.0', :binary => true
  pod 'FirebasePerformance', '7.8.0', :binary => true
  pod 'lottie-ios', '2.5.0', :binary => true
end

def ProdPods
  pod 'FirebaseCore', '7.8.0'
  pod 'GoogleUtilities', '7.2.2'
  pod 'FirebaseMessaging', '7.8.0'
  pod 'FirebaseCrashlytics', '7.8.0'
  pod 'FirebaseAnalytics', '7.8.0'
  pod 'FirebasePerformance', '7.8.0'
  pod 'lottie-ios', '2.5.0'
end

target 'Sample' do

  use_frameworks!
  # Pods for Sample
  DebugPods, :configuration => 'Debug'
  ProdPods, :configuration => 'Release'

  end

This doesn't seems to work as well

My only requirement is to disable it for Prod/QA builds are enable it for Debug build Can you guide me how to attain this I checked through all of the issues but I Couldn't find the solution

GOKUXGOD commented 3 years ago

Solved by this by setting var in ruby