Skip to content

Commit eb10eaa

Browse files
authored
Merge pull request #22 from cdietrich/cd_issue2
make use of patternLayout instead of layout 'pattern' on gradle 5.0 and later to ensure compatibilty with gradle 6.0
2 parents 9b5f15c + d008401 commit eb10eaa

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/main/groovy/com/moowork/gradle/node/task/SetupTask.groovy

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,16 @@ class SetupTask
178178
def distUrl = this.config.distBaseUrl
179179
this.repo = this.project.repositories.ivy {
180180
url distUrl
181-
layout 'pattern', {
182-
artifact 'v[revision]/[artifact](-v[revision]-[classifier]).[ext]'
183-
ivy 'v[revision]/ivy.xml'
181+
if (BackwardsCompat.usePatternLayout()) {
182+
patternLayout {
183+
artifact 'v[revision]/[artifact](-v[revision]-[classifier]).[ext]'
184+
ivy 'v[revision]/ivy.xml'
185+
}
186+
} else {
187+
layout 'pattern', {
188+
artifact 'v[revision]/[artifact](-v[revision]-[classifier]).[ext]'
189+
ivy 'v[revision]/ivy.xml'
190+
}
184191
}
185192
if (BackwardsCompat.useMetadataSourcesRepository()) {
186193
metadataSources {

src/main/groovy/com/moowork/gradle/node/util/BackwardsCompat.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ package com.moowork.gradle.node.util;
33
import org.gradle.util.GradleVersion;
44

55
class BackwardsCompat {
6-
private static boolean IS_GRADLE_MIN_45 = GradleVersion.current().compareTo(GradleVersion.version("4.5"))>=0;
6+
private static boolean IS_GRADLE_MIN_45 = GradleVersion.current().compareTo(GradleVersion.version("4.5"))>=0;
7+
private static boolean IS_GRADLE_MIN_50 = GradleVersion.current().compareTo(GradleVersion.version("5.0"))>=0;
78

89
static boolean useMetadataSourcesRepository() {
910
return IS_GRADLE_MIN_45
1011
}
12+
13+
static boolean usePatternLayout() {
14+
return IS_GRADLE_MIN_50
15+
}
1116
}

0 commit comments

Comments
 (0)