[zorg] r368371 - [monorepo] Remove the module cache
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 17:13:22 PDT 2019
Author: jdevlieghere
Date: Thu Aug 8 17:13:22 2019
New Revision: 368371
URL: http://llvm.org/viewvc/llvm-project?rev=368371&view=rev
Log:
[monorepo] Remove the module cache
Modified:
zorg/trunk/zorg/jenkins/monorepo_build.py
Modified: zorg/trunk/zorg/jenkins/monorepo_build.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/jenkins/monorepo_build.py?rev=368371&r1=368370&r2=368371&view=diff
==============================================================================
--- zorg/trunk/zorg/jenkins/monorepo_build.py (original)
+++ zorg/trunk/zorg/jenkins/monorepo_build.py Thu Aug 8 17:13:22 2019
@@ -18,6 +18,8 @@ SERVER = "labmaster2.lab.llvm.org"
NINJA = "/usr/local/bin/ninja"
+MODULE_CACHE_REGEX = re.compile(r'-fmodules-cache-path=([^\"]+)')
+
# Add dependency checker to the Python path.
# For relative reference to the dependency file.
here = os.path.dirname(os.path.abspath(__file__))
@@ -60,6 +62,38 @@ def create_dirs(paths):
os.makedirs(p)
+def find_system_compiler_module_cache():
+ cmd = [
+ 'xcrun', 'clang', '-fmodules', '-x', 'c', '-', '-o', '/dev/null',
+ '-###'
+ ]
+ output = subprocess.check_output(
+ cmd, stderr=subprocess.STDOUT).decode('utf-8')
+ module_cache = MODULE_CACHE_REGEX.findall(output)
+ if not module_cache:
+ return None
+ return module_cache[0]
+
+
+def find_module_caches(path):
+ caches = []
+ for root, dirs, _ in os.walk(path):
+ for d in dirs:
+ if d == "module.cache":
+ caches.append(os.path.join(root, d))
+ return caches
+
+def delete_module_caches(workspace):
+ caches = find_module_caches(workspace)
+ system_cache = find_system_compiler_module_cache()
+ if system_cache:
+ caches.append(system_cache)
+ for cache in caches:
+ if (os.path.exists(cache)):
+ print 'Removing module cache: {}'.format(cache)
+ shutil.rmtree(cache)
+
+
class Configuration(object):
"""docstring for Configuration"""
@@ -474,6 +508,10 @@ def lldb_cmake_builder(target):
cmake_cmd.extend(['-DCMAKE_C_COMPILER=' + conf.CC(),
'-DCMAKE_CXX_COMPILER=' + conf.CC() + "++"])
+ header("Clean")
+ delete_module_caches(conf.workspace)
+ footer()
+
if target == 'all' or target == 'build':
header("Cmake")
run_cmd(conf.lldbbuilddir(), cmake_cmd)
@@ -538,6 +576,10 @@ def lldb_cmake_standalone_builder(target
cmake_cmd.extend(['-DCMAKE_C_COMPILER=' + conf.CC(),
'-DCMAKE_CXX_COMPILER=' + conf.CC() + "++"])
+ header("Clean")
+ delete_module_caches(conf.workspace)
+ footer()
+
if target == 'all' or target == 'build':
header("CMake")
run_cmd(conf.lldbstandalonebuilddir(), cmake_cmd)
@@ -583,6 +625,10 @@ def lldb_cmake_xcode_builder(target):
cmake_cmd.extend(['-DCMAKE_C_COMPILER=' + conf.CC(),
'-DCMAKE_CXX_COMPILER=' + conf.CC() + "++"])
+ header("Clean")
+ delete_module_caches(conf.workspace)
+ footer()
+
if target == 'all' or target == 'build':
header("CMake")
run_cmd(conf.lldbxcodebuilddir(), cmake_cmd)
More information about the llvm-commits
mailing list