Closed Bug 1445271 Opened 6 years ago Closed 6 years ago

Rust $(topsrcdir)/target directory not removed on "./mach clobber"

Categories

(Firefox Build System :: General, defect, P3)

3 Branch
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: ato, Assigned: mbrubeck)

References

Details

After central gained support for cargo workspaces, the $(topsrcdir)/target
directory is not removed when cleaning:

> % ./mach build testing/geckodriver
> % ./mach clobber
> % file target
> target: directory
This appears to be because `mach clobber` only clobbers the objdir, and now with workspaces, we have object files built outside of the objdir.

mbrubeck, can you fix things up so Cargo is building everything inside the objdir, or if we should have been doing that already, look into why that's not happening?
Blocks: 1381576
Flags: needinfo?(mbrubeck)
Priority: -- → P3
I can't reproduce this:

> $ ./mach build >/dev/null
> $ ./mach build testing/geckodriver/
>  0:00.16 /usr/bin/make -C /home/mbrubeck/src/mozilla-central/obj-stylo-debug -j8 -s backend
>  0:00.23 /usr/bin/make -j8 -s testing
>  0:00.30 /usr/bin/make -j8 -s testing/geckodriver
>  0:00.39 Your build was successful!
> $ file target
> target: cannot open `target' (No such file or directory)

`mach build` sets `$CARGO_TARGET_DIR` to point into the objdir, so it won't put anything in `$topsrcdir`.

However, running `cargo` directly (not through `mach build`) without setting this environment variable will place the `target` directory outside the objdir.  This was also true before bug 1381576, but the location of the `target` directory has changed.  It is now at the root of the workspace, rather than the root of the package being built.

As before, if you build with `cargo build` then you can clobber with `cargo clean`.
Assignee: nobody → mbrubeck
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(mbrubeck)
Resolution: --- → WORKSFORME
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.