Skip to content

Commit

Permalink
refactor: rename pact broker and support code modules for better JDK …
Browse files Browse the repository at this point in the history
…9 module support
  • Loading branch information
Ronald Holshausen committed May 3, 2020
1 parent beb8cbf commit 3ee6a45
Show file tree
Hide file tree
Showing 24 changed files with 29 additions and 59 deletions.
38 changes: 12 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.71'
id 'org.jmailen.kotlinter' version '2.3.2'
id 'io.gitlab.arturbosch.detekt' version '1.7.4'
id 'org.jetbrains.dokka' version '0.10.0'
id 'com.github.johnrengelman.shadow' version '5.0.0' apply false
id 'org.jetbrains.dokka' version '0.10.1'
id 'org.javamodularity.moduleplugin' version '1.6.0' apply false
}

import org.apache.commons.text.StringEscapeUtils
Expand All @@ -25,9 +25,6 @@ allprojects {
apply plugin: 'signing'
}

group = 'au.com.dius.pact'
version = '4.1.0'

repositories {
mavenLocal()
mavenCentral()
Expand All @@ -40,9 +37,7 @@ allprojects {

subprojects {

if (name in ['core', 'consumer', 'provider']) {
return
}
version = '4.1.0'

buildscript {
repositories {
Expand All @@ -56,21 +51,15 @@ subprojects {
groovyDoc
}


apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'codenarc'
apply plugin: 'jacoco'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.jmailen.kotlinter'
apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'org.jetbrains.dokka'

repositories {
mavenLocal()
mavenCentral()
jcenter()
}
apply plugin: 'groovy'
apply plugin: 'codenarc'
apply plugin: 'jacoco'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.jmailen.kotlinter'
apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'org.jetbrains.dokka'
apply plugin: "org.javamodularity.moduleplugin"

compileTestGroovy {
classpath = classpath.plus(files(compileTestKotlin.destinationDir))
Expand All @@ -92,17 +81,14 @@ subprojects {
}

task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
if (JavaVersion.current().java9Compatible) {
enabled = false
}
outputFormat = 'javadoc'
outputDirectory = "$buildDir/docs/dokkaJavadoc"
}

jar {
manifest {
attributes provider: 'gradle',
'Implementation-Title': project.name, 'Implementation-Version': version,
'Implementation-Title': project.name, 'Implementation-Version': archiveVersion,
'Implementation-Vendor': project.group, 'Implementation-Vendor-Id': project.group,
'Specification-Vendor': project.group,
'Specification-Title': project.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void evaluatePactVerifications(PactVerifications pactVerifications, Stat
final RequestResponsePact[] pact = { null };
possiblePactVerifications.forEach(pactVerification -> {
Optional<Method> possiblePactMethod = findPactMethod(pactVerification);
if (possiblePactMethod.isEmpty()) {
if (!possiblePactMethod.isPresent()) {
throw new UnsupportedOperationException("Could not find method with @Pact for the provider " + provider);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void evaluate() throws Throwable {
Map<String, Message> pacts;
if (StringUtils.isNoneEmpty(pactDef.fragment())) {
Optional<Method> possiblePactMethod = findPactMethod(pactDef);
if (possiblePactMethod.isEmpty()) {
if (!possiblePactMethod.isPresent()) {
base.evaluate();
return;
}
Expand Down Expand Up @@ -130,14 +130,14 @@ private void evaluatePactVerifications(PactVerifications pactVerifications, Stat
}

Optional<PactVerification> possiblePactVerification = findPactVerification(pactVerifications);
if (possiblePactVerification.isEmpty()) {
if (!possiblePactVerification.isPresent()) {
base.evaluate();
return;
}

PactVerification pactVerification = possiblePactVerification.get();
Optional<Method> possiblePactMethod = findPactMethod(pactVerification);
if (possiblePactMethod.isEmpty()) {
if (!possiblePactMethod.isPresent()) {
throw new UnsupportedOperationException("Could not find method with @Pact for the provider " + provider);
}

Expand Down
2 changes: 1 addition & 1 deletion core/matchers/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
api project(path: ":core:pact-jvm-core-model", configuration: 'default')
api project(path: ":core:pact-jvm-core-support", configuration: 'default')
api project(path: ":core:support", configuration: 'default')
compile "org.apache.commons:commons-lang3:${project.commonsLang3Version}"
compile 'com.googlecode.java-diff-utils:diffutils:1.3.0'
implementation 'xerces:xercesImpl:2.12.0'
Expand Down
4 changes: 2 additions & 2 deletions core/model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ artifacts {
}

dependencies {
api project(path: ":core:pact-jvm-core-support", configuration: 'default')
api project(path: ":core:pact-jvm-core-pact-broker", configuration: 'default')
api project(path: ":core:support", configuration: 'default')
api project(path: ":core:pactbroker", configuration: 'default')
compile 'com.github.zafarkhaja:java-semver:0.9.0'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'com.github.mifmif:generex:1.0.2'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
api project(path: ":core:pact-jvm-core-support", configuration: 'default')
api project(path: ":core:support", configuration: 'default')
compile "org.apache.commons:commons-lang3:$commonsLang3Version"
api "com.google.code.gson:gson:${project.gsonVersion}"
compile 'com.github.salomonbrys.kotson:kotson:2.5.0'
Expand Down
2 changes: 0 additions & 2 deletions core/support/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ plugins {
id 'antlr'
}

group = 'au.com.dius.pact.core.support'

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion provider/pact-jvm-provider-junit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
api project(path: ":core:pact-jvm-core-support", configuration: 'default'),
api project(path: ":core:support", configuration: 'default'),
project(path: ":provider:pact-jvm-provider", configuration: 'default')
compile "org.apache.httpcomponents:fluent-hc:${project.httpClientVersion}",
"org.apache.httpcomponents:httpclient:${project.httpClientVersion}",
Expand Down
2 changes: 1 addition & 1 deletion provider/pact-jvm-provider-junit5/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
api project(path: ":core:pact-jvm-core-support", configuration: 'default'),
api project(path: ":core:support", configuration: 'default'),
project(path: ":provider:pact-jvm-provider", configuration: 'default')
compile "org.junit.jupiter:junit-jupiter-api:${project.junit5Version}"
implementation "org.slf4j:slf4j-api:${project.slf4jVersion}"
Expand Down
4 changes: 2 additions & 2 deletions provider/pact-jvm-provider-maven/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def isWindows() {
task generatePom(type: GenerateMavenPom, dependsOn: [":provider:pact-jvm-provider:publishToMavenLocal",
':core:pact-jvm-core-model:publishToMavenLocal',
':core:pact-jvm-core-matchers:publishToMavenLocal',
':core:pact-jvm-core-pact-broker:publishToMavenLocal',
':core:pact-jvm-core-support:publishToMavenLocal']) {
':core:pactbroker:publishToMavenLocal',
':core:support:publishToMavenLocal']) {
destination = file("${buildDir}/poms/pom.xml")
pom = publishMavenPublicationPublicationToMavenLocal.publication.pom
pom.packaging = 'maven-plugin'
Expand Down
4 changes: 2 additions & 2 deletions provider/pact-jvm-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ plugins {

dependencies {
api project(path: ":core:pact-jvm-core-model", configuration: 'default')
api project(path: ":core:pact-jvm-core-pact-broker", configuration: 'default')
api project(path: ":core:pactbroker", configuration: 'default')
api project(path: ":core:pact-jvm-core-matchers", configuration: 'default')
api project(path: ":core:pact-jvm-core-support", configuration: 'default')
api project(path: ":core:support", configuration: 'default')
compile'commons-io:commons-io:2.5',
"org.fusesource.jansi:jansi:${project.jansiVersion}",
"org.apache.httpcomponents:httpclient:${project.httpClientVersion}"
Expand Down
8 changes: 3 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
rootProject.name = 'pact-jvm'
rootProject.name = 'au.com.dius.pact'

include 'core:pact-jvm-core-support'
include 'core:pact-jvm-core-pact-broker'
include 'core:support'
include 'core:pactbroker'
include 'core:pact-jvm-core-model'
include 'core:pact-jvm-core-matchers'

project(':core:pact-jvm-core-support').projectDir = file('core/support')
project(':core:pact-jvm-core-pact-broker').projectDir = file('core/pact-broker')
project(':core:pact-jvm-core-model').projectDir = file('core/model')
project(':core:pact-jvm-core-matchers').projectDir = file('core/matchers')

Expand Down

0 comments on commit 3ee6a45

Please sign in to comment.