1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-24 13:47:38 +00:00

fix(gradle): add support for unstable Gradle versions (#5021)

This commit is contained in:
Harsh Shandilya 2023-03-27 20:11:09 +05:30 committed by GitHub
parent 3bf3148e08
commit f7fe41f9c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,7 @@ fn parse_gradle_version_from_properties(wrapper_properties: &str) -> Option<Stri
.rsplit_once('/')?
.1
.strip_prefix("gradle-")?
.split_once('-')?
.rsplit_once('-')?
.0;
Some(version.to_string())
}
@ -217,4 +217,27 @@ zipStorePath=wrapper/dists
Some("7.5.1".to_string())
);
}
#[test]
fn test_format_wrapper_properties_unstable_versions() {
let input = |version: &str| {
format!(
"\
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\\://services.gradle.org/distributions/gradle-{version}-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
"
)
};
assert_eq!(
parse_gradle_version_from_properties(&input("8.1-rc-1")),
Some("8.1-rc-1".to_string())
);
assert_eq!(
parse_gradle_version_from_properties(&input("7.5.1-20220729132837+0000")),
Some("7.5.1-20220729132837+0000".to_string())
);
}
}