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

Supporting K2 with Skate + update to IJ 2024.2.1 #1006

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -40,7 +40,7 @@ jobs:

- name: Build and run tests
id: gradle
run: ./gradlew check
run: ./gradlew check testIdeUi

- name: Print build scan url
if: always()
Expand Down
27 changes: 14 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ plugins {
alias(libs.plugins.binaryCompatibilityValidator)
}

buildscript {
dependencies {
// Apply boms for buildscript classpath
classpath(platform(libs.asm.bom))
classpath(platform(libs.kotlin.bom))
classpath(platform(libs.coroutines.bom))
classpath(platform(libs.kotlin.gradlePlugins.bom))
}
}

apiValidation {
// only :tools:cli is tracking this right now
// Annoyingly this only uses simple names
Expand Down Expand Up @@ -156,7 +166,7 @@ subprojects {
}
}

tasks.withType<JavaCompile>().configureEach { options.release.set(17) }
tasks.withType<JavaCompile>().configureEach { options.release.set(libs.versions.jvmTarget.map(String::toInt)) }
}

val isForIntelliJPlugin =
Expand Down Expand Up @@ -208,19 +218,10 @@ subprojects {
this.jvmTarget.set(jvmTargetVersion)
freeCompilerArgs.addAll(
// Enhance not null annotated type parameter's types to definitely not null types
// (@NotNull T
// => T & Any)
// (@NotNull T => T & Any)
"-Xenhance-type-parameter-types-to-def-not-null",
// Use fast implementation on Jar FS. This may speed up compilation time, but currently
// it's
// an experimental mode
// TODO toe-hold but we can't use it yet because it emits a warning that fails with
// -Werror
// https://youtrack.jetbrains.com/issue/KT-54928
// "-Xuse-fast-jar-file-system",
// Support inferring type arguments based on only self upper bounds of the corresponding
// type
// parameters
// type parameters
"-Xself-upper-bound-inference",
"-Xjsr305=strict",
// Match JVM assertion behavior:
Expand Down Expand Up @@ -336,7 +337,7 @@ subprojects {
}
}
project.dependencies {
configure<IntelliJPlatformDependenciesExtension> { intellijIdeaCommunity("2024.1.2") }
configure<IntelliJPlatformDependenciesExtension> { intellijIdeaCommunity("2024.2.1") }
}

if (hasProperty("SgpIntellijArtifactoryBaseUrl")) {
Expand Down
11 changes: 8 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
agp = "8.6.1"
agpAlpha = "8.6.1"
anvil = "2.5.0-beta11"
# Release notes: https://asm.ow2.io/versions.html
asm = "9.7"
bugsnagGradle = "8.1.0"
circuit = "0.23.1"
compose-jb = "1.7.0-rc01"
Expand All @@ -13,7 +15,8 @@ dokka = "1.9.20"
errorproneGradle = "3.1.0"
gradle-retry = "1.6.0"
intellij-platform = "2.1.0"
jdk = "22"
# Temporary until https://bugs.openjdk.org/browse/JDK-8331027 is fixed in 23
jdk = "21"
jvmTarget = "17"
jewel = "0.25.0"
jna = "5.15.0"
Expand Down Expand Up @@ -69,6 +72,7 @@ wire = { id = "com.squareup.wire", version.ref = "wire" }
[libraries]
agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
agpAlpha = { module = "com.android.tools.build:gradle", version.ref = "agpAlpha" }
asm-bom = { module = "org.ow2.asm:asm-bom", version.ref = "asm" }
autoService-annotations = "com.google.auto.service:auto-service-annotations:1.1.1"
autoService-ksp = "dev.zacsweers.autoservice:auto-service-ksp:1.2.0"
bugsnag = "com.bugsnag:bugsnag:3.7.2"
Expand Down Expand Up @@ -108,13 +112,14 @@ gradlePlugins-wire = { module = "com.squareup.wire:wire-gradle-plugin", version.
guava = "com.google.guava:guava:33.3.1-jre"
kaml = { module = "com.charleskorn.kaml:kaml", version.ref = "kaml" }
kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" }
kotlin-gradlePlugins-bom = { module = "org.jetbrains.kotlin:kotlin-gradle-plugins-bom", version.ref = "kotlin" }
kotlin-poet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinPoet" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
kotlinShell = "eu.jrie.jetbrains:kotlin-shell-core:0.2.1"
ktfmt = { module = "com.facebook:ktfmt", version.ref = "ktfmt" }
jewel-bridge = { module = "org.jetbrains.jewel:jewel-ide-laf-bridge-241", version.ref = "jewel" }
jewel-standalone = { module = "org.jetbrains.jewel:jewel-int-ui-standalone-241", version.ref = "jewel" }
jewel-bridge = { module = "org.jetbrains.jewel:jewel-ide-laf-bridge-242", version.ref = "jewel" }
jewel-standalone = { module = "org.jetbrains.jewel:jewel-int-ui-standalone-242", version.ref = "jewel" }
jgrapht = "org.jgrapht:jgrapht-core:1.5.2"
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
jna-platform = { module = "net.java.dev.jna:jna-platform", version.ref = "jna" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PLUGIN_ID=com.slack.intellij.artifactory
PLUGIN_NAME=Artifactory Authenticator
PLUGIN_DESCRIPTION=A plugin for authenticating plugin repositories with Artifactory.
VERSION_NAME=0.1.1
PLUGIN_SINCE_BUILD=241
PLUGIN_SINCE_BUILD=242
ARTIFACTORY_URL_SUFFIX=artifactory-authenticator
# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
Expand Down
2 changes: 1 addition & 1 deletion platforms/intellij/skate/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ dependencies {
// https://plugins.jetbrains.com/docs/intellij/android-studio.html#open-source-plugins-for-android-studio
// https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
// https://plugins.jetbrains.com/plugin/22989-android/versions/stable
plugin("org.jetbrains.android:241.17011.79")
plugin("org.jetbrains.android:242.21829.142")
bundledPlugins(
"com.intellij.java",
"org.intellij.plugins.markdown",
Expand Down
2 changes: 1 addition & 1 deletion platforms/intellij/skate/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PLUGIN_ID=com.slack.intellij.skate
PLUGIN_NAME=Skate
PLUGIN_DESCRIPTION=A plugin for IntelliJ and Android Studio for faster Kotlin and Android development!
VERSION_NAME=0.1.0
PLUGIN_SINCE_BUILD=241
PLUGIN_SINCE_BUILD=242
ARTIFACTORY_URL_SUFFIX=skate
# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.intellij.psi.search.GlobalSearchScope
import foundry.intellij.skate.SkatePluginSettings
import foundry.intellij.skate.modeltranslator.model.TranslatorBundle
import foundry.intellij.skate.util.snakeToCamelCase
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.getReturnTypeReference
import org.jetbrains.kotlin.idea.base.psi.getReturnTypeReferences
import org.jetbrains.kotlin.psi.KtBlockExpression
import org.jetbrains.kotlin.psi.KtConstructorCalleeExpression
import org.jetbrains.kotlin.psi.KtImportDirective
Expand Down Expand Up @@ -94,7 +94,7 @@ object TranslatorHelper {

// If the function doesn't have a return type, then it can't be a translator and no need to
// process it.
val destinationModelRef = element.getReturnTypeReference()
val destinationModelRef = element.getReturnTypeReferences().firstOrNull()
val destinationModel = destinationModelRef?.text ?: return null

// If the source model is a String and the destination isn't an enum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
canCloseContents="true" secondary="false" icon="AllIcons.Actions.Lightning"/>
</extensions>

<extensions defaultExtensionNs="org.jetbrains.kotlin">
<supportsKotlinPluginMode supportsK2="true" />
</extensions>

<projectListeners>
<listener
class="foundry.intellij.skate.WhatsNewToolWindowListener"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ import foundry.tracing.ValueType
import foundry.tracing.model.newTagBuilder
import java.time.Instant
import okio.ByteString
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class SkateTraceReporterTest : BasePlatformTestCase() {

override fun setUp() {
Expand All @@ -35,6 +39,7 @@ class SkateTraceReporterTest : BasePlatformTestCase() {
settings.isTracingEnabled = false
}

@Test
fun testSpanCreatedWithCorrectTags() {
val traceTags =
newTagBuilder().apply {
Expand Down Expand Up @@ -77,6 +82,7 @@ class SkateTraceReporterTest : BasePlatformTestCase() {
}
}

@Test
fun testSpanNotCreatedWhenSpanDataIsEmpty() {
val listOfSpans =
SkateTraceReporter(project)
Expand All @@ -92,6 +98,7 @@ class SkateTraceReporterTest : BasePlatformTestCase() {
assertThat(listOfSpans).isNull()
}

@Test
fun testSpanNotCreatedWhenIdeVersionEmpty() {
val listOfSpans =
SkateTraceReporter(project)
Expand Down
Loading