Browse Source

Replace autostyle with spotless

spotless
Jannis Weis 3 years ago
parent
commit
bf78bec464
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 2
      .github/workflows/branch-snapshot.yml
  2. 2
      .github/workflows/codeql-analysis.yml
  3. 2
      .github/workflows/documentation.yml
  4. 8
      .github/workflows/gradle.yml
  5. 6
      .github/workflows/illegalAccessCheck.yml
  6. 4
      .github/workflows/libs.yml
  7. 2
      .github/workflows/snapshot.yml
  8. 6
      .github/workflows/spotless.yml
  9. 2
      LICENSE
  10. 2
      README.md
  11. 96
      build.gradle.kts
  12. 20
      config/LICENSE_HEADER_JAVA.txt
  13. 23
      config/LICENSE_HEADER_PROPERTIES.txt
  14. 0
      config/darklaf_cpp.eclipseformat.xml
  15. 0
      config/darklaf_java.eclipseformat.xml
  16. 13
      gradle.properties
  17. 2
      settings.gradle.kts

2
.github/workflows/branch-snapshot.yml

@ -31,7 +31,7 @@ jobs:
- name: Publish
if: contains(github.event.pull_request.labels.*.name, 'published to test')
env:
PROPS_RELEASE: "-Prc=1 -Pgh -Prelease=false -PskipJavadoc -PskipAutostyle -PfailIfLibraryMissing -PsnapshotName=${{ steps.extract_branch.outputs.branch }}"
PROPS_RELEASE: "-Prc=1 -Pgh -Prelease=false -PskipJavadoc -PskipSpotless -PfailIfLibraryMissing -PsnapshotName=${{ steps.extract_branch.outputs.branch }}"
PROPS_GIT: "-PghGitSourceUsername=${{ secrets.GH_GIT_USERNAME }} -PghGitSourcePassword=${{ secrets.RELEASE_TOKEN }}"
PROPS_NEXUS: "-PghNexusUsername=${{ secrets.GH_NEXUS_USERNAME }} -PghNexusPassword=${{ secrets.GH_NEXUS_PASSWORD }}"
PROPS_SIGNING: "-PuseInMemoryKey=true -Psigning.inMemoryKey=${{ secrets.IN_MEMORY_KEY }} -Psigning.password=${{ secrets.SIGNING_PASSWORD }}"

2
.github/workflows/codeql-analysis.yml

@ -63,7 +63,7 @@ jobs:
- name: Build
uses: eskatos/gradle-command-action@v1
with:
arguments: build -PskipAutostyle --info -x test
arguments: build -PskipSpotless --info -x test
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true

2
.github/workflows/documentation.yml

@ -25,7 +25,7 @@ jobs:
- name: Build documentation
uses: eskatos/gradle-command-action@v1
with:
arguments: :darklaf-core:makeDocumentation -PskipAutostyle -x test
arguments: :darklaf-core:makeDocumentation -PskipSpotless -x test
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true

8
.github/workflows/gradle.yml

@ -25,7 +25,7 @@ jobs:
- name: Build & Test
uses: eskatos/gradle-command-action@v1
with:
arguments: build test -PskipAutostyle -PgithubAccessToken=${{ secrets.GITHUB_TOKEN }} --no-daemon
arguments: build test -PskipSpotless -PgithubAccessToken=${{ secrets.GITHUB_TOKEN }} --no-daemon
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
@ -62,7 +62,7 @@ jobs:
env:
PROPS_GITHUB: "-PgithubAccessToken=${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: xvfb-run -a -server-num=1 --server-args="-screen 0 2000x3000x16" ./gradlew build test -PskipAutostyle -PskipModuleInfo -PfailIfLibraryMissing=true $(echo $PROPS_GITHUB) --no-daemon
run: xvfb-run -a -server-num=1 --server-args="-screen 0 2000x3000x16" ./gradlew build test -PskipSpotless -PskipModuleInfo -PfailIfLibraryMissing=true $(echo $PROPS_GITHUB) --no-daemon
- name: Upload Test Report
uses: actions/upload-artifact@v1
if: ${{ always() }}
@ -88,7 +88,7 @@ jobs:
env:
PROPS_GITHUB: "-PgithubAccessToken=${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: xvfb-run -a -server-num=1 --server-args="-screen 0 2000x3000x16" ./gradlew build test -PskipAutostyle -PfailIfLibraryMissing=true $(echo $PROPS_GITHUB) --no-daemon
run: xvfb-run -a -server-num=1 --server-args="-screen 0 2000x3000x16" ./gradlew build test -PskipSpotless -PfailIfLibraryMissing=true $(echo $PROPS_GITHUB) --no-daemon
- name: Upload Test Results
if: ${{ always() }}
uses: actions/upload-artifact@v1
@ -119,7 +119,7 @@ jobs:
- name: Build & Test
uses: eskatos/gradle-command-action@v1
with:
arguments: build test -PskipAutostyle -PgithubAccessToken=${{ secrets.GITHUB_TOKEN }} --no-daemon
arguments: build test -PskipSpotless -PgithubAccessToken=${{ secrets.GITHUB_TOKEN }} --no-daemon
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true

