Skip to content

Commit

Permalink
Replace VersionNumber usage with GradleVersion
Browse files Browse the repository at this point in the history
VersionNumber is deprecated and to be removed in Gradle 8.

Fixes #24
  • Loading branch information
ejona86 committed Sep 7, 2022
1 parent a486e18 commit c91df06
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/main/java/com/google/gradle/osdetector/OsDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.file.RegularFile;
import org.gradle.api.provider.ProviderFactory;
import org.gradle.util.VersionNumber;
import org.gradle.util.GradleVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -82,7 +82,7 @@ public synchronized void setClassifierWithLikes(List<String> classifierWithLikes

private synchronized Impl getImpl() {
if (impl == null) {
if (compareGradleVersion(project, "6.5") >= 0) {
if (GradleVersion.current().compareTo(GradleVersion.version("6.5")) >= 0) {
impl = new Impl(classifierWithLikes, new ConfigurationTimeSafeSystemPropertyOperations(),
new ConfigurationTimeSafeFileOperations());
} else {
Expand All @@ -92,11 +92,6 @@ private synchronized Impl getImpl() {
return impl;
}

private static int compareGradleVersion(Project project, String target) {
return VersionNumber.parse(project.getGradle().getGradleVersion()).compareTo(
VersionNumber.parse(target));
}

/**
* Accessor to information about the current OS release.
*/
Expand Down

0 comments on commit c91df06

Please sign in to comment.