Class: Amimono::BuildPhasesUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-amimono/build_phases_updater.rb

Constant Summary collapse

FILELIST_SCRIPT =
<<-SCRIPT.strip_heredoc
  IFS=" " read -r -a SPLIT <<< "$ARCHS"
  for ARCH in "${SPLIT[@]}"; do
    cd "$OBJROOT/Pods.build"
    filelist=""
    for dependency in "${DEPENDENCIES[@]}"; do
      path="${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/${dependency}.build/Objects-normal/${ARCH}"
      if [ -d "$path" ]; then
        search_path="$path/*.o"
        for obj_file in $search_path; do
          filelist+="${OBJROOT}/Pods.build/${obj_file}"
          filelist+=$'\\n'
        done
      fi
    done
    filelist=${filelist\%$'\\n'}
    echo "$filelist" > "${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}-${TARGET_NAME}-${ARCH}.objects.filelist"
  done
SCRIPT
AMIMONO_FILELIST_BUILD_PHASE =
'[Amimono] Create filelist per architecture'

Instance Method Summary collapse

Instance Method Details

#update_build_phases(installer_context, aggregated_targets) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cocoapods-amimono/build_phases_updater.rb', line 26

def update_build_phases(installer_context, aggregated_targets)
  # All user projects should be the same I hope
  user_project = aggregated_targets.first.user_project
  aggregated_targets.each do |aggregated_target|
    # This pick is probably wrong, but works for most of the simple cases
    user_target = aggregated_target.user_targets.first
    # Remove the `Embed Pods Frameworks` build phase
    remove_embed_pods_frameworks(user_target)
    # Create or update [Amimono] build phase
    create_or_update_amimono_phase(user_target, AMIMONO_FILELIST_BUILD_PHASE, generate_filelist_script(installer_context, aggregated_target))
    puts "[Amimono] Build phases updated for target #{aggregated_target.cocoapods_target_label}"
  end
  user_project.save
end