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

Update to K2 #510

Merged
merged 44 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8d8d6a8
Updates
ZacSweers Nov 19, 2023
7cfb278
Update KCT
ZacSweers Nov 20, 2023
a72d554
Cleanups
ZacSweers Nov 20, 2023
aad6d23
Update CI
ZacSweers Nov 20, 2023
b7868d5
Merge branch 'main' into z/k2
ZacSweers Feb 3, 2024
dadd175
Add .kotlin to .gitignore
ZacSweers Feb 3, 2024
aa7bca4
Misc opt-ins and beta3 fixes
ZacSweers Feb 3, 2024
169a162
Update KCT to alpha02
ZacSweers Feb 3, 2024
a6e2c04
Update KCT + add KSP2 testing
ZacSweers Feb 3, 2024
bda9150
Add exclusions
ZacSweers Feb 3, 2024
be85d19
Spotless
ZacSweers Feb 3, 2024
6be1472
Oops one too many
ZacSweers Feb 3, 2024
06a2077
concurrency
ZacSweers Feb 3, 2024
f967b6a
Merge branch 'main' into z/k2
ZacSweers Feb 3, 2024
c0edb9a
Remove JDK from matrix
ZacSweers Feb 3, 2024
8cc1358
Typo
ZacSweers Feb 3, 2024
399b895
Spotless
ZacSweers Feb 3, 2024
0858302
Enable CC
ZacSweers Feb 3, 2024
d700886
Enable caching and COD
ZacSweers Feb 3, 2024
020b7d9
Fixes
ZacSweers Feb 3, 2024
cb9ae2e
Disable CC in publishing
ZacSweers Feb 3, 2024
5875041
Mark validateProguardRules as not CC compatible
ZacSweers Feb 3, 2024
3820d9e
Beta4
ZacSweers Feb 14, 2024
bcc8f2b
Merge branch 'main' into z/k2
ZacSweers Mar 5, 2024
bc3b493
Update KSP2 and KCT bits
ZacSweers Mar 5, 2024
588b88e
Update to beta5
ZacSweers Mar 21, 2024
63ccda3
Merge branch 'main' into z/k2
ZacSweers Mar 21, 2024
d749f28
kct 0.5.0-alpha06
ZacSweers Mar 21, 2024
b7444fb
Try raising
ZacSweers Mar 21, 2024
36a017f
Use correct rename
ZacSweers Mar 21, 2024
ad76c34
Update CI
ZacSweers Mar 21, 2024
6ebab3c
KSP 1.0.20
ZacSweers Apr 5, 2024
6ecfe78
Merge branch 'main' into z/k2
ZacSweers Apr 10, 2024
302f6f0
RC1
ZacSweers Apr 10, 2024
010cbcc
Migrate to kotlin-metadata
ZacSweers Apr 10, 2024
235bf88
Merge branch 'main' into z/k2
ZacSweers Apr 29, 2024
000c299
RC2
ZacSweers Apr 29, 2024
88a36cc
KSP RC2
ZacSweers Apr 30, 2024
c1fcde7
RC3
ZacSweers May 10, 2024
0870d50
Merge branch 'main' into z/k2
ZacSweers May 12, 2024
c1e0136
KSP RC3
ZacSweers May 13, 2024
60e65f1
2.0.0 final
ZacSweers May 21, 2024
fb769a6
KSP final + lint alpha
ZacSweers May 22, 2024
15af991
Merge branch 'main' into z/k2
ZacSweers May 22, 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
27 changes: 17 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
name: CI

on: [ push, pull_request ]
on:
# Only run push on main
push:
branches:
- main
paths-ignore:
- '**/*.md'
# Always run on PRs
pull_request:
branches: [ main ]

concurrency:
group: 'ci-${{ github.event.merge_group.head_ref || github.head_ref }}-${{ github.workflow }}'
cancel-in-progress: true

jobs:
build:
name: 'JDK ${{ matrix.java }} - KSP ${{ matrix.ksp_enabled }} - Kotlin ${{ matrix.kotlin }} - K2 ${{ matrix.k2_enabled }}'
name: 'KSP ${{ matrix.ksp_enabled }} / K2 ${{ matrix.k2_enabled }}'
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '21' ]
kotlin: [ '1.9.24' ]
ksp_enabled: [ true, false ]
k2_enabled: [ true, false ]
fail-fast: false

env:
DEP_OVERRIDE_kotlin: ${{ matrix.kotlin }}
DEP_OVERRIDE_java: ${{ matrix.java }}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -29,10 +36,10 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
java-version: '21'

