Skip to content

Commit 0113242

Browse files
daricheyfacebook-github-bot
authored andcommitted
Back out "Set included_dirs based on buck srcs"
Summary: This breaks handling of generated thrift sources. We need to think about how to handle all these cases in a more principled way. In the mean time, revert, since thrift is more common than the `core` use case this fixed. Original commit changeset: 25b598122c83 Original Phabricator Diff: D58479338 Reviewed By: davidbarsky, dtolnay Differential Revision: D58875911 fbshipit-source-id: 4b6d37cbfd0eeb03a1c42bd856475e91ee4fe87e
1 parent 36eb13c commit 0113242

File tree

2 files changed

+3
-54
lines changed

2 files changed

+3
-54
lines changed

integrations/rust-project/src/buck.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ pub(crate) fn to_json_project(
150150
}
151151
}
152152

153-
include_dirs.extend(info.src_dirs());
153+
if let Some(parent) = root_module.parent() {
154+
include_dirs.insert(parent.to_owned());
155+
}
154156

155157
let build = if info.in_workspace {
156158
let build = Build {

integrations/rust-project/src/target.rs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -249,25 +249,6 @@ impl TargetInfo {
249249

250250
cfg
251251
}
252-
253-
pub(crate) fn src_dirs(&self) -> Vec<PathBuf> {
254-
let mut all_src_dirs: Vec<&Path> = self.srcs.iter().filter_map(|p| p.parent()).collect();
255-
all_src_dirs.sort();
256-
257-
let mut uniq_dirs: Vec<PathBuf> = vec![];
258-
for src_dir in all_src_dirs {
259-
match uniq_dirs.last() {
260-
Some(last_dir) => {
261-
if !src_dir.starts_with(last_dir) {
262-
uniq_dirs.push(src_dir.to_owned());
263-
}
264-
}
265-
None => uniq_dirs.push(src_dir.to_owned()),
266-
}
267-
}
268-
269-
uniq_dirs
270-
}
271252
}
272253

273254
#[derive(Debug, Clone, Deserialize, PartialEq, Eq, Default)]
@@ -365,37 +346,3 @@ fn test_cfg() {
365346

366347
assert_eq!(info.cfg(), expected);
367348
}
368-
369-
#[test]
370-
fn test_src_dirs() {
371-
let info = TargetInfo {
372-
name: "bar".to_owned(),
373-
label: "bar".to_owned(),
374-
kind: Kind::Library,
375-
edition: None,
376-
srcs: vec![
377-
PathBuf::from("src/foo.rs"),
378-
PathBuf::from("src/bar/foo.rs"),
379-
PathBuf::from("other/blah.rs"),
380-
],
381-
mapped_srcs: FxHashMap::default(),
382-
crate_name: None,
383-
crate_dynamic: None,
384-
crate_root: None,
385-
deps: vec![],
386-
test_deps: vec![],
387-
named_deps: FxHashMap::default(),
388-
proc_macro: None,
389-
features: vec![],
390-
env: FxHashMap::default(),
391-
source_folder: PathBuf::from("/tmp"),
392-
project_relative_buildfile: PathBuf::from("bar/BUCK"),
393-
in_workspace: false,
394-
out_dir: None,
395-
rustc_flags: vec![],
396-
};
397-
398-
let expected: Vec<PathBuf> = vec![PathBuf::from("other"), PathBuf::from("src")];
399-
400-
assert_eq!(info.src_dirs(), expected);
401-
}

0 commit comments

Comments
 (0)