Skip to content

Commit 1a1c595

Browse files
committed
Copy LLVM build artifacts to output dir when compilation fails
This CL causes the build system to copy LLVM build artifacts to the output dist directory if the invocation of `x.py` fails. Test: None Change-Id: I3da9a55b253af541e80c58c224beb64757e456bb
1 parent 031d178 commit 1a1c595

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

do_build.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@
5151
"vendor/unicode-width",
5252
]
5353

54+
LLVM_BUILD_PATHS_OF_INTEREST: list[str] = [
55+
'build.ninja',
56+
'cmake',
57+
'CMakeCache.txt',
58+
'CMakeFiles',
59+
'cmake_install.cmake',
60+
'compile_commands.json',
61+
'CPackConfig.cmake',
62+
'CPackSourceConfig.cmake',
63+
'install_manifest.txt',
64+
'llvm.spec'
65+
]
66+
5467

5568
def parse_args():
5669
"""Parses arguments and returns the parsed structure."""
@@ -149,6 +162,9 @@ def main():
149162
'--stage', '3', 'install'], cwd=OUT_PATH_RUST_SOURCE, env=env).wait()
150163
if ec != 0:
151164
print("Build stage failed with error {}".format(ec))
165+
tarball_path = dist_dir / 'llvm-build-config.tar.gz'
166+
subprocess.check_call(['tar', 'czf', tarball_path] + LLVM_BUILD_PATHS_OF_INTEREST,
167+
cwd=LLVM_BUILD_PATH)
152168
sys.exit(ec)
153169

154170
# Install sources

paths.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
OUT_PATH_STDLIB_SRCS: Path = OUT_PATH_PACKAGE / 'src' / 'stdlibs'
3434
OUT_PATH_WRAPPERS: Path = OUT_PATH / 'wrappers'
3535

36+
LLVM_BUILD_PATH: Path = OUT_PATH_RUST_SOURCE / 'build' / 'x86_64-unknown-linux-gnu' / 'llvm' / 'build'
37+
3638
PREBUILT_PATH: Path = WORKSPACE_PATH / 'prebuilts'
3739
RUST_PREBUILT_PATH: Path = PREBUILT_PATH / 'rust' / build_platform.prebuilt() / STAGE0_RUST_VERSION
3840
LLVM_PREBUILT_PATH: Path = PREBUILT_PATH / 'clang' / 'host' / build_platform.prebuilt() / CLANG_NAME

0 commit comments

Comments
 (0)