Method: Zabel.zabel_disable_build_and_inject_extract

Defined in:
lib/zabel.rb

.zabel_disable_build_and_inject_extract(project, target, target_context) ⇒ Object



683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
# File 'lib/zabel.rb', line 683

def self.zabel_disable_build_and_inject_extract(project, target, target_context)
    target_cache_dir = target_context[:hit_target_cache_dir]

    # touch to update mtime
    raise unless system "touch \"#{target_cache_dir}\""

    # delete build phases to disable build command
    target.build_phases.delete_if { | build_phase | 
        build_phase.class == Xcodeproj::Project::Object::PBXHeadersBuildPhase or 
        build_phase.class == Xcodeproj::Project::Object::PBXSourcesBuildPhase or 
        build_phase.class == Xcodeproj::Project::Object::PBXResourcesBuildPhase
    }

    zabel_exec = "\"#{$0}\""
    if ENV["BUNDLE_BIN_PATH"] and ENV["BUNDLE_BIN_PATH"].size > 0 and ENV["BUNDLE_GEMFILE"] and ENV["BUNDLE_GEMFILE"].size > 0
        zabel_exec = "cd \"#{File.dirname(ENV["BUNDLE_GEMFILE"])}\" && \"#{ENV["BUNDLE_BIN_PATH"]}\" exe zabel"
    end
    extract_script = "#{zabel_exec} #{STAGE_EXTRACT} \"#{target_cache_dir}\" \"#{target_context[:build_product_dir]}\" \"#{target_context[:build_intermediate_dir]}\""

    inject_phase = target.new_shell_script_build_phase("zabel_extract_#{target.name}")
    inject_phase.shell_script = extract_script
    inject_phase.show_env_vars_in_log = '1'
end