1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 # Setup for build cache
7 # builds where buildprops didn't have the data (eg: taskcluster) and without sccache disabled:
8 if test -z "$bucket" -a -z "$SCCACHE_DISABLE" -a -z "$MOZ_PGO"; then
10 # prevent rerun if az is set, or wget is not available
11 if test -z "$availability_zone" -a -x "$(command -v wget)"; then
12 if test -n "${TASKCLUSTER_WORKER_GROUP}"; then
13 # TASKCLUSTER_WORKER_GROUP is just the region now, so
14 # stick an extra character on to make the already-convoluted logic
16 availability_zone="${TASKCLUSTER_WORKER_GROUP}x"
18 # timeout after 1 second, and don't retry (failure indicates instance is not in ec2 or network issue)
19 # availability_zone is of the form <region><letter> where region is e.g. us-west-2, and az is us-west-2a
20 availability_zone=$(wget -T 1 -t 1 -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone || true)
22 if test -z "$availability_zone" -o "$availability_zone" = "not-ec2"; then
23 availability_zone=not-ec2
25 # region is az with last letter trimmed
26 region=${availability_zone%?}
27 # set S3 bucket according to tree (level)
28 case "${GECKO_HEAD_REPOSITORY}" in
30 bucket=taskcluster-level-1-sccache-${region}
32 *hg.mozilla.org/integration/autoland*|*hg.mozilla.org/integration/mozilla-inbound*)
33 bucket=taskcluster-level-3-sccache-${region}
40 master=dummy.euc1.mozilla.com
43 master=dummy.use1.mozilla.com
46 master=dummy.usw1.mozilla.com
49 master=dummy.usw2.mozilla.com
56 # if platform hasn't been determined from buildprops, and we're on windows,
57 # it must be set to prevent adding ac_add_options --with-ccache below
58 if test -z "$platform"; then
59 # set platform based on the SYSTEMROOT env var
60 case "${SYSTEMROOT}" in
68 if test -n "$bucket"; then
69 mk_add_options "export SCCACHE_BUCKET=$bucket"
71 *us[ew][12].mozilla.com*|*euc1.mozilla.com*)
72 mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
75 export CCACHE="$topsrcdir/sccache2/sccache${suffix}"
76 export SCCACHE_VERBOSE_STATS=1
77 mk_add_options MOZBUILD_MANAGE_SCCACHE_DAEMON=${topsrcdir}/sccache2/sccache
80 # For now, sccache doesn't support separate PDBs so force debug info to be
82 mk_add_options "export COMPILE_PDB_FLAG="
83 mk_add_options "export HOST_PDB_FLAG="
84 mk_add_options "export MOZ_DEBUG_FLAGS=-Z7"