mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 19:26:18 +00:00
[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:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user