Skip to content

Commit 35ab4cb

Browse files
maciektrDelevoXDG
andauthored
Pass Scarb no proc macros flags to subprocesses. (#2230)
Signed-off-by: maciektr <[email protected]> Co-authored-by: Maksim Zdobnikau <[email protected]>
1 parent bd0618e commit 35ab4cb

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

scarb/src/subcommands.rs

+10
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ pub fn get_env_vars(
3232
"SCARB_UI_VERBOSITY".into(),
3333
config.ui().verbosity().to_string().into(),
3434
),
35+
(
36+
"SCARB_NO_PROC_MACROS".into(),
37+
(!config.proc_macro_repository().load_proc_macros())
38+
.to_string()
39+
.into(),
40+
),
41+
(
42+
"SCARB_NO_PREBUILT_PROC_MACROS".into(),
43+
(!config.load_prebuilt_proc_macros()).to_string().into(),
44+
),
3545
(SCARB_ENV.into(), config.app_exe()?.into()),
3646
];
3747
if let Some(target_dir) = target_dir {

scarb/tests/subcommand.rs

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ fn env_variables_are_passed() {
7070
SCARB_PROFILE
7171
SCARB_MANIFEST_PATH
7272
SCARB_UI_VERBOSITY
73+
SCARB_NO_PROC_MACROS
74+
SCARB_NO_PREBUILT_PROC_MACROS
7375
)
7476
for v in "${required[@]}"; do
7577
if test -z "${!v}"

website/docs/writing-extensions/subcommands.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ Any additional arguments on the command line after `${command}` will be forwarde
1616

1717
Additionally, Scarb passes more contextual information via environment variables:
1818

19-
| Environment variable | Description |
20-
| --------------------- | ------------------------------------------------------------------------------------------ |
21-
| `SCARB` | Path to Scarb executable. |
22-
| `PATH` | System `$PATH` but augmented with `bin` directory in Scarb's [local data directory][dirs]. |
23-
| `SCARB_CACHE` | Path to Scarb's [cache][dirs] directory. |
24-
| `SCARB_CONFIG` | Path to Scarb's [config][dirs] directory. |
25-
| `SCARB_TARGET_DIR` | Path to the current target directory. |
26-
| `SCARB_PROFILE` | Name of the current profile. |
27-
| `SCARB_MANIFEST_PATH` | Absolute path to current `Scarb.toml`. |
28-
| `SCARB_UI_VERBOSITY` | Scarb's messages verbosity, possible values: `quiet`, `no-warnings`, `normal`, `verbose`. |
29-
| `SCARB_LOG` | Scarb's logger directives, follows [`tracing`'s `EnvFilter` syntax][tracing-env-filter]. |
19+
| Environment variable | Description |
20+
| ------------------------------- | ------------------------------------------------------------------------------------------------------- |
21+
| `SCARB` | Path to Scarb executable. |
22+
| `PATH` | System `$PATH` but augmented with `bin` directory in Scarb's [local data directory][dirs]. |
23+
| `SCARB_CACHE` | Path to Scarb's [cache][dirs] directory. |
24+
| `SCARB_CONFIG` | Path to Scarb's [config][dirs] directory. |
25+
| `SCARB_TARGET_DIR` | Path to the current target directory. |
26+
| `SCARB_PROFILE` | Name of the current profile. |
27+
| `SCARB_MANIFEST_PATH` | Absolute path to current `Scarb.toml`. |
28+
| `SCARB_UI_VERBOSITY` | Scarb's messages verbosity, possible values: `quiet`, `no-warnings`, `normal`, `verbose`. |
29+
| `SCARB_LOG` | Scarb's logger directives, follows [`tracing`'s `EnvFilter` syntax][tracing-env-filter]. |
30+
| `SCARB_NO_PROC_MACROS` | If enabled, Scarb will not allow running any procedural macros. |
31+
| `SCARB_NO_PREBUILT_PROC_MACROS` | If enabled, Scarb will not load any prebuilt procedural macros and will build them from source instead. |
3032

3133
## Implementation recommendations
3234

0 commit comments

Comments
 (0)