Skip to content

Commit

Permalink
Updated build.gradle to resolve ANTLR dependency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Husain committed Aug 2, 2023
1 parent 553e1ae commit 8f81d67
Showing 1 changed file with 31 additions and 45 deletions.
76 changes: 31 additions & 45 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
id 'io.freefair.lombok' version '8.1.0'
id 'org.flywaydb.flyway' version '9.21.1'
id "info.solidsoft.pitest" version '1.9.11'
id "au.com.dius.pact" version '4.3.4'
id "au.com.dius.pact" version '4.3.16'
id 'net.serenity-bdd.serenity-gradle-plugin' version '3.2.0'
}

Expand Down Expand Up @@ -125,10 +125,6 @@ pmd {
ruleSetFiles = files("config/pmd/ruleset.xml")
}

project.ext {
pacticipantVersion = getCheckedOutGitCommitHash()
}

static def getCheckedOutGitCommitHash() {
'git rev-parse --verify --short HEAD'.execute().text.trim()
}
Expand Down Expand Up @@ -255,12 +251,28 @@ def versions = [
springSecurity : '6.1.2',
testcontainers : '1.18.3',
wiremock : '2.35.0',
pactVersion : '4.3.4',
pactVersion : '4.3.15',
serenity : '3.1.20',
]

ext['jackson.version'] = '2.14.1'


rootProject.tasks.named("processTestResources") {
duplicatesStrategy = 'include'
}

rootProject.tasks.named("processFunctionalTestResources") {
duplicatesStrategy = 'include'
}

rootProject.tasks.named("processIntegrationTestResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processContractTestResources") {
duplicatesStrategy = 'include'
}

dependencies {

implementation group: 'commons-io', name: 'commons-io', version: versions.commonsIo
Expand Down Expand Up @@ -318,57 +330,46 @@ dependencies {
functionalTestCompileOnly group: 'org.apiguardian', name: 'apiguardian-api', version: versions.apiGuardian
integrationTestCompileOnly group: 'org.apiguardian', name: 'apiguardian-api', version: versions.apiGuardian

//pact contract testing
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'junit5', version: versions.pactVersion
contractTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.7.12'
//pact contract testing
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'junit5', version: versions.pactVersion
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'junit', version: versions.pactVersion
contractTestRuntimeOnly(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit)
contractTestImplementation(group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit)

contractTestRuntimeOnly(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit)
contractTestImplementation(group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit)

contractTestImplementation sourceSets.main.runtimeClasspath
contractTestImplementation sourceSets.test.runtimeClasspath
contractTestImplementation sourceSets.main.runtimeClasspath
contractTestImplementation sourceSets.test.runtimeClasspath
}

mainClassName = 'uk.gov.hmcts.reform.ccd.ApplicationBootstrap'

task contract(type: Test, description: 'Runs the pact contract tests.', group: 'Verification') {
description = "Runs the consumer Pact tests"
useJUnitPlatform()
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
}

task runAndPublishConsumerPactTests(type: Test){
logger.lifecycle("Runs pact Tests")
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath

}

runAndPublishConsumerPactTests.dependsOn contract
runAndPublishConsumerPactTests.finalizedBy pactPublish
project.ext.pacticipantVersion = getCheckedOutGitCommitHash()

pact {
broker {
pactBrokerUrl = System.getenv("PACT_BROKER_FULL_URL") ?: 'http://localhost:80'
}
publish {
pactDirectory = 'pacts'
pactDirectory = 'build/pacts'
tags = [System.getenv("PACT_BRANCH_NAME") ?: 'Dev']
version = project.pacticipantVersion
}
}

task runProviderPactVerification(type: Test) {
logger.lifecycle("Runs provider pact Tests")
task contract(type: Test, description: 'Runs the pact contract tests.', group: 'Verification') {
description = "Runs the consumer Pact tests"
useJUnitPlatform()
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
systemProperty 'pact.verifier.publishResults', System.getProperty('pact.verifier.publishResults')
systemProperty 'pact.provider.version', project.pacticipantVersion
}

runProviderPactVerification.dependsOn contract
runProviderPactVerification.finalizedBy pactVerify

bootJar {
getArchiveFileName().set(provider {
'ccd-case-disposer.jar'
Expand All @@ -382,18 +383,3 @@ bootJar {
wrapper {
distributionType = Wrapper.DistributionType.ALL
}

rootProject.tasks.named("processTestResources") {
duplicatesStrategy = 'include'
}

rootProject.tasks.named("processFunctionalTestResources") {
duplicatesStrategy = 'include'
}

rootProject.tasks.named("processIntegrationTestResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processContractTestResources") {
duplicatesStrategy = 'include'
}

0 comments on commit 8f81d67

Please sign in to comment.