Handle clang-tools-extra project in docker scripts.

Reviewers: klimek, mehdi_amini

Reviewed By: mehdi_amini

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35418

llvm-svn: 308594
This commit is contained in:
Ilya Biryukov 2017-07-20 08:30:44 +00:00
parent 956d4d2ee6
commit e421fc81a4
1 changed files with 45 additions and 6 deletions

View File

@ -48,6 +48,7 @@ CMAKE_INSTALL_TARGETS=""
# We always checkout llvm
LLVM_PROJECTS="llvm"
CMAKE_LLVM_ENABLE_PROJECTS=""
CLANG_TOOLS_EXTRA_ENABLED=0
function contains_project() {
local TARGET_PROJ="$1"
@ -60,6 +61,17 @@ function contains_project() {
return 1
}
function append_project() {
local PROJ="$1"
LLVM_PROJECTS="$LLVM_PROJECTS $PROJ"
if [ "$CMAKE_LLVM_ENABLE_PROJECTS" != "" ]; then
CMAKE_LLVM_ENABLE_PROJECTS="$CMAKE_LLVM_ENABLE_PROJECTS;$PROJ"
else
CMAKE_LLVM_ENABLE_PROJECTS="$PROJ"
fi
}
while [[ $# -gt 0 ]]; do
case "$1" in
-r|--revision)
@ -75,19 +87,27 @@ while [[ $# -gt 0 ]]; do
-p|--llvm-project)
shift
PROJ="$1"
shift
if [ "$PROJ" == "cfe" ]; then
PROJ="clang"
fi
if ! contains_project "$PROJ" ; then
LLVM_PROJECTS="$LLVM_PROJECTS $PROJ"
if [ "$CMAKE_LLVM_ENABLE_PROJECTS" != "" ]; then
CMAKE_LLVM_ENABLE_PROJECTS="$CMAKE_LLVM_ENABLE_PROJECTS;"
if [ "$PROJ" == "clang-tools-extra" ]; then
if [ $CLANG_TOOLS_EXTRA_ENABLED -ne 0 ]; then
echo "Project 'clang-tools-extra' is already enabled, ignoring extra occurences."
else
CLANG_TOOLS_EXTRA_ENABLED=1
fi
CMAKE_LLVM_ENABLE_PROJECTS="$CMAKE_LLVM_ENABLED_PROJECTS$PROJ"
continue
fi
if ! contains_project "$PROJ" ; then
append_project "$PROJ"
else
echo "Project '$PROJ' is already enabled, ignoring extra occurences."
fi
shift
;;
-i|--install-target)
shift
@ -114,6 +134,15 @@ if [ "$CMAKE_INSTALL_TARGETS" == "" ]; then
exit 1
fi
if [ $CLANG_TOOLS_EXTRA_ENABLED -ne 0 ]; then
if ! contains_project "clang"; then
echo "Project 'clang-tools-extra' was enabled without 'clang'."
echo "Adding 'clang' to a list of projects."
append_project "clang"
fi
fi
if [ "$LLVM_BRANCH" == "" ]; then
LLVM_BRANCH="trunk"
fi
@ -148,6 +177,16 @@ for LLVM_PROJECT in $LLVM_PROJECTS; do
"$CLANG_BUILD_DIR/src/$LLVM_PROJECT"
done
if [ $CLANG_TOOLS_EXTRA_ENABLED -ne 0 ]; then
echo "Checking out https://llvm.org/svn/llvm-project/clang-tools-extra to $CLANG_BUILD_DIR/src/clang/tools/extra"
# FIXME: --trust-server-cert is required to workaround 'SSL issuer is not
# trusted' error. Using https seems preferable to http either way,
# albeit this is not secure.
svn co -q $SVN_REV_ARG --trust-server-cert \
"https://llvm.org/svn/llvm-project/clang-tools-extra/$LLVM_BRANCH" \
"$CLANG_BUILD_DIR/src/clang/tools/extra"
fi
mkdir "$CLANG_BUILD_DIR/build"
pushd "$CLANG_BUILD_DIR/build"