[analyzer] SATest: Do not re-run CMake in Docker if not needed
Differential Revision: https://reviews.llvm.org/D81596
diff --git a/clang/utils/analyzer/entrypoint.py b/clang/utils/analyzer/entrypoint.py
index 8a1f59e..02eb5cb 100644
--- a/clang/utils/analyzer/entrypoint.py
+++ b/clang/utils/analyzer/entrypoint.py
@@ -23,16 +23,21 @@
return parser.parse_known_args()
-def build_llvm() -> None:
+def build_llvm():
os.chdir('/build')
try:
- cmake()
+ if is_cmake_needed():
+ cmake()
ninja()
except CalledProcessError:
print("Build failed!")
sys.exit(1)
+def is_cmake_needed():
+ return "build.ninja" not in os.listdir()
+
+
CMAKE_COMMAND = "cmake -G Ninja -DCMAKE_BUILD_TYPE=Release " \
"-DCMAKE_INSTALL_PREFIX=/analyzer -DLLVM_TARGETS_TO_BUILD=X86 " \
"-DLLVM_ENABLE_PROJECTS=clang -DLLVM_BUILD_RUNTIME=OFF " \