cocoapods-binary icon indicating copy to clipboard operation
cocoapods-binary copied to clipboard

Cannot detect changes for generated frameworks when `Pod` is excluded from git

Open leavez opened this issue 7 years ago • 4 comments

if Pod folder is excluded from git, there's no grantee the prebuilt frameworks have the same version with the ones specified in podfile.

For example, there's a pod A of 0.1 version in podfile. After pod install, we have prebuilt framework "A.framework" in pod folder. Then I pull the change from remote repo. Pod A is upgraded to 0.2. When build the project, it stops because the lock file doesn't match. Then I do a pod install, the checking in prebuild process cannot tell the version of "A.framework" in the pod file. It doesn't update the framework because there's already a framework.

leavez avatar Jul 11 '18 17:07 leavez

Actually the commit is saved in the manifest.lock file in the _prebuild folder. It should be used in have_exact_prebuild_cache method.

leavez avatar Jul 11 '18 17:07 leavez

I think that issue is resolved right now. Probably by #41 and #47

Rag0n avatar May 03 '19 09:05 Rag0n

I think that issue is resolved right now. Probably by #41 and #47

Nope. Tested with v0.4.4 and able to reproduce the issue.

nex-derek avatar May 07 '19 10:05 nex-derek

I have created this pre_install script that will remove the generated frameworks for pods that are intended to be updated, with its dependencies, for changes to take effect

pre_install do |installer|
  installer.analysis_result.podfile_state.changed.each do |target|
    if installer.sandbox.class == Pod::PrebuildSandbox
      def delete_generatedframework(target, installer)
        changed_pod_dest = installer.sandbox.framework_folder_path_for_pod_name(target)
        
        if Dir.exists?(changed_pod_dest)
          puts "\e[#32mDeleted GeneratedFramework for target '" + target + "\e[0m"
          FileUtils.rm_rf(changed_pod_dest)
          else
          puts "\e[#31mCould not delete GeneratedFramework directory for target '" + target + "', Manually delete it at path " + changed_pod_dest.to_s + "\e[0m"
        end
      end
      delete_generatedframework(target, installer)
      dependencies = installer.pod_targets.detect { |pod| pod.pod_name == target }.dependencies
      dependencies.each do |dependency|
        if dependency != target
          delete_generatedframework(dependency, installer)
        end
      end
    end
  end
end

i0sa avatar Jan 23 '21 15:01 i0sa