Module: CocoaPodsAmicable::TargetIntegratorMixin

Included in:
Pod::Installer::UserProjectIntegrator::TargetIntegrator
Defined in:
lib/cocoapods_amicable.rb

Instance Method Summary collapse

Instance Method Details

#add_check_manifest_lock_script_phaseObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cocoapods_amicable.rb', line 5

def add_check_manifest_lock_script_phase
  podfile = target.target_definition.podfile
  return super unless podfile.plugins.key?('cocoapods-amicable')

  phase_name = Pod::Installer::UserProjectIntegrator::TargetIntegrator::CHECK_MANIFEST_PHASE_NAME
  native_targets.each do |native_target|
    phase = Pod::Installer::UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target,
                                                                                                              Pod::Installer::UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + phase_name)
    native_target.build_phases.unshift(phase).uniq! unless native_target.build_phases.first == phase

    phase.shell_script = "set -e\nset -u\nset -o pipefail\n\nfail() {\n# print error to STDERR\necho \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" $@ >&2\nexit 1\n}\n\ndiff -q \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null || fail \"The manifest in the sandbox differs from your lockfile.\"\n\nif [ -f \"${PODS_ROOT}/Podfile.sha1\" ]; then\n(cd \"${PODS_PODFILE_DIR_PATH}\" && shasum --algorithm 1 --status --check \"${PODS_ROOT}/Podfile.sha1\") || fail \"Your Podfile has been changed since the last time you ran 'pod install'.\"\nfi\n\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n          SH\n\n    phase.input_paths = %w[\n      ${PODS_PODFILE_DIR_PATH}/Podfile.lock\n      ${PODS_ROOT}/Manifest.lock\n      ${PODS_ROOT}/Podfile.sha1\n    ]\n    if name = podfile.defined_in_file && podfile.defined_in_file.basename\n      phase.input_paths << \"${PODS_PODFILE_DIR_PATH}/\#{name}\"\n    end\n    phase.output_paths = [target.check_manifest_lock_script_output_file_path]\n  end\nend\n"