Skip to content

Commit

Permalink
Merge pull request #20 from bennyhuo/feature/kotlin-1.9
Browse files Browse the repository at this point in the history
Bump Kotlin version to 1.9.20.
  • Loading branch information
bennyhuo committed Nov 18, 2023
2 parents d604b6f + 1c4da16 commit 2d84820
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 110 deletions.
63 changes: 3 additions & 60 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The artifacts have been deployed to maven central repository. Set up your projec

```gradle
plugins {
id("com.google.devtools.ksp") version "1.8.20-1.0.11" // ksp
id("com.google.devtools.ksp") version "1.9.20-1.0.14" // ksp
id "org.jetbrains.kotlin.kapt" // kapt
}
...
Expand All @@ -92,7 +92,7 @@ This is a nearly perfect version I think. It works like `copy` does. You can ins

```gradle
plugins {
kotlin("jvm") version "1.8.20"
kotlin("jvm") version "1.9.20"
id("com.bennyhuo.kotlin.plugin.deepcopy") version "<latest-version>"
}
Expand All @@ -105,64 +105,7 @@ And then try to call the `deepCopy` function directly!

# Change Log

## v1.8.20-1.0.1

Fix dependencies error [#19](https://github.com/bennyhuo/KotlinDeepCopy/issues/19).

## v1.8.20-1.0.0

Build with Kotlin 1.8.20.

## v1.7.10.0

Build with Kotlin 1.7.10.

### Runtime

* Rename `DeepCopiable` to `DeepCopyable` which seems more widely used.

### Reflect

* Make `deepCopy` function available to `DeepCopyable` only.
* [NEW] Add support for Kotlin JS.

### APT & KSP

* Support multi-module project in a unified way.

### KCP

* Generate a copy-like function `deepCopy` for data classes annotated with `@DeepCopy`.
* Generate implementation of `deepCopy` for data classes implemented `DeepCopyable`.
* Add super type `DeepCopyable` to those data classes annotated with `@DeepCopy`.
* Carefully handle manually written `deepCopy` function.
* Add support for Collections.

## v1.5.0 Reflect & Apt

Compiles on Kotlin v1.5.0. Update `kotlinx-metadata-jvm` to v0.3.0.

## v1.3.72 Apt

Build with Kotlin v1.3.72.

* [Bug] Fixed: rewriting DeepCopy.kt.
* [Bug] Fixed: maven dependency scope with runtime module.

## v1.3.0 Apt

* [Feature] Collections/Maps are supported.
* [Feature] Prebuilt types are supported by annotation `DeepCopyConfig`. See [Prebuilt](apt-impl/sample/src/main/kotlin/com/bennyhuo/kotlin/deepcopy/sample/prebuilt/PrebuiltClass.kt)
* [Bug] Fixed: Data classes with their dependencies should be place into the same package.
* [Bug] Fixed: Improperly import a type variable when component type is not reified.

## v1.2.0 Apt

* [Feature] Add support for nullable types. It will allow copy loop sematically and an exception will be thrown to respond when compiling. See [Recursive.kt](apt-impl/sample/src/main/kotlin/com/bennyhuo/kotlin/deepcopy/sample/recursive/Recursive.kt).

## v1.1.0 Apt

* [Feature] Add default values to generated `deepCopy` functions.
See [releases](https://github.com/bennyhuo/KotlinDeepCopy/releases).

# License

Expand Down
4 changes: 2 additions & 2 deletions annotations/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
api("com.bennyhuo.kotlin:annotations-module-support:1.8.20-1.0.0")
api("com.bennyhuo.kotlin:annotations-module-support:$moduleSupportVersion")
}
}
}
}

rootProject.plugins.withType<NodeJsRootPlugin> {
rootProject.the<NodeJsRootExtension>().nodeVersion = "16.0.0"
}
}
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext {
kotlin_version = "1.8.20"
ksp_version = "1.8.20-1.0.11"
kotlin_version = "1.9.20"
ksp_version = "1.9.20-1.0.14"
}
}

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.20" apply false
id("org.jetbrains.kotlin.jvm") version "1.9.20" apply false
id("org.jetbrains.dokka") version "1.7.10" apply false
id("com.github.gmazzo.buildconfig") version "2.1.0" apply false
id("com.vanniktech.maven.publish") version "0.25.2" apply false
Expand Down
6 changes: 4 additions & 2 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* Created by benny.
*/
const val kotlinVersion = "1.8.20"
const val kspVersion = "1.8.20-1.0.11"
const val kotlinVersion = "1.9.20"
const val kspVersion = "1.9.20-1.0.14"
const val kotlinPoetVersion = "1.12.0"
const val moduleSupportVersion = "1.9.20-1.0.0"
const val compileTestingExtensionsVersion = "1.9.20-1.3.0"
30 changes: 0 additions & 30 deletions compiler/compiler-apt/build.gradle

