Skip to content

Commit 4d7eb2b

Browse files
committed
Merge pull request #4 from gkiki90/project_path
update
2 parents f890ab9 + f6850d6 commit 4d7eb2b

File tree

4 files changed

+79
-6
lines changed

4 files changed

+79
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.bitrise.secrets.yml
22
.bitrise
3+
out/

bitrise.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
44
app:
55
envs:
66
# define these in your .bitrise.secrets.yml
7-
- project_path:
8-
- scheme:
9-
- workdir:
7+
- BITRISE_PROJECT_PATH​:
8+
- BITRISE_SCHEME:
9+
- BITRISE_SOURCE_DIR:
1010

1111
workflows:
1212
test:
@@ -19,3 +19,4 @@ workflows:
1919
inputs:
2020
- content: |-
2121
echo "-> BITRISE_IPA_PATH: ${BITRISE_IPA_PATH}"
22+
echo "-> BITRISE_DSYM_PATH: ${BITRISE_DSYM_PATH}"

step.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cd -
3838

3939
archive_path="${output_dir}/${scheme}.xcarchive"
4040
ipa_path="${output_dir}/${scheme}.ipa"
41+
dsym_zip_path="${output_dir}/${scheme}.dSYM.zip"
4142

4243
if [ -z "${workdir}" ] ; then
4344
workdir="$(pwd)"
@@ -52,6 +53,7 @@ echo " * workdir: ${workdir}"
5253
echo " * output_dir: ${output_dir}"
5354
echo " * archive_path: ${archive_path}"
5455
echo " * ipa_path: ${ipa_path}"
56+
echo " * dsym_zip_path: ${dsym_zip_path}"
5557

5658
if [ ! -z "${workdir}" ] ; then
5759
echo
@@ -145,4 +147,60 @@ echo " (i) The IPA is now available at: ${ipa_path}"
145147
envman add --key BITRISE_IPA_PATH --value "${ipa_path}"
146148
echo ' (i) The IPA path is now available in the Environment Variable: $BITRISE_IPA_PATH'
147149

150+
set -v
151+
152+
153+
#
154+
# dSYM handling
155+
# get the .app.dSYM folders from the dSYMs archive folder
156+
archive_dsyms_folder="${archive_path}/dSYMs"
157+
ls "${archive_dsyms_folder}"
158+
app_dsym_count=0
159+
app_dsym_path=""
160+
161+
IFS=$'\n'
162+
for a_app_dsym in $(find "${archive_dsyms_folder}" -type d -name "*.app.dSYM") ; do
163+
echo " (i) .app.dSYM found: ${a_app_dsym}"
164+
app_dsym_count=$[app_dsym_count + 1]
165+
app_dsym_path="${a_app_dsym}"
166+
echo " (i) app_dsym_count: $app_dsym_count"
167+
done
168+
unset IFS
169+
170+
echo " (i) Found dSYM count: ${app_dsym_count}"
171+
if [ ${app_dsym_count} -eq 1 ] ; then
172+
echo "* dSYM found at: ${app_dsym_path}"
173+
if [ -d "${app_dsym_path}" ] ; then
174+
export DSYM_PATH="${app_dsym_path}"
175+
else
176+
echo "* (i) *Found dSYM path is not a directory!*"
177+
fi
178+
else
179+
if [ ${app_dsym_count} -eq 0 ] ; then
180+
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*."
181+
else
182+
echo "* (i) *More than one dSYM found!*"
183+
fi
184+
fi
185+
186+
# Generate dSym zip
187+
if [[ ! -z "${DSYM_PATH}" && -d "${DSYM_PATH}" ]] ; then
188+
echo "Generating zip for dSym"
189+
190+
dsym_parent_folder=$( dirname "${DSYM_PATH}" )
191+
dsym_fold_name=$( basename "${DSYM_PATH}" )
192+
# cd into dSYM parent to not to store full
193+
# paths in the ZIP
194+
cd "${dsym_parent_folder}"
195+
/usr/bin/zip -rTy \
196+
"${dsym_zip_path}" \
197+
"${dsym_fold_name}"
198+
199+
echo " (i) The IPA is now available at: ${dsym_zip_path}"
200+
envman add --key BITRISE_DSYM_PATH --value "${dsym_zip_path}"
201+
echo ' (i) The IPA path is now available in the Environment Variable: $BITRISE_DSYM_PATH'
202+
else
203+
echo " (!) No dSYM found (or not a directory: ${DSYM_PATH})"
204+
fi
205+
148206
exit 0

step.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
title: Xcode Archive
22
summary: Runs Xcode's `archive` action.
3+
description: ""
34
website: https://github.com/bitrise-io/steps-new-xcode-archive
45
source_code_url: https://github.com/bitrise-io/steps-new-xcode-archive
56
support_url: https://github.com/bitrise-io/steps-new-xcode-archive/issues
@@ -16,38 +17,50 @@ is_skippable: false
1617
dependencies:
1718
- manager: _
1819
name: xcode
20+
run_if: ""
1921
inputs:
20-
- project_path:
22+
- project_path: ${BITRISE_PROJECT_PATH​}
2123
opts:
2224
title: "Project (or Workspace) path"
25+
summary: ""
2326
description: |
2427
A `.xcodeproj` or `.xcworkspace` path.
2528
is_required: true
2629
is_expand: true
27-
- scheme:
30+
is_dont_change_value: false
31+
- scheme: ${BITRISE_SCHEME}
2832
opts:
2933
title: "Scheme name"
34+
summary: ""
3035
description: |
3136
The Scheme to use.
3237
is_required: true
3338
is_expand: true
34-
- workdir:
39+
is_dont_change_value: false
40+
- workdir: ${BITRISE_SOURCE_DIR}
3541
opts:
3642
title: "Working directory"
43+
summary: ""
3744
description: |
3845
Working directory of the step.
3946
You can leave it empty to don't change it.
4047
is_required: false
4148
is_expand: true
49+
is_dont_change_value: false
4250
- output_dir: "./build"
4351
opts:
4452
title: "Output directory path"
53+
summary: ""
4554
description: |
4655
This directory will contain the generated Xcode archive (.xcarchive)
4756
and the .ipa file.
4857
is_required: false
4958
is_expand: true
59+
is_dont_change_value: false
5060
outputs:
5161
- BITRISE_IPA_PATH:
5262
opts:
5363
title: The created .ipa file's path
64+
- BITRISE_DSYM_PATH:
65+
opts:
66+
title: The created .dSYM.zip file's path

0 commit comments

Comments
 (0)