Commit 6fcbf9d6 authored by thakis@chromium.org's avatar thakis@chromium.org

clang: Instead of having update.sh clobber out/, add a define with the current revision.

When clang is turned on or off, or when clang is updated, all .o files and all
precompiled headers need to be rebuilt. This is currently done by having the
update script remove the out/ directory. This has issues:
* It fails to catch build directories with different names (e.g. out_android)
* It removes other build artifacts (like resources) that don't need rebuilding
* It doesn't happen when turning clang off (i.e. moving clang -> gcc).

Instead, let common.gypi add a define with the current clang revision to each
source file. This way, the clang revision is on each compile's command line
and the build system's commandline tracking can take care of the rebuilding.

BUG=nativeclient:3840
NOTRY=true

Review URL: https://codereview.chromium.org/268363020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269427 0039d316-1c4b-4281-b951-d872f2087c98
parent 4957aa02
......@@ -2313,6 +2313,14 @@
],
},
}],
['clang==1 and OS!="win"', {
# This is here so that all files get recompiled after a clang roll and
# when turning clang on or off.
# (defines are passed via the command line, and build systems rebuild
# things when their commandline changes). Nothing should ever read this
# define.
'defines': ['CR_CLANG_REVISION=<!(<(DEPTH)/tools/clang/scripts/update.sh --print-revision)'],
}],
['enable_rlz==1', {
'defines': ['ENABLE_RLZ'],
}],
......
......@@ -78,6 +78,10 @@ while [[ $# > 0 ]]; do
--force-local-build)
force_local_build=yes
;;
--print-revision)
echo $CLANG_REVISION
exit 0
;;
--run-tests)
run_tests=yes
;;
......@@ -113,6 +117,7 @@ while [[ $# > 0 ]]; do
echo "--force-local-build: Don't try to download prebuilt binaries."
echo "--if-needed: Download clang only if the script thinks it is needed."
echo "--run-tests: Run tests after building. Only for local builds."
echo "--print-revision: Print current clang revision and exit."
echo "--without-android: Don't build ASan Android runtime library."
echo "--with-chrome-tools: Select which chrome tools to build." \
"Defaults to plugins."
......@@ -136,7 +141,6 @@ done
if [[ -f "${LLVM_BUILD_DIR}/autoinstall_stamp" ]]; then
echo Removing autoinstalled clang and clobbering
rm -rf "${LLVM_BUILD_DIR}"
rm -rf "${THIS_DIR}/../../../out"
fi
if [[ -n "$if_needed" ]]; then
......@@ -171,18 +175,6 @@ fi
rm -f "${STAMP_FILE}"
# Clobber all output files. PCH files only work with the compiler that created
# them, so we need clobber the output files to make sure they are rebuilt
# using the new compiler.
echo "Clobbering build files"
MAKE_DIR="${THIS_DIR}/../../../out"
XCODEBUILD_DIR="${THIS_DIR}/../../../xcodebuild"
for DIR in "${XCODEBUILD_DIR}" "${MAKE_DIR}"; do
if [[ -d "${DIR}" ]]; then
rm -rf "${DIR}"
fi
done
if [[ -z "$force_local_build" ]]; then
# Check if there's a prebuilt binary and if so just fetch that. That's faster,
# and goma relies on having matching binary hashes on client and server too.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment