OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 set -e | 7 set -e |
8 | 8 |
9 # Pull off the optional args | 9 # Pull off the optional args |
10 USE_BREAKPAD=0 | 10 USE_BREAKPAD=0 |
(...skipping 21 matching lines...) Expand all Loading... |
32 ;; | 32 ;; |
33 *) | 33 *) |
34 echo "Not recognized argument $an_opt" | 34 echo "Not recognized argument $an_opt" |
35 exit 1 | 35 exit 1 |
36 ;; | 36 ;; |
37 esac | 37 esac |
38 done | 38 done |
39 shift $(($OPTIND - 1)) | 39 shift $(($OPTIND - 1)) |
40 | 40 |
41 # Make sure the branding argument was supplied. | 41 # Make sure the branding argument was supplied. |
42 if [ $# -ne 1 ]; then | 42 if [ $# -ne 2 ]; then |
43 echo "error: missing branding as an argument" >&2 | 43 echo "usage: $0 [-b 1] [-k 1] [-s 1] BRANDING IDENTIFIER" >&2 |
44 exit 1 | 44 exit 1 |
45 fi | 45 fi |
46 | 46 |
47 # | 47 # |
48 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work | 48 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work |
49 # because: | 49 # because: |
50 # | 50 # |
51 # 1. Xcode wants to do the Info.plist work before it runs any build phases, | 51 # 1. Xcode wants to do the Info.plist work before it runs any build phases, |
52 # this means if we were to generate a .h file for INFOPLIST_PREFIX_HEADER | 52 # this means if we were to generate a .h file for INFOPLIST_PREFIX_HEADER |
53 # we'd have to put it in another target so it runs in time. | 53 # we'd have to put it in another target so it runs in time. |
54 # 2. Xcode also doesn't check to see if the header being used as a prefix for | 54 # 2. Xcode also doesn't check to see if the header being used as a prefix for |
55 # the Info.plist has changed. So even if we updated it, it's only looking | 55 # the Info.plist has changed. So even if we updated it, it's only looking |
56 # at the modtime of the info.plist to see if that's changed. | 56 # at the modtime of the info.plist to see if that's changed. |
57 # | 57 # |
58 # So, we work around all of this by making a script build phase that will run | 58 # So, we work around all of this by making a script build phase that will run |
59 # during the app build, and simply update the info.plist in place. This way | 59 # during the app build, and simply update the info.plist in place. This way |
60 # by the time the app target is done, the info.plist is correct. | 60 # by the time the app target is done, the info.plist is correct. |
61 # | 61 # |
62 | 62 |
63 TOP="${SRCROOT}/.." | 63 TOP="${SRCROOT}/.." |
64 BUILD_BRANDING=$1 | 64 BUILD_BRANDING=$1 |
| 65 IDENTIFIER=$2 |
65 | 66 |
66 set -x | 67 set -x |
67 | 68 |
68 if [ "${USE_SVN}" = "1" ] ; then | 69 if [ "${USE_SVN}" = "1" ] ; then |
69 # Visible in the about:version page. | 70 # Visible in the about:version page. |
70 SVN_INFO=$(svn info "${TOP}" 2>/dev/null || true) | 71 SVN_INFO=$(svn info "${TOP}" 2>/dev/null || true) |
71 SVN_REVISION=$(echo "${SVN_INFO}" | sed -Ene 's/^Revision: (.*)$/\1/p') | 72 SVN_REVISION=$(echo "${SVN_INFO}" | sed -Ene 's/^Revision: (.*)$/\1/p') |
72 if [ -z "${SVN_REVISION}" ] ; then | 73 if [ -z "${SVN_REVISION}" ] ; then |
73 GIT_INFO=$(git log -1 --grep=git-svn-id --format=%b 2>/dev/null || true) | 74 GIT_INFO=$(git log -1 --grep=git-svn-id --format=%b 2>/dev/null || true) |
74 SVN_REVISION=$(echo "${GIT_INFO}" | \ | 75 SVN_REVISION=$(echo "${GIT_INFO}" | \ |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProduct || true | 153 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProduct || true |
153 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProductDisplay || true | 154 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProductDisplay || true |
154 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadVersion || true | 155 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadVersion || true |
155 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSendAndExit || true | 156 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSendAndExit || true |
156 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSkipConfirm || true | 157 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSkipConfirm || true |
157 fi | 158 fi |
158 | 159 |
159 # Add or remove the Keystone keys (only supported in release builds). | 160 # Add or remove the Keystone keys (only supported in release builds). |
160 if [ "${USE_KEYSTONE}" = "1" ] && [ "${CONFIGURATION}" = "Release" ] ; then | 161 if [ "${USE_KEYSTONE}" = "1" ] && [ "${CONFIGURATION}" = "Release" ] ; then |
161 KEYSTONE_URL="https://tools.google.com/service/update2" | 162 KEYSTONE_URL="https://tools.google.com/service/update2" |
162 KEYSTONE_APP_ID=$(defaults read "${TMP_INFO_PLIST_DEFAULTS}" \ | 163 KEYSTONE_APP_ID="${IDENTIFIER}" |
163 CFBundleIdentifier) | |
164 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 164 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
165 KSVersion -string "${FULL_VERSION}" | 165 KSVersion -string "${FULL_VERSION}" |
166 defaults write "${TMP_INFO_PLIST_DEFAULTS}" KSProductID "${KEYSTONE_APP_ID}" | 166 defaults write "${TMP_INFO_PLIST_DEFAULTS}" KSProductID "${KEYSTONE_APP_ID}" |
167 defaults write "${TMP_INFO_PLIST_DEFAULTS}" KSUpdateURL "${KEYSTONE_URL}" | 167 defaults write "${TMP_INFO_PLIST_DEFAULTS}" KSUpdateURL "${KEYSTONE_URL}" |
168 else | 168 else |
169 # Make sure the keys aren't there, || true to avoid errors if they aren't. | 169 # Make sure the keys aren't there, || true to avoid errors if they aren't. |
170 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" KSVersion || true | 170 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" KSVersion || true |
171 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" KSProductID || true | 171 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" KSProductID || true |
172 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" KSUpdateURL || true | 172 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" KSUpdateURL || true |
173 fi | 173 fi |
174 | 174 |
175 # Info.plist will work perfectly well in any plist format, but traditionally | 175 # Info.plist will work perfectly well in any plist format, but traditionally |
176 # applications use xml1 for this, so convert it back after whatever defaults | 176 # applications use xml1 for this, so convert it back after whatever defaults |
177 # might have done. | 177 # might have done. |
178 plutil -convert xml1 "${TMP_INFO_PLIST}" | 178 plutil -convert xml1 "${TMP_INFO_PLIST}" |
179 cp "${TMP_INFO_PLIST}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | 179 cp "${TMP_INFO_PLIST}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" |
180 | 180 |
181 # Clean up. | 181 # Clean up. |
182 rm -f "${TMP_INFO_PLIST}" | 182 rm -f "${TMP_INFO_PLIST}" |
OLD | NEW |