about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Pallant <jonathan.pallant@ferrous-systems.com>2025-01-06 11:02:30 +0000
committerJonathan Pallant <jonathan.pallant@ferrous-systems.com>2025-01-06 11:02:30 +0000
commitf7f2fa540f59384481d0cf1e2de799883219087f (patch)
treef1f9a2f329d05db794a73e5bde3d5d86859ac528
parentf9c16997dc016a3ef1456f56df2ab564a1c48cb2 (diff)
downloadrust-f7f2fa540f59384481d0cf1e2de799883219087f.tar.gz
rust-f7f2fa540f59384481d0cf1e2de799883219087f.zip
Ensure generate-copyright is executed from the project root.
-rw-r--r--src/bootstrap/src/core/build_steps/run.rs3
-rw-r--r--src/tools/generate-copyright/src/main.rs5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/run.rs b/src/bootstrap/src/core/build_steps/run.rs
index 0a6aea26359..1c2a8dbaf90 100644
--- a/src/bootstrap/src/core/build_steps/run.rs
+++ b/src/bootstrap/src/core/build_steps/run.rs
@@ -218,6 +218,9 @@ impl Step for GenerateCopyright {
         cmd.env("DEST_LIBSTD", &dest_libstd);
         cmd.env("OUT_DIR", &builder.out);
         cmd.env("CARGO", &builder.initial_cargo);
+        // it is important that generate-copyright runs from the root of the
+        // source tree, because it uses relative paths
+        cmd.current_dir(&builder.src);
         cmd.run(builder);
 
         vec![dest, dest_libstd]
diff --git a/src/tools/generate-copyright/src/main.rs b/src/tools/generate-copyright/src/main.rs
index f83d16d0cab..0a446ecff5b 100644
--- a/src/tools/generate-copyright/src/main.rs
+++ b/src/tools/generate-copyright/src/main.rs
@@ -8,7 +8,10 @@ mod cargo_metadata;
 
 /// The entry point to the binary.
 ///
-/// You should probably let `bootstrap` execute this program instead of running it directly.
+/// You should probably let `bootstrap` execute this program instead of running
+/// it directly. It assumes that the current working directory is the root of a
+/// Rust git repository checkout, and constructs a bunch of relative paths based
+/// on that assumption.
 ///
 /// Run `x.py run generate-copyright`
 fn main() -> Result<(), Error> {