From ea1344cdefc1124017ec9f3c5f2f8c696191224d Mon Sep 17 00:00:00 2001 From: jk1 Date: Mon, 24 Apr 2017 23:51:36 +0300 Subject: [PATCH] #26 gradle 3.5 compatibility --- README.md | 7 ++++++- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../TeamCityDependenciesPlugin.groovy | 4 ++-- .../processing/ArtifactRegexResolver.groovy | 5 ++++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e865623..b2a80e3 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,12 @@ The plugin makes use of default artifact cache, downloading each dependency only ###Simple example ```groovy -// Gradle 3.1+ +// Gradle 3.5+ +plugins { + id 'com.github.jk1.tcdeps' version '0.13' +} + +// Gradle 3.1-3.4 plugins { id 'com.github.jk1.tcdeps' version '0.12' } diff --git a/build.gradle b/build.gradle index 2597d0f..76ce4f6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins{ group = 'com.github.jk1' description = 'TeamCity dependencies plugin resolves project dependencies via local TeamCity server' -version = '0.12' +version = '0.13' sourceCompatibility = 1.6 targetCompatibility = 1.6 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index eebf4a7..b3170fc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip diff --git a/src/main/groovy/com.github.jk1.tcdeps/TeamCityDependenciesPlugin.groovy b/src/main/groovy/com.github.jk1.tcdeps/TeamCityDependenciesPlugin.groovy index d5e4c62..02088fe 100755 --- a/src/main/groovy/com.github.jk1.tcdeps/TeamCityDependenciesPlugin.groovy +++ b/src/main/groovy/com.github.jk1.tcdeps/TeamCityDependenciesPlugin.groovy @@ -41,8 +41,8 @@ class TeamCityDependenciesPlugin implements Plugin { def current = GradleVersion.current().version.split("\\.") def major = current[0].toInteger() def minor = current[1].split("-")[0].toInteger() - if (major < 3 || (major == 3 && minor < 1)) { - throw new GradleException("TeamCity dependencies plugin requires Gradle 3.1. ${GradleVersion.current()} detected.") + if (major < 3 || (major == 3 && minor < 5)) { + throw new GradleException("TeamCity dependencies plugin requires Gradle 3.5. ${GradleVersion.current()} detected.") } } diff --git a/src/main/groovy/com.github.jk1.tcdeps/processing/ArtifactRegexResolver.groovy b/src/main/groovy/com.github.jk1.tcdeps/processing/ArtifactRegexResolver.groovy index 81519b1..dbe2fe5 100755 --- a/src/main/groovy/com.github.jk1.tcdeps/processing/ArtifactRegexResolver.groovy +++ b/src/main/groovy/com.github.jk1.tcdeps/processing/ArtifactRegexResolver.groovy @@ -8,8 +8,10 @@ import org.gradle.api.artifacts.ModuleDependency import org.gradle.api.artifacts.result.ComponentArtifactsResult import org.gradle.api.artifacts.result.ResolvedArtifactResult import org.gradle.api.artifacts.result.ResolvedDependencyResult +import org.gradle.api.internal.artifacts.DefaultImmutableModuleIdentifierFactory import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.DisconnectedDescriptorParseContext import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.DownloadedIvyModuleDescriptorParser +import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.IvyModuleDescriptorConverter import org.gradle.internal.component.external.descriptor.Artifact import org.gradle.ivy.IvyDescriptorArtifact import org.gradle.ivy.IvyModule @@ -98,7 +100,8 @@ class ArtifactRegexResolver { private Set readArtifactsSet(File ivyFile, Project project) { project.logger.debug("Parsing ivy file [$ivyFile]") - new DownloadedIvyModuleDescriptorParser() + def factory = new DefaultImmutableModuleIdentifierFactory() + new DownloadedIvyModuleDescriptorParser(new IvyModuleDescriptorConverter(factory), factory) .parseMetaData(new DisconnectedDescriptorParseContext(), ivyFile) .descriptor .artifacts