build-logic: migrate Spotless to a convention plugin

This commit is contained in:
Harsh Shandilya 2021-11-09 21:33:59 +05:30
parent 1040552dbf
commit 96a9211f9e
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
9 changed files with 62 additions and 34 deletions

1
build-logic/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,3 @@
plugins { `kotlin-dsl` }
dependencies { implementation(libs.build.spotless) }

View file

@ -0,0 +1,29 @@
rootProject.name = "build-logic"
enableFeaturePreview("VERSION_CATALOGS")
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } }
}
rootProject.name = "build-logic"
enableFeaturePreview("VERSION_CATALOGS")
include("android-plugins")
include("automation-plugins")
include("kotlin-plugins")

View file

@ -0,0 +1,24 @@
/*
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins { id("com.diffplug.spotless") }
spotless {
kotlin {
ktfmt().googleStyle()
target("**/*.kt")
targetExclude("**/build/")
}
kotlinGradle {
ktfmt().googleStyle()
target("**/*.kts")
}
format("xml") {
target("**/*.xml")
targetExclude("**/build/", ".idea/")
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
}