From f6850d673e8453a6ab50be3e56b34b5e720367f4 Mon Sep 17 00:00:00 2001 From: Krisztian Goedrei Date: Wed, 9 Sep 2015 14:37:02 +0200 Subject: [PATCH] update --- .gitignore | 1 + bitrise.yml | 7 ++++--- step.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ step.yml | 19 +++++++++++++++--- 4 files changed, 79 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index d5281d29..6affce3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .bitrise.secrets.yml .bitrise +out/ diff --git a/bitrise.yml b/bitrise.yml index 62025690..73bbdeb0 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -4,9 +4,9 @@ default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git app: envs: # define these in your .bitrise.secrets.yml - - project_path: - - scheme: - - workdir: + - BITRISE_PROJECT_PATH​: + - BITRISE_SCHEME: + - BITRISE_SOURCE_DIR: workflows: test: @@ -19,3 +19,4 @@ workflows: inputs: - content: |- echo "-> BITRISE_IPA_PATH: ${BITRISE_IPA_PATH}" + echo "-> BITRISE_DSYM_PATH: ${BITRISE_DSYM_PATH}" diff --git a/step.sh b/step.sh index 7a0b9142..692b0776 100644 --- a/step.sh +++ b/step.sh @@ -38,6 +38,7 @@ cd - archive_path="${output_dir}/${scheme}.xcarchive" ipa_path="${output_dir}/${scheme}.ipa" +dsym_zip_path="${output_dir}/${scheme}.dSYM.zip" if [ -z "${workdir}" ] ; then workdir="$(pwd)" @@ -52,6 +53,7 @@ echo " * workdir: ${workdir}" echo " * output_dir: ${output_dir}" echo " * archive_path: ${archive_path}" echo " * ipa_path: ${ipa_path}" +echo " * dsym_zip_path: ${dsym_zip_path}" if [ ! -z "${workdir}" ] ; then echo @@ -145,4 +147,60 @@ echo " (i) The IPA is now available at: ${ipa_path}" envman add --key BITRISE_IPA_PATH --value "${ipa_path}" echo ' (i) The IPA path is now available in the Environment Variable: $BITRISE_IPA_PATH' +set -v + + +# +# dSYM handling +# get the .app.dSYM folders from the dSYMs archive folder +archive_dsyms_folder="${archive_path}/dSYMs" +ls "${archive_dsyms_folder}" +app_dsym_count=0 +app_dsym_path="" + +IFS=$'\n' +for a_app_dsym in $(find "${archive_dsyms_folder}" -type d -name "*.app.dSYM") ; do + echo " (i) .app.dSYM found: ${a_app_dsym}" + app_dsym_count=$[app_dsym_count + 1] + app_dsym_path="${a_app_dsym}" + echo " (i) app_dsym_count: $app_dsym_count" +done +unset IFS + +echo " (i) Found dSYM count: ${app_dsym_count}" +if [ ${app_dsym_count} -eq 1 ] ; then + echo "* dSYM found at: ${app_dsym_path}" + if [ -d "${app_dsym_path}" ] ; then + export DSYM_PATH="${app_dsym_path}" + else + echo "* (i) *Found dSYM path is not a directory!*" + fi +else + if [ ${app_dsym_count} -eq 0 ] ; then + echo "* (i) **No dSYM found!** To generate debug symbols (dSYM) go to your Xcode Project's Settings - *Build Settings - Debug Information Format* and set it to *DWARF with dSYM File*." + else + echo "* (i) *More than one dSYM found!*" + fi +fi + +# Generate dSym zip +if [[ ! -z "${DSYM_PATH}" && -d "${DSYM_PATH}" ]] ; then + echo "Generating zip for dSym" + + dsym_parent_folder=$( dirname "${DSYM_PATH}" ) + dsym_fold_name=$( basename "${DSYM_PATH}" ) + # cd into dSYM parent to not to store full + # paths in the ZIP + cd "${dsym_parent_folder}" + /usr/bin/zip -rTy \ + "${dsym_zip_path}" \ + "${dsym_fold_name}" + + echo " (i) The IPA is now available at: ${dsym_zip_path}" + envman add --key BITRISE_DSYM_PATH --value "${dsym_zip_path}" + echo ' (i) The IPA path is now available in the Environment Variable: $BITRISE_DSYM_PATH' +else + echo " (!) No dSYM found (or not a directory: ${DSYM_PATH})" +fi + exit 0 diff --git a/step.yml b/step.yml index 13319666..ef9d5f48 100644 --- a/step.yml +++ b/step.yml @@ -1,5 +1,6 @@ title: Xcode Archive summary: Runs Xcode's `archive` action. +description: "" website: https://github.com/bitrise-io/steps-new-xcode-archive source_code_url: https://github.com/bitrise-io/steps-new-xcode-archive support_url: https://github.com/bitrise-io/steps-new-xcode-archive/issues @@ -16,38 +17,50 @@ is_skippable: false dependencies: - manager: _ name: xcode +run_if: "" inputs: - - project_path: + - project_path: ${BITRISE_PROJECT_PATH​} opts: title: "Project (or Workspace) path" + summary: "" description: | A `.xcodeproj` or `.xcworkspace` path. is_required: true is_expand: true - - scheme: + is_dont_change_value: false + - scheme: ${BITRISE_SCHEME} opts: title: "Scheme name" + summary: "" description: | The Scheme to use. is_required: true is_expand: true - - workdir: + is_dont_change_value: false + - workdir: ${BITRISE_SOURCE_DIR} opts: title: "Working directory" + summary: "" description: | Working directory of the step. You can leave it empty to don't change it. is_required: false is_expand: true + is_dont_change_value: false - output_dir: "./build" opts: title: "Output directory path" + summary: "" description: | This directory will contain the generated Xcode archive (.xcarchive) and the .ipa file. is_required: false is_expand: true + is_dont_change_value: false outputs: - BITRISE_IPA_PATH: opts: title: The created .ipa file's path + - BITRISE_DSYM_PATH: + opts: + title: The created .dSYM.zip file's path