Don't handle copyrights in spotless (#1438)

It can get it wrong too easily
This commit is contained in:
Zac Sweers
2021-11-30 21:34:35 -05:00
committed by GitHub
parent 9a9cc450c6
commit ace45a29cf
4 changed files with 2 additions and 85 deletions

View File

@@ -48,63 +48,26 @@ spotless {
indentWithSpaces(2) indentWithSpaces(2)
endWithNewline() endWithNewline()
} }
val externalJavaFiles = arrayOf(
"**/ClassFactory.java",
"**/Iso8601Utils.java",
"**/JsonReader.java",
"**/JsonReaderPathTest.java",
"**/JsonReaderTest.java",
"**/JsonScope.java",
"**/JsonUtf8Reader.java",
"**/JsonUtf8ReaderPathTest.java",
"**/JsonUtf8ReaderTest.java",
"**/JsonUtf8ReaderTest.java",
"**/JsonUtf8Writer.java",
"**/JsonUtf8WriterTest.java",
"**/JsonWriter.java",
"**/JsonWriterPathTest.java",
"**/JsonWriterTest.java",
"**/LinkedHashTreeMap.java",
"**/LinkedHashTreeMapTest.java",
"**/PolymorphicJsonAdapterFactory.java",
"**/RecursiveTypesResolveTest.java",
"**/Types.java",
"**/TypesTest.java"
)
val configureCommonJavaFormat: JavaExtension.() -> Unit = { val configureCommonJavaFormat: JavaExtension.() -> Unit = {
googleJavaFormat(libs.versions.gjf.get()) googleJavaFormat(libs.versions.gjf.get())
} }
java { java {
configureCommonJavaFormat() configureCommonJavaFormat()
target("**/*.java") target("**/*.java")
targetExclude( targetExclude("**/build/**",)
"**/spotless.java",
"**/build/**",
*externalJavaFiles
)
licenseHeaderFile("spotless/spotless.java")
}
format("externalJava", JavaExtension::class.java) {
// These don't use our spotless config for header files since we don't want to overwrite the
// existing copyright headers.
configureCommonJavaFormat()
target(*externalJavaFiles)
} }
kotlin { kotlin {
ktlint(libs.versions.ktlint.get()).userData(mapOf("indent_size" to "2")) ktlint(libs.versions.ktlint.get()).userData(mapOf("indent_size" to "2"))
target("**/*.kt") target("**/*.kt")
trimTrailingWhitespace() trimTrailingWhitespace()
endWithNewline() endWithNewline()
licenseHeaderFile("spotless/spotless.kt") targetExclude("**/Dependencies.kt", "**/build/**")
.updateYearWithLatest(false)
targetExclude("**/Dependencies.kt", "**/spotless.kt", "**/build/**")
} }
kotlinGradle { kotlinGradle {
ktlint(libs.versions.ktlint.get()).userData(mapOf("indent_size" to "2")) ktlint(libs.versions.ktlint.get()).userData(mapOf("indent_size" to "2"))
target("**/*.gradle.kts") target("**/*.gradle.kts")
trimTrailingWhitespace() trimTrailingWhitespace()
endWithNewline() endWithNewline()
licenseHeaderFile("spotless/spotless.kts", "(import|plugins|buildscript|dependencies|pluginManagement)")
} }
} }

View File

@@ -1,15 +0,0 @@
/*
* Copyright (C) $YEAR Square, Inc.
*
* 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
*
* https://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.
*/

View File

@@ -1,15 +0,0 @@
/*
* Copyright (C) $YEAR Square, Inc.
*
* 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
*
* https://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.
*/

View File

@@ -1,16 +0,0 @@
/*
* Copyright (C) $YEAR Square, Inc.
*
* 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
*
* https://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.
*/