Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin 2.0.0-RC3 #258

Merged
merged 28 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
521f226
Kotlin 2.0.0-Beta1
drewhamilton Nov 16, 2023
05ed1a5
Remove non-K2 code from PokoMembersTransformer
drewhamilton Nov 16, 2023
8a73e29
Remove K2 parameter from PokoCompilerPluginTest
drewhamilton Nov 16, 2023
079f814
Remove duplicate K2 targets from :poko-tests
drewhamilton Nov 16, 2023
56fbd09
Add :poko-tests-without-k2 module
drewhamilton Nov 17, 2023
fcfa9fd
Revert "Remove non-K2 code from PokoMembersTransformer"
drewhamilton Nov 17, 2023
c7310df
Revert "Remove K2 parameter from PokoCompilerPluginTest"
drewhamilton Nov 17, 2023
c7296f5
Fix K2 usage in PokoCompilerPluginTest
drewhamilton Nov 17, 2023
0faa299
Fix PokoSample:compose custom annotation path
drewhamilton Nov 17, 2023
28eef79
Compose compiler 1.5.6-dev-k2.0.0-Beta1-06a03be2b42
drewhamilton Dec 15, 2023
eb0efcd
Kotlin 2.0.0-Beta2
drewhamilton Dec 15, 2023
5de75c2
Switch to non-deprecated Node properties
drewhamilton Dec 15, 2023
3d7c9f0
Implement IrDeclarationOrigin interface with PokoOrigin
drewhamilton Dec 16, 2023
dd0856e
KSP 2.0.0-Beta2-1.0.16 (#283)
3flex Dec 21, 2023
f43432f
Compose compiler 1.5.8-dev-k2.0.0-Beta2-99ed868a0f8 (#287)
3flex Jan 2, 2024
b23d180
Publish snapshots from kotlin-2.0 branch
drewhamilton Jan 2, 2024
8e8c6f3
Kotlin 2.0.0-Beta3
drewhamilton Jan 30, 2024
74ec238
Kotlin 2.0.0-Beta4
drewhamilton Feb 16, 2024
3957f9c
Add opt-in for experimental WASM DSL in :poko-tests
drewhamilton Feb 29, 2024
bed59d9
Switch to IrFactoryImpl where required
drewhamilton Feb 29, 2024
06fe2ec
KSP 2.0.0-Beta4-1.0.19
drewhamilton Mar 9, 2024
f08ea7f
Kotlin 2.0.0-Beta5
drewhamilton Mar 23, 2024
ef477f8
Kotlin 2.0.0-RC1 (#331)
3flex Apr 11, 2024
d564695
Kotlin 2.0.0-RC2
drewhamilton Apr 29, 2024
fb048ea
KSP 2.0.0-RC2-1.0.20
drewhamilton May 5, 2024
e27939e
Kotlin 2.0.0-RC3
drewhamilton May 14, 2024
c98d3a4
Use Kotlin's default Node version
drewhamilton May 20, 2024
261c9d5
Remove publishing from this branch
drewhamilton May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
uses: gradle/actions/setup-gradle@v3

- name: Test
run: ./gradlew :poko-tests:jvmTest :poko-tests:jvmK2Test --stacktrace
run: ./gradlew :poko-tests:jvmTest :poko-tests-without-k2:jvmTest --stacktrace
env:
poko_tests_jvm_toolchain_version: ${{ matrix.poko_tests_jvm_toolchain_version }}

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,6 @@ gradle-app.setting
# gradle/wrapper/gradle-wrapper.properties

# End of https://www.gitignore.io/api/gradle,intellij

# Kotlin
.kotlin
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.AppliedPlugin
import org.gradle.kotlin.dsl.buildConfigField
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtensionConfig
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

private val Project.pokoGroupId get() = property("PUBLISH_GROUP") as String
private val Project.pokoVersion get() = property("PUBLISH_VERSION") as String
Expand All @@ -31,8 +31,8 @@ class PokoBuildPlugin : Plugin<Project> {
}

private fun commonKotlinConfiguration(project: Project) {
project.tasks.withType(KotlinCompile::class.java).configureEach {
kotlinOptions.freeCompilerArgs += "-progressive"
project.tasks.withType(KotlinCompilationTask::class.java).configureEach {
compilerOptions.freeCompilerArgs.add("-progressive")
}
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ allprojects {
}

// The tests vary their own JVM targets among multiple targets. Do not overwrite them.
if (path != ":poko-tests") {
if (path !in setOf(":poko-tests", ":poko-tests-without-k2")) {
val kotlinPluginHandler: AppliedPlugin.() -> Unit = {
val javaVersion = JavaVersion.VERSION_1_8
project.tasks.withType<JavaCompile>().configureEach {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kotlin.code.style=official

PUBLISH_GROUP=dev.drewhamilton.poko
PUBLISH_VERSION=0.15.4-SNAPSHOT
PUBLISH_VERSION=0.16.0-SNAPSHOT

# Uncomment to enable snapshot dependencies:
#snapshots_repository=https://oss.sonatype.org/content/repositories/snapshots
Expand Down
10 changes: 4 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
[versions]

# https://androidx.dev/storage/compose-compiler/repository for versions matching new Kotlin versions:
androidx-compose-compiler = "1.5.14"
androidx-compose-runtime = "1.6.7"
kotlin = "1.9.24"
kotlin = "2.0.0-RC3"
kotlinCompileTesting = "1.5.1"
kotlinCompileTestingFork = "0.4.1"
kotlinCompileTestingFork = "0.5.0-alpha07"
# https://github.com/google/ksp/releases:
ksp = "1.9.24-1.0.20"
ksp = "2.0.0-RC3-1.0.20"

[libraries]

androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "androidx-compose-compiler" }
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "androidx-compose-runtime" }

autoService-annotations = { module = "com.google.auto.service:auto-service-annotations", version = "1.1.1" }
Expand Down Expand Up @@ -41,5 +38,6 @@ android-library = { id = "com.android.library", version = "8.4.0" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-compose-plugin = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinx-binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.14.0" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
63 changes: 19 additions & 44 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ binary-extensions@^2.0.0:
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==

brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"

brace-expansion@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
Expand Down Expand Up @@ -123,11 +115,6 @@ color-name@~1.1.4:
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==

[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==

[email protected]:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
Expand Down Expand Up @@ -207,17 +194,16 @@ glob-parent@~5.1.2:
dependencies:
is-glob "^4.0.1"

glob@7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023"
integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==
glob@8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
minimatch "^5.0.1"
once "^1.3.0"
path-is-absolute "^1.0.0"

has-flag@^4.0.0:
version "4.0.0"
Expand Down Expand Up @@ -310,17 +296,17 @@ [email protected]:
dependencies:
brace-expansion "^2.0.1"

minimatch@^3.0.4:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
minimatch@^5.0.1:
version "5.1.6"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
dependencies:
brace-expansion "^1.1.7"
brace-expansion "^2.0.1"

mocha@10.2.0:
version "10.2.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8"
integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==
mocha@10.3.0:
version "10.3.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.3.0.tgz#0e185c49e6dccf582035c05fa91084a4ff6e3fe9"
integrity sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==
dependencies:
ansi-colors "4.1.1"
browser-stdout "1.3.1"
Expand All @@ -329,13 +315,12 @@ [email protected]:
diff "5.0.0"
escape-string-regexp "4.0.0"
find-up "5.0.0"
glob "7.2.0"
glob "8.1.0"
he "1.2.0"
js-yaml "4.1.0"
log-symbols "4.1.0"
minimatch "5.0.1"
ms "2.1.3"
nanoid "3.3.3"
serialize-javascript "6.0.0"
strip-json-comments "3.1.1"
supports-color "8.1.1"
Expand All @@ -354,11 +339,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==

[email protected]:
version "3.3.3"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25"
integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==

normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
Expand Down Expand Up @@ -390,11 +370,6 @@ path-exists@^4.0.0:
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==

path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==

picomatch@^2.0.4, picomatch@^2.2.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
Expand Down Expand Up @@ -486,10 +461,10 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"

typescript@5.0.4:
version "5.0.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
typescript@5.4.3:
version "5.4.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.3.tgz#5c6fedd4c87bee01cd7a528a30145521f8e0feff"
integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==

[email protected]:
version "6.2.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.diagnostics.rendering.BaseDiagnosticRendererFactory
import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory
import org.jetbrains.kotlin.diagnostics.reportOn
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.analysis.checkers.MppCheckerKind
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.DeclarationCheckers
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirRegularClassChecker
Expand All @@ -32,7 +33,9 @@ internal class PokoFirCheckersExtension(
setOf(PokoFirRegularClassChecker)
}

internal object PokoFirRegularClassChecker : FirRegularClassChecker() {
internal object PokoFirRegularClassChecker : FirRegularClassChecker(
mppKind = MppCheckerKind.Common,
) {
override fun check(
declaration: FirRegularClass,
context: CheckerContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.declarations.IrProperty
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.createType
import org.jetbrains.kotlin.ir.util.hasAnnotation
Expand Down Expand Up @@ -151,7 +151,7 @@ internal class PokoMembersTransformer(
private fun IrFunction.mutateWithNewDispatchReceiverParameterForParentClass() {
val parentClass = parent as IrClass
val originalReceiver = requireNotNull(dispatchReceiverParameter)
dispatchReceiverParameter = IrValueParameterImpl(
dispatchReceiverParameter = IrFactoryImpl.createValueParameter(
startOffset = originalReceiver.startOffset,
endOffset = originalReceiver.endOffset,
origin = originalReceiver.origin,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package dev.drewhamilton.poko.ir

import org.jetbrains.kotlin.ir.declarations.IrDeclarationOriginImpl
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin

internal object PokoOrigin : IrDeclarationOriginImpl("GENERATED_POKO_CLASS_MEMBER")
internal object PokoOrigin : IrDeclarationOrigin, ReadOnlyProperty<Any?, PokoOrigin> {
override val name: String = "GENERATED_POKO_CLASS_MEMBER"

override fun toString(): String = name

override fun getValue(thisRef: Any?, property: KProperty<*>): PokoOrigin = this
}
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ class PokoCompilerPluginTest(
verbose = false
jvmTarget = JvmTarget.JVM_1_8.description
if (k2) {
languageVersion = "2.0"
supportsK2 = true
} else {
supportsK2 = false
languageVersion = "1.9"
}

val commandLineProcessor = PokoCommandLineProcessor()
Expand Down
79 changes: 79 additions & 0 deletions poko-tests-without-k2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.plugin.NATIVE_COMPILER_PLUGIN_CLASSPATH_CONFIGURATION_NAME
import org.jetbrains.kotlin.gradle.plugin.PLUGIN_CLASSPATH_CONFIGURATION_NAME
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(libs.plugins.kotlin.multiplatform)
}

tasks.withType<KotlinCompile>().configureEach {
compilerOptions.languageVersion.set(KotlinVersion.KOTLIN_1_9)
}

val jvmToolchainVersion: Int? = System.getenv()["poko_tests_jvm_toolchain_version"]?.toInt()

kotlin {
jvmToolchainVersion?.let { jvmToolchain(it) }

jvm()

js {
nodejs()
// Produce a JS file for performance tests.
binaries.executable()
}

mingwX64()

linuxArm64()
linuxX64()

iosArm64()
iosSimulatorArm64()
iosX64()

macosArm64()
macosX64()

tvosArm64()
tvosX64()
tvosSimulatorArm64()

@OptIn(ExperimentalWasmDsl::class)
wasmJs().nodejs()
@OptIn(ExperimentalWasmDsl::class)
wasmWasi().nodejs()

watchosArm32()
watchosArm64()
watchosDeviceArm64()
watchosSimulatorArm64()
watchosX64()

androidNativeArm32()
androidNativeArm64()

androidNativeX86()
androidNativeX64()

sourceSets {
commonMain {
dependencies {
implementation(project(":poko-annotations"))
}
}
commonTest {
dependencies {
implementation(libs.kotlin.test)
implementation(libs.assertk)
}
}
}
}

dependencies {
add(PLUGIN_CLASSPATH_CONFIGURATION_NAME, project(":poko-compiler-plugin"))
add(NATIVE_COMPILER_PLUGIN_CLASSPATH_CONFIGURATION_NAME, project(":poko-compiler-plugin"))
}
5 changes: 5 additions & 0 deletions poko-tests-without-k2/src/commonMain/kotlin/Super.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
abstract class Super {
override fun equals(other: Any?): Boolean = other == true
override fun hashCode(): Int = 50934
override fun toString(): String = "superclass"
}
Loading