Skip to content

Commit

Permalink
Merge branch 'main' into FromFileToPath
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg committed Jan 26, 2023
2 parents 9adce64 + 5bef415 commit ad78bc6
Show file tree
Hide file tree
Showing 119 changed files with 2,926 additions and 1,662 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* text eol=lf
*.bat eol=crlf
*.png binary
*.jar binary
3 changes: 2 additions & 1 deletion .github/workflows/changelog-print.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: gradle caching
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- run: ./gradlew changelogPrint
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
with:
distribution: "temurin"
java-version: 11
cache: gradle
- name: gradle caching
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: spotlessCheck
run: ./gradlew spotlessCheck --build-cache
- name: assemble testClasses
Expand All @@ -37,19 +40,19 @@ jobs:
fail-fast: false
matrix:
kind: [maven, gradle]
jre: [8, 11, 17]
jre: [11, 17]
os: [ubuntu-latest]
include:
# test windows at the diagonals of the above matrix
- kind: maven
jre: 8
jre: 11
os: windows-latest
- kind: gradle
jre: 17
os: windows-latest
# npm on linux only (crazy slow on windows)
- kind: npm
jre: 8
jre: 11
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -60,7 +63,10 @@ jobs:
with:
distribution: "temurin"
java-version: ${{ matrix.jre }}
cache: gradle
- name: gradle caching
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: build (maven-only)
if: matrix.kind == 'maven'
run: ./gradlew :plugin-maven:build -x spotlessCheck --build-cache
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ jobs:
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: gradle caching
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: git fetch origin main
run: git fetch origin main
- name: publish all
if: "${{ github.event.inputs.to_publish == 'all' }}"
run: |
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]
on:
push:
paths:
- 'gradlew'
- 'gradlew.bat'
- 'gradle/wrapper/'
pull_request:
paths:
- 'gradlew'
- 'gradlew.bat'
- 'gradle/wrapper/'

permissions:
contents: read
Expand Down
15 changes: 15 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,26 @@ This document is intended for Spotless developers.
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).

## [Unreleased]

