spotify / XCRemoteCache

Other
830 stars 53 forks source link

Cannot deintegrate XCRemoteCache when error with pod generate_multiple_pod_projects => true #73

Closed dwirandyh closed 2 years ago

dwirandyh commented 2 years ago

Hi there, So i try to use XCRemoteCache for my project with pod configuration like this

source 'https://cdn.cocoapods.org/'

platform :ios, '12.0'
inhibit_all_warnings!
use_modular_headers!
use_frameworks! :linkage => :static

install! 'cocoapods',
:generate_multiple_pod_projects => true,
:incremental_installation => true

plugin 'cocoapods-xcremotecache'

xcremotecache({
    'cache_addresses' => ['http://localhost:8080/cache/movieapp'],
    'primary_repo' => 'git@github.com-dwirandyh:dwirandyh/xcremotecache-modular-example.git',
    'primary_branch' => 'main',
    'mode' => 'consumer', # consumer / producer
#    'final_target' => 'MovieApp', # producer only
    'xcrc_location' => '../tools/xcremotecache',
})

target 'MovieApp' do

  pod 'User', :path => './Modules/User/'

  pod 'RxSwift', '6.5.0'
  pod 'RxCocoa', '6.5.0'
  pod 'SDWebImage', '5.0'

  target 'MovieAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MovieAppUITests' do
    # Pods for testing
  end

end

I notice that XCRemoteCache is able to deintegrate when error happend (e.g can't connect to remote cache server), but it doesn't deintegrate third party pod library xcodeproj when i use generate_multiple_pod_projects

MovieApp xcodeproj Build Phases:

Screen Shot 2022-02-08 at 15 35 37

Pods xcodeproj Build Phases:

Screen Shot 2022-02-08 at 15 36 14

Pods xcodeproj Build Settings:

Screen Shot 2022-02-08 at 15 38 53

I have created a example project here: https://github.com/dwirandyh/xcremotecache-modular-example

polac24 commented 2 years ago

To clarify, do you face any concrete troubles with that or just concerned with a performance? If I recall correctly, incremental_installation is a mode that doesn't expose all Pods project to the plugin so there is no easy way to deintegrate it. As a workaround (see a comment below), Pods are always integrated and there is another quick check that bails out the remote cache logic (during a build in Xcode).

https://github.com/spotify/XCRemoteCache/blob/327d282e23572909b0cba99af40ac2e2a6215630/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb#L392-L393

dwirandyh commented 2 years ago

I face a trouble when i can not connect to remote server during pod install, and then I build the project (consumer side), xcode is stuck in building process and xcode is not responding.

To handle that problem, i should delete xcodproj in pods folder and then pod install again

Note: After i try to set incremental_installation to false, and it works, xcremotecahce is able to deintegrate xcodeproj in pod directory