[libcxx-commits] [PATCH] D93520: [libc++] [CI] Install Tip-of-Trunk clang.

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 18 00:19:19 PST 2020


curdeius created this revision.
curdeius added a reviewer: ldionne.
Herald added a subscriber: arichardson.
curdeius requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

- Check created symlinks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93520

Files:
  libcxx/utils/ci/Dockerfile


Index: libcxx/utils/ci/Dockerfile
===================================================================
--- libcxx/utils/ci/Dockerfile
+++ libcxx/utils/ci/Dockerfile
@@ -36,11 +36,18 @@
 #   $ docker build -t ldionne/libcxx-builder .
 #   $ docker push ldionne/libcxx-builder
 #
+# Optional build arguments:
+#   * LLVM_TOT_VERSION defines the tip-of-trunk (not released) LLVM version to install.
+#
+# Usage example:
+#   $ docker build --build-arg LLVM_TOT_VERSION=12 -t ldionne/libcxx-builder .
+#
 
 FROM ubuntu:bionic
 
 # Make sure apt-get doesn't try to prompt for stuff like our time zone, etc.
 ENV DEBIAN_FRONTEND=noninteractive
+ENV LLVM_TOT_VERSION=${LLVM_TOT_VERSION:-12}
 
 RUN apt-get update && apt-get install -y bash curl
 
@@ -50,19 +57,25 @@
 
 # Install the most recently released LLVM
 RUN apt-get update && apt-get install -y lsb-release wget software-properties-common
-RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
-RUN ln -s $(find /usr/bin -regex '^.+/clang\+\+-[0-9.]+$') /usr/bin/clang++
-RUN ln -s $(find /usr/bin -regex '^.+/clang-[0-9.]+$') /usr/bin/clang
+# llvm.sh sets the $LLVM_VERSION variable that we use to install the corresponding version of clang-format.
+RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh) ; apt-get install -y clang-format-\$LLVM_VERSION"
+RUN ln -s $(find /usr/bin -regex '^.+/clang\+\+-[0-9.]+$') /usr/bin/clang++ && [ -e $(readlink /usr/bin/clang++) ]
+RUN ln -s $(find /usr/bin -regex '^.+/clang-[0-9.]+$') /usr/bin/clang && [ -e $(readlink /usr/bin/clang) ]
+RUN ln -s $(find /usr/bin -regex '^.+/clang-format-[0-9.]+$') /usr/bin/clang-format && [ -e $(readlink /usr/bin/clang-format) ]
+RUN ln -s $(find /usr/bin -regex '^.+/git-clang-format-[0-9.]+$') /usr/bin/git-clang-format && [ -e $(readlink /usr/bin/git-clang-format) ]
 
-RUN apt-get update && apt-get install -y clang-format-11
-# Make a symbolic link to git-clang-format (pointing to git-clang-format-<version>), if it doesn't exist.
-RUN which git-clang-format || $(cd /usr/bin/ && ln -s $(ls git-clang-format-* | sort -rV | head -n 1) git-clang-format)
+# Install the not-yet-released LLVM
+RUN wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
+RUN chmod +x /tmp/llvm.sh
+RUN bash /tmp/llvm.sh ${LLVM_TOT_VERSION}
+RUN ln -s /usr/bin/clang++-${LLVM_TOT_VERSION} /usr/bin/clang++-tot && [ -e $(readlink /usr/bin/clang++-tot) ]
+RUN ln -s /usr/bin/clang-${LLVM_TOT_VERSION} /usr/bin/clang-tot && [ -e $(readlink /usr/bin/clang-tot) ]
 
 # Install a recent GCC
 RUN add-apt-repository ppa:ubuntu-toolchain-r/test
 RUN apt-get update && apt install -y gcc-10 g++-10
-RUN ln -f -s /usr/bin/g++-10 /usr/bin/g++
-RUN ln -f -s /usr/bin/gcc-10 /usr/bin/gcc
+RUN ln -f -s /usr/bin/g++-10 /usr/bin/g++ && [ -e $(readlink /usr/bin/g++) ]
+RUN ln -f -s /usr/bin/gcc-10 /usr/bin/gcc && [ -e $(readlink /usr/bin/gcc) ]
 
 # Install a recent CMake
 RUN wget https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-Linux-x86_64.sh -O /tmp/install-cmake.sh


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93520.312699.patch
Type: text/x-patch
Size: 2995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201218/d58e1273/attachment-0001.bin>


More information about the libcxx-commits mailing list