Skip to content

Commit 77b79a2

Browse files
committed
fix(Gradle): Update methods on GradleProviderInfo to support calling hasPactsFromPactBroker without options #1586
1 parent 35d0ca0 commit 77b79a2

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
@@ -142,8 +142,10 @@ subprojects {
142142
publications {
143143
mavenPublication(MavenPublication) {
144144
from components.java
145-
artifact sourceJar
146-
artifact javadocJar
145+
if (!project.hasProperty('isGradleRelease')) {
146+
artifact sourceJar
147+
artifact javadocJar
148+
}
147149
pom {
148150
name = project.name
149151
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
@@ -125,8 +125,9 @@ open class GradleProviderInfo(override var name: String, val project: Project) :
125125
return fromPactBroker
126126
}
127127

128+
@JvmOverloads
128129
@Deprecated(message = "hasPactsFromPactBroker has been deprecated in favor of fromPactBroker")
129-
fun hasPactsFromPactBroker(options: Map<String, Any>, pactBrokerUrl: String): List<ConsumerInfo> {
130+
fun hasPactsFromPactBroker(options: Map<String, Any> = mapOf(), pactBrokerUrl: String): List<ConsumerInfo> {
130131
return try {
131132
provider.hasPactsFromPactBroker(options, pactBrokerUrl)
132133
} catch (e: Exception) {
@@ -158,9 +159,10 @@ open class GradleProviderInfo(override var name: String, val project: Project) :
158159
return fromPactBroker
159160
}
160161

162+
@JvmOverloads
161163
@Deprecated(message = "hasPactsFromPactBroker has been deprecated in favor of fromPactBroker")
162164
fun hasPactsFromPactBrokerWithSelectors(
163-
options: Map<String, Any?>,
165+
options: Map<String, Any?> = mapOf(),
164166
pactBrokerUrl: String,
165167
selectors: List<ConsumerVersionSelector>
166168
): List<ConsumerInfo> {
@@ -217,7 +219,7 @@ open class GradleProviderInfo(override var name: String, val project: Project) :
217219
|For instance:
218220
|
219221
|fromPactBroker {
220-
| selectors = latestTags('test')
222+
| withSelectors { latestTag('test') }
221223
| enablePending = true
222224
| providerTags = ['master']
223225
|}

0 commit comments

Comments
 (0)