/
script_build_end.sh
69 lines (53 loc) · 1.78 KB
/
script_build_end.sh
1
2
3
4
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# script_build_end.sh
# PoseGallery
#
# Copyright (c) 2015 Trollwerks Inc. All rights reserved.
#
plist="${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}"
# http://blog.jaredsinclair.com/post/97193356620/the-best-of-all-possible-xcode-automated-build
update_bundle_version()
{
git=`sh /etc/profile; which git`
build=`"$git" rev-list --all |wc -l`
if [[ $CONFIGURATION == *Debug* ]]; then
branch=`"$git" rev-parse --abbrev-ref HEAD`
version=$build-$branch
else
version=$build
fi
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $version" "${plist}"
echo Build version set to git specs: $version
}
# displayed in settings
update_build_date()
{
CFBuildDate=$(date +"%a %b %d %H:%M:%S %Z %Y")
/usr/libexec/PlistBuddy -c "Set :CFBuildDate $CFBuildDate" "${plist}"
echo Build date set to current date: $CFBuildDate
}
# https://gist.github.com/dulaccc/a52154ac4c007db2be55
restore_icon()
{
if [ $CONFIGURATION != "Release" ] ; then
${SRCROOT}/PoseGalleryConfig/script_tag_icon.sh cleanup PoseGallery/resources/Images.xcassets/AppIcon.appiconset
fi
}
# http://vocaro.com/trevor/blog/2012/10/21/xcode-groups-vs-folder-references/
copy_branding()
{
# this will add all your images in the folder reference into the actual .app build of your project. cheers
find -L ${SRCROOT}// -type f -not -name “.*” -not -name “`basename ${INFOPLIST_FILE}`” | xargs -t -I {} cp {} ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/;
}
# set build-specific info
echo Setting info in plist $plist:
update_bundle_version
update_build_date
restore_icon
#copy_branding
# reveal the binary in the Finder if you like
echo Built at ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
/usr/bin/open --reveal "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
# finished
return 0