Skip to content

Commit

Permalink
Add spotless config
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Oct 18, 2021
1 parent 229816d commit b562806
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 11 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
AutoValue Kotlin
================

auto-value-kotlin (AVK) is an [AutoValue](https://github.com/google/auto) extension that generates
binary-and-source-compatible, equivalent Kotlin `data` classes. This is intended to help migrations
by doing 95% of the work and just letting the developer come through and clean up the generated file
auto-value-kotlin (AVK) is an [AutoValue](https://github.com/google/auto) extension that generates
binary-and-source-compatible, equivalent Kotlin `data` classes. This is intended to help migrations
by doing 95% of the work and just letting the developer come through and clean up the generated file
as-needed.

The intended use of this project is to ease migration from AutoValue classes to Kotlin data classes
Expand All @@ -28,17 +28,17 @@ Configure the following arguments in your build file
```kotlin
kapt {
arguments {
// Source dir to output files to. This should usually be the src/main/java or src/main/kotlin
// Source dir to output files to. This should usually be the src/main/java or src/main/kotlin
// path of the project you’re running this in.
// REQUIRED
arg("avkSrc", file("src/main/java"))

// Colon-delimited string of simple class names to convert
// OPTIONAL. By default, AVK will convert all AutoValue models on the compilation.
arg("avkTargets", "ClassOne:ClassTwo")

// Boolean option to ignore nested classes. By default, AVK will error out when it encounters
// a nested AutoValue class as it has no means of safely converting the class since its
// a nested AutoValue class as it has no means of safely converting the class since its
// references are always qualified. This option can be set to true to make AVK just skip them
// and emit a warning.
// OPTIONAL. False by default.
Expand Down Expand Up @@ -108,4 +108,4 @@ License
limitations under the License.


[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/slack/auto/value/
[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/slack/auto/value/
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ spotless {
ktlint(ktlintVersion).userData(ktlintUserData)
trimTrailingWhitespace()
endWithNewline()
licenseHeaderFile("spotless/spotless.kt", "(import|plugins|buildscript|dependencies|pluginManagement)")
licenseHeaderFile("spotless/spotless.kt", "(import|plugins|buildscript|dependencies|pluginManagement|rootProject)")
}
}

Expand All @@ -105,4 +105,4 @@ dependencies {
testImplementation("com.google.truth:truth:1.1.3")
testImplementation("org.jetbrains.kotlin:kotlin-test:1.5.31")
testImplementation("com.github.tschuchortdev:kotlin-compile-testing-ksp:1.4.5")
}
}
17 changes: 16 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
rootProject.name = "auto-value-kotlin"
/*
* Copyright (C) 2021 Slack Technologies, LLC
*
* 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.
*/
rootProject.name = "auto-value-kotlin"
15 changes: 15 additions & 0 deletions spotless/spotless.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (C) $YEAR Slack Technologies, LLC
*
* 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.
*/
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright (C) 2021 Slack Technologies, LLC
*
* 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.
*/
@file:OptIn(DelicateKotlinPoetApi::class)

package com.slack.auto.value.kotlin
Expand Down

0 comments on commit b562806

Please sign in to comment.