- name: Build project
run: ./gradlew build check -Pmoshix.useKsp=${{ matrix.ksp_enabled }} -Pkotlin.experimental.tryK2=${{ matrix.k2_enabled }} --stacktrace
run: ./gradlew build check -Pmoshix.useKsp=${{ matrix.ksp_enabled }} -Pkotlin.experimental.tryK2=${{ matrix.k2_enabled }} --quiet

publish-snapshot:
needs: 'build'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ gen/
.gradle/
.gradletasknamecache
build/
.kotlin/

# Local configuration file (sdk path, etc)
local.properties
Expand Down
21 changes: 13 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
import com.android.build.api.dsl.Lint
import com.google.devtools.ksp.gradle.KspTask
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import java.net.URI
import org.jetbrains.dokka.gradle.DokkaTask
Expand Down Expand Up @@ -85,15 +86,19 @@ subprojects {
project.tasks.withType<JavaCompile>().configureEach { options.release.set(jvmTargetProvider) }
}
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(libs.versions.jvmTarget.map(JvmTarget::fromTarget))
freeCompilerArgs.addAll("-Xjsr305=strict", "-progressive")
// TODO disabled because Gradle's Kotlin handling is silly
// https://github.com/gradle/gradle/issues/16779
// allWarningsAsErrors = true
tasks
.withType<KotlinCompile>()
.matching { it !is KspTask }
.configureEach {
compilerOptions {
jvmTarget.set(libs.versions.jvmTarget.map(JvmTarget::fromTarget))
freeCompilerArgs.addAll("-Xjsr305=strict")
progressiveMode.set(true)
// TODO disabled because Gradle's Kotlin handling is silly
// https://github.com/gradle/gradle/issues/16779
// allWarningsAsErrors = true
}
}
}
if (
project.name != "sample" && !project.path.contains("sample") && !project.path.contains("test")
) {
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ POM_DEVELOPER_NAME=Zac Sweers
SONATYPE_STAGING_PROFILE=dev.zacsweers
RELEASE_SIGNING_ENABLED=true

org.gradle.configureondemand=false
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true

kapt.include.compile.classpath=false

Expand Down
15 changes: 9 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ gjf = "1.17.0"
incap = "1.0.0"
jdk = "21"
jvmTarget = "11"
kotlin = "1.9.24"
kotlinCompileTesting = "0.4.1"
kotlin = "2.0.0"
kotlinCompileTesting = "0.5.0-alpha07"
kotlinpoet = "1.16.0"
ksp = "1.9.24-1.0.20"
ksp = "2.0.0-1.0.21"
ktfmt = "0.49"
moshi = "1.15.1"
okhttp = "4.12.0"
Expand All @@ -33,7 +33,7 @@ dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
kotlinBinaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.14.0" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
lint = { id = "com.android.lint", version = "8.5.0-beta01" }
lint = { id = "com.android.lint", version = "8.6.0-alpha02" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.28.0" }
mavenShadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
moshix = { id = "dev.zacsweers.moshix", version = "0.26.0" } # Always replaced by the local plugin
Expand All @@ -56,7 +56,7 @@ incap = { module = "net.ltgt.gradle.incap:incap", version.ref = "incap" }
incap-processor = { module = "net.ltgt.gradle.incap:incap-processor", version.ref = "incap" }

kotlin-compilerEmbeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin" }
kotlin-metadata = { module = "org.jetbrains.kotlinx:kotlinx-metadata-jvm", version = "0.9.0" }
kotlin-metadata = { module = "org.jetbrains.kotlin:kotlin-metadata-jvm", version.ref = "kotlin" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-gradlePlugin-api = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "kotlin" }
Expand All @@ -68,8 +68,11 @@ kotlinpoet-metadata = { module = "com.squareup:kotlinpoet-metadata", version.ref
kotlinpoet-ksp = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlinpoet" }

ksp = { module = "com.google.devtools.ksp:symbol-processing", version.ref = "ksp" }
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
ksp-gradlePlugin = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" }
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
ksp-cli = { module = "com.google.devtools.ksp:symbol-processing-cmdline", version.ref = "ksp" }
ksp-aa-embeddable = { module = "com.google.devtools.ksp:symbol-processing-aa-embeddable", version.ref = "ksp" }
ksp-commonDeps = { module = "com.google.devtools.ksp:symbol-processing-common-deps", version.ref = "ksp" }

# Only present to trigger automatic renovate updates
ktfmt = { module = "com.facebook:ktfmt", version.ref = "ktfmt" }
Expand Down
Loading