## [2.33.0] - 2023-01-26
### Added
* `ProcessRunner` has added some convenience methods so it can be used for maven testing. ([#1496](https://github.com/diffplug/spotless/pull/1496))
* `ProcessRunner` allows to limit captured output to a certain number of bytes. ([#1511](https://github.com/diffplug/spotless/pull/1511))
* `ProcessRunner` is now capable of handling long-running tasks where waiting for exit is delegated to the caller. ([#1511](https://github.com/diffplug/spotless/pull/1511))
* Allow to specify node executable for node-based formatters using `nodeExecutable` parameter ([#1500](https://github.com/diffplug/spotless/pull/1500))
### Fixed
* The default list of type annotations used by `formatAnnotations` has had 8 more annotations from the Checker Framework added [#1494](https://github.com/diffplug/spotless/pull/1494)
### Changes
* **POTENTIALLY BREAKING** Bump minimum JRE from 8 to 11, next release likely to bump bytecode to Java 11 ([#1514](https://github.com/diffplug/spotless/pull/1514) part 1 of [#1337](https://github.com/diffplug/spotless/issues/1337))
* Rename `YamlJacksonStep` into `JacksonYamlStep` while normalizing Jackson usage ([#1492](https://github.com/diffplug/spotless/pull/1492))
* Convert `gson` integration to use a compile-only source set ([#1510](https://github.com/diffplug/spotless/pull/1510)).
* ** POTENTIALLY BREAKING** Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475))
* `KtLint` does not maintain a stable API - before this PR, we supported every breaking change in the API since 2019.
* From now on, we will support no more than 2 breaking changes at a time.
* NpmFormatterStepStateBase delays `npm install` call until the formatter is first used. This enables better integration
with `gradle-node-plugin`. ([#1522](https://github.com/diffplug/spotless/pull/1522))
* Bump default `ktlint` version to latest `0.48.1` -> `0.48.2` ([#1529](https://github.com/diffplug/spotless/pull/1529))
* Bump default `scalafmt` version to latest `3.6.1` -> `3.7.1` ([#1529](https://github.com/diffplug/spotless/pull/1529))

## [2.32.0] - 2023-01-13
### Added
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ lib('java.RemoveUnusedImportsStep') +'{{yes}} | {{yes}}
extra('java.EclipseJdtFormatterStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
lib('java.FormatAnnotationsStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
lib('json.gson.GsonStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
lib('json.JacksonJsonStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
lib('json.JsonSimpleStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
lib('kotlin.KtLintStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
lib('kotlin.KtfmtStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
Expand All @@ -77,7 +78,7 @@ lib('python.BlackStep') +'{{yes}} | {{no}}
lib('scala.ScalaFmtStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
lib('sql.DBeaverSQLFormatterStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
extra('wtp.EclipseWtpFormatterStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
lib('yaml.YamlJacksonStep') +'{{no}} | {{yes}} | {{no}} | {{no}} |',
lib('yaml.JacksonYamlStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
'| [(Your FormatterStep here)](CONTRIBUTING.md#how-to-add-a-new-formatterstep) | {{no}} | {{no}} | {{no}} | {{no}} |',
].join('\n');
-->
Expand Down Expand Up @@ -109,6 +110,7 @@ lib('yaml.YamlJacksonStep') +'{{no}} | {{yes}}
| [`java.EclipseJdtFormatterStep`](lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
| [`java.FormatAnnotationsStep`](lib/src/main/java/com/diffplug/spotless/java/FormatAnnotationsStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
| [`json.gson.GsonStep`](lib/src/main/java/com/diffplug/spotless/json/gson/GsonStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
| [`json.JacksonJsonStep`](lib/src/main/java/com/diffplug/spotless/json/JacksonJsonStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
| [`json.JsonSimpleStep`](lib/src/main/java/com/diffplug/spotless/json/JsonSimpleStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
| [`kotlin.KtLintStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtLintStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
| [`kotlin.KtfmtStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtfmtStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
Expand All @@ -123,7 +125,7 @@ lib('yaml.YamlJacksonStep') +'{{no}} | {{yes}}
| [`scala.ScalaFmtStep`](lib/src/main/java/com/diffplug/spotless/scala/ScalaFmtStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
| [`sql.DBeaverSQLFormatterStep`](lib/src/main/java/com/diffplug/spotless/sql/DBeaverSQLFormatterStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
| [`wtp.EclipseWtpFormatterStep`](lib-extra/src/main/java/com/diffplug/spotless/extra/wtp/EclipseWtpFormatterStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
| [`yaml.YamlJacksonStep`](lib/src/main/java/com/diffplug/spotless/yaml/YamlJacksonStep.java) | :white_large_square: | :+1: | :white_large_square: | :white_large_square: |
| [`yaml.JacksonYamlStep`](lib/src/main/java/com/diffplug/spotless/yaml/JacksonYamlStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
| [(Your FormatterStep here)](CONTRIBUTING.md#how-to-add-a-new-formatterstep) | :white_large_square: | :white_large_square: | :white_large_square: | :white_large_square: |
<!---freshmark /matrix -->

Expand Down
2 changes: 1 addition & 1 deletion _ext/eclipse-wtp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ sourceSets {
* All test classes need to run separately since they all instatiate different setups of the
* Eclipse framework.
*/
test {
tasks.withType(Test).configureEach {
//Skip default tests, which would run every test case.
exclude '**'
}
Expand Down
6 changes: 4 additions & 2 deletions _ext/gradle/java-setup.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apply from: rootProject.file('gradle/java-setup.gradle')
apply plugin: 'java-library'

// Show warning locations, fail on warnings
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xlint:unchecked"
options.compilerArgs << "-Xlint:deprecation"
options.compilerArgs << "-Werror"
Expand All @@ -22,4 +22,6 @@ dependencies {
testImplementation project(':testlib')
}

test { useJUnitPlatform() }
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
4 changes: 2 additions & 2 deletions _ext/gradle/update-lockfile.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Use file locking
configurations.all {
configurations.configureEach {
resolutionStrategy {
activateDependencyLocking()
}
}
}
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
repositories {
mavenCentral()
}
apply from: rootProject.file('gradle/java-publish.gradle')
apply from: rootProject.file('gradle/changelog.gradle')
allprojects {
Expand All @@ -18,4 +15,4 @@ spotless {
trimTrailingWhitespace()
endWithNewline()
}
}
}
1 change: 1 addition & 0 deletions gradle/changelog.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spotlessChangelog {
// need -Prelease=true in order to do a publish
appendDashSnapshotUnless_dashPrelease=true

branch 'release'
tagPrefix "${kind}/"
commitMessage "Published ${kind}/{{version}}" // {{version}} will be replaced
}
Expand Down
14 changes: 6 additions & 8 deletions gradle/java-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,12 @@ if (!version.endsWith('-SNAPSHOT')) {
}
// ensures that changelog bump and push only happens if the publish was successful
def thisProj = project
afterEvaluate {
changelogTasks.named('changelogBump').configure {
dependsOn thisProj.tasks.named('publishPluginMavenPublicationToSonatypeRepository')
dependsOn rootProject.tasks.named('closeAndReleaseSonatypeStagingRepository')
// if we have a gradle plugin, we need to push it up to the plugin portal too
if (thisProj.tasks.names.contains('publishPlugins')) {
dependsOn thisProj.tasks.named('publishPlugins')
}
changelogTasks.named('changelogBump').configure {
dependsOn ":${thisProj.path}:publishPluginMavenPublicationToSonatypeRepository"
dependsOn ":closeAndReleaseSonatypeStagingRepository"
// if we have a gradle plugin, we need to push it up to the plugin portal too
if (thisProj.tasks.names.contains('publishPlugins')) {
dependsOn thisProj.tasks.named('publishPlugins')
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions gradle/java-setup.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
//////////
// JAVA //
//////////
repositories { mavenCentral() }

// setup java
apply plugin: 'java'

sourceCompatibility = VER_JAVA
targetCompatibility = VER_JAVA
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' }

//////////////
// SPOTBUGS //
Expand All @@ -34,8 +33,6 @@ tasks.withType(com.github.spotbugs.snom.SpotBugsTask).configureEach {
}

tasks.named('spotbugsMain') {
// only run on Java 8 (no benefit to running twice)
enabled = org.gradle.api.JavaVersion.current() == org.gradle.api.JavaVersion.VERSION_11
reports {
html.enabled = true
}
Expand Down
3 changes: 1 addition & 2 deletions gradle/special-tests.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
apply plugin: 'org.gradle.test-retry'
apply plugin: 'com.adarshr.test-logger'
def special = [
'Npm',
Expand All @@ -7,7 +6,7 @@ def special = [
]

boolean isCiServer = System.getenv().containsKey("CI")
tasks.named('test') {
tasks.withType(Test).configureEach {
// See com.diffplug.spotless.tag package for available JUnit 5 @Tag annotations
useJUnitPlatform {
excludeTags special as String[]
Expand Down
2 changes: 1 addition & 1 deletion lib-extra/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies {
spotbugs { reportLevel = 'low' } // low|medium|high (low = sensitive to even minor mistakes)

apply from: rootProject.file('gradle/special-tests.gradle')
tasks.named('test') {
tasks.withType(Test).configureEach {
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) {
// needed for EclipseCdtFormatterStepTest
jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,14 +15,11 @@
*/
package com.diffplug.spotless.extra.java;

import static org.junit.jupiter.api.condition.JRE.JAVA_11;

import java.io.File;
import java.util.stream.Stream;

import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

Expand Down Expand Up @@ -57,7 +54,7 @@ private static Stream<String> formatWithVersion() {

/** New format interface requires source file information to distinguish module-info from compilation unit */
@Nested
@EnabledForJreRange(min = JAVA_11)

class NewFormatInterface extends EclipseResourceHarness {
public NewFormatInterface() throws Exception {
super(createBuilder(), "module-info.java", getTestResource("java/eclipse/ModuleInfoUnformatted.test"), getTestResource("java/eclipse/ModuleInfoFormatted.test"));
Expand Down
Loading

0 comments on commit ad78bc6

Please sign in to comment.