6
.github/workflows/illegalAccessCheck.yml

@ -25,7 +25,7 @@ jobs:
- name: Build & Test
uses: eskatos/gradle-command-action@v1
with:
arguments: build test -PskipAutostyle -PverboseTest=true -PgithubAccessToken=${{ secrets.GITHUB_TOKEN }} --no-daemon
arguments: build test -PskipSpotless -PverboseTest=true -PgithubAccessToken=${{ secrets.GITHUB_TOKEN }} --no-daemon
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
@ -62,7 +62,7 @@ jobs:
env:
PROPS_GITHUB: "-PgithubAccessToken=${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: xvfb-run -a -server-num=1 --server-args="-screen 0 2000x3000x16" ./gradlew build test -PskipAutostyle -PverboseTest=true -PfailIfLibraryMissing=true $(echo $PROPS_GITHUB) --no-daemon
run: xvfb-run -a -server-num=1 --server-args="-screen 0 2000x3000x16" ./gradlew build test -PskipSpotless -PverboseTest=true -PfailIfLibraryMissing=true $(echo $PROPS_GITHUB) --no-daemon
- name: Upload Test Results
if: ${{ always() }}
uses: actions/upload-artifact@v1
@ -93,7 +93,7 @@ jobs:
- name: Build & Test
uses: eskatos/gradle-command-action@v1
with:
arguments: build test -PskipAutostyle -PverboseTest=true -PgithubAccessToken=${{ secrets.GITHUB_TOKEN }} --no-daemon
arguments: build test -PskipSpotless -PverboseTest=true -PgithubAccessToken=${{ secrets.GITHUB_TOKEN }} --no-daemon
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true

4
.github/workflows/libs.yml

@ -37,7 +37,7 @@ jobs:
- name: Build
uses: eskatos/gradle-command-action@v1
with:
arguments: :darklaf-windows:build -PskipAutostyle -x test
arguments: :darklaf-windows:build -PskipSpotless -x test
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
@ -69,7 +69,7 @@ jobs:
- name: Build
uses: eskatos/gradle-command-action@v1
with:
arguments: :darklaf-macos:build -PskipAutostyle -x test
arguments: :darklaf-macos:build -PskipSpotless -x test
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true

2
.github/workflows/snapshot.yml

@ -28,7 +28,7 @@ jobs:
java-version: 11
- name: Publish
env:
PROPS_RELEASE: "-Prc=1 -Pgh -Prelease=false -PskipJavadoc -PskipAutostyle -PfailIfLibraryMissing"
PROPS_RELEASE: "-Prc=1 -Pgh -Prelease=false -PskipJavadoc -PskipSpotless -PfailIfLibraryMissing"
PROPS_GIT: "-PghGitSourceUsername=${{ secrets.GH_GIT_USERNAME }} -PghGitSourcePassword=${{ secrets.RELEASE_TOKEN }}"
PROPS_NEXUS: "-PghNexusUsername=${{ secrets.GH_NEXUS_USERNAME }} -PghNexusPassword=${{ secrets.GH_NEXUS_PASSWORD }}"
PROPS_SIGNING: "-PuseInMemoryKey=true -Psigning.inMemoryKey=${{ secrets.IN_MEMORY_KEY }} -Psigning.password=${{ secrets.SIGNING_PASSWORD }}"

