Skip to content

Commit 113c3d6

Browse files
Make build_crate use root_out_dir as its temp.
1 parent 946ac7d commit 113c3d6

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

script/build_crate.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2025 The Brave Authors. All rights reserved.
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
4+
# You can obtain one at https://mozilla.org/MPL/2.0/.
5+
6+
import argparse
7+
import os
8+
import platform
9+
import subprocess
10+
11+
parser = argparse.ArgumentParser(
12+
description='Build crates in //brave/tools/crates/config.gni')
13+
parser.add_argument('--temp_dir_path', required=True)
14+
args, cargo_args = parser.parse_known_args()
15+
env = os.environ.copy()
16+
if platform.system() == "Windows":
17+
env['TEMP'] = env['TMP'] = args.temp_dir_path
18+
else:
19+
env["TMPDIR"] = args.temp_dir_path
20+
subprocess.check_call(cargo_args, env=env)

tools/crates/build_crate.gni

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ template("build_crate") {
1515

1616
forward_variables_from(invoker, [ "deps" ])
1717

18-
script = "//build/gn_run_binary.py"
18+
script = "//brave/script/build_crate.py"
1919

2020
cargo_exe = "//third_party/rust-toolchain/bin/cargo"
2121
if (host_os == "win") {
@@ -36,6 +36,8 @@ template("build_crate") {
3636
# --frozen (--locked + --offline)
3737
# when running `cargo build`.
3838
args = [
39+
"--temp_dir_path",
40+
rebase_path(root_out_dir),
3941
rebase_path(cargo_exe),
4042
"build",
4143
"--quiet",

0 commit comments

Comments
 (0)