Преглед изворни кода

Resolve local distro in bwc tests more efficient (#80350)

This fixes #80320
Rene Groeschke пре 3 година
родитељ
комит
ad4694c4ad

+ 7 - 1
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java

@@ -65,7 +65,7 @@ public class InternalDistributionDownloadPlugin implements InternalPlugin {
      */
     private void registerInternalDistributionResolutions(NamedDomainObjectContainer<DistributionResolution> resolutions) {
         resolutions.register("localBuild", distributionResolution -> distributionResolution.setResolver((project, distribution) -> {
-            if (VersionProperties.getElasticsearch().equals(distribution.getVersion())) {
+            if (isCurrentVersion(distribution)) {
                 // non-external project, so depend on local build
                 return new ProjectBasedDistributionDependency(
                     config -> projectDependency(project, distributionProjectPath(distribution), config)
@@ -95,6 +95,12 @@ public class InternalDistributionDownloadPlugin implements InternalPlugin {
         }));
     }
 
+    private boolean isCurrentVersion(ElasticsearchDistribution distribution) {
+        Version currentVersionNumber = Version.fromString(VersionProperties.getElasticsearch());
+        Version parsedDistVersionNumber = Version.fromString(distribution.getVersion());
+        return currentVersionNumber.equals(parsedDistVersionNumber);
+    }
+
     /**
      * Will be removed once this is backported to all unreleased branches.
      */