Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Mar 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/modules/gradle.rs
Expand Up @@ -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())
}
Expand Down Expand Up @@ -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())
);
}
}