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 | |
8 | |
9 # Pull off the optional args | |
10 INCLUDE_BREAKPAD=0 | |
11 OPTERR=0 | |
12 while getopts ":b:" an_opt ; do | |
13 case $an_opt in | |
14 b) | |
15 INCLUDE_BREAKPAD=$OPTARG | |
16 ;; | |
17 \?) | |
18 echo "Unknown option $OPTARG" | |
19 exit 1 | |
20 ;; | |
21 :) | |
22 echo "Option $OPTARG missing it's value" | |
23 exit 1 | |
24 ;; | |
25 *) | |
26 echo "Not recognized argument $an_opt" | |
27 exit 1 | |
28 ;; | |
29 esac | |
30 done | |
31 shift $(($OPTIND - 1)) | |
32 | |
7 # Make sure we got the header to write into passed to us | 33 # Make sure we got the header to write into passed to us |
8 if [ $# -ne 1 ]; then | 34 if [ $# -ne 1 ]; then |
9 echo "error: missing branding as an argument" >&2 | 35 echo "error: missing branding as an argument" >&2 |
10 exit 1 | 36 exit 1 |
11 fi | 37 fi |
12 | 38 |
13 # | 39 # |
14 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work | 40 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work |
15 # because: | 41 # because: |
16 # | 42 # |
17 # 1. Xcode wants to do the Info.plist work before it runs any build phases, | 43 # 1. Xcode wants to do the Info.plist work before it runs any build phases, |
18 # this means if we were to generate a .h file for INFOPLIST_PREFIX_HEADER | 44 # this means if we were to generate a .h file for INFOPLIST_PREFIX_HEADER |
19 # we'd have to put it in another target so it runs in time. | 45 # we'd have to put it in another target so it runs in time. |
20 # 2. Xcode also doesn't check to see if the header being used as a prefix for | 46 # 2. Xcode also doesn't check to see if the header being used as a prefix for |
21 # the Info.plist has changed. So even if we updated it, it's only looking | 47 # the Info.plist has changed. So even if we updated it, it's only looking |
22 # at the modtime of the info.plist to see if that's changed. | 48 # at the modtime of the info.plist to see if that's changed. |
23 # | 49 # |
24 # So, we work around all of this by making a script build phase that will run | 50 # So, we work around all of this by making a script build phase that will run |
25 # during the app build, and simply update the info.plist in place. This way | 51 # during the app build, and simply update the info.plist in place. This way |
26 # by the time the app target is done, the info.plist is correct. | 52 # by the time the app target is done, the info.plist is correct. |
27 # | 53 # |
28 | 54 |
29 set -ex | |
30 | |
31 TOP="${SRCROOT}/.." | 55 TOP="${SRCROOT}/.." |
32 BUILD_BRANDING=$1 | 56 BUILD_BRANDING=$1 |
33 SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${BUILD_BRANDING}.app" | 57 SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${BUILD_BRANDING}.app" |
34 | 58 |
59 set -x | |
60 | |
35 # Figure out what version this build corresponds to. Just use the svn revision | 61 # Figure out what version this build corresponds to. Just use the svn revision |
36 # for now. Warning: my svnversion returns 10495:10552M. But that's ok since | 62 # for now. Warning: my svnversion returns 10495:10552M. But that's ok since |
37 # it is just for reference. | 63 # it is just for reference. |
38 SVN_REVISION=$(svnversion "${SRCROOT}") | 64 SVN_REVISION=$(svnversion "${SRCROOT}") |
39 if [ -z "${SVN_REVISION}" ] ; then | 65 if [ -z "${SVN_REVISION}" ] ; then |
40 echo "warning: could not determine svn revision" >&2 | 66 echo "warning: could not determine svn revision" >&2 |
41 fi | 67 fi |
42 | 68 |
43 # Pull in the chrome version number | 69 # Pull in the chrome version number |
44 . "${TOP}/chrome/VERSION" | 70 . "${TOP}/chrome/VERSION" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 # fixed in later OS release, but hasn't been tested (it's easy enough to find | 108 # fixed in later OS release, but hasn't been tested (it's easy enough to find |
83 # out with "lsregister -dump). | 109 # out with "lsregister -dump). |
84 # http://lists.apple.com/archives/carbon-dev/2006/Jun/msg00139.html | 110 # http://lists.apple.com/archives/carbon-dev/2006/Jun/msg00139.html |
85 # BUILD will always be an increasing value, so BUILD_PATH gives us something | 111 # BUILD will always be an increasing value, so BUILD_PATH gives us something |
86 # unique that meetings what LS wants. | 112 # unique that meetings what LS wants. |
87 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 113 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
88 CFBundleVersion -string "${BUILD}.${PATCH}" | 114 CFBundleVersion -string "${BUILD}.${PATCH}" |
89 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 115 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
90 NSHumanReadableCopyright -string "${COPYRIGHT_STRING}" | 116 NSHumanReadableCopyright -string "${COPYRIGHT_STRING}" |
91 | 117 |
118 # Add/Remove the breakpad keys | |
119 if [ "${INCLUDE_BREAKPAD}" == "1" ] ; then | |
120 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | |
121 BreakpadURL "https://clients2.google.com/cr/report" | |
122 defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadReportInterval "3600" | |
123 defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProduct "${BUILD_BRANDING} _Mac" | |
Mark Mentovai
2009/05/12 21:54:16
break up long lines
| |
124 defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProductDisplay "${BUILD_BR ANDING}" | |
125 defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadVersion "${FULL_VERSION}" | |
Mark Mentovai
2009/05/12 21:54:16
-string this one
| |
126 defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSendAndExit "YES" | |
127 # TODO: remove/update this when we have first launch | |
128 defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSkipConfirm "YES" | |
129 else | |
130 # Make sure the keys aren't there, || true to avoid errors if they aren't. | |
131 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadURL || true | |
132 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadReportInterval || true | |
133 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProduct || true | |
134 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProductDisplay || true | |
135 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadVersion || true | |
136 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSendAndExit || true | |
137 # TODO: remove/update this when we have first launch | |
138 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSkipConfirm || true | |
139 fi | |
140 | |
92 # Info.plist will work perfectly well in any plist format, but traditionally | 141 # Info.plist will work perfectly well in any plist format, but traditionally |
93 # applications use xml1 for this, so convert it back after whatever defaults | 142 # applications use xml1 for this, so convert it back after whatever defaults |
94 # might have done. | 143 # might have done. |
95 plutil -convert xml1 "${TMP_INFO_PLIST}" | 144 plutil -convert xml1 "${TMP_INFO_PLIST}" |
96 cp "${TMP_INFO_PLIST}" "${SRC_APP_PATH}/${INFO_PLIST_PATH}" | 145 cp "${TMP_INFO_PLIST}" "${SRC_APP_PATH}/${INFO_PLIST_PATH}" |
OLD | NEW |