Sha256: bf3166791405fd1aa4102bcd07d3b91f18c80d6e3a14e619033fb7c2314b9f83

Contents?: true

Size: 1.49 KB

Versions: 8

Compression:

Stored size: 1.49 KB

Contents

module Jxedt
    class PostInstall
        def initialize(installer_context)
            @installer_context = installer_context
        end

        def run
            # check binary switch
            return unless Jxedt.config.binary_switch?
            
            require_relative '../helper/prebuild_sandbox'

            # :post_install过程校验两次`pod install`的值
            validate_pod_checksum unless @installer_context.sandbox.is_a?(Pod::JxedtPrebuildSandbox)
        end

        def validate_pod_checksum
            original_installer = ObjectSpace.each_object(Pod::Installer).reject {|installer| installer.sandbox.is_a?(Pod::JxedtPrebuildSandbox) }.first
            return if original_installer.nil?

            check_result = original_installer.lockfile == @installer_context.sandbox.source_lockfile
            unless check_result
                validation_failed = []
                lockfile = original_installer.lockfile
                source_lockfile = @installer_context.sandbox.source_lockfile
                lockfile.internal_data["SPEC CHECKSUMS"].each_key { |name| 
                    value1 = lockfile.spec_checksums_hash_key(name)
                    value2 = source_lockfile.spec_checksums_hash_key(name)
                    validation_failed << name if value1.nil? || value2.nil? || value1 != value2
                }
                Pod::UI.warn "⚠️  ⚠️  ⚠️  Lockfile文件校验失败,请检查Pod组件: #{validation_failed}"
            end
        end
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cocoapods-jxedt-0.0.21 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.20 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.19 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.18 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.17 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.16 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.15 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.14 lib/cocoapods-jxedt/binary/hooks/post_install.rb