[Java][native] add spotless gradle/mvn plugin (#14641)

* add spotless plugin to java native client

* apply spotless

* Revert "apply spotless"

This reverts commit 485d50bbde.
This commit is contained in:
William Cheng
2023-02-09 10:29:40 +08:00
committed by GitHub
parent 011982ab9c
commit 687bace3f3
10 changed files with 340 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'com.diffplug.spotless'
group = 'org.openapitools'
version = '0.1.0'
@@ -8,6 +9,9 @@ buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0'
}
}
repositories {
@@ -79,3 +83,26 @@ dependencies {
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
testImplementation "junit:junit:$junit_version"
}
// Use spotless plugin to automatically format code, remove unused import, etc
// To apply changes directly to the file, run `gradlew spotlessApply`
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
// comment out below to run spotless as part of the `check` task
enforceCheck false
format 'misc', {
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
target '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// don't need to set target, it is inferred from java
// apply a specific flavor of google-java-format
googleJavaFormat('1.8').aosp().reflowLongStrings()
removeUnusedImports()
importOrder()
}
}