Skip to content

Commit d7ec724

Browse files
committed
fix(Gradle): Update methods on GradleProviderInfo to support calling hasPactsFromPactBroker without options #1586
1 parent 9e98f0b commit d7ec724

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ subprojects {
146146
publications {
147147
mavenPublication(MavenPublication) {
148148
from components.java
149-
artifact sourceJar
150-
artifact javadocJar
149+
if (!project.hasProperty('isGradleRelease')) {
150+
artifact sourceJar
151+
artifact javadocJar
152+
}
151153
pom {
152154
name = project.name
153155
description = StringEscapeUtils.escapeXml11(new File(projectDir, 'README.md').text)

provider/gradle/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,7 @@ pact {
693693
}
694694
```
695695

696-
**NOTE: Currently the pacts are fetched from the broker during the configuration phase of the build. This means that
697-
if the broker is not available, you will not be able to run any Gradle tasks.** This should be fixed in a forth coming
698-
release.
699-
700-
In the mean time, to only load the pacts when running the validate task, you can do something like:
696+
To only load the pacts when running the validate task, you can do something like:
701697

702698
```groovy
703699
pact {

provider/gradle/src/main/kotlin/au/com/dius/pact/provider/gradle/GradleProviderInfo.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ open class GradleProviderInfo(override var name: String, val project: Project) :
8585
return fromPactBroker
8686
}
8787

88+
@JvmOverloads
8889
@Deprecated(message = "hasPactsFromPactBroker has been deprecated in favor of fromPactBroker")
89-
fun hasPactsFromPactBroker(options: Map<String, Any>, pactBrokerUrl: String): List<ConsumerInfo> {
90+
fun hasPactsFromPactBroker(options: Map<String, Any> = mapOf(), pactBrokerUrl: String): List<ConsumerInfo> {
9091
return try {
9192
provider.hasPactsFromPactBroker(options, pactBrokerUrl)
9293
} catch (e: Exception) {
@@ -118,9 +119,10 @@ open class GradleProviderInfo(override var name: String, val project: Project) :
118119
return fromPactBroker
119120
}
120121

122+
@JvmOverloads
121123
@Deprecated(message = "hasPactsFromPactBroker has been deprecated in favor of fromPactBroker")
122124
fun hasPactsFromPactBrokerWithSelectors(
123-
options: Map<String, Any?>,
125+
options: Map<String, Any?> = mapOf(),
124126
pactBrokerUrl: String,
125127
selectors: List<ConsumerVersionSelector>
126128
): List<ConsumerInfo> {
@@ -177,7 +179,7 @@ open class GradleProviderInfo(override var name: String, val project: Project) :
177179
|For instance:
178180
|
179181
|fromPactBroker {
180-
| selectors = latestTags('test')
182+
| withSelectors { latestTag('test') }
181183
| enablePending = true
182184
| providerTags = ['master']
183185
|}

0 commit comments

Comments
 (0)