Skip to content

Commit

Permalink
Update to Kotlin 1.7 + other deps (#1262)
Browse files Browse the repository at this point in the history
Co-authored-by: Egor Andreevich <egor@squareup.com>
  • Loading branch information
ZacSweers and Egorand committed Jun 12, 2022
1 parent c17e163 commit 298bc22
Show file tree
Hide file tree
Showing 27 changed files with 846 additions and 438 deletions.
5 changes: 1 addition & 4 deletions build.gradle.kts
Expand Up @@ -65,16 +65,13 @@ subprojects {
}
}
}
configure<MavenPublishPluginExtension> {
sonatypeHost = S01
}
}

apply(plugin = "com.diffplug.spotless")
configure<SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint(libs.versions.ktlint.get()).userData(mapOf("indent_size" to "2"))
ktlint(libs.versions.ktlint.get()).editorConfigOverride(mapOf("indent_size" to "2"))
trimTrailingWhitespace()
endWithNewline()

Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Expand Up @@ -14,3 +14,6 @@ POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=square
POM_DEVELOPER_NAME=Square, Inc.

SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true
20 changes: 11 additions & 9 deletions gradle/libs.versions.toml
Expand Up @@ -13,29 +13,31 @@
# limitations under the License.

[versions]
kotlin = "1.6.21"
kct = "1.4.8"
ksp = "1.6.20-1.0.5"
ktlint = "0.42.1"
kotlin = "1.7.0"
kct = "1.4.9-alpha01"
ksp = "1.7.0-1.0.6"
ktlint = "0.45.2"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
dokka = { id = "org.jetbrains.dokka", version = "1.6.20" }
dokka = { id = "org.jetbrains.dokka", version = "1.6.21" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
spotless = { id = "com.diffplug.spotless", version = "6.2.1" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.18.0" }
spotless = { id = "com.diffplug.spotless", version = "6.7.1" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.20.0" }

[libraries]
autoCommon = { module = "com.google.auto:auto-common", version = "1.1.2" }
guava = { module = "com.google.guava:guava", version = "30.1.1-jre" }
guava = { module = "com.google.guava:guava", version = "31.1-jre" }
javapoet = "com.squareup:javapoet:1.13.0"

autoService = "com.google.auto.service:auto-service-annotations:1.0"
autoService-ksp = "dev.zacsweers.autoservice:auto-service-ksp:1.0.0"

kotlin-compilerEmbeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin" }
kotlin-annotationProcessingEmbeddable = { module = "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable", version.ref = "kotlin" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlin-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
kotlin-metadata = { module = "org.jetbrains.kotlinx:kotlinx-metadata-jvm", version = "0.4.0" }
kotlin-metadata = { module = "org.jetbrains.kotlinx:kotlinx-metadata-jvm", version = "0.4.2" }

ksp = { module = "com.google.devtools.ksp:symbol-processing", version.ref = "ksp" }
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
Expand Down
2 changes: 2 additions & 0 deletions interop/kotlinx-metadata/build.gradle.kts
Expand Up @@ -39,4 +39,6 @@ dependencies {
testImplementation(libs.truth)
testImplementation(libs.compileTesting)
testImplementation(libs.kotlinCompileTesting)
testImplementation(libs.kotlin.annotationProcessingEmbeddable)
testImplementation(libs.kotlin.compilerEmbeddable)
}
5 changes: 4 additions & 1 deletion interop/ksp/test-processor/build.gradle.kts
Expand Up @@ -31,7 +31,10 @@ dependencies {
implementation(libs.autoService)
compileOnly(libs.ksp.api)
ksp(libs.autoService.ksp)
// Always force the latest version of the KSP impl in tests to match what we're building against
// Always force the latest version of the KSP/kotlin impl in tests to match what we're building against
testImplementation(libs.ksp.api)
testImplementation(libs.kotlin.compilerEmbeddable)
testImplementation(libs.kotlin.annotationProcessingEmbeddable)
testImplementation(libs.ksp)
testImplementation(libs.kotlinCompileTesting)
testImplementation(libs.kotlinCompileTesting.ksp)
Expand Down
2 changes: 2 additions & 0 deletions kotlinpoet/build.gradle.kts
Expand Up @@ -47,4 +47,6 @@ dependencies {
testImplementation(libs.jimfs)
testImplementation(libs.ecj)
testImplementation(libs.kotlinCompileTesting)
testImplementation(libs.kotlin.annotationProcessingEmbeddable)
testImplementation(libs.kotlin.compilerEmbeddable)
}
Expand Up @@ -320,7 +320,8 @@ internal class CodeWriter constructor(
|Current code block:
|- Format parts: ${codeBlock.formatParts.map(::escapeCharacterLiterals)}
|- Arguments: ${codeBlock.args}
|""".trimMargin()
|
""".trimMargin()
}
statementLine = 0
}
Expand All @@ -333,7 +334,8 @@ internal class CodeWriter constructor(
|Current code block:
|- Format parts: ${codeBlock.formatParts.map(::escapeCharacterLiterals)}
|- Arguments: ${codeBlock.args}
|""".trimMargin()
|
""".trimMargin()
}
if (statementLine > 0) {
unindent(2) // End a multi-line statement. Decrease the indentation level.
Expand Down
Expand Up @@ -117,7 +117,8 @@ class AnnotationSpecTest {
| r = arrayOf(Float::class, Double::class),
|)
|public class Taco
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down Expand Up @@ -147,7 +148,8 @@ class AnnotationSpecTest {
| r = arrayOf(Float::class, Double::class),
|)
|public class IsAnnotated
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down Expand Up @@ -193,7 +195,8 @@ class AnnotationSpecTest {
| r = arrayOf(Float::class, Double::class),
|)
|public class Taco
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down Expand Up @@ -231,7 +234,8 @@ class AnnotationSpecTest {
| r = arrayOf(Float::class, Double::class),
|)
|public class Taco
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down Expand Up @@ -319,7 +323,7 @@ class AnnotationSpecTest {
| @Suppress("Things")
| val annotatedString = "AnnotatedString"
|}
""".trimMargin()
""".trimMargin()
)
}

Expand Down Expand Up @@ -362,7 +366,8 @@ class AnnotationSpecTest {
|@JavaClassWithArrayValueAnnotation.AnnotationWithArrayValue(value = arrayOf(Object::class,
| Boolean::class))
|public class Result
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down Expand Up @@ -390,7 +395,7 @@ class AnnotationSpecTest {
|
|@AnnotationSpecTest.AnnotationWithArrayValue(value = arrayOf(Object::class, Boolean::class))
|public class Result
""".trimMargin()
""".trimMargin()
)
}

Expand All @@ -412,7 +417,7 @@ class AnnotationSpecTest {
|@JavaClassWithArrayValueAnnotation.AnnotationWithArrayValue(value = arrayOf(Object::class,
| Boolean::class))
|public class Result
""".trimMargin()
""".trimMargin()
)
}

Expand All @@ -432,7 +437,7 @@ class AnnotationSpecTest {
|
|@AnnotationSpecTest.AnnotationWithArrayValue(value = arrayOf(Object::class, Boolean::class))
|public class Result
""".trimMargin()
""".trimMargin()
)
}

Expand Down
24 changes: 16 additions & 8 deletions kotlinpoet/src/test/java/com/squareup/kotlinpoet/CodeBlockTest.kt
Expand Up @@ -201,7 +201,8 @@ class CodeBlockTest {
|Current code block:
|- Format parts: [«, print(, «, %L, », ), \n, »]
|- Arguments: [1 + 1]
|""".trimMargin()
|
""".trimMargin()
)
}

