Skip to content

Commit

Permalink
Replace Spotless -> Autostyle
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Dec 28, 2019
1 parent d0b9bac commit 8f9353c
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 46 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ This library is distributed under terms of Apache License 2.0

Change log
----------
HEAD
* Replace Spotless -> [Autostyle](https://github.com/autostyle/autostyle) for simpler code style management

v1.53
* stage-vote-release-plugin: expose NexusConfig#mavenCentral to enable publishing to Central

Expand Down
33 changes: 11 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {
`kotlin-dsl`
`maven-publish`
id("com.gradle.plugin-publish") version "0.10.1" apply false
id("com.diffplug.gradle.spotless") version "3.25.0"
id("com.github.autostyle") version "3.0"
id("org.jetbrains.gradle.plugin.idea-ext") version "0.5"
id("com.github.ben-manes.versions") version "0.21.0"
id("org.jetbrains.dokka") version "0.9.17"
Expand Down Expand Up @@ -59,18 +59,22 @@ allprojects {
}
}

val licenseHeaderFile = file("gradle/license-header.txt")
val licenseHeader = file("gradle/license-header.txt").readText()
allprojects {
if (project.path != ":plugins:license-gather-plugin") {
apply(plugin = "com.diffplug.gradle.spotless")
spotless {
apply(plugin = "com.github.autostyle")
autostyle {
kotlin {
licenseHeader(licenseHeader)
trimTrailingWhitespace()
// Generated build/generated-sources/licenses/com/github/vlsi/gradle/license/api/License.kt
// has wrong indentation, and it is not clear how to exclude it
ktlint().userData(mapOf("disabled_rules" to "no-wildcard-imports,import-ordering"))
ktlint {
userData(mapOf("disabled_rules" to "no-wildcard-imports,import-ordering"))
}
// It prints errors regarding build/generated-sources/licenses/com/github/vlsi/gradle/license/api/License.kt
// so comment it for now :(
licenseHeaderFile(licenseHeaderFile)
endWithNewline()
}
}
}
Expand Down Expand Up @@ -98,22 +102,7 @@ idea {
profiles {
create("Apache-2.0") {
keyword = "Copyright"
notice = """
Copyright 2019 Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
""".trimIndent()
notice = licenseHeader
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,37 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`java`
`kotlin-dsl` apply false
id("com.github.autostyle") version "3.0"
}

repositories {
jcenter()
gradlePluginPortal()
}

val licenseHeader = file("$rootDir/../gradle/license-header.txt").readText()
allprojects {
repositories {
jcenter()
gradlePluginPortal()
}
applyKotlinProjectConventions()

apply(plugin = "com.github.autostyle")
autostyle {
kotlin {
licenseHeader(licenseHeader)
trimTrailingWhitespace()
// Generated build/generated-sources/licenses/com/github/vlsi/gradle/license/api/License.kt
// has wrong indentation, and it is not clear how to exclude it
ktlint {
userData(mapOf("disabled_rules" to "no-wildcard-imports,import-ordering"))
}
// It prints errors regarding build/generated-sources/licenses/com/github/vlsi/gradle/license/api/License.kt
// so comment it for now :(
endWithNewline()
}
}
}

fun Project.applyKotlinProjectConventions() {
Expand Down
16 changes: 16 additions & 0 deletions buildSrc/checksum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,35 @@
<trust-requirement pgp='GROUP' checksum='NONE' />
<ignored-keys />
<trusted-keys>
<trusted-key id='379ce192d401ab61' group='com.diffplug.durian' />
<trusted-key id='c9fbaa83a8753994' group='com.fasterxml.jackson.core' />
<trusted-key id='c9fbaa83a8753994' group='com.fasterxml.jackson.module' />
<trusted-key id='105cb91cac2aee0e' group='com.github.autostyle' />
<trusted-key id='461a804f2609fd89' group='com.github.shyiko.klob' />
<trusted-key id='7a01b0f236e5430f' group='com.google.code.gson' />
<trusted-key id='7eb97d110dfadd60' group='com.googlecode.concurrent-trees' />
<trusted-key id='72475fd306b9cab7' group='com.googlecode.javaewah' />
<trusted-key id='a50569c7ca7fa1f0' group='com.jcraft' />
<trusted-key id='aa49c633b4734832' group='com.pinterest' />
<trusted-key id='aa49c633b4734832' group='com.pinterest.ktlint' />
<trusted-key id='685c46769dbb5e5d' group='com.squareup' />
<trusted-key id='86fdc7e2a11262cb' group='commons-codec' />
<trusted-key id='a41f13c999945293' group='commons-logging' />
<trusted-key id='6449005f96bc97a3' group='de.undercouch' />
<trusted-key id='379ce192d401ab61' group='info.picocli' />
<trusted-key id='efe8086f9e93774e' group='junit' />
<trusted-key id='7c25280eae63ebe5' group='org.apache.httpcomponents' />
<trusted-key id='e2b3d84202b812d9' group='org.assertj' />
<trusted-key id='41321490758aad6f' group='org.codehaus.groovy' />
<trusted-key id='0e91c2de43b72bb1' group='org.ec4j.core' />
<trusted-key id='5b05ccde140c2876' group='org.eclipse.jgit' />
<trusted-key id='a6adfc93ef34893e' group='org.hamcrest' />
<trusted-key id='bcf4173966770193' group='org.jetbrains' />
<trusted-key id='379ce192d401ab61' group='org.jetbrains.intellij.deps' />
<trusted-key id='6a0975f8b1127b83' group='org.jetbrains.kotlin' />
<trusted-key id='98fe03a974ce0a0b' group='org.jetbrains.kotlin' />
<trusted-key id='379ce192d401ab61' group='org.jetbrains.kotlinx' />
<trusted-key id='2c7b12f2a511e325' group='org.slf4j' />
</trusted-keys>
<dependencies>
<dependency group='org.gradle.kotlin' module='plugins' version='1.2.9'>
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for (project in rootProject.children) {

buildscript {
dependencies {
classpath("com.github.vlsi.gradle:checksum-dependency-plugin:1.26.0") {
classpath("com.github.vlsi.gradle:checksum-dependency-plugin:1.45.0") {
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
}
}
Expand All @@ -54,8 +54,8 @@ val expectedSha512 = mapOf(
to "okhttp-4.1.0.jar",
"93E7A41BE44CC17FB500EA5CD84D515204C180AEC934491D11FC6A71DAEA761FB0EECEF865D6FD5C3D88AAF55DCE3C2C424BE5BA5D43BEBF48D05F1FA63FA8A7"
to "okio-2.2.2.jar",
"2AB28DC6026A9CFC869C6287501D1002B8F2B61C7C3896B61A5616CE686DD41FD22EE9FD2D122111E4DABAA8359A4947C3F43B9DF29B1AFC8AA5D809A8188CAD"
to "checksum-dependency-plugin-1.26.0.jar"
"993FD75CCCE1618BBE64BB2ED55242836C2B01442AD0AE98DA03CD672EAFF935567921304B6E8705AAE87367FDF7B8FF684C992A45E8008DDB4EF7E73FEA4DAD"
to "checksum-dependency-plugin-1.45.0.jar"
)

fun File.sha512(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*
*/

package com.github.vlsi.gradle.buildtools

import org.apache.tools.ant.filters.FixCrLfFilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*
*/

package com.github.vlsi.gradle.license

import com.fasterxml.jackson.databind.DeserializationFeature
Expand Down Expand Up @@ -230,4 +229,4 @@ class EnumItem(
val name: String,
val detailsUrl: String,
val seeAlso: List<String>
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*
*/

package com.github.vlsi.gradle.license

import org.gradle.api.Plugin
Expand Down
3 changes: 2 additions & 1 deletion checksum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ignored-keys />
<trusted-keys>
<trusted-key id='379ce192d401ab61' group='com.diffplug.durian' />
<trusted-key id='379ce192d401ab61' group='com.diffplug.spotless' />
<trusted-key id='105cb91cac2aee0e' group='com.github.autostyle' />
<trusted-key id='461a804f2609fd89' group='com.github.shyiko.klob' />
<trusted-key id='59a252fb1199d873' group='com.google.code.findbugs' />
<trusted-key id='7a01b0f236e5430f' group='com.google.code.gson' />
Expand Down Expand Up @@ -42,6 +42,7 @@
<trusted-key id='41321490758aad6f' group='org.codehaus.groovy' />
<trusted-key id='6525fd70cc303655' group='org.codehaus.mojo' />
<trusted-key id='466caed6e0747d50' group='org.codehaus.plexus' />
<trusted-key id='0e91c2de43b72bb1' group='org.ec4j.core' />
<trusted-key id='c7bf26d0bb617866' group='org.eclipse.aether' />
<trusted-key id='5b05ccde140c2876' group='org.eclipse.jgit' />
<trusted-key id='a6adfc93ef34893e' group='org.hamcrest' />
Expand Down
29 changes: 13 additions & 16 deletions gradle/license-header.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
/*
* Copyright 2019 Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
Copyright 2019 Vladimir Sitnikov <sitnikov.vladimir@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

0 comments on commit 8f9353c

Please sign in to comment.