Skip to content

Commit

Permalink
fix(Gradle): Update methods on GradleProviderInfo to support calling …
Browse files Browse the repository at this point in the history
…hasPactsFromPactBroker without options #1586
  • Loading branch information
uglyog committed Aug 2, 2022
1 parent 35d0ca0 commit 77b79a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ subprojects {
publications {
mavenPublication(MavenPublication) {
from components.java
artifact sourceJar
artifact javadocJar
if (!project.hasProperty('isGradleRelease')) {
artifact sourceJar
artifact javadocJar
}
pom {
name = project.name
description = StringEscapeUtils.escapeXml11(new File(projectDir, 'README.md').text)
Expand Down
6 changes: 1 addition & 5 deletions provider/gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -693,11 +693,7 @@ pact {
}
```

**NOTE: Currently the pacts are fetched from the broker during the configuration phase of the build. This means that
if the broker is not available, you will not be able to run any Gradle tasks.** This should be fixed in a forth coming
release.

In the mean time, to only load the pacts when running the validate task, you can do something like:
To only load the pacts when running the validate task, you can do something like:

```groovy
pact {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ open class GradleProviderInfo(override var name: String, val project: Project) :
return fromPactBroker
}

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

@JvmOverloads
@Deprecated(message = "hasPactsFromPactBroker has been deprecated in favor of fromPactBroker")
fun hasPactsFromPactBrokerWithSelectors(
options: Map<String, Any?>,
options: Map<String, Any?> = mapOf(),
pactBrokerUrl: String,
selectors: List<ConsumerVersionSelector>
): List<ConsumerInfo> {
Expand Down Expand Up @@ -217,7 +219,7 @@ open class GradleProviderInfo(override var name: String, val project: Project) :
|For instance:
|
|fromPactBroker {
| selectors = latestTags('test')
| withSelectors { latestTag('test') }
| enablePending = true
| providerTags = ['master']
|}
Expand Down

0 comments on commit 77b79a2

Please sign in to comment.