This file was deleted.

27 changes: 27 additions & 0 deletions compiler/compiler-apt/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
java
kotlin("jvm")
}

dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
api("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.7.0")
api("com.bennyhuo:aptutils:1.8")
api("com.squareup:kotlinpoet:1.10.2")
api("com.squareup:kotlinpoet-metadata:1.10.2")

api(project(":annotations"))

api("com.bennyhuo.kotlin:apt-module-support:$moduleSupportVersion")
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xuse-experimental=com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview",
"-Xopt-in=kotlin.contracts.ExperimentalContracts"
)
}
}
6 changes: 3 additions & 3 deletions compiler/compiler-ksp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dependencies {
implementation("com.squareup:kotlinpoet:$kotlinPoetVersion")
implementation("com.squareup:kotlinpoet-ksp:$kotlinPoetVersion")

implementation("com.bennyhuo.kotlin:ksp-module-support:1.8.20-1.0.0")
implementation("com.bennyhuo.kotlin:ksp-module-support:$moduleSupportVersion")

implementation(project(":annotations"))
}

Expand All @@ -22,4 +22,4 @@ tasks.withType<KotlinCompile>().configureEach {
"-Xopt-in=kotlin.contracts.ExperimentalContracts"
)
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kotlin.code.style=official

VERSION_NAME=1.8.20-1.0.1
VERSION_NAME=1.9.20-1.0.1

GROUP=com.bennyhuo.kotlin

Expand Down
6 changes: 3 additions & 3 deletions kcp-impl/compiler-kcp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ dependencies {

testImplementation(project(":annotations"))
testImplementation(project(":runtime"))

testImplementation(kotlin("test-junit"))
testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")

testImplementation("com.bennyhuo.kotlin:kotlin-compile-testing-extensions:1.8.20-1.0.0")
testImplementation("com.bennyhuo.kotlin:kotlin-compile-testing-extensions:$compileTestingExtensionsVersion")
}

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions.freeCompilerArgs += listOf("-Xjvm-default=enable", "-opt-in=kotlin.RequiresOptIn")
compileKotlin.kotlinOptions.freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")

buildConfig {
packageName("$group.kcp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.builders.irGet
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.declarations.createExpressionBody
import org.jetbrains.kotlin.ir.util.properties

class DeepCopyClassTransformer(
Expand Down
8 changes: 4 additions & 4 deletions kcp-impl/sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version "1.8.20"
id "com.bennyhuo.kotlin.plugin.deepcopy" version "1.8.20.0"
id 'org.jetbrains.kotlin.jvm' version "1.9.20"
id "com.bennyhuo.kotlin.plugin.deepcopy" version "1.9.20.0"
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.20")
implementation("com.bennyhuo.kotlin:deepcopy-runtime:1.8.20.0")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.20")
implementation("com.bennyhuo.kotlin:deepcopy-runtime:1.9.20.0")
}

compileKotlin {
Expand Down
2 changes: 1 addition & 1 deletion test-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
implementation(kotlin("stdlib"))
implementation(project(":annotations"))

testImplementation("com.bennyhuo.kotlin:kotlin-compile-testing-extensions:1.8.0.0")
testImplementation("com.bennyhuo.kotlin:kotlin-compile-testing-extensions:$compileTestingExtensionsVersion")

testImplementation(project(":compiler:compiler-ksp"))
testImplementation(project(":compiler:compiler-apt"))
Expand Down
2 changes: 1 addition & 1 deletion test-common/testData/kapt/Recursive.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ data class Owner(val project: Project)
// EXPECT
// FILE: compiles.log
COMPILATION_ERROR
e: Project.java: (11, -1): error: Detect infinite copy loop. It will cause stack overflow to call Project.deepCopy() in the runtime.
e: Project.java: (9, -1): error: Detect infinite copy loop. It will cause stack overflow to call Project.deepCopy() in the runtime.

0 comments on commit 2d84820

Please sign in to comment.