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 #264

Merged
merged 33 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b65c61b
Update deps
ZacSweers Feb 3, 2024
1da6206
Enable CoD and CC
ZacSweers Feb 3, 2024
951979b
Enable android.lint.useK2Uast
ZacSweers Feb 3, 2024
0e02195
Enable KSP2
ZacSweers Feb 3, 2024
b4d5522
Update lint
ZacSweers Feb 3, 2024
313cea6
Speed up tests
ZacSweers Feb 4, 2024
5685ed5
Exclude .kotlin
ZacSweers Feb 4, 2024
58c94b8
Run tests with K2 enabled
ZacSweers Feb 4, 2024
0c3fe63
Beta4
ZacSweers Feb 14, 2024
bcef49e
alpha09
ZacSweers Feb 14, 2024
8ee7318
Test K2 UAST on CI
ZacSweers Feb 14, 2024
130bf9c
Remove custom lint client from tests
ZacSweers Feb 14, 2024
c76a0fc
This is... necessary?
ZacSweers Feb 14, 2024
9672a2f
Merge branch 'main' into z/k2
ZacSweers Mar 1, 2024
26f8b0c
Update KSP
ZacSweers Mar 1, 2024
a6b578e
Remove workaround
ZacSweers Mar 1, 2024
c2c88c3
Disable
ZacSweers Mar 1, 2024
a802657
Don't fail fast
ZacSweers Mar 2, 2024
202a0e1
Spotless
ZacSweers Mar 2, 2024
b5d7d22
Merge branch 'main' into z/k2
ZacSweers Mar 21, 2024
20e305f
Beta5 and others
ZacSweers Mar 21, 2024
861f19c
Merge branch 'main' into z/k2
ZacSweers Apr 11, 2024
2f27451
RC1
ZacSweers Apr 11, 2024
117a97b
Comment
ZacSweers Apr 11, 2024
40805fb
Merge branch 'main' into z/k2
ZacSweers Apr 30, 2024
42fcabc
RC2
ZacSweers Apr 30, 2024
361eece
RC3
ZacSweers May 13, 2024
2df52f0
Merge branch 'main' into z/k2
ZacSweers May 13, 2024
edf59f9
Lint beta01
ZacSweers May 13, 2024
28a6738
Merge branch 'main' into z/k2
ZacSweers May 13, 2024
c877f2f
Merge branch 'main' into z/k2
ZacSweers May 22, 2024
0ba280a
2.0 final
ZacSweers May 22, 2024
4f7e2d1
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
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ concurrency:

jobs:
build:
name: "K2 UAST = ${{ matrix.useK2Uast }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
useK2Uast: [true, false]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -35,7 +40,7 @@ jobs:
uses: gradle/actions/setup-gradle@v3

- name: Build
run: ./gradlew check
run: ./gradlew check -DuseK2Uast=${{ matrix.useK2Uast }}

- name: (Fail-only) Upload build reports
if: failure()
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle
.kotlin/
local.properties
.fleet
.idea
Expand Down
15 changes: 15 additions & 0 deletions compose-lint-checks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
alias(libs.plugins.lint)
alias(libs.plugins.ksp)
alias(libs.plugins.mavenPublish)
alias(libs.plugins.buildConfig)
}

lint {
Expand All @@ -22,6 +23,20 @@ lint {
fatal += setOf("LintDocExample", "LintImplPsiEquals", "UastImplementation")
}

buildConfig {
packageName("slack.lint.compose")
useKotlinOutput { internalVisibility = true }
sourceSets.getByName("test") {
buildConfigField(
"Boolean",
"USE_K2_UAST",
providers.systemProperty("useK2Uast").orElse("false"),
)
}
}

tasks.test { maxParallelForks = Runtime.getRuntime().availableProcessors() * 2 }

dependencies {
compileOnly(libs.lint.api)
ksp(libs.autoService.ksp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package slack.lint.compose

import com.android.tools.lint.checks.infrastructure.LintDetectorTest
import com.android.tools.lint.checks.infrastructure.TestLintClient
import com.android.tools.lint.checks.infrastructure.TestLintTask
import com.android.tools.lint.checks.infrastructure.TestMode
import com.android.tools.lint.detector.api.Detector
Expand Down Expand Up @@ -82,9 +81,6 @@ abstract class BaseComposeLintTest : LintDetectorTest() {
),
)

/** Optional override to customize the lint client name when running lint test tasks. */
open val lintClientName: String? = null

/**
* Lint periodically adds new "TestModes" to LintDetectorTest. These modes act as a sort of chaos
* testing mechanism, adding different common variations of code (extra spaces, extra parens, etc)
Expand All @@ -100,7 +96,7 @@ abstract class BaseComposeLintTest : LintDetectorTest() {

override fun lint(): TestLintTask {
val lintTask = super.lint()
lintClientName?.let { lintTask.clientFactory { TestLintClient(it) } }
lintTask.configureOptions { flags -> flags.setUseK2Uast(TestBuildConfig.USE_K2_UAST) }
lintTask.allowCompilationErrors(false)

skipTestModes?.let { testModesToSkip -> lintTask.skipTestModes(*testModesToSkip) }
Expand Down
16 changes: 9 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
org.gradle.jvmargs=-Xms1g -Xmx4g -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=1g

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

# Enable remote build cache
# https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true

# Suppress warnings about experimental AGP properties we're using
# Ironically, this property itself is also experimental, so we have to suppress it too.
android.suppressUnsupportedOptionWarnings=android.suppressUnsupportedOptionWarnings,\
android.experimental.lint.missingBaselineIsEmptyBaseline
android.experimental.lint.missingBaselineIsEmptyBaseline,\
android.lint.useK2Uast

android.experimental.lint.missingBaselineIsEmptyBaseline=true

android.lint.useK2Uast=true

# https://github.com/google/ksp/issues/1839
ksp.useKSP2=false

# Versioning bits
GROUP=com.slack.lint.compose
POM_URL=https://github.com/slackhq/compose-lints/
Expand Down
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[versions]
kotlin = "1.9.24"
kotlin = "2.0.0"
ktfmt = "0.49"
jdk = "21"
jvmTarget = "17"
lint = "31.4.1"
lint-latest = "31.6.0-alpha02"

[plugins]
buildConfig = { id = "com.github.gmazzo.buildconfig", version = "5.3.5" }
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.6" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
lint = { id = "com.android.lint", version = "8.6.0-alpha02" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version = "1.9.24-1.0.20" }
ksp = { id = "com.google.devtools.ksp", version = "2.0.0-1.0.21" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.28.0" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }

Expand Down