From 952a3d1517297ada0a4ac5e279a3d45f996fbd8e Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 16:39:54 -0800 Subject: [PATCH 1/9] Add an environment variable to exclude maven from the build. --- settings.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index eb75eb0f99..9ca612c058 100644 --- a/settings.gradle +++ b/settings.gradle @@ -34,4 +34,8 @@ include 'testlib' // library for sharing test infrastructure between the project include 'lib-extra' // reusable library with lots of dependencies include 'plugin-gradle' // gradle-specific glue code -include 'plugin-maven' // maven-specific glue code + +// excludes maven from JitCI builds, +if (System.env['SPOTLESS_EXCLUDE_MAVEN'] != 'true') { + include 'plugin-maven' // maven-specific glue code +} From aabe37bcdbbc5431b03bcdc205284b59794adaca Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 16:42:21 -0800 Subject: [PATCH 2/9] Update changelog. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 2f6a57d724..2a927f5274 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ You might be looking for: * Ignored `KtLintStepTest`, because [gradle/gradle#11752](https://github.com/gradle/gradle/issues/11752) is causing too many CI failures. ([#499](https://github.com/diffplug/spotless/pull/499)) * Also fixed a minor problem in TestProvisioner. +* If you set the following environment variable `SPOTLESS_EXCLUDE_MAVEN=true` then the maven plugin will be excluded from the build. ([#502](https://github.com/diffplug/spotless/pull/502)) ### Version 1.26.1 - November 27th 2019 (javadoc [lib](https://diffplug.github.io/spotless/javadoc/spotless-lib/1.26.0/) [lib-extra](https://diffplug.github.io/spotless/javadoc/spotless-lib-extra/1.26.0/), artifact [lib]([jcenter](https://bintray.com/diffplug/opensource/spotless-lib), [lib-extra]([jcenter](https://bintray.com/diffplug/opensource/spotless-lib-extra))) From cba2db1ca2843601cd9ca29273227dcb4660a3ff Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 17:00:51 -0800 Subject: [PATCH 3/9] JitPack is picking up plugin-maven anyway, but it's pretty fancy. Maybe this will help. --- plugin-maven/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin-maven/build.gradle b/plugin-maven/build.gradle index c5a3c87759..17b6a10b9f 100644 --- a/plugin-maven/build.gradle +++ b/plugin-maven/build.gradle @@ -6,6 +6,10 @@ plugins { id 'cz.malohlava.visteg' version '1.0.5' // https://github.com/mmalohlava/gradle-visteg } +if (System.env['SPOTLESS_EXCLUDE_MAVEN'] == 'true') { + return +} + // to generate taskGraph.pdf // - set enabled (below) to true // - run: ./gradlew :plugin-maven:test From 62bce7183817140e8c627e55b399527ab50621aa Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 17:08:20 -0800 Subject: [PATCH 4/9] Console println SPOTLESS_EXCLUDE_MAVEN to figure out what's going on in JitPack. --- build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.gradle b/build.gradle index 106a6ab335..0122ce0b48 100644 --- a/build.gradle +++ b/build.gradle @@ -38,3 +38,13 @@ eclipseResourceFilters { static Class spotBugsTaskType() { return com.github.spotbugs.SpotBugsTask } + +subprojects { + afterEvaluate { + if (tasks.names.contains('jar')) { + tasks.jar.doLast { + println('SPOTLESS_EXCLUDE_MAVEN=' + System.env['SPOTLESS_EXCLUDE_MAVEN']) + } + } + } +} From e101967e4d8f5299b9279d522b0700244c4fd71b Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 17:14:06 -0800 Subject: [PATCH 5/9] Another way to spell System.getenv. --- build.gradle | 2 +- settings.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 0122ce0b48..172bff7805 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ subprojects { afterEvaluate { if (tasks.names.contains('jar')) { tasks.jar.doLast { - println('SPOTLESS_EXCLUDE_MAVEN=' + System.env['SPOTLESS_EXCLUDE_MAVEN']) + println('SPOTLESS_EXCLUDE_MAVEN=' + System.getenv('SPOTLESS_EXCLUDE_MAVEN')) } } } diff --git a/settings.gradle b/settings.gradle index 9ca612c058..84dc4f5629 100644 --- a/settings.gradle +++ b/settings.gradle @@ -36,6 +36,6 @@ include 'lib-extra' // reusable library with lots of dependencies include 'plugin-gradle' // gradle-specific glue code // excludes maven from JitCI builds, -if (System.env['SPOTLESS_EXCLUDE_MAVEN'] != 'true') { +if (System.getenv('SPOTLESS_EXCLUDE_MAVEN') != 'true') { include 'plugin-maven' // maven-specific glue code } From 3190811e7649da3ce7ddca48c1ebfdb9d4780327 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 17:18:31 -0800 Subject: [PATCH 6/9] Remove the debug/experimental stuff. --- build.gradle | 10 ---------- plugin-maven/build.gradle | 4 ---- 2 files changed, 14 deletions(-) diff --git a/build.gradle b/build.gradle index 172bff7805..106a6ab335 100644 --- a/build.gradle +++ b/build.gradle @@ -38,13 +38,3 @@ eclipseResourceFilters { static Class spotBugsTaskType() { return com.github.spotbugs.SpotBugsTask } - -subprojects { - afterEvaluate { - if (tasks.names.contains('jar')) { - tasks.jar.doLast { - println('SPOTLESS_EXCLUDE_MAVEN=' + System.getenv('SPOTLESS_EXCLUDE_MAVEN')) - } - } - } -} diff --git a/plugin-maven/build.gradle b/plugin-maven/build.gradle index 17b6a10b9f..c5a3c87759 100644 --- a/plugin-maven/build.gradle +++ b/plugin-maven/build.gradle @@ -6,10 +6,6 @@ plugins { id 'cz.malohlava.visteg' version '1.0.5' // https://github.com/mmalohlava/gradle-visteg } -if (System.env['SPOTLESS_EXCLUDE_MAVEN'] == 'true') { - return -} - // to generate taskGraph.pdf // - set enabled (below) to true // - run: ./gradlew :plugin-maven:test From dbf502f67bde091f8764c16def3a42f2e59c9146 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 17:34:32 -0800 Subject: [PATCH 7/9] We succeeded in blocking from JitCI, but not JitPack. This should work on JitPack. --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 84dc4f5629..a321cbe438 100644 --- a/settings.gradle +++ b/settings.gradle @@ -36,6 +36,6 @@ include 'lib-extra' // reusable library with lots of dependencies include 'plugin-gradle' // gradle-specific glue code // excludes maven from JitCI builds, -if (System.getenv('SPOTLESS_EXCLUDE_MAVEN') != 'true') { +if (System.getenv('SPOTLESS_EXCLUDE_MAVEN') != 'true' && System.getenv('JITPACK') != 'true') { include 'plugin-maven' // maven-specific glue code } From dad2e36d951fae7d79a9cf2e0fbc8a0a9fca59a9 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 19:09:31 -0800 Subject: [PATCH 8/9] Update changelog since we finally got it to work. --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 2a927f5274..53a97b3d21 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,7 +9,8 @@ You might be looking for: * Ignored `KtLintStepTest`, because [gradle/gradle#11752](https://github.com/gradle/gradle/issues/11752) is causing too many CI failures. ([#499](https://github.com/diffplug/spotless/pull/499)) * Also fixed a minor problem in TestProvisioner. -* If you set the following environment variable `SPOTLESS_EXCLUDE_MAVEN=true` then the maven plugin will be excluded from the build. ([#502](https://github.com/diffplug/spotless/pull/502)) +* If you set the environment variable `SPOTLESS_EXCLUDE_MAVEN=true` then the maven plugin will be excluded from the build. ([#502](https://github.com/diffplug/spotless/pull/502)) + * We have set this in JitPack, as a workaround for [jitpack/jitpack.io#4112](https://github.com/jitpack/jitpack.io/issues/4112) ### Version 1.26.1 - November 27th 2019 (javadoc [lib](https://diffplug.github.io/spotless/javadoc/spotless-lib/1.26.0/) [lib-extra](https://diffplug.github.io/spotless/javadoc/spotless-lib-extra/1.26.0/), artifact [lib]([jcenter](https://bintray.com/diffplug/opensource/spotless-lib), [lib-extra]([jcenter](https://bintray.com/diffplug/opensource/spotless-lib-extra))) From c112bcd2424256e88175f730e09fc15f2b467ac6 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 31 Dec 2019 19:12:07 -0800 Subject: [PATCH 9/9] Update the integration testing instructions. --- CONTRIBUTING.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b0d22a3efd..699e9df5ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -117,7 +117,7 @@ If you get something running, we'd love to host your plugin within this repo as ## Integration testing -### Locally +### Gradle - locally First, run `./gradlew publishToMavenLocal` in your local checkout of Spotless. Now, in any other project on your machine, you can use the following snippet in your `settings.gradle` (for Gradle 6.0+). @@ -141,9 +141,9 @@ pluginManagement { } ``` -### Any commit in a public GitHub repo (this one, or any fork) +### Gradle - any commit in a public GitHub repo (this one, or any fork) -In Gradle 6.0+, you can use the following snippet in your `settings.gradle`. TODO: broken until [jitpack/jitpack.io#4112](https://github.com/jitpack/jitpack.io/issues/4112) is resolved. +In Gradle 6.0+, you can use the following snippet in your `settings.gradle`. ```gradle pluginManagement { @@ -165,6 +165,9 @@ pluginManagement { } } ``` +### Maven + +Run `./gradlew publishToMavenLocal` to publish this to your local repository. The maven plugin is not published to JitPack due to [jitpack/jitpack.io#4112](https://github.com/jitpack/jitpack.io/issues/4112). ## License @@ -173,7 +176,7 @@ By contributing your code, you agree to license your contribution under the term All files are released with the Apache 2.0 license as such: ``` -Copyright 2016 DiffPlug +Copyright 2020 DiffPlug Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.