Skip to content

Commit

Permalink
Bug 1415971 - Inline sccache.mk into client.mk; r=nalexander
Browse files Browse the repository at this point in the history
sccache.mk is the only thing that uses MOZ_PREFLIGHT_ALL and
MOZ_POSTFLIGHT_ALL. We're trying to kill client.mk and these
variables are next on the chopping block.

This commit essentially moves the logic of sccache.mk inline into
client.mk. Initially, I wanted to move the management of the
sccache daemon to Python as part of what `mach build` invokes.
However, the sccache daemon needs access to the make jobserver.
Since we don't have an active make process in `mach`, this is
obviously problematic. The sccache daemon is also used by
configure, which is launched from client.mk. So the best we
can do right now is move the sccache daemon logic into client.mk.

As part of the port, we pass the path to the sccache binary via
an environment variable. This feels slightly better than hardcoding
the path that automation uses.

MozReview-Commit-ID: zcOYR4I1OG

--HG--
extra : rebase_source : 305a237dc9f5bd96e4aa83d491ac2498fe3c3ba0
  • Loading branch information
indygreg committed Nov 9, 2017
1 parent 965ee1e commit 67d153a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
3 changes: 1 addition & 2 deletions build/mozconfig.cache
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ else
esac
export CCACHE="$topsrcdir/sccache2/sccache${suffix}"
export SCCACHE_VERBOSE_STATS=1
mk_add_options MOZ_PREFLIGHT_ALL+=build/sccache.mk
mk_add_options MOZ_POSTFLIGHT_ALL+=build/sccache.mk
mk_add_options MOZBUILD_MANAGE_SCCACHE_DAEMON=${topsrcdir}/sccache2/sccache
mk_add_options "UPLOAD_EXTRA_FILES+=sccache.log.gz"
case "$platform" in
win*)
Expand Down
15 changes: 0 additions & 15 deletions build/sccache.mk

This file was deleted.

18 changes: 18 additions & 0 deletions client.mk
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ build preflight_all::
done
endif

# In automation, manage an sccache daemon. The starting of the server
# needs to be in a make file so sccache inherits the jobserver.
ifdef MOZBUILD_MANAGE_SCCACHE_DAEMON
build::
# Terminate any sccache server that might still be around.
-$(MOZBUILD_MANAGE_SCCACHE_DAEMON) --stop-server > /dev/null 2>&1
# Start a new server, ensuring it gets the jobserver file descriptors
# from make (but don't use the + prefix when make -n is used, so that
# the command doesn't run in that case)
$(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env RUST_LOG=sccache::compiler=debug SCCACHE_ERROR_LOG=$(OBJDIR)/dist/sccache.log $(MOZBUILD_MANAGE_SCCACHE_DAEMON) --start-server
endif

####################################
# Configure

Expand Down Expand Up @@ -288,6 +300,12 @@ build::
$(MAKE) -f $(TOPSRCDIR)/client.mk automation/build
endif

ifdef MOZBUILD_MANAGE_SCCACHE_DAEMON
build::
# Terminate sccache server. This prints sccache stats.
-$(MOZBUILD_MANAGE_SCCACHE_DAEMON) --stop-server
endif

ifdef MOZ_POSTFLIGHT_ALL
build postflight_all::
set -e; \
Expand Down

0 comments on commit 67d153a

Please sign in to comment.