From e924d807c385d32e49e0778cae0026d37af2a619 Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Wed, 10 Aug 2022 16:17:49 +1000 Subject: [PATCH] fix: allways apply the plugin-publish plugin to the Gradle plugin project #1588 --- build.gradle | 92 ++++++++++++++++++++---------------- provider/gradle/build.gradle | 34 ++++++------- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/build.gradle b/build.gradle index 9302b25493..f10d2700a5 100644 --- a/build.gradle +++ b/build.gradle @@ -55,11 +55,16 @@ subprojects { apply plugin: 'jacoco' apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'io.gitlab.arturbosch.detekt' - if (System.env.TRAVIS != 'true') { + if (System.env.CI != 'true') { apply plugin: 'org.jetbrains.dokka' } //apply plugin: "org.javamodularity.moduleplugin" + dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" + } + compileTestGroovy { classpath = classpath.plus(files(compileTestKotlin.destinationDir)) dependsOn compileTestKotlin @@ -101,11 +106,13 @@ subprojects { if (System.env.CI != 'true') { task javadocJar(type: Jar, dependsOn: [javadoc, groovydoc, dokkaJavadoc]) { archiveClassifier = 'javadoc' + duplicatesStrategy = 'exclude' from javadoc.destinationDir, groovydoc.destinationDir, dokkaJavadoc.outputDirectory } } else { task javadocJar(type: Jar, dependsOn: [javadoc, groovydoc]) { archiveClassifier = 'javadoc' + duplicatesStrategy = 'exclude' from javadoc.destinationDir, groovydoc.destinationDir } } @@ -125,7 +132,7 @@ subprojects { showExceptions true showStackTraces true showStandardStreams false - events "passed", "skipped", "failed" //, "standardOut", "standardError" + events "passed", "skipped", "failed" } } else { // Show test results. @@ -138,60 +145,61 @@ subprojects { systemProperty 'pact_do_not_track', 'true' } - publishing { - publications { - mavenPublication(MavenPublication) { - from components.java - if (!project.hasProperty('isGradleRelease')) { + // Gradle plugin plugin will automatically add these + if (name != 'gradle') { + publishing { + publications { + mavenPublication(MavenPublication) { + from components.java artifact sourceJar artifact javadocJar - } - pom { - name = project.name - description = StringEscapeUtils.escapeXml11(new File(projectDir, 'README.md').text) - url = 'https://github.com/DiUS/pact-jvm' - licenses { - license { - name = 'Apache 2' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - scm { - url = 'https://github.com/DiUS/pact-jvm' - connection = 'https://github.com/DiUS/pact-jvm.git' - } - developers { - developer { - id = 'thetrav' - name = 'Travis Dixon' - email = 'the.trav@gmail.com' + pom { + name = project.name + description = StringEscapeUtils.escapeXml11(new File(projectDir, 'README.md').text) + url = 'https://github.com/DiUS/pact-jvm' + licenses { + license { + name = 'Apache 2' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'repo' + } } - developer { - id = 'rholshausen' - name = 'Ronald Holshausen' - email = 'rholshausen@dius.com.au' + scm { + url = 'https://github.com/pact-foundation/pact-jvm' + connection = 'https://github.com/pact-foundation/pact-jvm.git' + } + + developers { + developer { + id = 'thetrav' + name = 'Travis Dixon' + email = 'the.trav@gmail.com' + } + developer { + id = 'rholshausen' + name = 'Ronald Holshausen' + email = 'rholshausen@dius.com.au' + } } } } } - } - repositories { - maven { - url "https://oss.sonatype.org/service/local/staging/deploy/maven2" - if (project.hasProperty('sonatypeUsername')) { - credentials { - username sonatypeUsername - password sonatypePassword + repositories { + maven { + url "https://oss.sonatype.org/service/local/staging/deploy/maven2" + if (project.hasProperty('sonatypeUsername')) { + credentials { + username sonatypeUsername + password sonatypePassword + } } } } } - } - if (System.env.CI != 'true') { signing { + required { project.hasProperty('isRelease') } sign publishing.publications.mavenPublication } } diff --git a/provider/gradle/build.gradle b/provider/gradle/build.gradle index ed2197cdef..f96787e7ee 100644 --- a/provider/gradle/build.gradle +++ b/provider/gradle/build.gradle @@ -1,9 +1,5 @@ plugins { - id "com.gradle.plugin-publish" version "1.0.0" apply false -} - -if (project.hasProperty('isGradleRelease')) { - apply plugin: 'com.gradle.plugin-publish' + id "com.gradle.plugin-publish" version "1.0.0" } dependencies { @@ -27,22 +23,20 @@ groovydoc { enabled = false } -if (project.hasProperty('isGradleRelease')) { - pluginBundle { - website = 'https://github.com/pact-foundation/pact-jvm/tree/master/provider/gradle' - vcsUrl = 'https://github.com/pact-foundation/pact-jvm' - description = 'Gradle plugin for verifying pacts against a provider.' - tags = ['pact', 'cdc', 'consumerdrivencontracts', 'microservicetesting'] - } +pluginBundle { + website = 'https://github.com/pact-foundation/pact-jvm/tree/master/provider/gradle' + vcsUrl = 'https://github.com/pact-foundation/pact-jvm' + description = 'Gradle plugin for verifying pacts against a provider.' + tags = ['pact', 'cdc', 'consumerdrivencontracts', 'microservicetesting'] +} - gradlePlugin { - plugins { - pactProviderPlugin { - id = 'au.com.dius.pact' - displayName = 'Gradle Pact Provider plugin' - implementationClass = 'au.com.dius.pact.provider.gradle.PactPlugin' - description = 'Gradle plugin for verifying pacts against a provider.' - } +gradlePlugin { + plugins { + pactProviderPlugin { + id = 'au.com.dius.pact' + displayName = 'Gradle Pact Provider plugin' + implementationClass = 'au.com.dius.pact.provider.gradle.PactPlugin' + description = 'Gradle plugin for verifying pacts against a provider.' } } }