Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion integrations/rust-project/src/buck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub(crate) fn to_project_json(
include_all_buildfiles: bool,
extra_cfgs: &[String],
buck: &Buck,
rustc_target: Option<&String>,
) -> Result<ProjectJson, anyhow::Error> {
let project_root = buck.resolve_project_root()?;

Expand Down Expand Up @@ -220,7 +221,7 @@ pub(crate) fn to_project_json(
build,
is_proc_macro: info.proc_macro.unwrap_or(false),
proc_macro_dylib_path,
target: None,
target: rustc_target.cloned(),
};
crates.push(crate_info);
}
Expand Down
9 changes: 9 additions & 0 deletions integrations/rust-project/src/cli/develop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub(crate) struct Develop {
pub(crate) check_cycles: bool,
pub(crate) invoked_by_ra: bool,
pub(crate) include_all_buildfiles: bool,
pub(crate) rustc_target: Option<String>,
}

pub(crate) struct OutputCfg {
Expand Down Expand Up @@ -71,6 +72,7 @@ impl Develop {
buck2_command,
include_all_buildfiles,
max_extra_targets,
rustc_target,
..
} = command
{
Expand All @@ -97,6 +99,7 @@ impl Develop {
check_cycles,
invoked_by_ra: false,
include_all_buildfiles,
rustc_target,
};
let max_extra_targets = max_extra_targets.unwrap_or(DEFAULT_EXTRA_TARGETS);
let out = OutputCfg {
Expand All @@ -121,6 +124,7 @@ impl Develop {
buck2_command,
max_extra_targets,
mode,
rustc_target,
..
} = command
{
Expand Down Expand Up @@ -148,6 +152,7 @@ impl Develop {
check_cycles: false,
invoked_by_ra: true,
include_all_buildfiles: false,
rustc_target,
};
let max_extra_targets = max_extra_targets.unwrap_or(DEFAULT_EXTRA_TARGETS);
let out = OutputCfg {
Expand Down Expand Up @@ -280,6 +285,7 @@ impl Develop {
buck,
check_cycles,
include_all_buildfiles,
rustc_target,
..
} = self;

Expand Down Expand Up @@ -314,6 +320,7 @@ impl Develop {
*check_cycles,
*include_all_buildfiles,
extra_cfgs,
rustc_target.as_ref(),
)
}

Expand Down Expand Up @@ -351,6 +358,7 @@ pub(crate) fn develop_with_sysroot(
check_cycles: bool,
include_all_buildfiles: bool,
extra_cfgs: &[String],
rustc_target: Option<&String>,
) -> Result<ProjectJson, anyhow::Error> {
info!(kind = "progress", "building generated code");
let expanded_and_resolved = buck.expand_and_resolve(&targets, exclude_workspaces)?;
Expand All @@ -368,6 +376,7 @@ pub(crate) fn develop_with_sysroot(
include_all_buildfiles,
extra_cfgs,
buck,
rustc_target,
)?;

Ok(rust_project)
Expand Down
6 changes: 6 additions & 0 deletions integrations/rust-project/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ enum Command {
/// Include a `build` section for every crate, including dependencies. Otherwise, `build` is only included for crates in the workspace.
#[clap(long)]
include_all_buildfiles: bool,

#[clap(long)]
rustc_target: Option<String>,
},
/// `DevelopJson` is a more limited, stripped down [`Command::Develop`].
///
Expand Down Expand Up @@ -151,6 +154,9 @@ enum Command {
#[clap(long, default_value = "50", env = "RUST_PROJECT_EXTRA_TARGETS")]
max_extra_targets: Option<usize>,

#[clap(long)]
rustc_target: Option<String>,

args: JsonArguments,
},
/// Build the saved file's owning target. This is meant to be used by IDEs to provide diagnostics on save.
Expand Down
3 changes: 2 additions & 1 deletion integrations/rust-project/src/sysroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ pub(crate) fn resolve_buckconfig_sysroot(
true,
false,
false,
&[], // sysroot doesn't get any extra cfgs
&[], // sysroot doesn't get any extra cfgs
None, // sysroot doesn't get any extra cfgs
)?;
for krate in &mut sysroot_project.crates {
if let Some(display_name) = &mut krate.display_name {
Expand Down
Loading