6
.github/workflows/autostyle.yml → .github/workflows/spotless.yml

@ -1,14 +1,14 @@
name: Autostyle
name: Spotless
on: [push, pull_request]
jobs:
autostlye:
name: "Autostyle"
name: "Spotless"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Check
run: ./gradlew autostyleCheck
run: ./gradlew spotlessCheck -PspotlessRatchet=false

2
LICENSE

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Jannis Weis
Copyright (c) 2019-2022 Jannis Weis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

2
README.md

@ -2,7 +2,7 @@
[![CI Status](https://github.com/weisJ/darklaf/workflows/CI/badge.svg?branch=master)](https://github.com/weisJ/darklaf/actions?query=workflow%3ACI)
[![Native Libraries](https://github.com/weisJ/darklaf/workflows/Build%20Native%20Libraries/badge.svg)](https://github.com/weisJ/darklaf/actions?query=workflow%3A%22Build+Native+Libraries%22)
[![Code Style](https://github.com/weisJ/darklaf/workflows/Autostyle/badge.svg)](https://github.com/weisJ/darklaf/actions?query=workflow%3AAutostyle)
[![Code Style](https://github.com/weisJ/darklaf/workflows/Spotless/badge.svg)](https://github.com/weisJ/darklaf/actions?query=workflow%3ASpotless)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.weisj/darklaf-core?label=Maven%20Central)](https://search.maven.org/artifact/com.github.weisj/darklaf-core)
This project is based on the [darcula](https://github.com/bulenkov/Darcula) look and feel for Swing.

96
build.gradle.kts

@ -1,5 +1,3 @@
import com.github.autostyle.generic.DefaultCopyrightStyle
import com.github.autostyle.gradle.BaseFormatExtension
import com.github.vlsi.gradle.crlf.CrLfSpec
import com.github.vlsi.gradle.crlf.LineEndings
import com.github.vlsi.gradle.properties.dsl.props
@ -11,7 +9,7 @@ import net.ltgt.gradle.errorprone.errorprone
plugins {
idea
id("com.github.autostyle")
id("com.diffplug.spotless")
id("com.github.vlsi.crlf")
id("com.github.vlsi.gradle-extensions")
id("com.github.vlsi.stage-vote-release")
@ -23,7 +21,7 @@ val skipJavadoc by props()
val enableMavenLocal by props(false)
val enableGradleMetadata by props()
val enableErrorProne by props()
val skipAutostyle by props(false)
val skipSpotless by props(false)
val isRelease = project.stringProperty("release").toBool()
val snapshotName by props("")
@ -67,35 +65,6 @@ println("Building: Darklaf $buildVersion")
println(" JDK: " + System.getProperty("java.home"))
println(" Gradle: " + gradle.gradleVersion)
fun BaseFormatExtension.license(addition: String = "") {
val extra = if (addition.isEmpty()) "" else "\n$addition"
licenseHeader(File("${project.rootDir}/LICENSE").readText() + extra) {
filter {
exclude("**/org/pbjar/jxlayer/*")
}
copyrightStyle("bat", DefaultCopyrightStyle.REM)
copyrightStyle("cmd", DefaultCopyrightStyle.REM)
}
trimTrailingWhitespace()
if (addition.isEmpty()) {
endWithNewline()
}
}
fun BaseFormatExtension.configFilter(init: PatternFilterable.() -> Unit) {
filter {
// Autostyle does not support gitignore yet https://github.com/autostyle/autostyle/issues/13
exclude("out/**")
exclude(".idea/**", ".run/**")
if (project == rootProject) {
exclude("gradlew*", "gradle/**")
} else {
exclude("bin/**")
}
init()
}
}
allprojects {
group = "com.github.weisj"
version = buildVersion
@ -136,48 +105,49 @@ allprojects {
}
}
if (!skipAutostyle) {
apply(plugin = "com.github.autostyle")
autostyle {
kotlinGradle {
ktlint(version = "ktlint".v)
if (!skipSpotless) {
apply(plugin = "com.diffplug.spotless")
spotless {
val spotlessRatchet by props(default = true)
if (spotlessRatchet) {
ratchetFrom("origin/master")
}
format("properties") {
configFilter {
include("**/*.properties")
exclude("**/gradle.properties")
exclude("externalResources/**")
}
license("\nsuppress inspection \"UnusedProperty\" for whole file")
}
format("configs") {
configFilter {
include("**/*.sh", "**/*.bsh", "**/*.cmd", "**/*.bat")
include("**/*.xsd", "**/*.xsl", "**/*.xml")
exclude("**/*.eclipseformat.xml")
}
license()
kotlinGradle {
ktlint("ktlint".v)
}
format("markdown") {
filter.include("**/*.md")
target("**/*.md")
endWithNewline()
}
cpp {
trimTrailingWhitespace()
}
format("svg") {
target("**/*.svg")
endWithNewline()
license()
eclipse {
configFile("${project.rootDir}/darklaf_cpp.eclipseformat.xml")
trimTrailingWhitespace()
eclipseWtp(com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep.XML)
}
plugins.withType<dev.nokee.platform.jni.internal.plugins.JniLibraryPlugin>().configureEach {
cpp {
target("**/*.cpp", "**/*.h")
endWithNewline()
trimTrailingWhitespace()
eclipseCdt().configFile("${project.rootDir}/config/darklaf_cpp.eclipseformat.xml")
licenseHeaderFile("${project.rootDir}/config/LICENSE_HEADER_JAVA.txt")
}
}
plugins.withType<JavaPlugin>().configureEach {
format("properties") {
target("**/*.properties")
targetExclude("*/build/")
licenseHeaderFile("${project.rootDir}/config/LICENSE_HEADER_PROPERTIES.txt", "[^#]")
}
java {
importOrder("java", "javax", "org", "com")
removeUnusedImports()
license()
eclipse {
configFile("${project.rootDir}/darklaf_java.eclipseformat.xml")
}
endWithNewline()
trimTrailingWhitespace()
eclipse().configFile("${project.rootDir}/config/darklaf_java.eclipseformat.xml")
licenseHeaderFile("${project.rootDir}/config/LICENSE_HEADER_JAVA.txt")
}
}
}

20
config/LICENSE_HEADER_JAVA.txt

@ -0,0 +1,20 @@
/*
* MIT License
*
* Copyright (c) $YEAR Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

23
config/LICENSE_HEADER_PROPERTIES.txt

@ -0,0 +1,23 @@
# MIT License
#
# Copyright (c) $YEAR Jannis Weis
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# suppress inspection "UnusedProperty" for whole file

0
darklaf_cpp.eclipseformat.xml → config/darklaf_cpp.eclipseformat.xml

0
darklaf_java.eclipseformat.xml → config/darklaf_java.eclipseformat.xml

13
gradle.properties

@ -7,15 +7,24 @@ kotlin.code.style = official
# repository.apache.org does not yet support .sha256 and .sha512 checksums
systemProp.org.gradle.internal.publish.checksums.insecure = true
# Fix illegal access issues with some gradle plugins
org.gradle.jvmargs = \
-XX:+IgnoreUnrecognizedVMOptions \
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
# Darklaf version
darklaf.version = 3.0.0
# Plugins
com.github.vlsi.vlsi-release-plugins.version = 1.74
com.github.autostyle.version = 3.1
com.diffplug.spotless.version = 6.0.3
nokee.version = 0.4.0-202112012027.ff552c41
org.ajoberstar.grgit.version = 4.1.0
ktlint.version = 0.40.0
ktlint.version = 0.43.2
net.ltgt.errorprone.version = 2.0.2
# Dependencies

2
settings.gradle.kts

@ -5,7 +5,7 @@ rootProject.name = "darklaf"
pluginManagement {
plugins {
fun idv(id: String, key: String = id) = id(id) version extra["$key.version"].toString()
idv("com.github.autostyle")
idv("com.diffplug.spotless")
idv("com.github.vlsi.crlf", "com.github.vlsi.vlsi-release-plugins")
idv("com.github.vlsi.gradle-extensions", "com.github.vlsi.vlsi-release-plugins")
idv("com.github.vlsi.license-gather", "com.github.vlsi.vlsi-release-plugins")

Loading…
Cancel
Save