mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 08:07:49 +00:00
fix(maven): keep edited nested test launchers when refreshing defaults
This commit is contained in:
@@ -252,12 +252,10 @@ pub fn prepare_maven_run(config: &mut RunConfig, root: &Path, s: &Settings) {
|
||||
let id = id.strip_prefix("workspace:").and_then(|id| id.split_once(':')).map_or(id, |(_, id)| id);
|
||||
let source = ide_run::detect(root)
|
||||
.into_iter()
|
||||
.filter(|base| {
|
||||
base.kind == "maven"
|
||||
&& (id == base.id || id.starts_with(&format!("{}:", base.id)))
|
||||
&& !saved.iter().any(|user| user.id == base.id)
|
||||
})
|
||||
.max_by_key(|base| base.id.len());
|
||||
.chain(saved.iter().cloned())
|
||||
.filter(|base| base.kind == "maven" && (id == base.id || id.starts_with(&format!("{}:", base.id))))
|
||||
.max_by_key(|base| base.id.len())
|
||||
.filter(|base| !saved.iter().any(|user| user.id == base.id));
|
||||
if let Some(base) = source.filter(|_| config.extras.params.is_empty()) {
|
||||
if let Some(prefix) = maven_settings_prefixes(&config.args)
|
||||
.into_iter()
|
||||
|
||||
@@ -357,6 +357,17 @@ fn maven_launch_refreshes_legacy_defaults_but_keeps_user_overrides() {
|
||||
prepare_maven_run(&mut explicit, tmp.path(), &s);
|
||||
assert_eq!(explicit.command, "/custom/mvn");
|
||||
assert_eq!(explicit.args, ["-s", "own-settings.xml", "-Dmaven.repo.local=own-repo", "test"]);
|
||||
|
||||
std::fs::create_dir(tmp.path().join("child")).unwrap();
|
||||
std::fs::write(tmp.path().join("child/pom.xml"), "<project/>").unwrap();
|
||||
let mut nested = explicit.clone();
|
||||
nested.id = "maven:test:child".into();
|
||||
nested.detected = false;
|
||||
ide_run::save_user_configs(tmp.path(), &[nested]).unwrap();
|
||||
explicit.id = "context:maven:test:child:src/test/java/ExampleTest.java".into();
|
||||
prepare_maven_run(&mut explicit, tmp.path(), &s);
|
||||
assert_eq!(explicit.command, "/custom/mvn", "an edited child must not fall back to the parent's defaults");
|
||||
assert_eq!(explicit.args, ["-s", "own-settings.xml", "-Dmaven.repo.local=own-repo", "test"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user