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

Bump dependencies and cleanup #265

Merged
merged 1 commit into from
Dec 14, 2024
Merged
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 compiler-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ abstract class UpdatePluginVersionTask : DefaultTask() {

destination.get().asFile.forEachLine { line ->
if (line.startsWith("package")) packageLine = line
if (line.contains("const val VERSION")) currentVersion = line.split("\"")[1]
if (line.contains("const val VERSION")) currentVersion = line.split('"')[1]
}
if (currentVersion == version.get()) return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet.Companion.COMMON_MAIN_
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
import org.jetbrains.kotlin.gradle.plugin.kotlinToolingVersion

public class ComposeInvestigatorGradleSubplugin : KotlinCompilerPluginSupportPlugin {
override fun apply(target: Project) {
Expand All @@ -27,7 +28,12 @@ public class ComposeInvestigatorGradleSubplugin : KotlinCompilerPluginSupportPlu
version = VERSION,
)

override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true
// TODO test this
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean {
val project = kotlinCompilation.target.project
val kotlinVersion = project.kotlinToolingVersion
return kotlinVersion.major == 2
}

override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider<List<SubpluginOption>> {
val project = kotlinCompilation.target.project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// SPDX-License-Identifier: Apache-2.0
package land.sungbin.composeinvestigator.gradle

internal const val VERSION = "2.1.0-Beta1-1.0.0-b1"
internal const val VERSION = "2.1.0-1.0.0.a1"
11 changes: 6 additions & 5 deletions compiler-integration-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ kotlin {

jvm()

iosArm64()
iosX64()
iosSimulatorArm64()
// TODO
// iosArm64()
// iosX64()
// iosSimulatorArm64()

sourceSets {
commonMain {
Expand Down Expand Up @@ -55,6 +56,6 @@ kotlin {

dependencies {
configurations
.filter { conf -> conf.name.contains("kotlinCompilerPluginClasspath") }
.forEach { conf -> conf(projects.compiler) }
.filter { configuration -> configuration.name.contains("kotlinCompilerPluginClasspath", ignoreCase = true) }
.forEach { configuration -> configuration(projects.compiler) }
}
2 changes: 1 addition & 1 deletion compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
testImplementation(projects.runtime)
testImplementation(libs.compose.runtime)
testImplementation(libs.test.diffutil)
testImplementation(libs.test.kluent) // FIXME Temporary library to use until KT-53336 is resolved
testImplementation(libs.test.kluent) // TODO Temporary library to use until KT-53336 is resolved

testImplementation(kotlin("test-junit5", version = libs.versions.kotlin.core.get()))
testImplementation(kotlin("compiler-embeddable", version = libs.versions.kotlin.core.get()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package land.sungbin.composeinvestigator.compiler

import androidx.compose.compiler.plugins.kotlin.analysis.StabilityInferencer
import java.util.EnumSet
import land.sungbin.composeinvestigator.compiler.ComposeInvestigatorPluginRegistrar.Companion.DefaultIrValidatorConfig
import land.sungbin.composeinvestigator.compiler.analysis.DurableComposableKeyAnalyzer
import land.sungbin.composeinvestigator.compiler.lower.InvalidationProcessTracingFirstTransformer
import land.sungbin.composeinvestigator.compiler.lower.InvalidationTraceTableInstanceTransformer
Expand Down Expand Up @@ -61,9 +62,8 @@ public class ComposeInvestigatorFirstPhaseExtension(
performBasicIrValidation(
moduleFragment,
pluginContext.irBuiltIns,
phaseName = "Before ComposeInvestigator First Phase",
checkProperties = true,
checkTypes = false, // TODO KT-68663
"Before ComposeInvestigator First Phase",
DefaultIrValidatorConfig,
)
}

Expand All @@ -81,9 +81,8 @@ public class ComposeInvestigatorFirstPhaseExtension(
performBasicIrValidation(
moduleFragment,
pluginContext.irBuiltIns,
phaseName = "After ComposeInvestigator First Phase",
checkProperties = true,
checkTypes = false, // TODO KT-68663
"After ComposeInvestigator First Phase",
DefaultIrValidatorConfig,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package land.sungbin.composeinvestigator.compiler

import java.util.EnumSet
import land.sungbin.composeinvestigator.compiler.ComposeInvestigatorPluginRegistrar.Companion.DefaultIrValidatorConfig
import land.sungbin.composeinvestigator.compiler.lower.InvalidationSkipTracingLastTransformer
import land.sungbin.composeinvestigator.compiler.lower.InvalidationTraceTableInstanceTransformer
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
Expand Down Expand Up @@ -43,9 +44,8 @@ public class ComposeInvestigatorLastPhaseExtension(
performBasicIrValidation(
moduleFragment,
pluginContext.irBuiltIns,
phaseName = "Before ComposeInvestigator Last Phase",
checkProperties = true,
checkTypes = false, // TODO KT-68663
"Before ComposeInvestigator Last Phase",
DefaultIrValidatorConfig,
)
}

Expand All @@ -59,9 +59,8 @@ public class ComposeInvestigatorLastPhaseExtension(
performBasicIrValidation(
moduleFragment,
pluginContext.irBuiltIns,
phaseName = "After ComposeInvestigator Last Phase",
checkProperties = true,
checkTypes = false, // There is implicit type downcasting: InvalidationType.Skipped -> InvalidationType
"After ComposeInvestigator Last Phase",
DefaultIrValidatorConfig,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package land.sungbin.composeinvestigator.compiler

import java.util.EnumSet
import org.jetbrains.kotlin.backend.common.IrValidatorConfig
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.cli.jvm.compiler.CompileEnvironmentException
import org.jetbrains.kotlin.com.intellij.mock.MockProject
Expand Down Expand Up @@ -60,5 +61,11 @@ public class ComposeInvestigatorPluginRegistrar : ComponentRegistrar {
public companion object {
public val DefaultEnabledFeatureFlags: EnumSet<FeatureFlag> =
EnumSet.allOf(FeatureFlag::class.java).apply { remove(FeatureFlag.StateInitializerTracking) }

public val DefaultIrValidatorConfig: IrValidatorConfig =
IrValidatorConfig(
checkProperties = true,
checkTypes = false, // TODO KT-68663
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.compose.compiler.plugins.kotlin.EmptyModuleMetrics
import androidx.compose.compiler.plugins.kotlin.FeatureFlags
import androidx.compose.compiler.plugins.kotlin.analysis.StabilityInferencer
import androidx.compose.compiler.plugins.kotlin.irTrace
import androidx.compose.compiler.plugins.kotlin.lower.ComposableSymbolRemapper
import androidx.compose.compiler.plugins.kotlin.lower.DurableKeyTransformer
import androidx.compose.compiler.plugins.kotlin.lower.DurableKeyVisitor
import land.sungbin.composeinvestigator.compiler.ComposeInvestigatorCommandLineProcessor.Companion.PLUGIN_ID
Expand Down Expand Up @@ -38,7 +37,6 @@ public class DurableComposableKeyAnalyzer(
) : DurableKeyTransformer(
context = context,
keyVisitor = DurableKeyVisitor(),
symbolRemapper = ComposableSymbolRemapper(),
stabilityInferencer = stabilityInferencer,
metrics = EmptyModuleMetrics,
featureFlags = featureFlags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.config.messageCollector
import org.jetbrains.kotlin.diagnostics.DiagnosticReporterFactory
import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticsCollector
import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticsCollector.RawReporter
import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory
import org.jetbrains.kotlin.fir.BinaryModuleData
import org.jetbrains.kotlin.fir.DependencyListForCliModule
Expand Down Expand Up @@ -149,7 +150,11 @@ class KotlinK2Compiler private constructor(private val environment: KotlinCoreEn
projectEnvironment = projectEnvironment,
)

val reporter = DiagnosticReporterFactory.createReporter()
val reporter = DiagnosticReporterFactory.createReporter(
RawReporter { message, severity ->
if (severity.isError) error(message) else println("[${severity.name}] $message")
},
)
val analysis = buildResolveAndCheckFirFromKtFiles(session, listOf(file.toKtFile(project)), reporter)

return FirAnalysisResult(FirResult(listOf(analysis)), reporter)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SONATYPE_AUTOMATIC_RELEASE=true
RELEASE_SIGNING_ENABLED=true

GROUP=in.sungb.composeinvestigator
VERSION_NAME=2.1.0-Beta1-1.0.0-b1
VERSION_NAME=2.1.0-1.0.0.a1

POM_DESCRIPTION=Trace the recomposition of a Composable with its cause without boilerplate code.
POM_INCEPTION_YEAR=2024
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ gradle-android = "8.7.3"
gradle-publish-maven = "0.30.0"
gradle-test-logging = "4.0.0"

kotlin-core = "2.1.0-Beta1"
kotlin-core = "2.1.0"
kotlin-dokka = "2.0.0-Beta"
kotlin-coroutines = "1.9.0"

androidx-activity = "1.9.3"
androidx-annotation = "1.9.1"

compose-activity = "1.9.3"
compose-multiplatform = "1.7.0"
compose-multiplatform = "1.7.1"

spotless = "6.25.0"
ktlint = "1.5.0"
Expand Down
12 changes: 5 additions & 7 deletions runtime/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// Copyright 2024 Ji Sungbin
// SPDX-License-Identifier: Apache-2.0
import org.gradle.kotlin.dsl.dokka
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
kotlin("multiplatform")
alias(libs.plugins.kotlin.dokka)
Expand All @@ -24,7 +21,6 @@ dokka {
}
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
kotlin {
explicitApi()
jvmToolchain(libs.versions.jdk.get().toInt())
Expand All @@ -38,9 +34,11 @@ kotlin {

jvm()

iosArm64()
iosX64()
iosSimulatorArm64()
// FIXME Task :runtime:linkDebugTestIosSimulatorArm64 FAILED
// e: java.lang.NullPointerException
// iosArm64()
// iosX64()
// iosSimulatorArm64()

sourceSets {
commonMain {
Expand Down