Expand All @@ -219,7 +220,8 @@ class CodeBlockTest {
|Current code block:
|- Format parts: [«, print(, %L, », ), \n, »]
|- Arguments: [1 + 1]
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down Expand Up @@ -460,7 +462,8 @@ class CodeBlockTest {
|list.forEach { element ->
| println(element)
|}
|""".trimMargin()
|
""".trimMargin()
)
}

Expand All @@ -475,7 +478,8 @@ class CodeBlockTest {
|listOf("${'$'}{1.toString()}").forEach { element ->
| println(element)
|}
|""".trimMargin()
|
""".trimMargin()
)
}

Expand All @@ -494,7 +498,8 @@ class CodeBlockTest {
|} else {
| println("bar")
|}
|""".trimMargin()
|
""".trimMargin()
)
}

Expand All @@ -521,7 +526,8 @@ class CodeBlockTest {
| "Long string that would wrap the line 2 ") {
| }
|}
|""".trimMargin()
|
""".trimMargin()
)
}

Expand All @@ -537,7 +543,8 @@ class CodeBlockTest {
|Modeling a kdoc
|
|Statement with no args
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down Expand Up @@ -585,7 +592,8 @@ class CodeBlockTest {
| "London",
| )
|)
|""".trimMargin()
|
""".trimMargin()
)
}
}
Expand Up @@ -89,7 +89,8 @@ class CrossplatformTest {
|}
|
|public actual typealias AtomicRef<V> = AtomicReference<V>
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down Expand Up @@ -118,7 +119,8 @@ class CrossplatformTest {
|
| public constructor(message: String)
|}
|""".trimMargin()
|
""".trimMargin()
)
}

Expand All @@ -139,7 +141,8 @@ class CrossplatformTest {
|public expect val bar: String
|
|public actual val bar: String = "Hello"
|""".trimMargin()
|
""".trimMargin()
)
}

Expand All @@ -166,7 +169,8 @@ class CrossplatformTest {
|public expect fun f1(): Int
|
|public actual fun f1() = 1
|""".trimMargin()
|
""".trimMargin()
)
}

Expand Down

0 comments on commit 298bc22

Please sign in to comment.