Skip to content

Commit

Permalink
Update to K2 (#179)
Browse files Browse the repository at this point in the history
* Prepare for K2

* Spotless

* Fix wrong check of dispatchReceiver

* Remove custom FIR and just continue using it for checks

* Update CI

* Add .kotlin to ignored

* Update versions to beta03

* Fix RedactedOrigin

* Test fixes

* Extract error message logic

* node control is no longer needed

* Add toehold for KSP2

* Beta4

* Specify MppCheckerKind

* Update to beta5

* kct 0.5.0-alpha06

* RC1

* Avoid impl type

* Regen yarn lock

* Implement error messages

* Spotless

* Use KSP2

* RC2

* Import

* Extract error messages

* Wire up new FIR errors

* Use new carried over type inference

* KSP RC2

* Enable native binary compatibility checks

* RC3

* Spotless

* Old comment

* Fully align FIR and IR implementations

* Disable strict validation

* Fix wrong annotation

* Prep changelog

* ksp rc3

* 2.0.0 final

* KSP final
  • Loading branch information
ZacSweers authored May 22, 2024
1 parent b258730 commit ee2515a
Show file tree
Hide file tree
Showing 22 changed files with 1,114 additions and 694 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ concurrency:

jobs:
jvm:
name: jvm / StringConcat ${{ matrix.stringConcat }} / K2 ${{ matrix.k2 }}
name: jvm / StringConcat ${{ matrix.stringConcat }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
stringConcat: [ 'inline', 'indy', 'indy-with-constants' ]
k2: [ 'true', 'false']

steps:
- name: Checkout
Expand All @@ -43,7 +42,7 @@ jobs:
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
run: ./gradlew check -Dkjs=false -Dknative=false --stacktrace -Pstring_concat=${{ matrix.stringConcat }} -Pkotlin.experimental.tryK2=${{ matrix.k2 }} --quiet
run: ./gradlew check -Dkjs=false -Dknative=false --stacktrace -Pstring_concat=${{ matrix.stringConcat }} --quiet

all-platforms:
name: "platform / ${{ matrix.os }}"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/build
.idea
.gradle
.kotlin/
.iml
.project
.classpath
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changelog
**Unreleased**
--------------

- Update to Kotlin `2.0.0` (aka K2). This plugin now assumes 2.0, but can be used with Kotlin 1.9.x as well.
- Fully implement validation checks in FIR, allowing the plugin to report errors earlier and also (eventually) have errors appear automatically in the IDE.
- The IR plugin no longer validates by default.
- The `enabled` compiler option is no longer required and just defaults to true.
- Omit the stdlib from transitive dependencies on the compiler plugin and Gradle plugin artifacts. Both kotlinc and Gradle impose their own versions on the classpath.

1.8.1
Expand Down
17 changes: 9 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import kotlinx.validation.ExperimentalBCVApi
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

Expand All @@ -25,14 +24,16 @@ plugins {
alias(libs.plugins.binaryCompatibilityValidator)
}

plugins.withType<NodeJsRootPlugin>().configureEach {
// 16+ required for Apple Silicon support
// https://youtrack.jetbrains.com/issue/KT-49109#focus=Comments-27-5259190.0-0
the<NodeJsRootExtension>().nodeVersion = "18.0.0"
apiValidation {
ignoredProjects += listOf("sample", "sample-jvm")
@OptIn(ExperimentalBCVApi::class)
klib {
// This is only really possible to run on macOS
// strictValidation = true
enabled = true
}
}

apiValidation { ignoredProjects += listOf("sample", "sample-jvm") }

spotless {
format("misc") {
target("*.gradle", "*.md", ".gitignore")
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
org.gradle.jvmargs=-Xmx1g -Dfile.encoding=UTF-8

ksp.useKSP2=true

org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@

[versions]
autoService = "1.1.1"
kotlinCompileTesting = "0.4.1"
kotlin = "1.9.24"
kotlinCompileTesting = "0.5.0-alpha07"
kotlin = "2.0.0"
jdk = "21"
jvmTarget = "11"
ksp = "1.9.24-1.0.20"
ksp = "2.0.0-1.0.21"
ktfmt = "0.49"
moshi = "1.14.0"
moshi = "1.15.1"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.14.0" }
binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.15.0-Beta.2" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.28.0" }
Expand Down
Loading

0 comments on commit ee2515a

Please sign in to comment.