Merge changes from topic "kotlin_1.5.20" into androidx-main
* changes:
Fix xprocessing tests for kotlin 1.5.21
Upgrade to Kotlin 1.5.21 and KSP 1.5.20-beta04
diff --git a/activity/activity-compose/build.gradle b/activity/activity-compose/build.gradle
index 907ed2e..c9c5b9e 100644
--- a/activity/activity-compose/build.gradle
+++ b/activity/activity-compose/build.gradle
@@ -26,11 +26,11 @@
}
dependencies {
- kotlinPlugin "androidx.compose.compiler:compiler:1.0.0-rc02"
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
- api "androidx.compose.runtime:runtime:1.0.0-rc02"
- api "androidx.compose.runtime:runtime-saveable:1.0.0-rc02"
+ api(projectOrArtifact(":compose:runtime:runtime"))
+ api(projectOrArtifact(":compose:runtime:runtime-saveable"))
api(projectOrArtifact(":activity:activity-ktx"))
api("androidx.compose.ui:ui:1.0.0-rc02")
diff --git a/activity/activity-compose/samples/build.gradle b/activity/activity-compose/samples/build.gradle
index e5e84a5..db3752a 100644
--- a/activity/activity-compose/samples/build.gradle
+++ b/activity/activity-compose/samples/build.gradle
@@ -25,7 +25,7 @@
}
dependencies {
- kotlinPlugin "androidx.compose.compiler:compiler:1.0.0-rc02"
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
compileOnly projectOrArtifact(":annotation:annotation-sampled")
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXComposePlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXComposePlugin.kt
index ed0fdc1..4085989 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXComposePlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXComposePlugin.kt
@@ -56,47 +56,7 @@
project.configureAndroidCommonOptions(app)
}
is KotlinBasePluginWrapper -> {
- val conf = project.configurations.create("kotlinPlugin")
- val kotlinPlugin = conf.incoming.artifactView { view ->
- view.attributes { attributes ->
- attributes.attribute(
- Attribute.of("artifactType", String::class.java),
- ArtifactTypeDefinition.JAR_TYPE
- )
- }
- }.files
-
- project.tasks.withType(KotlinCompile::class.java).configureEach { compile ->
- // TODO(b/157230235): remove when this is enabled by default
- compile.kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
- compile.inputs.files({ kotlinPlugin })
- .withPropertyName("composeCompilerExtension")
- .withNormalizer(ClasspathNormalizer::class.java)
- compile.doFirst {
- if (!kotlinPlugin.isEmpty) {
- compile.kotlinOptions.freeCompilerArgs +=
- "-Xplugin=${kotlinPlugin.first()}"
- }
- }
- }
-
- project.afterEvaluate {
- val androidXExtension =
- project.extensions.findByType(AndroidXExtension::class.java)
- if (androidXExtension != null) {
- if (androidXExtension.publish.shouldPublish()) {
- project.tasks.withType(KotlinCompile::class.java)
- .configureEach { compile ->
- compile.doFirst {
- if (!kotlinPlugin.isEmpty) {
- compile.kotlinOptions.freeCompilerArgs +=
- listOf("-P", composeSourceOption)
- }
- }
- }
- }
- }
- }
+ project.configureComposePluginForAndroidx()
if (plugin is KotlinMultiplatformPluginWrapper) {
project.configureForMultiplatform()
@@ -319,3 +279,48 @@
}
}
}
+
+fun Project.configureComposePluginForAndroidx() {
+
+ val conf = project.configurations.create("kotlinPlugin")
+ val kotlinPlugin = conf.incoming.artifactView { view ->
+ view.attributes { attributes ->
+ attributes.attribute(
+ Attribute.of("artifactType", String::class.java),
+ ArtifactTypeDefinition.JAR_TYPE
+ )
+ }
+ }.files
+
+ project.tasks.withType(KotlinCompile::class.java).configureEach { compile ->
+ // TODO(b/157230235): remove when this is enabled by default
+ compile.kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
+ compile.inputs.files({ kotlinPlugin })
+ .withPropertyName("composeCompilerExtension")
+ .withNormalizer(ClasspathNormalizer::class.java)
+ compile.doFirst {
+ if (!kotlinPlugin.isEmpty) {
+ compile.kotlinOptions.freeCompilerArgs +=
+ "-Xplugin=${kotlinPlugin.first()}"
+ }
+ }
+ }
+
+ project.afterEvaluate {
+ val androidXExtension =
+ project.extensions.findByType(AndroidXExtension::class.java)
+ if (androidXExtension != null) {
+ if (androidXExtension.publish.shouldPublish()) {
+ project.tasks.withType(KotlinCompile::class.java)
+ .configureEach { compile ->
+ compile.doFirst {
+ if (!kotlinPlugin.isEmpty) {
+ compile.kotlinOptions.freeCompilerArgs +=
+ listOf("-P", composeSourceOption)
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
index 3e175c1..845d077 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
@@ -38,7 +38,6 @@
import org.gradle.build.event.BuildEventsListenerRegistry
import org.gradle.kotlin.dsl.KotlinClosure1
import org.gradle.kotlin.dsl.extra
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File
import java.util.concurrent.ConcurrentHashMap
@@ -235,8 +234,6 @@
task.setOutput(File(project.getDistributionDirectory(), "task_outputs.txt"))
task.removePrefix(project.getCheckoutRoot().path)
}
-
- project.ensureOneKotlinCompilerRunner()
}
@Suppress("UnstableApiUsage")
@@ -258,23 +255,6 @@
androidx.build.dependencies.guavaVersion = getVersion("guavaJre")
}
- // Experimental workaround for https://youtrack.jetbrains.com/issue/KT-46820
- // Creates one kotlin compiler runner as soon as possible, to avoid concurrency issues when
- // trying to create multiple at once
- private fun Project.ensureOneKotlinCompilerRunner() {
- val taskGraph = project.gradle.taskGraph
- taskGraph.whenReady {
- for (task in taskGraph.allTasks) {
- val compile = task as? KotlinCompile
- if (compile != null) {
- @Suppress("invisible_member")
- compile.compilerRunner()
- break
- }
- }
- }
- }
-
companion object {
const val PROJECT_OR_ARTIFACT_EXT_NAME = "projectOrArtifact"
}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/RecorderTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/RecorderTest.kt
index 7d12101..86b8114 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/RecorderTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/RecorderTest.kt
@@ -396,12 +396,14 @@
verify(videoRecordEventListener, atLeastOnce()).accept(captor.capture())
captor.allValues.run {
assertThat(size).isAtLeast(
- 1 /* Start */ +
- 5 /* Status */ +
- 1 /* Pause */ +
- 1 /* Resume */ +
- 5 /* Status */ +
- 1 /* Stop */
+ (
+ 1 /* Start */ +
+ 5 /* Status */ +
+ 1 /* Pause */ +
+ 1 /* Resume */ +
+ 5 /* Status */ +
+ 1 /* Stop */
+ )
)
// Ensure duration and bytes are increasing
diff --git a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/BasicUnitTest.kt b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/BasicUnitTest.kt
deleted file mode 100644
index bfcdb5a..0000000
--- a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/BasicUnitTest.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package androidx.camera.integration.camera2.pipe
-
-import org.junit.Test
-
-import org.junit.Assert.assertEquals
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-class BasicUnitTest {
- @Test
- fun addition_isCorrect() {
- assertEquals(4, 2 + 2)
- }
-}
\ No newline at end of file
diff --git a/camera/integration-tests/viewtestapp/build.gradle b/camera/integration-tests/viewtestapp/build.gradle
index 03d55ff..098cdd0 100644
--- a/camera/integration-tests/viewtestapp/build.gradle
+++ b/camera/integration-tests/viewtestapp/build.gradle
@@ -14,6 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+import androidx.build.AndroidXComposePluginKt
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -22,6 +26,8 @@
apply(from: "../../camera-view/dependencies.gradle")
+AndroidXComposePluginKt.configureComposePluginForAndroidx(project)
+
android {
defaultConfig {
applicationId "androidx.camera.integration.view"
@@ -49,15 +55,6 @@
kotlinOptions {
jvmTarget = '1.8'
- useIR = true
- }
-
- buildFeatures {
- compose true
- }
-
- composeOptions {
- kotlinCompilerExtensionVersion "1.0.0-beta09"
}
}
@@ -78,9 +75,11 @@
implementation("androidx.appcompat:appcompat:1.3.0")
// Compose UI
- implementation("androidx.compose.ui:ui:1.0.0-beta09")
- implementation("androidx.compose.material:material:1.0.0-beta09")
- implementation("androidx.compose.ui:ui-tooling:1.0.0-beta09")
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
+ implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.ui:ui:1.0.0-rc02")
+ implementation("androidx.compose.material:material:1.0.0-rc02")
+ implementation("androidx.compose.ui:ui-tooling:1.0.0-rc02")
implementation("androidx.activity:activity-compose:1.3.0-beta02")
// Testing framework
@@ -103,4 +102,3 @@
exclude(group:"androidx.camera", module:"camera-core")
}
}
-
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractIrTransformTest.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractIrTransformTest.kt
index 776d801..1c44c15 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractIrTransformTest.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractIrTransformTest.kt
@@ -23,7 +23,7 @@
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContextImpl
import org.jetbrains.kotlin.backend.common.ir.BuiltinSymbolsBase
import org.jetbrains.kotlin.backend.common.ir.createParameterDeclarations
-import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions
+import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensionsImpl
import org.jetbrains.kotlin.backend.jvm.JvmNameProvider
import org.jetbrains.kotlin.backend.jvm.serialization.JvmIdSignatureDescriptor
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
@@ -36,7 +36,6 @@
import org.jetbrains.kotlin.descriptors.konan.DeserializedKlibModuleOrigin
import org.jetbrains.kotlin.descriptors.konan.KlibModuleOrigin
import org.jetbrains.kotlin.ir.IrElement
-import org.jetbrains.kotlin.ir.backend.jvm.serialization.EmptyLoggingContext
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmIrLinker
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.ir.builders.TranslationPluginContext
@@ -48,8 +47,8 @@
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.descriptors.IrFunctionFactory
import org.jetbrains.kotlin.ir.linkage.IrDeserializer
-import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator
import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator
+import org.jetbrains.kotlin.ir.util.IrMessageLogger
import org.jetbrains.kotlin.ir.util.ReferenceSymbolTable
import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.ir.util.TypeTranslator
@@ -58,9 +57,9 @@
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi2ir.Psi2IrConfiguration
import org.jetbrains.kotlin.psi2ir.Psi2IrTranslator
+import org.jetbrains.kotlin.psi2ir.generators.DeclarationStubGeneratorImpl
import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext
import org.jetbrains.kotlin.resolve.AnalyzingUtils
-import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import java.io.File
@@ -87,6 +86,7 @@
module: IrModuleFragment,
generatorContext: GeneratorContext,
irLinker: IrDeserializer,
+ diagnosticReporter: IrMessageLogger,
symbols: BuiltinSymbolsBase
) {
val context = IrPluginContextImpl(
@@ -97,6 +97,7 @@
typeTranslator = generatorContext.typeTranslator,
irBuiltIns = generatorContext.irBuiltIns,
linker = irLinker,
+ diagnosticReporter = diagnosticReporter,
symbols = symbols
)
pluginContext = context
@@ -123,6 +124,7 @@
module: IrModuleFragment,
generatorContext: GeneratorContext,
irLinker: IrDeserializer,
+ diagnosticReporter: IrMessageLogger,
symbols: BuiltinSymbolsBase
)
@@ -400,6 +402,8 @@
environment.configuration.languageVersionSettings,
Psi2IrConfiguration(ignoreErrors = false)
)
+ val messageLogger = environment.configuration[IrMessageLogger.IR_MESSAGE_LOGGER]
+ ?: IrMessageLogger.None
val symbolTable = SymbolTable(
JvmIdSignatureDescriptor(mangler),
IrFactoryImpl,
@@ -411,14 +415,14 @@
analysisResult.throwIfError()
AnalyzingUtils.throwExceptionOnErrors(analysisResult.bindingContext)
}
- val extensions = JvmGeneratorExtensions()
+ val extensions = JvmGeneratorExtensionsImpl()
val generatorContext = psi2ir.createGeneratorContext(
analysisResult.moduleDescriptor,
analysisResult.bindingContext,
symbolTable,
extensions = extensions
)
- val stubGenerator = DeclarationStubGenerator(
+ val stubGenerator = DeclarationStubGeneratorImpl(
generatorContext.moduleDescriptor,
generatorContext.symbolTable,
generatorContext.irBuiltIns.languageVersionSettings,
@@ -431,8 +435,6 @@
val frontEndContext = object : TranslationPluginContext {
override val moduleDescriptor: ModuleDescriptor
get() = generatorContext.moduleDescriptor
- override val bindingContext: BindingContext
- get() = generatorContext.bindingContext
override val symbolTable: ReferenceSymbolTable
get() = symbolTable
override val typeTranslator: TypeTranslator
@@ -443,7 +445,7 @@
generatorContext.irBuiltIns.functionFactory = functionFactory
val irLinker = JvmIrLinker(
generatorContext.moduleDescriptor,
- EmptyLoggingContext,
+ messageLogger,
generatorContext.irBuiltIns,
generatorContext.symbolTable,
functionFactory,
@@ -468,15 +470,14 @@
ExternalDependenciesGenerator(
generatorContext.symbolTable,
- irProviders,
- generatorContext.languageVersionSettings
+ irProviders
).generateUnboundSymbolsAsDependencies()
psi2ir.addPostprocessingStep { module ->
val old = stubGenerator.unboundSymbolGeneration
try {
stubGenerator.unboundSymbolGeneration = true
- postProcessingStep(module, generatorContext, irLinker, symbols)
+ postProcessingStep(module, generatorContext, irLinker, messageLogger, symbols)
} finally {
stubGenerator.unboundSymbolGeneration = old
}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralTransformTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralTransformTests.kt
index 2392999..128eb2e 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralTransformTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralTransformTests.kt
@@ -24,6 +24,7 @@
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.linkage.IrDeserializer
import org.jetbrains.kotlin.ir.util.DeepCopySymbolRemapper
+import org.jetbrains.kotlin.ir.util.IrMessageLogger
import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext
import org.jetbrains.kotlin.resolve.DelegatingBindingTrace
import org.junit.Test
@@ -564,6 +565,7 @@
module: IrModuleFragment,
generatorContext: GeneratorContext,
irLinker: IrDeserializer,
+ diagnosticReporter: IrMessageLogger,
symbols: BuiltinSymbolsBase
) {
val pluginContext = IrPluginContextImpl(
@@ -574,6 +576,7 @@
typeTranslator = generatorContext.typeTranslator,
irBuiltIns = generatorContext.irBuiltIns,
linker = irLinker,
+ diagnosticReporter = diagnosticReporter,
symbols = symbols
)
@Suppress("DEPRECATION")
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralV2TransformTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralV2TransformTests.kt
index 86e2efb..575f51a 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralV2TransformTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralV2TransformTests.kt
@@ -24,6 +24,7 @@
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.linkage.IrDeserializer
import org.jetbrains.kotlin.ir.util.DeepCopySymbolRemapper
+import org.jetbrains.kotlin.ir.util.IrMessageLogger
import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext
import org.jetbrains.kotlin.resolve.DelegatingBindingTrace
import org.junit.Test
@@ -566,6 +567,7 @@
module: IrModuleFragment,
generatorContext: GeneratorContext,
irLinker: IrDeserializer,
+ diagnosticReporter: IrMessageLogger,
symbols: BuiltinSymbolsBase
) {
val pluginContext = IrPluginContextImpl(
@@ -576,6 +578,7 @@
typeTranslator = generatorContext.typeTranslator,
irBuiltIns = generatorContext.irBuiltIns,
linker = irLinker,
+ diagnosticReporter = diagnosticReporter,
symbols = symbols
)
@Suppress("DEPRECATION")
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt
index e17879b..988f78a 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt
@@ -159,7 +159,7 @@
project: Project,
configuration: CompilerConfiguration
) {
- val KOTLIN_VERSION_EXPECTATION = "1.5.10"
+ val KOTLIN_VERSION_EXPECTATION = "1.5.21"
KotlinCompilerVersion.getVersion()?.let { version ->
val suppressKotlinVersionCheck = configuration.get(
ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK,
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/analysis/Stability.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/analysis/Stability.kt
index a457226..e36cc25 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/analysis/Stability.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/analysis/Stability.kt
@@ -33,7 +33,9 @@
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrGetObjectValue
import org.jetbrains.kotlin.ir.expressions.IrGetValue
+import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
+import org.jetbrains.kotlin.ir.symbols.IrScriptSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.IrDynamicType
import org.jetbrains.kotlin.ir.types.IrErrorType
@@ -47,6 +49,7 @@
import org.jetbrains.kotlin.ir.types.classifierOrFail
import org.jetbrains.kotlin.ir.types.classifierOrNull
import org.jetbrains.kotlin.ir.types.isAny
+import org.jetbrains.kotlin.ir.types.isMarkedNullable
import org.jetbrains.kotlin.ir.types.isNullable
import org.jetbrains.kotlin.ir.types.isPrimitiveType
import org.jetbrains.kotlin.ir.types.isString
@@ -54,7 +57,7 @@
import org.jetbrains.kotlin.ir.types.makeNotNull
import org.jetbrains.kotlin.ir.util.fqNameForIrSerialization
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
-import org.jetbrains.kotlin.ir.util.getInlinedClass
+import org.jetbrains.kotlin.ir.util.getInlineClassUnderlyingType
import org.jetbrains.kotlin.ir.util.isEnumClass
import org.jetbrains.kotlin.ir.util.isEnumEntry
import org.jetbrains.kotlin.ir.util.isFunctionOrKFunction
@@ -454,4 +457,44 @@
else -> stability
}
}
-}
\ No newline at end of file
+}
+
+/**
+ * Returns inline class for given class or null of type is not inlined
+ * TODO: Make this configurable for different backends (currently implements logic of JS BE)
+ */
+// From Kotin's InlineClasses.kt
+private fun IrType.getInlinedClass(): IrClass? {
+ if (this is IrSimpleType) {
+ val erased = erase(this) ?: return null
+ if (erased.isInline) {
+ if (this.isMarkedNullable()) {
+ var fieldType: IrType
+ var fieldInlinedClass = erased
+ while (true) {
+ fieldType = getInlineClassUnderlyingType(fieldInlinedClass)
+ if (fieldType.isMarkedNullable()) {
+ return null
+ }
+
+ fieldInlinedClass = fieldType.getInlinedClass() ?: break
+ }
+ }
+
+ return erased
+ }
+ }
+ return null
+}
+
+// From Kotin's InlineClasses.kt
+private tailrec fun erase(type: IrType): IrClass? {
+ val classifier = type.classifierOrFail
+
+ return when (classifier) {
+ is IrClassSymbol -> classifier.owner
+ is IrScriptSymbol -> null // TODO: check if correct
+ is IrTypeParameterSymbol -> erase(classifier.owner.superTypes.first())
+ else -> error(classifier)
+ }
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/AbstractComposeLowering.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/AbstractComposeLowering.kt
index 34a6197..4237e60 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/AbstractComposeLowering.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/AbstractComposeLowering.kt
@@ -34,7 +34,6 @@
import org.jetbrains.kotlin.builtins.getReceiverTypeFromFunctionType
import org.jetbrains.kotlin.builtins.getReturnTypeFromFunctionType
import org.jetbrains.kotlin.builtins.getValueParameterTypesFromFunctionType
-import org.jetbrains.kotlin.cfg.index
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
@@ -44,6 +43,7 @@
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
+import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
@@ -125,10 +125,8 @@
import org.jetbrains.kotlin.ir.types.makeNullable
import org.jetbrains.kotlin.ir.types.toKotlinType
import org.jetbrains.kotlin.ir.types.typeWith
-import org.jetbrains.kotlin.ir.util.ConstantValueGenerator
import org.jetbrains.kotlin.ir.util.DeepCopySymbolRemapper
import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET
-import org.jetbrains.kotlin.ir.util.TypeTranslator
import org.jetbrains.kotlin.ir.util.constructedClass
import org.jetbrains.kotlin.ir.util.functions
import org.jetbrains.kotlin.ir.util.getArguments
@@ -145,6 +143,7 @@
import org.jetbrains.kotlin.platform.jvm.isJvm
import org.jetbrains.kotlin.psi.psiUtil.endOffset
import org.jetbrains.kotlin.psi.psiUtil.startOffset
+import org.jetbrains.kotlin.psi2ir.generators.TypeTranslatorImpl
import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.resolve.DescriptorFactory
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
@@ -169,17 +168,11 @@
@ObsoleteDescriptorBasedAPI
protected val typeTranslator =
- TypeTranslator(
+ TypeTranslatorImpl(
context.symbolTable,
context.languageVersionSettings,
- context.builtIns
- ).apply {
- constantValueGenerator = ConstantValueGenerator(
- context.moduleDescriptor,
- context.symbolTable
- )
- constantValueGenerator.typeTranslator = this
- }
+ context.moduleDescriptor
+ )
protected val builtIns = context.irBuiltIns
@@ -1281,3 +1274,10 @@
// on jvm we can rely on type, but the owner can be unbound
type.classOrNull
}
+
+fun ParameterDescriptor.index(): Int =
+ when (this) {
+ is ReceiverParameterDescriptor -> -1
+ is ValueParameterDescriptor -> index
+ else -> error("expected either receiver or value parameter, but got: $this")
+ }
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/BitmapCapturingTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/BitmapCapturingTest.kt
index 56d88eb..6f9980d 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/BitmapCapturingTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/BitmapCapturingTest.kt
@@ -88,7 +88,7 @@
calledCount++
color11
}
- assertThat(calledCount).isEqualTo(100 * 50)
+ assertThat(calledCount).isEqualTo((100 * 50))
rule.onNodeWithTag(tag12)
.captureToImage()
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposeLayer.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposeLayer.desktop.kt
index 93ff419..84decba0 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposeLayer.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposeLayer.desktop.kt
@@ -124,6 +124,7 @@
}
override val locationOnScreen: Point
+ @Suppress("ACCIDENTAL_OVERRIDE") // KT-47743
get() = super.getLocationOnScreen()
override val density: Density
@@ -292,4 +293,4 @@
// We will know density only after SkiaLayer will be visible.
initOwner!!()
}
-}
\ No newline at end of file
+}
diff --git a/gradle.properties b/gradle.properties
index adcf1fd..74c033f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -11,9 +11,6 @@
android.useAndroidX=true
android.nonTransitiveRClass=true
android.disableAutomaticComponentCreation=true
-# Run multiple kotlin compilations in parallel within the same project.
-# See also https://github.com/JetBrains/kotlin/blob/1978db9d0e68a2ec29aded30a07e9c3c740c29f6/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinProperties.kt#L100 and https://blog.jetbrains.com/kotlin/2019/01/kotlin-1-3-20-released/
-kotlin.parallel.tasks.in.project=true
# Suppress pointless warning about mpp being experimental
kotlin.mpp.stability.nowarn=true
# Workaround for b/141364941
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index b27044f..9f4e3fc 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -27,10 +27,10 @@
guavaJre = "29.0-jre"
hilt = "2.36"
incap = "0.2"
-kotlin = "1.5.10"
+kotlin = "1.5.21"
kotlinCompileTesting = "1.4.1"
kotlinCoroutines = "1.5.0"
-ksp = "1.5.10-1.0.0-beta01"
+ksp = "1.5.20-1.0.0-beta04"
leakcanary = "2.2"
mockito = "2.25.0"
skiko = "0.3.6"
diff --git a/hilt/hilt-navigation-compose/build.gradle b/hilt/hilt-navigation-compose/build.gradle
index f3466f2..1989f53 100644
--- a/hilt/hilt-navigation-compose/build.gradle
+++ b/hilt/hilt-navigation-compose/build.gradle
@@ -35,11 +35,11 @@
}
dependencies {
- kotlinPlugin "androidx.compose.compiler:compiler:1.0.0-rc02"
+ kotlinPlugin(project(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
api("androidx.hilt:hilt-navigation:1.0.0")
- api("androidx.compose.runtime:runtime:1.0.0-rc02")
+ api(project(":compose:runtime:runtime"))
api("androidx.compose.ui:ui:1.0.0-rc02")
api("androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07")
api(projectOrArtifact(":navigation:navigation-compose"))
diff --git a/hilt/hilt-navigation-compose/samples/build.gradle b/hilt/hilt-navigation-compose/samples/build.gradle
index 71b0238..3c00b2c 100644
--- a/hilt/hilt-navigation-compose/samples/build.gradle
+++ b/hilt/hilt-navigation-compose/samples/build.gradle
@@ -27,7 +27,7 @@
}
dependencies {
- kotlinPlugin("androidx.compose.compiler:compiler:1.0.0-rc02")
+ kotlinPlugin(project(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
compileOnly(projectOrArtifact(":annotation:annotation-sampled"))
diff --git a/lifecycle/lifecycle-viewmodel-compose/build.gradle b/lifecycle/lifecycle-viewmodel-compose/build.gradle
index 711d186..6bf586b 100644
--- a/lifecycle/lifecycle-viewmodel-compose/build.gradle
+++ b/lifecycle/lifecycle-viewmodel-compose/build.gradle
@@ -27,10 +27,10 @@
}
dependencies {
- kotlinPlugin "androidx.compose.compiler:compiler:1.0.0-rc02"
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
api "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0"
- api "androidx.compose.runtime:runtime:1.0.0-rc02"
+ api(projectOrArtifact(":compose:runtime:runtime"))
api "androidx.compose.ui:ui:1.0.0-rc02"
implementation(libs.kotlinStdlib)
diff --git a/lifecycle/lifecycle-viewmodel-compose/samples/build.gradle b/lifecycle/lifecycle-viewmodel-compose/samples/build.gradle
index 1b620ea..f4fcc19 100644
--- a/lifecycle/lifecycle-viewmodel-compose/samples/build.gradle
+++ b/lifecycle/lifecycle-viewmodel-compose/samples/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- kotlinPlugin "androidx.compose.compiler:compiler:1.0.0-rc02"
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
implementation projectOrArtifact(":lifecycle:lifecycle-viewmodel-compose")
}
diff --git a/navigation/navigation-compose/build.gradle b/navigation/navigation-compose/build.gradle
index 7b68615..564c176 100644
--- a/navigation/navigation-compose/build.gradle
+++ b/navigation/navigation-compose/build.gradle
@@ -26,14 +26,14 @@
}
dependencies {
- kotlinPlugin("androidx.compose.compiler:compiler:1.0.0-rc02")
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
implementation("androidx.compose.foundation:foundation-layout:1.0.0-rc02")
api("androidx.activity:activity-compose:1.3.0-rc02")
api("androidx.compose.animation:animation:1.0.0-rc02")
- api("androidx.compose.runtime:runtime:1.0.0-rc02")
- api("androidx.compose.runtime:runtime-saveable:1.0.0-rc02")
+ api(projectOrArtifact(":compose:runtime:runtime"))
+ api(projectOrArtifact(":compose:runtime:runtime-saveable"))
api("androidx.compose.ui:ui:1.0.0-rc02")
api("androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07")
api(projectOrArtifact(":navigation:navigation-runtime-ktx"))
diff --git a/navigation/navigation-compose/samples/build.gradle b/navigation/navigation-compose/samples/build.gradle
index b2c1ca6..192e019 100644
--- a/navigation/navigation-compose/samples/build.gradle
+++ b/navigation/navigation-compose/samples/build.gradle
@@ -25,7 +25,7 @@
}
dependencies {
- kotlinPlugin("androidx.compose.compiler:compiler:1.0.0-rc02")
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
compileOnly(projectOrArtifact(":annotation:annotation-sampled"))
diff --git a/paging/paging-compose/build.gradle b/paging/paging-compose/build.gradle
index 9c8ab08..f6892b8 100644
--- a/paging/paging-compose/build.gradle
+++ b/paging/paging-compose/build.gradle
@@ -28,10 +28,10 @@
}
dependencies {
- kotlinPlugin("androidx.compose.compiler:compiler:1.0.0-rc02")
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
- api("androidx.compose.foundation:foundation:1.0.0-rc02")
+ api(projectOrArtifact(":compose:foundation:foundation"))
api("androidx.paging:paging-common:3.0.0")
androidTestImplementation(projectOrArtifact(":compose:ui:ui-test-junit4"))
diff --git a/paging/paging-compose/samples/build.gradle b/paging/paging-compose/samples/build.gradle
index 83fcaf5..8bd229e 100644
--- a/paging/paging-compose/samples/build.gradle
+++ b/paging/paging-compose/samples/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- kotlinPlugin("androidx.compose.compiler:compiler:1.0.0-rc02")
+ kotlinPlugin(projectOrArtifact(":compose:compiler:compiler"))
implementation(libs.kotlinStdlib)
compileOnly(projectOrArtifact(":annotation:annotation-sampled"))
diff --git a/room/room-compiler-processing-testing/build.gradle b/room/room-compiler-processing-testing/build.gradle
index 0e8ddae..c9bb51b 100644
--- a/room/room-compiler-processing-testing/build.gradle
+++ b/room/room-compiler-processing-testing/build.gradle
@@ -30,7 +30,7 @@
implementation(libs.kotlinStdlibJdk8) // KSP defines older version as dependency, force update.
implementation(libs.ksp)
implementation(libs.googleCompileTesting)
- implementation(libs.kotlinCompileTestingKsp)
+ implementation(libs.kotlinCompileTesting)
// specify these to match the kotlin compiler version in AndroidX rather than what KSP or KCT
// uses
implementation(libs.kotlinCompilerEmbeddable)
diff --git a/room/room-compiler-processing-testing/src/main/java/com/tschuchort/compiletesting/KspKotlinCompileTesting.kt b/room/room-compiler-processing-testing/src/main/java/com/tschuchort/compiletesting/KspKotlinCompileTesting.kt
new file mode 100644
index 0000000..8ac19ff
--- /dev/null
+++ b/room/room-compiler-processing-testing/src/main/java/com/tschuchort/compiletesting/KspKotlinCompileTesting.kt
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This file replicates the KSP support in KotlinCompileTesting as a workaround not to wait for
+ * the library to take KSP beta05 update.
+ *
+ * Ideally, this file should either disappear and replaced with the KCT library OR moved to a
+ * real AndroidX library as a replacement for KCT.
+ */
+
+package com.tschuchort.compiletesting
+
+import com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension
+import com.google.devtools.ksp.KspOptions
+import com.google.devtools.ksp.processing.KSPLogger
+import com.google.devtools.ksp.processing.SymbolProcessorProvider
+import com.google.devtools.ksp.processing.impl.MessageCollectorBasedKSPLogger
+import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
+import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
+import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector
+import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot
+import org.jetbrains.kotlin.com.intellij.core.CoreApplicationEnvironment
+import org.jetbrains.kotlin.com.intellij.mock.MockProject
+import org.jetbrains.kotlin.com.intellij.psi.PsiTreeChangeAdapter
+import org.jetbrains.kotlin.com.intellij.psi.PsiTreeChangeListener
+import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
+import org.jetbrains.kotlin.config.CompilerConfiguration
+import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
+import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
+import java.io.File
+
+/**
+ * The list of symbol processors for the kotlin compilation.
+ * https://goo.gle/ksp
+ */
+var KotlinCompilation.symbolProcessorProviders: List<SymbolProcessorProvider>
+ get() = getKspRegistrar().providers
+ set(value) {
+ val registrar = getKspRegistrar()
+ registrar.providers = value
+ }
+
+/**
+ * The directory where generated KSP sources are written
+ */
+val KotlinCompilation.kspSourcesDir: File
+ get() = kspWorkingDir.resolve("sources")
+
+/**
+ * Arbitrary arguments to be passed to ksp
+ */
+var KotlinCompilation.kspArgs: MutableMap<String, String>
+ get() = getKspRegistrar().options
+ set(value) {
+ val registrar = getKspRegistrar()
+ registrar.options = value
+ }
+
+private val KotlinCompilation.kspJavaSourceDir: File
+ get() = kspSourcesDir.resolve("java")
+
+private val KotlinCompilation.kspKotlinSourceDir: File
+ get() = kspSourcesDir.resolve("kotlin")
+
+private val KotlinCompilation.kspResources: File
+ get() = kspSourcesDir.resolve("resources")
+
+/**
+ * The working directory for KSP
+ */
+private val KotlinCompilation.kspWorkingDir: File
+ get() = workingDir.resolve("ksp")
+
+/**
+ * The directory where compiled KSP classes are written
+ */
+// TODO this seems to be ignored by KSP and it is putting classes into regular classes directory
+// but we still need to provide it in the KSP options builder as it is required
+// once it works, we should make the property public.
+private val KotlinCompilation.kspClassesDir: File
+ get() = kspWorkingDir.resolve("classes")
+
+/**
+ * The directory where compiled KSP caches are written
+ */
+private val KotlinCompilation.kspCachesDir: File
+ get() = kspWorkingDir.resolve("caches")
+
+/**
+ * Custom subclass of [AbstractKotlinSymbolProcessingExtension] where processors are pre-defined instead of being
+ * loaded via ServiceLocator.
+ */
+private class KspTestExtension(
+ options: KspOptions,
+ processorProviders: List<SymbolProcessorProvider>,
+ logger: KSPLogger
+) : AbstractKotlinSymbolProcessingExtension(
+ options = options,
+ logger = logger,
+ testMode = false
+) {
+ private val loadedProviders = processorProviders
+
+ override fun loadProviders() = loadedProviders
+}
+
+/**
+ * Registers the [KspTestExtension] to load the given list of processors.
+ */
+private class KspCompileTestingComponentRegistrar(
+ private val compilation: KotlinCompilation
+) : ComponentRegistrar {
+ var providers = emptyList<SymbolProcessorProvider>()
+
+ var options: MutableMap<String, String> = mutableMapOf()
+
+ var incremental: Boolean = false
+ var incrementalLog: Boolean = false
+
+ override fun registerProjectComponents(
+ project: MockProject,
+ configuration: CompilerConfiguration
+ ) {
+ if (providers.isEmpty()) {
+ return
+ }
+ val options = KspOptions.Builder().apply {
+ this.projectBaseDir = compilation.kspWorkingDir
+
+ this.processingOptions.putAll(compilation.kspArgs)
+
+ this.incremental = this@KspCompileTestingComponentRegistrar.incremental
+ this.incrementalLog = this@KspCompileTestingComponentRegistrar.incrementalLog
+
+ this.cachesDir = compilation.kspCachesDir.also {
+ it.deleteRecursively()
+ it.mkdirs()
+ }
+ this.kspOutputDir = compilation.kspSourcesDir.also {
+ it.deleteRecursively()
+ it.mkdirs()
+ }
+ this.classOutputDir = compilation.kspClassesDir.also {
+ it.deleteRecursively()
+ it.mkdirs()
+ }
+ this.javaOutputDir = compilation.kspJavaSourceDir.also {
+ it.deleteRecursively()
+ it.mkdirs()
+ }
+ this.kotlinOutputDir = compilation.kspKotlinSourceDir.also {
+ it.deleteRecursively()
+ it.mkdirs()
+ }
+ this.resourceOutputDir = compilation.kspResources.also {
+ it.deleteRecursively()
+ it.mkdirs()
+ }
+ configuration[CLIConfigurationKeys.CONTENT_ROOTS]
+ ?.filterIsInstance<JavaSourceRoot>()
+ ?.forEach {
+ this.javaSourceRoots.add(it.file)
+ }
+ }.build()
+
+ // Temporary until friend-paths is fully supported https://youtrack.jetbrains.com/issue/KT-34102
+ @Suppress("invisible_member")
+ val messageCollectorBasedKSPLogger = MessageCollectorBasedKSPLogger(
+ PrintingMessageCollector(
+ compilation.internalMessageStreamAccess,
+ MessageRenderer.GRADLE_STYLE,
+ compilation.verbose
+ )
+ )
+ // Placeholder extension point; Required by dropPsiCaches().
+ @Suppress("UnstableApiUsage")
+ CoreApplicationEnvironment.registerExtensionPoint(
+ project.extensionArea,
+ PsiTreeChangeListener.EP.name,
+ PsiTreeChangeAdapter::class.java
+ )
+ val registrar = KspTestExtension(options, providers, messageCollectorBasedKSPLogger)
+ AnalysisHandlerExtension.registerExtension(project, registrar)
+ }
+}
+
+/**
+ * Gets the test registrar from the plugin list or adds if it does not exist.
+ */
+private fun KotlinCompilation.getKspRegistrar(): KspCompileTestingComponentRegistrar {
+ compilerPlugins.firstIsInstanceOrNull<KspCompileTestingComponentRegistrar>()?.let {
+ return it
+ }
+ val kspRegistrar = KspCompileTestingComponentRegistrar(this)
+ compilerPlugins = compilerPlugins + kspRegistrar
+ return kspRegistrar
+}
\ No newline at end of file
diff --git a/room/room-compiler-processing/build.gradle b/room/room-compiler-processing/build.gradle
index d1ae9643..4715bac 100644
--- a/room/room-compiler-processing/build.gradle
+++ b/room/room-compiler-processing/build.gradle
@@ -40,7 +40,7 @@
testImplementation(libs.googleCompileTesting)
testImplementation(libs.junit)
testImplementation(libs.jsr250)
- testImplementation(libs.kotlinCompileTestingKsp)
+ testImplementation(libs.kotlinCompileTesting)
testImplementation(libs.ksp)
testImplementation(project(":room:room-compiler-processing-testing"))
}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticContinuationParameterElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticContinuationParameterElement.kt
index 2e12e3b..3ebf79b 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticContinuationParameterElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticContinuationParameterElement.kt
@@ -46,15 +46,16 @@
) {
override val name: String by lazy {
- // kotlin names this as pN where N is the # of arguments
- // seems like kapt doesn't handle conflicts with declared arguments but we should
- val desiredName = "p${containing.declaration.parameters.size}"
-
- if (containing.declaration.parameters.none { it.name?.asString() == desiredName }) {
- desiredName
- } else {
- "_syntheticContinuation"
+ // KAPT uses `continuation` but it doesn't check for conflicts, we do.
+ var candidate = "continuation"
+ var suffix = 0
+ while (
+ containing.declaration.parameters.any { it.name?.asString() == candidate }
+ ) {
+ candidate = "continuation_$suffix"
+ suffix ++
}
+ candidate
}
override val equalityItems: Array<out Any?> by lazy {
diff --git a/room/room-runtime/src/androidTest/java/androidx/room/AutoCloserTest.kt b/room/room-runtime/src/androidTest/java/androidx/room/AutoCloserTest.kt
index 474c81d..23e3258 100644
--- a/room/room-runtime/src/androidTest/java/androidx/room/AutoCloserTest.kt
+++ b/room/room-runtime/src/androidTest/java/androidx/room/AutoCloserTest.kt
@@ -117,7 +117,7 @@
@Test
public fun executeRefCountingFunctionPropagatesFailure() {
assertThrows<IOException> {
- autoCloser.executeRefCountingFunction {
+ autoCloser.executeRefCountingFunction<Nothing> {
throw IOException()
}
}
diff --git a/settings.gradle b/settings.gradle
index c40d9d5..c7c9405 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -287,8 +287,8 @@
includeProject(":compose:animation:animation-graphics-samples", "compose/animation/animation-graphics/samples", [BuildType.COMPOSE])
includeProject(":compose:benchmark-utils", "compose/benchmark-utils", [BuildType.COMPOSE])
includeProject(":compose:benchmark-utils:benchmark-utils-benchmark", "compose/benchmark-utils/benchmark", [BuildType.COMPOSE])
-includeProject(":compose:compiler:compiler", "compose/compiler/compiler", [BuildType.COMPOSE])
-includeProject(":compose:compiler:compiler-hosted", "compose/compiler/compiler-hosted", [BuildType.COMPOSE])
+includeProject(":compose:compiler:compiler", "compose/compiler/compiler", [BuildType.COMPOSE, BuildType.MAIN])
+includeProject(":compose:compiler:compiler-hosted", "compose/compiler/compiler-hosted", [BuildType.COMPOSE, BuildType.MAIN])
includeProject(":compose:compiler:compiler-hosted:integration-tests", "compose/compiler/compiler-hosted/integration-tests", [BuildType.COMPOSE])
includeProject(":compose:compiler:compiler-hosted:integration-tests:kotlin-compiler-repackaged", "compose/compiler/compiler-hosted/integration-tests/kotlin-compiler-repackaged", [BuildType.COMPOSE])
if (isMultiplatformEnabled()) {
@@ -312,9 +312,9 @@
includeProject(":compose:integration-tests:macrobenchmark", "compose/integration-tests/macrobenchmark", [BuildType.COMPOSE])
includeProject(":compose:integration-tests:macrobenchmark-target", "compose/integration-tests/macrobenchmark-target", [BuildType.COMPOSE])
includeProject(":compose:lint", "compose/lint", [BuildType.COMPOSE])
-includeProject(":compose:lint:internal-lint-checks", "compose/lint/internal-lint-checks", [BuildType.COMPOSE])
-includeProject(":compose:lint:common", "compose/lint/common", [BuildType.COMPOSE])
-includeProject(":compose:lint:common-test", "compose/lint/common-test", [BuildType.COMPOSE])
+includeProject(":compose:lint:internal-lint-checks", "compose/lint/internal-lint-checks", [BuildType.COMPOSE, BuildType.MAIN])
+includeProject(":compose:lint:common", "compose/lint/common", [BuildType.COMPOSE, BuildType.MAIN])
+includeProject(":compose:lint:common-test", "compose/lint/common-test", [BuildType.COMPOSE, BuildType.MAIN])
includeProject(":compose:material", "compose/material", [BuildType.COMPOSE])
includeProject(":compose:material:material", "compose/material/material", [BuildType.COMPOSE])
includeProject(":compose:material:material-benchmark", "compose/material/material/benchmark", [BuildType.COMPOSE])
@@ -332,9 +332,9 @@
includeProject(":compose:material:material:integration-tests:material-demos", "compose/material/material/integration-tests/material-demos", [BuildType.COMPOSE])
includeProject(":compose:material:material:integration-tests:material-catalog", "compose/material/material/integration-tests/material-catalog", [BuildType.COMPOSE])
includeProject(":compose:material:material:material-samples", "compose/material/material/samples", [BuildType.COMPOSE])
-includeProject(":compose:runtime", "compose/runtime", [BuildType.COMPOSE])
-includeProject(":compose:runtime:runtime", "compose/runtime/runtime", [BuildType.COMPOSE])
-includeProject(":compose:runtime:runtime-lint", "compose/runtime/runtime-lint", [BuildType.COMPOSE])
+includeProject(":compose:runtime", "compose/runtime", [BuildType.COMPOSE, BuildType.MAIN])
+includeProject(":compose:runtime:runtime", "compose/runtime/runtime", [BuildType.COMPOSE, BuildType.MAIN])
+includeProject(":compose:runtime:runtime-lint", "compose/runtime/runtime-lint", [BuildType.COMPOSE, BuildType.MAIN])
includeProject(":compose:runtime:runtime-livedata", "compose/runtime/runtime-livedata", [BuildType.COMPOSE])
includeProject(":compose:runtime:runtime-livedata:runtime-livedata-samples", "compose/runtime/runtime-livedata/samples", [BuildType.COMPOSE])
includeProject(":compose:runtime:runtime-rxjava2", "compose/runtime/runtime-rxjava2", [BuildType.COMPOSE])
diff --git a/wear/compose/compose-foundation/build.gradle b/wear/compose/compose-foundation/build.gradle
index e4d5601..7430b2c 100644
--- a/wear/compose/compose-foundation/build.gradle
+++ b/wear/compose/compose-foundation/build.gradle
@@ -28,13 +28,13 @@
AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
dependencies {
- kotlinPlugin("androidx.compose.compiler:compiler:1.0.0-rc02")
+ kotlinPlugin(project(":compose:compiler:compiler"))
if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
- api("androidx.compose.foundation:foundation:1.0.0-rc02")
- api("androidx.compose.ui:ui:1.0.0-rc02")
- api("androidx.compose.ui:ui-text:1.0.0-rc02")
- api("androidx.compose.runtime:runtime:1.0.0-rc02")
+ api(project(":compose:foundation:foundation"))
+ api(project(":compose:ui:ui"))
+ api(project(":compose:ui:ui-text"))
+ api(project(":compose:runtime:runtime"))
implementation(libs.kotlinStdlib)
implementation("androidx.compose.foundation:foundation-layout:1.0.0-rc02")
diff --git a/wear/compose/compose-material/build.gradle b/wear/compose/compose-material/build.gradle
index 35f6046..6c38fcb 100644
--- a/wear/compose/compose-material/build.gradle
+++ b/wear/compose/compose-material/build.gradle
@@ -28,13 +28,13 @@
AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
dependencies {
- kotlinPlugin("androidx.compose.compiler:compiler:1.0.0-rc02")
+ kotlinPlugin(project(":compose:compiler:compiler"))
if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
api("androidx.compose.foundation:foundation:1.0.0-rc02")
api("androidx.compose.ui:ui:1.0.0-rc02")
api("androidx.compose.ui:ui-text:1.0.0-rc02")
- api("androidx.compose.runtime:runtime:1.0.0-rc02")
+ api(project(":compose:runtime:runtime"))
implementation(libs.kotlinStdlib)
implementation("androidx.compose.material:material:1.0.0-rc02")