Skip to content

Commit deed665

Browse files
monkey666-crchenrun666
andauthored
Revert "fix: debug source lookup for Bazel Java workspaces (#25)" (#26)
This reverts commit 7d4d1a6. Co-authored-by: chenrun666 <7417245+chenrun666@user.noreply.gitee.com>
1 parent 7d4d1a6 commit deed665

14 files changed

Lines changed: 24 additions & 1345 deletions

File tree

bazel-jdt-bridge/crates/bazel-graph/src/classpath.rs

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,98 +1978,4 @@ mod tests {
19781978
"java_library output_jars should NOT contain dep jars"
19791979
);
19801980
}
1981-
1982-
#[test]
1983-
fn test_processed_jar_skipped_in_favor_of_runtime_jar() {
1984-
let tmp = tempfile::tempdir().unwrap();
1985-
let workspace = tmp.path().join("workspace");
1986-
let jar_dir = workspace.join("external/maven/guava/33.4.0-jre");
1987-
std::fs::create_dir_all(&jar_dir).unwrap();
1988-
1989-
let processed_jar = jar_dir.join("processed_guava-33.4.0-jre.jar");
1990-
let full_jar = jar_dir.join("guava-33.4.0-jre.jar");
1991-
let source_jar = jar_dir.join("guava-33.4.0-jre-sources.jar");
1992-
std::fs::write(&processed_jar, [0u8; 2048]).unwrap();
1993-
std::fs::write(&full_jar, [0u8; 2048]).unwrap();
1994-
std::fs::write(&source_jar, [0u8; 2048]).unwrap();
1995-
1996-
let processed_path = processed_jar.to_string_lossy().into_owned();
1997-
let full_path = full_jar.to_string_lossy().into_owned();
1998-
let source_path = source_jar.to_string_lossy().into_owned();
1999-
2000-
let mut graph = DependencyGraph::new();
2001-
let results = vec![
2002-
TargetIdeInfo {
2003-
label: "//app:app".to_string(),
2004-
kind: "java_library".to_string(),
2005-
build_file: None,
2006-
java_info: Some(JavaIdeInfo {
2007-
jars: vec![JarInfo {
2008-
jar: ArtifactLocation {
2009-
absolute_path: Some("/workspace/app.jar".to_string()),
2010-
..Default::default()
2011-
},
2012-
..Default::default()
2013-
}],
2014-
..Default::default()
2015-
}),
2016-
deps: vec!["@maven//:guava".to_string()],
2017-
runtime_deps: Vec::new(),
2018-
exports: Vec::new(),
2019-
},
2020-
TargetIdeInfo {
2021-
label: "@maven//:guava".to_string(),
2022-
kind: "java_import".to_string(),
2023-
build_file: None,
2024-
java_info: Some(JavaIdeInfo {
2025-
jars: vec![],
2026-
compile_jars: vec![ArtifactLocation {
2027-
absolute_path: Some(processed_path.clone()),
2028-
..Default::default()
2029-
}],
2030-
runtime_jars: vec![ArtifactLocation {
2031-
absolute_path: Some(full_path.clone()),
2032-
..Default::default()
2033-
}],
2034-
source_jars: vec![ArtifactLocation {
2035-
absolute_path: Some(source_path.clone()),
2036-
..Default::default()
2037-
}],
2038-
..Default::default()
2039-
}),
2040-
deps: vec![],
2041-
runtime_deps: Vec::new(),
2042-
exports: Vec::new(),
2043-
},
2044-
];
2045-
2046-
graph.populate_from_aspects(&results, &workspace);
2047-
2048-
let cp = ComputedClasspath::compute_for(&graph, "//app:app", TargetKind::JavaLibrary, None)
2049-
.unwrap();
2050-
2051-
let guava_entry = cp
2052-
.entries
2053-
.iter()
2054-
.find(|e| e.entry_type == ClasspathEntryType::Library && (e.path.contains("guava")));
2055-
2056-
assert!(guava_entry.is_some(), "Expected LIB entry for guava");
2057-
2058-
let entry = guava_entry.unwrap();
2059-
assert!(
2060-
!entry.path.contains("processed_"),
2061-
"LIB entry should reference the real JAR, not processed_ header JAR. Got: {}",
2062-
entry.path
2063-
);
2064-
assert!(
2065-
entry.path.contains("guava-33.4.0-jre.jar"),
2066-
"LIB entry should reference the full/runtime JAR. Got: {}",
2067-
entry.path
2068-
);
2069-
assert_eq!(
2070-
entry.source_attachment_path.as_deref(),
2071-
Some(source_path.as_str()),
2072-
"Source attachment should point to the sources JAR"
2073-
);
2074-
}
20751981
}

0 commit comments

Comments
 (0)