diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-21 16:08:55 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-21 16:08:55 +0000 |
commit | 9dd1c62fe0b132d97aca2e8ae36d8714e8ee0623 (patch) | |
tree | 5f6d072a2258af2353935cf3594419c8d2d32610 | |
parent | 69d41efbe86b9ba85f3ed85d0a20c00c8ba81a12 (diff) | |
parent | 52e7c3157c9a20903a44f915bc1924049d93e6a0 (diff) | |
download | kotlin-studio-2022.1.1-canary.tar.gz |
Snap for 8853699 from 52e7c3157c9a20903a44f915bc1924049d93e6a0 to studio-ee-releasestudio-2022.1.1-canarystudio-2022.1.1-beta2studio-canarystudio-2022.1.1-canary
Change-Id: I89d4fc49fc6f51e584afb500f97a791e7d8011e0
52 files changed, 551 insertions, 463 deletions
diff --git a/ChangeLog.md b/ChangeLog.md index daf9c7be41f..5cf39734084 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,127 @@ +## 1.7.10 + +### Compiler + +- [`KT-52702`](https://youtrack.jetbrains.com/issue/KT-52702) Invalid locals information when compiling `kotlinx.collections.immutable` with Kotlin 1.7.0-RC2 +- [`KT-52892`](https://youtrack.jetbrains.com/issue/KT-52892) Disappeared specific builder inference resolution ambiguity errors +- [`KT-52782`](https://youtrack.jetbrains.com/issue/KT-52782) Appeared receiver type mismatch error due to ProperTypeInferenceConstraintsProcessing compiler feature +- [`KT-52718`](https://youtrack.jetbrains.com/issue/KT-52718) declaringClass deprecation message mentions the wrong replacement in 1.7 + +### IDE + +#### Fixes + +- [`KTIJ-19088`](https://youtrack.jetbrains.com/issue/KTIJ-19088) KotlinUFunctionCallExpression.resolve() returns null for calls to @JvmSynthetic functions +- [`KTIJ-19624`](https://youtrack.jetbrains.com/issue/KTIJ-19624) NoDescriptorForDeclarationException on iosTest.kt.vm +- [`KTIJ-21515`](https://youtrack.jetbrains.com/issue/KTIJ-21515) Load JVM target 1.6 as 1.8 in Maven projects +- [`KTIJ-21735`](https://youtrack.jetbrains.com/issue/KTIJ-21735) Exception when opening a project +- [`KTIJ-17414`](https://youtrack.jetbrains.com/issue/KTIJ-17414) UAST: Synthetic enum methods have null return values +- [`KTIJ-17444`](https://youtrack.jetbrains.com/issue/KTIJ-17444) UAST: Synthetic enum methods are missing nullness annotations +- [`KTIJ-19043`](https://youtrack.jetbrains.com/issue/KTIJ-19043) UElement#comments is empty for a Kotlin property with a getter +- [`KTIJ-10031`](https://youtrack.jetbrains.com/issue/KTIJ-10031) IDE fails to suggest a project declaration import if the name clashes with internal declaration with implicit import from stdlib (ex. @Serializable) +- [`KTIJ-21151`](https://youtrack.jetbrains.com/issue/KTIJ-21151) Exception about wrong read access from "Java overriding methods searcher" with Kotlin overrides +- [`KTIJ-20736`](https://youtrack.jetbrains.com/issue/KTIJ-20736) NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.idea.roots.KotlinNonJvmOrderEnumerationHandler. Kotlin plugin 1.7 fails to start +- [`KTIJ-21063`](https://youtrack.jetbrains.com/issue/KTIJ-21063) IDE highlighting: False positive error "Context receivers should be enabled explicitly" +- [`KTIJ-20810`](https://youtrack.jetbrains.com/issue/KTIJ-20810) NoClassDefFoundError: org/jetbrains/kotlin/idea/util/SafeAnalyzeKt errors in 1.7.0-master-212 kotlin plugin on project open +- [`KTIJ-17869`](https://youtrack.jetbrains.com/issue/KTIJ-17869) KotlinUFunctionCallExpression.resolve() returns null for instantiations of local classes with default constructors +- [`KTIJ-21061`](https://youtrack.jetbrains.com/issue/KTIJ-21061) UObjectLiteralExpression.getExpressionType() returns the base class type for Kotlin object literals instead of the anonymous class type +- [`KTIJ-20200`](https://youtrack.jetbrains.com/issue/KTIJ-20200) UAST: @Deprecated(level=HIDDEN) constructors are not returning UMethod.isConstructor=true + +### IDE. Code Style, Formatting + +- [`KTIJ-20554`](https://youtrack.jetbrains.com/issue/KTIJ-20554) Introduce some code style for definitely non-null types + +### IDE. Completion + +- [`KTIJ-14740`](https://youtrack.jetbrains.com/issue/KTIJ-14740) Multiplatform declaration actualised in an intermediate source set is shown twice in a completion popup called in the source set + +### IDE. Debugger + +- [`KTIJ-20815`](https://youtrack.jetbrains.com/issue/KTIJ-20815) MPP Debugger: Evaluation of expect function for the project with intermediate source set may fail with java.lang.NoSuchMethodError + +### IDE. Decompiler, Indexing, Stubs + +- [`KTIJ-21472`](https://youtrack.jetbrains.com/issue/KTIJ-21472) "java.lang.IllegalStateException: Could not read file" exception on indexing invalid class file +- [`KTIJ-20802`](https://youtrack.jetbrains.com/issue/KTIJ-20802) Definitely Not-Null types: "UpToDateStubIndexMismatch: PSI and index do not match" plugin error when trying to use library function with T&Any + +### IDE. FIR + +- [`KTIJ-20971`](https://youtrack.jetbrains.com/issue/KTIJ-20971) FIR IDE: "Parameter Info" shows parameters of uncallable methods +- [`KTIJ-21021`](https://youtrack.jetbrains.com/issue/KTIJ-21021) FIR IDE: Completion of extension function does not work on nullable receiver +- [`KTIJ-21343`](https://youtrack.jetbrains.com/issue/KTIJ-21343) FIR IDE: Navigation from explicit invoke call does not work +- [`KTIJ-21013`](https://youtrack.jetbrains.com/issue/KTIJ-21013) FIR IDE: Inconsistent smartcasts highlighting +- [`KTIJ-21374`](https://youtrack.jetbrains.com/issue/KTIJ-21374) FIR IDE: Incorrect highlighting for operators +- [`KTIJ-20443`](https://youtrack.jetbrains.com/issue/KTIJ-20443) FIR IDE: Work in Dumb mode +- [`KTIJ-20852`](https://youtrack.jetbrains.com/issue/KTIJ-20852) FIR IDE: Exception when checking `isInheritor` on two classes in different modules +- [`KTIJ-20637`](https://youtrack.jetbrains.com/issue/KTIJ-20637) FIR IDE: Strange exception while commenting-uncommenting FirReferenceResolveHelper.kt + +### IDE. Gradle Integration + +- [`KTIJ-21807`](https://youtrack.jetbrains.com/issue/KTIJ-21807) Gradle to IDEA import: language and API version settings are not imported for Native facet +- [`KTIJ-21692`](https://youtrack.jetbrains.com/issue/KTIJ-21692) Kotlin Import Test maintenance: 1.7.0-Beta +- [`KTIJ-20567`](https://youtrack.jetbrains.com/issue/KTIJ-20567) Kotlin/JS: Gradle import into IDEA creates no proper sub-modules, source sets, facets + +### IDE. Hints. Inlay + +- [`KTIJ-20552`](https://youtrack.jetbrains.com/issue/KTIJ-20552) Support definitely non-null types in inlay hints + +### IDE. Inspections and Intentions + +#### New Features + +- [`KTIJ-18979`](https://youtrack.jetbrains.com/issue/KTIJ-18979) Quickfix for INTEGER_OPERATOR_RESOLVE_WILL_CHANGE to add explicit conversion call +- [`KTIJ-19950`](https://youtrack.jetbrains.com/issue/KTIJ-19950) Provide quickfixes for `INVALID_IF_AS_EXPRESSION_WARNING` and `NO_ELSE_IN_WHEN_WARNING` +- [`KTIJ-19866`](https://youtrack.jetbrains.com/issue/KTIJ-19866) Create quick-fix for effective visibility error on private-in-file interface exposing private class +- [`KTIJ-19939`](https://youtrack.jetbrains.com/issue/KTIJ-19939) Provide quickfix for deprecated confusing expressions in when branches + +#### Fixes + +- [`KTIJ-20705`](https://youtrack.jetbrains.com/issue/KTIJ-20705) Register quickfix for `NO_CONSTRUCTOR_WARNING` diagnostic +- [`KTIJ-21226`](https://youtrack.jetbrains.com/issue/KTIJ-21226) "Remove else branch" quick fix is not suggested +- [`KTIJ-20981`](https://youtrack.jetbrains.com/issue/KTIJ-20981) Definitely non-null types: quick-fixes suggested incorrectly for LV=1.6 when Xenhance-type-parameter-types-to-def-not-null flag is set +- [`KTIJ-20953`](https://youtrack.jetbrains.com/issue/KTIJ-20953) Add quickfix for OVERRIDE_DEPRECATION warning to 1.7 - 1.9 migration +- [`KTIJ-20734`](https://youtrack.jetbrains.com/issue/KTIJ-20734) Replace with [@JvmInline] value quick fix should be appliable on a whole project +- [`KTIJ-21420`](https://youtrack.jetbrains.com/issue/KTIJ-21420) Add 'else' branch quick fix suggestion is displayed twice in case 'if' isn't completed +- [`KTIJ-21192`](https://youtrack.jetbrains.com/issue/KTIJ-21192) "Make protected" intention is redundant for interface properties +- [`KTIJ-18120`](https://youtrack.jetbrains.com/issue/KTIJ-18120) "Make public" intention does not add explicit "public" modifier when using ExplicitApi Strict mode +- [`KTIJ-20493`](https://youtrack.jetbrains.com/issue/KTIJ-20493) "Create expect" quick fix doesn't warn about platform-specific annotations + +### IDE. Misc + +- [`KTIJ-21582`](https://youtrack.jetbrains.com/issue/KTIJ-21582) Notification for Kotlin EAP survey + +### IDE. Native + +- [`KTIJ-21602`](https://youtrack.jetbrains.com/issue/KTIJ-21602) With Native Debugging Support plugin Gradle run configurations can't be executed from IDEA: LLDB_NATVIS_RENDERERS_ENABLED + +### IDE. Wizards + +- [`KTIJ-20919`](https://youtrack.jetbrains.com/issue/KTIJ-20919) Update ktor-html-builder dependency in kotlin wizards +- [`KTIJ-20962`](https://youtrack.jetbrains.com/issue/KTIJ-20962) Wizard: Invalid Ktor imports + +### Tools. Gradle + +- [`KT-52777`](https://youtrack.jetbrains.com/issue/KT-52777) 'org.jetbrains.kotlinx:atomicfu:1.7.0' Gradle 7.0+ plugin variant was published with missing classes + +### Tools. Gradle. JS + +- [`KT-52856`](https://youtrack.jetbrains.com/issue/KT-52856) Kotlin/JS: Upgrade NPM dependencies + +### Tools. Gradle. Multiplatform + +- [`KT-52955`](https://youtrack.jetbrains.com/issue/KT-52955) SourceSetMetadataStorageForIde: Broken 'cleanupStaleEntries' with enabled configuration caching or isolated ClassLoaders +- [`KT-52694`](https://youtrack.jetbrains.com/issue/KT-52694) Kotlin 1.7.0 breaks Configuration Caching in Android projects + +### Tools. Incremental Compile + +- [`KT-52669`](https://youtrack.jetbrains.com/issue/KT-52669) Full rebuild in IC exception recovery leaves corrupt IC data + +### Tools. JPS + +- [`KTIJ-17280`](https://youtrack.jetbrains.com/issue/KTIJ-17280) JPS: don't use java.io.File.createTempFile as it is not working sometimes +- [`KTIJ-20954`](https://youtrack.jetbrains.com/issue/KTIJ-20954) NPE at at org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil.readNameResolver on compiling by JPS with LV > 1.7 + + ## 1.7.0 ### Analysis API. FIR diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 3c8fb41d3d0..1b765da4762 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -14522,6 +14522,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag } @Test + @TestMetadata("kt52782.kt") + public void testKt52782() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt"); + } + + @Test @TestMetadata("memberScopeOfCaptured.kt") public void testMemberScopeOfCaptured() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/memberScopeOfCaptured.kt"); diff --git a/build-common/src/org/jetbrains/kotlin/build/report/metrics/BuildAttribute.kt b/build-common/src/org/jetbrains/kotlin/build/report/metrics/BuildAttribute.kt index 9115e6daa35..bdfe01a4135 100644 --- a/build-common/src/org/jetbrains/kotlin/build/report/metrics/BuildAttribute.kt +++ b/build-common/src/org/jetbrains/kotlin/build/report/metrics/BuildAttribute.kt @@ -18,8 +18,9 @@ enum class BuildAttributeKind : Serializable { enum class BuildAttribute(val kind: BuildAttributeKind, val readableString: String) : Serializable { NO_BUILD_HISTORY(BuildAttributeKind.REBUILD_REASON, "Build history file not found"), NO_ABI_SNAPSHOT(BuildAttributeKind.REBUILD_REASON, "ABI snapshot not found"), + INTERNAL_ERROR(BuildAttributeKind.REBUILD_REASON, "Internal error during preparation of IC round"), CLASSPATH_SNAPSHOT_NOT_FOUND(BuildAttributeKind.REBUILD_REASON, "Classpath snapshot not found"), - CACHE_CORRUPTION(BuildAttributeKind.REBUILD_REASON, "Cache corrupted"), + INCREMENTAL_COMPILATION_FAILED(BuildAttributeKind.REBUILD_REASON, "Incremental compilation failed"), UNKNOWN_CHANGES_IN_GRADLE_INPUTS(BuildAttributeKind.REBUILD_REASON, "Unknown Gradle changes"), JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED(BuildAttributeKind.REBUILD_REASON, "Untracked Java file is removed"), JAVA_CHANGE_UNEXPECTED_PSI(BuildAttributeKind.REBUILD_REASON, "Java PSI file is expected"), diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 8acbec7d3a1..71082484f5c 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -163,7 +163,7 @@ dependencies { implementation(kotlin("stdlib", embeddedKotlinVersion)) implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}") implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:${kotlinBuildProperties.buildGradlePluginVersion}") - implementation("com.gradle.publish:plugin-publish-plugin:0.20.0") + implementation("com.gradle.publish:plugin-publish-plugin:1.0.0-rc-3") implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.6.10") implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}") diff --git a/buildSrc/src/main/kotlin/GradleCommon.kt b/buildSrc/src/main/kotlin/GradleCommon.kt index 0a6439b12e6..76d6577d923 100644 --- a/buildSrc/src/main/kotlin/GradleCommon.kt +++ b/buildSrc/src/main/kotlin/GradleCommon.kt @@ -11,21 +11,25 @@ import org.gradle.api.artifacts.type.ArtifactTypeDefinition import org.gradle.api.attributes.Attribute import org.gradle.api.attributes.LibraryElements import org.gradle.api.attributes.java.TargetJvmEnvironment +import org.gradle.api.attributes.java.TargetJvmVersion import org.gradle.api.attributes.plugin.GradlePluginApiVersion +import org.gradle.api.component.AdhocComponentWithVariants import org.gradle.api.plugins.JavaLibraryPlugin +import org.gradle.api.plugins.JavaPlugin import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.Copy import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.compile.JavaCompile import org.gradle.jvm.tasks.Jar import org.gradle.kotlin.dsl.* import org.gradle.plugin.devel.plugins.JavaGradlePluginPlugin import org.jetbrains.dokka.DokkaVersion import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.dsl.KotlinSingleTargetExtension +import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.jetbrains.kotlin.project.model.KotlinPlatformTypeAttribute import plugins.configureDefaultPublishing import plugins.configureKotlinPomAttributes @@ -238,6 +242,8 @@ fun Project.wireGradleVariantToCommonGradleVariant( } } +private const val FIXED_CONFIGURATION_SUFFIX = "WithFixedAttribute" + /** * 'main' sources are used for minimal supported Gradle versions (6.7) up to Gradle 7.0. */ @@ -289,25 +295,90 @@ fun Project.reconfigureMainSourcesSetForGradlePlugin( } } - plugins.withId("org.jetbrains.dokka") { - val dokkaTask = tasks.named<DokkaTask>("dokkaJavadoc") { - dokkaSourceSets { - named(commonSourceSet.name) { - suppress.set(false) + if (kotlinBuildProperties.publishGradlePluginsJavadoc || + kotlinBuildProperties.isTeamcityBuild + ) { + plugins.withId("org.jetbrains.dokka") { + val dokkaTask = tasks.named<DokkaTask>("dokkaJavadoc") { + dokkaSourceSets { + named(commonSourceSet.name) { + suppress.set(false) + } + + named("main") { + dependsOn(commonSourceSet) + } } + } - named("main") { - dependsOn(commonSourceSet) + tasks.withType<Jar>().configureEach { + if (name == javadocJarTaskName) { + from(dokkaTask.flatMap { it.outputDirectory }) } } } + } + + val javaComponent = project.components["java"] as AdhocComponentWithVariants + + // Workaround for https://youtrack.jetbrains.com/issue/KT-52987 + listOf( + runtimeElementsConfigurationName, + apiElementsConfigurationName + ) + .map { configurations[it] } + .forEach { originalConfiguration -> + configurations.create("${originalConfiguration.name}$FIXED_CONFIGURATION_SUFFIX") { + isCanBeResolved = originalConfiguration.isCanBeResolved + isCanBeConsumed = originalConfiguration.isCanBeConsumed + isVisible = originalConfiguration.isVisible + setExtendsFrom(originalConfiguration.extendsFrom) + + artifacts { + originalConfiguration.artifacts.forEach { + add(name, it) + } + } - tasks.withType<Jar>().configureEach { - if (name == javadocJarTaskName) { - from(dokkaTask.flatMap { it.outputDirectory }) + // Removing 'org.jetbrains.kotlin.platform.type' attribute + // as it brings issues with Gradle variant resolve on Gradle 7.6+ versions + attributes { + originalConfiguration.attributes.keySet() + .filter { it.name != KotlinPlatformType.attribute.name } + .forEach { originalAttribute -> + @Suppress("UNCHECKED_CAST") + attribute( + originalAttribute as Attribute<Any>, + originalConfiguration.attributes.getAttribute(originalAttribute)!! + ) + } + + plugins.withType<JavaPlugin> { + tasks.named<JavaCompile>(compileJavaTaskName) { + attribute( + TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, + targetCompatibility.toInt() + ) + } + } + } + + javaComponent.addVariantsFromConfiguration(this) { + if (originalConfiguration.name.startsWith("api")) { + mapToMavenScope("compile") + } else { + mapToMavenScope("runtime") + } + } + + // Make original configuration unpublishable and not visible + originalConfiguration.isCanBeConsumed = false + originalConfiguration.isVisible = false + javaComponent.withVariantsFromConfiguration(originalConfiguration) { + skip() + } } } - } } // Fix common sources visibility for tests @@ -446,10 +517,6 @@ private fun Project.commonVariantAttributes(): Action<Configuration> = Action<Co TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, objects.named(TargetJvmEnvironment.STANDARD_JVM) ) - attribute( - Attribute.of(KotlinPlatformTypeAttribute.uniqueName, String::class.java), - KotlinPlatformTypeAttribute.JVM - ) } } @@ -490,16 +557,28 @@ fun Project.publishShadowedJar( } // Removing artifact produced by Jar task - configurations[sourceSet.runtimeElementsConfigurationName] - .artifacts.removeAll { true } - configurations[sourceSet.apiElementsConfigurationName] - .artifacts.removeAll { true } + if (sourceSet.name == SourceSet.MAIN_SOURCE_SET_NAME) { + configurations["${sourceSet.runtimeElementsConfigurationName}$FIXED_CONFIGURATION_SUFFIX"] + .artifacts.removeAll { true } + configurations["${sourceSet.apiElementsConfigurationName}$FIXED_CONFIGURATION_SUFFIX"] + .artifacts.removeAll { true } + } else { + configurations[sourceSet.runtimeElementsConfigurationName] + .artifacts.removeAll { true } + configurations[sourceSet.apiElementsConfigurationName] + .artifacts.removeAll { true } + } // Adding instead artifact from shadow jar task configurations { artifacts { - add(sourceSet.runtimeElementsConfigurationName, shadowJarTask) - add(sourceSet.apiElementsConfigurationName, shadowJarTask) + if (sourceSet.name == SourceSet.MAIN_SOURCE_SET_NAME) { + add("${sourceSet.runtimeElementsConfigurationName}$FIXED_CONFIGURATION_SUFFIX", shadowJarTask) + add("${sourceSet.apiElementsConfigurationName}$FIXED_CONFIGURATION_SUFFIX", shadowJarTask) + } else { + add(sourceSet.apiElementsConfigurationName, shadowJarTask) + add(sourceSet.runtimeElementsConfigurationName, shadowJarTask) + } } } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt index 4dec3c14a7a..f11ddd9f51c 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt @@ -140,12 +140,11 @@ class DefaultLambda(info: ExtractedDefaultLambda, sourceCompiler: SourceCompiler val withFakeVariable = MethodNode(originNode.access, originNode.name, originNode.desc, originNode.signature, originNode.exceptions?.toTypedArray()) val fakeVarIndex = originNode.maxLocals + withFakeVariable.instructions.add(LdcInsnNode(0)) + withFakeVariable.instructions.add(VarInsnNode(Opcodes.ISTORE, fakeVarIndex)) + val startLabel = LabelNode().also { withFakeVariable.instructions.add(it) } originNode.accept(withFakeVariable) - val startLabel = - withFakeVariable.instructions.first as? LabelNode ?: LabelNode().apply { withFakeVariable.instructions.insert(this) } val endLabel = withFakeVariable.instructions.last as? LabelNode ?: LabelNode().apply { withFakeVariable.instructions.add(this) } - withFakeVariable.instructions.insert(startLabel, VarInsnNode(Opcodes.ISTORE, fakeVarIndex)) - withFakeVariable.instructions.insert(startLabel, LdcInsnNode(0)) withFakeVariable.localVariables.add( LocalVariableNode( diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index e525cc6cb68..59802afddb7 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -14522,6 +14522,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti } @Test + @TestMetadata("kt52782.kt") + public void testKt52782() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt"); + } + + @Test @TestMetadata("memberScopeOfCaptured.kt") public void testMemberScopeOfCaptured() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/memberScopeOfCaptured.kt"); diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 311449478d0..b3b51063ff2 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -14522,6 +14522,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac } @Test + @TestMetadata("kt52782.kt") + public void testKt52782() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt"); + } + + @Test @TestMetadata("memberScopeOfCaptured.kt") public void testMemberScopeOfCaptured() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/memberScopeOfCaptured.kt"); diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 830bd5b5c9e..8d71cbc1a1b 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -13670,6 +13670,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } @Test + @TestMetadata("kt52702.kt") + public void testKt52702() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/kt52702.kt"); + } + + @Test @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 0bb4313d47e..3be4e7cefc8 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -228,7 +228,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND, "Non-reified type parameters with recursive bounds are not supported yet: {0}", STRING); MAP.put(JAVA_SAM_INTERFACE_CONSTRUCTOR_REFERENCE, "Java SAM interface constructor references are prohibited"); - MAP.put(ENUM_DECLARING_CLASS_DEPRECATED, "Enum.declaringClass is deprecated, use javaDeclaringClass instead"); + MAP.put(ENUM_DECLARING_CLASS_DEPRECATED, "Enum.declaringClass is deprecated, use declaringJavaClass instead"); } @NotNull diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCachesManager.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCachesManager.kt index b70c1a1a740..a6acd7dd3b5 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCachesManager.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCachesManager.kt @@ -34,6 +34,7 @@ abstract class IncrementalCachesManager<PlatformCache : AbstractIncrementalCache private val caches = arrayListOf<BasicMapsOwner>() var isClosed = false + var isSuccessfulyClosed = false @Synchronized protected fun <T : BasicMapsOwner> T.registerCache() { @@ -52,15 +53,15 @@ abstract class IncrementalCachesManager<PlatformCache : AbstractIncrementalCache @Synchronized fun close(flush: Boolean = false): Boolean { if (isClosed) { - return true + return isSuccessfulyClosed } - var successful = true + isSuccessfulyClosed = true for (cache in caches) { if (flush) { try { cache.flush(false) } catch (e: Throwable) { - successful = false + isSuccessfulyClosed = false reporter.report { "Exception when flushing cache ${cache.javaClass}: $e" } } } @@ -68,13 +69,13 @@ abstract class IncrementalCachesManager<PlatformCache : AbstractIncrementalCache try { cache.close() } catch (e: Throwable) { - successful = false + isSuccessfulyClosed = false reporter.report { "Exception when closing cache ${cache.javaClass}: $e" } } } isClosed = true - return successful + return isSuccessfulyClosed } } diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCompilerRunner.kt index eadf86c2677..dd9a0e870b8 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCompilerRunner.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCompilerRunner.kt @@ -71,7 +71,53 @@ abstract class IncrementalCompilerRunner< providedChangedFiles: ChangedFiles?, projectDir: File? = null ): ExitCode = reporter.measure(BuildTime.INCREMENTAL_COMPILATION_DAEMON) { - compileImpl(allSourceFiles, args, messageCollector, providedChangedFiles, projectDir) + try { + compileImpl(allSourceFiles, args, messageCollector, providedChangedFiles, projectDir) + } finally { + reporter.measure(BuildTime.CALCULATE_OUTPUT_SIZE) { + reporter.addMetric( + BuildPerformanceMetric.SNAPSHOT_SIZE, + buildHistoryFile.length() + lastBuildInfoFile.length() + abiSnapshotFile.length() + ) + if (cacheDirectory.exists() && cacheDirectory.isDirectory()) { + cacheDirectory.walkTopDown().filter { it.isFile }.map { it.length() }.sum().let { + reporter.addMetric(BuildPerformanceMetric.CACHE_DIRECTORY_SIZE, it) + } + } + } + } + } + + fun rebuild( + reason: BuildAttribute, + allSourceFiles: List<File>, + args: Args, + messageCollector: MessageCollector, + providedChangedFiles: ChangedFiles?, + projectDir: File? = null, + classpathAbiSnapshot: Map<String, AbiSnapshot> + ): ExitCode { + reporter.report { "Non-incremental compilation will be performed: $reason" } + reporter.measure(BuildTime.CLEAR_OUTPUT_ON_REBUILD) { + cleanOutputsAndLocalStateOnRebuild(args) + } + val caches = createCacheManager(args, projectDir) + try { + if (providedChangedFiles == null) { + caches.inputsCache.sourceSnapshotMap.compareAndUpdate(allSourceFiles) + } + val allKotlinFiles = allSourceFiles.filter { it.isKotlinFile(kotlinSourceFilesExtensions) } + return compileIncrementally( + args, caches, allKotlinFiles, CompilationMode.Rebuild(reason), messageCollector, withAbiSnapshot, + classpathAbiSnapshot = classpathAbiSnapshot + ).also { + if (it == ExitCode.OK) { + performWorkAfterSuccessfulCompilation(caches) + } + } + } finally { + caches.close(true) + } } private fun compileImpl( @@ -82,13 +128,11 @@ abstract class IncrementalCompilerRunner< projectDir: File? = null ): ExitCode { var caches = createCacheManager(args, projectDir) + var rebuildReason = BuildAttribute.INTERNAL_ERROR - if (withAbiSnapshot) { - reporter.report { "Incremental compilation with ABI snapshot enabled" } - } - //TODO if abi-snapshot is corrupted unable to rebuild. Should roll back to withSnapshot = false? val classpathAbiSnapshot = if (withAbiSnapshot) { + reporter.report { "Incremental compilation with ABI snapshot enabled" } reporter.measure(BuildTime.SET_UP_ABI_SNAPSHOTS) { setupJarDependencies(args, withAbiSnapshot, reporter) } @@ -96,27 +140,7 @@ abstract class IncrementalCompilerRunner< emptyMap() } - fun rebuild(reason: BuildAttribute): ExitCode { - reporter.report { "Non-incremental compilation will be performed: $reason" } - caches.close(false) - // todo: we can recompile all files incrementally (not cleaning caches), so rebuild won't propagate - reporter.measure(BuildTime.CLEAR_OUTPUT_ON_REBUILD) { - cleanOutputsAndLocalStateOnRebuild(args) - } - caches = createCacheManager(args, projectDir) - if (providedChangedFiles == null) { - caches.inputsCache.sourceSnapshotMap.compareAndUpdate(allSourceFiles) - } - val allKotlinFiles = allSourceFiles.filter { it.isKotlinFile(kotlinSourceFilesExtensions) } - return compileIncrementally( - args, caches, allKotlinFiles, CompilationMode.Rebuild(reason), messageCollector, withAbiSnapshot, - classpathAbiSnapshot = classpathAbiSnapshot - ) - } - - // If compilation has crashed or we failed to close caches we have to clear them - var cachesMayBeCorrupted = true - return try { + try { val changedFiles = when (providedChangedFiles) { is ChangedFiles.Dependencies -> { val changedSources = caches.inputsCache.sourceSnapshotMap.compareAndUpdate(allSourceFiles) @@ -129,75 +153,51 @@ abstract class IncrementalCompilerRunner< else -> providedChangedFiles } - @Suppress("MoveVariableDeclarationIntoWhen") - val compilationMode = sourcesToCompile(caches, changedFiles, args, messageCollector, classpathAbiSnapshot) + var compilationMode = sourcesToCompile(caches, changedFiles, args, messageCollector, classpathAbiSnapshot) + val abiSnapshot = if (compilationMode is CompilationMode.Incremental && withAbiSnapshot) { + AbiSnapshotImpl.read(abiSnapshotFile, reporter) + } else { + if (withAbiSnapshot) { + compilationMode = CompilationMode.Rebuild(BuildAttribute.NO_ABI_SNAPSHOT) + } + null + } - val exitCode = when (compilationMode) { + when (compilationMode) { is CompilationMode.Incremental -> { - if (withAbiSnapshot) { - val abiSnapshot = AbiSnapshotImpl.read(abiSnapshotFile, reporter) - if (abiSnapshot != null) { + try { + val exitCode = if (withAbiSnapshot) { compileIncrementally( - args, - caches, - allSourceFiles, - compilationMode, - messageCollector, - withAbiSnapshot, - abiSnapshot, - classpathAbiSnapshot + args, caches, allSourceFiles, compilationMode, messageCollector, + withAbiSnapshot, abiSnapshot!!, classpathAbiSnapshot ) } else { - rebuild(BuildAttribute.NO_ABI_SNAPSHOT) + compileIncrementally(args, caches, allSourceFiles, compilationMode, messageCollector, withAbiSnapshot) } - } else { - compileIncrementally( - args, - caches, - allSourceFiles, - compilationMode, - messageCollector, - withAbiSnapshot - ) - } - } - is CompilationMode.Rebuild -> { - rebuild(compilationMode.reason) - } - } - - if (exitCode == ExitCode.OK) { - performWorkAfterSuccessfulCompilation(caches) - } - - if (!caches.close(flush = true)) throw RuntimeException("Could not flush caches") - // Here we should analyze exit code of compiler. E.g. compiler failure should lead to caches rebuild, - // but now JsKlib compiler reports invalid exit code. - cachesMayBeCorrupted = false - - reporter.measure(BuildTime.CALCULATE_OUTPUT_SIZE) { - reporter.addMetric( - BuildPerformanceMetric.SNAPSHOT_SIZE, - buildHistoryFile.length() + lastBuildInfoFile.length() + abiSnapshotFile.length() - ) - if (cacheDirectory.exists() && cacheDirectory.isDirectory()) { - cacheDirectory.walkTopDown().filter { it.isFile }.map { it.length() }.sum().let { - reporter.addMetric(BuildPerformanceMetric.CACHE_DIRECTORY_SIZE, it) + if (exitCode == ExitCode.OK) { + performWorkAfterSuccessfulCompilation(caches) + } + return exitCode + } catch (e: Throwable) { + reporter.report { + "Incremental compilation failed: ${e.stackTraceToString()}.\nFalling back to non-incremental compilation." + } + rebuildReason = BuildAttribute.INCREMENTAL_COMPILATION_FAILED } } + is CompilationMode.Rebuild -> rebuildReason = compilationMode.reason } - return exitCode - } catch (e: Exception) { // todo: catch only cache corruption - // todo: warn? - reporter.report { "Possible caches corruption: $e" } - rebuild(BuildAttribute.CACHE_CORRUPTION).also { - cachesMayBeCorrupted = false + } catch (e: Exception) { + reporter.report { + "Incremental compilation analysis failed: ${e.stackTraceToString()}.\nFalling back to non-incremental compilation." } } finally { - if (cachesMayBeCorrupted) { + if (!caches.close()) { + reporter.report { "Unable to close IC caches. Cleaning internal state" } cleanOutputsAndLocalStateOnRebuild(args) } } + return rebuild(rebuildReason, allSourceFiles, args, messageCollector, providedChangedFiles, projectDir, classpathAbiSnapshot) } /** @@ -411,7 +411,10 @@ abstract class IncrementalCompilerRunner< break } - val (dirtyLookupSymbols, dirtyClassFqNames, forceRecompile) = changesCollector.getDirtyData(listOf(caches.platformCache), reporter) + val (dirtyLookupSymbols, dirtyClassFqNames, forceRecompile) = changesCollector.getDirtyData( + listOf(caches.platformCache), + reporter + ) val compiledInThisIterationSet = sourcesToCompile.toHashSet() val forceToRecompileFiles = mapClassesFqNamesToFiles(listOf(caches.platformCache), forceRecompile, reporter) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt index f74a4857b6c..681d131d2b0 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt @@ -28,7 +28,7 @@ object KotlinStubVersions { // Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed // or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder). // Increasing this version will lead to reindexing of all binary files that are potentially kotlin binaries (including all class files). - private const val BINARY_STUB_VERSION = 78 + private const val BINARY_STUB_VERSION = 79 // Classfile stub version should be increased if changes are made to classfile stub building subsystem (org.jetbrains.kotlin.idea.decompiler.classFile) // Increasing this version will lead to reindexing of all classfiles. diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/KotlinConstraintSystemCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/KotlinConstraintSystemCompleter.kt index 82af42268a3..274161c2d10 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/KotlinConstraintSystemCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/KotlinConstraintSystemCompleter.kt @@ -223,6 +223,11 @@ class KotlinConstraintSystemCompleter( if (!argument.atom.hasBuilderInferenceAnnotation && !useBuilderInferenceWithoutAnnotation) continue + // Imitate having builder inference annotation. TODO: Remove after getting rid of @BuilderInference + if (!argument.atom.hasBuilderInferenceAnnotation && useBuilderInferenceWithoutAnnotation) { + argument.atom.hasBuilderInferenceAnnotation = true + } + val notFixedInputTypeVariables = argument.inputTypes .flatMap { it.extractTypeVariables() }.filter { it !in fixedTypeVariables } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt index 6f1b4f79e37..6f5759dc0aa 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt @@ -106,8 +106,8 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker { val innerType = capturedType.lowerType ?: capturedType.constructor.projection.type.unwrap() val substitutedInnerType = substitute(innerType, keepAnnotation, runCapturedChecks = false) - val substitutedSuperTypes = - capturedType.constructor.supertypes.map { substitute(it, keepAnnotation, runCapturedChecks = false) ?: it } + val (projectionSupertype, boundSupertypes) = + capturedType.constructor.transformSupertypes { substitute(it, keepAnnotation, runCapturedChecks = false) ?: it } if (substitutedInnerType != null) { return if (substitutedInnerType.isCaptured()) substitutedInnerType else { @@ -116,7 +116,7 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker { NewCapturedTypeConstructor( TypeProjectionImpl(typeConstructor.projection.projectionKind, substitutedInnerType), typeParameter = typeConstructor.typeParameter - ).also { it.initializeSupertypes(substitutedSuperTypes) }, + ).also { it.initializeSupertypes(projectionSupertype, boundSupertypes) }, lowerType = if (capturedType.lowerType != null) substitutedInnerType else null ) } diff --git a/compiler/testData/codegen/box/defaultArguments/kt52702.kt b/compiler/testData/codegen/box/defaultArguments/kt52702.kt new file mode 100644 index 00000000000..21f5bfd3705 --- /dev/null +++ b/compiler/testData/codegen/box/defaultArguments/kt52702.kt @@ -0,0 +1,24 @@ +// IGNORE_BACKEND: JS +// Check that local variables for inline functions and inline default lambdas start +// after they are initialized. + +inline fun spray() { + val a = Any() + val b = Any() + val c = Any() + val d = Any() + val e = Any() +} + +inline fun f(block: () -> String = { "OK" }): String = block() + +fun box(): String { + // On the JVM, this call adds some locals with reference types to the LVT + // which end after the call returns. + spray() + // When inlining `f` we'll reuse the same slots that previously contained + // locals with reference types for the $i$f$f and $i$a$-f-... variables. + // Since these locals have integer types D8 would produce a warning if they + // started before being initialized, which would cause the test to fail. + return f() +} diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.fir.kt index faad5dd9fee..3edd24a0e44 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.fir.kt @@ -201,7 +201,7 @@ interface Foo2<K, V> { fun entries(): MutableSet<MutableMap.MutableEntry<K, V>> } -fun <L, K, V> twoBuilderLambdas(@BuilderInference block: Foo<L>.() -> Unit, @BuilderInference block2: Foo2<K, V>.() -> Unit) {} +fun <L, K, V> twoBuilderLambdas(block: Foo<L>.() -> Unit, block2: Foo2<K, V>.() -> Unit) {} fun test() { twoBuilderLambdas( diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.kt index 4ed8dd2e8ac..1c4bd72d29e 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.kt @@ -201,7 +201,7 @@ interface Foo2<K, V> { fun entries(): MutableSet<MutableMap.MutableEntry<K, V>> } -fun <L, K, V> twoBuilderLambdas(@BuilderInference block: Foo<L>.() -> Unit, @BuilderInference block2: Foo2<K, V>.() -> Unit) {} +fun <L, K, V> twoBuilderLambdas(block: Foo<L>.() -> Unit, block2: Foo2<K, V>.() -> Unit) {} fun test() { twoBuilderLambdas( diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.txt b/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.txt index 6fe2cd86100..1ea391c302c 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.txt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.txt @@ -19,7 +19,7 @@ public fun foo11(/*0*/ x: kotlin.collections.MutableSet<kotlin.collections.Mutab @kotlin.jvm.JvmName(name = "foo111") public fun foo11(/*0*/ x: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<kotlin.String, kotlin.Int>>): kotlin.Unit public fun main(): kotlin.Unit public fun test(): kotlin.Unit -public fun </*0*/ L, /*1*/ K, /*2*/ V> twoBuilderLambdas(/*0*/ @kotlin.BuilderInference block: Foo<L>.() -> kotlin.Unit, /*1*/ @kotlin.BuilderInference block2: Foo2<K, V>.() -> kotlin.Unit): kotlin.Unit +public fun </*0*/ L, /*1*/ K, /*2*/ V> twoBuilderLambdas(/*0*/ block: Foo<L>.() -> kotlin.Unit, /*1*/ block2: Foo2<K, V>.() -> kotlin.Unit): kotlin.Unit public fun kotlin.Int.bar(): kotlin.Unit @kotlin.jvm.JvmName(name = "bar1") public fun kotlin.String.bar(): kotlin.Unit public fun kotlin.Int.foo0003(/*0*/ y: kotlin.Number, /*1*/ z: kotlin.String): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt new file mode 100644 index 00000000000..1b8cb3ea392 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt @@ -0,0 +1,13 @@ +// FIR_IDENTICAL +// FILE: Foo.java +public abstract class Foo<K extends Bar<? extends Foo<K>>> { + abstract String getTest(); +} + +// FILE: Bar.java +public abstract class Bar<T extends Foo<? extends Bar<T>>> {} + +// FILE: main.kt +fun box(foo: Foo<*>) { + foo.test // unresolved in 1.7.0, OK before +} diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.txt b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.txt new file mode 100644 index 00000000000..b1d922751e5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.txt @@ -0,0 +1,18 @@ +package + +public fun box(/*0*/ foo: Foo<*>): kotlin.Unit + +public abstract class Bar</*0*/ T : Foo<out Bar<T!>!>!> { + public constructor Bar</*0*/ T : Foo<out Bar<T!>!>!>() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class Foo</*0*/ K : Bar<out Foo<K!>!>!> { + public constructor Foo</*0*/ K : Bar<out Foo<K!>!>!>() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ abstract fun getTest(): kotlin.String! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/inference/kt47316.kt b/compiler/testData/diagnostics/tests/inference/kt47316.kt index f881ef0e15d..b36c5dcf9df 100644 --- a/compiler/testData/diagnostics/tests/inference/kt47316.kt +++ b/compiler/testData/diagnostics/tests/inference/kt47316.kt @@ -30,7 +30,7 @@ fun String.asFsdAddress(): String { fun box(): String { val state = Test().state if (state is GoBuildingRunningState<*>) { - state.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>buildingWorkingDirectory<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>asFsdAddress<!>() + <!DEBUG_INFO_SMARTCAST!>state<!>.buildingWorkingDirectory.asFsdAddress() } return "OK" } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 614e4e99be2..73ddf114944 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -14528,6 +14528,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { } @Test + @TestMetadata("kt52782.kt") + public void testKt52782() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt"); + } + + @Test @TestMetadata("memberScopeOfCaptured.kt") public void testMemberScopeOfCaptured() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/memberScopeOfCaptured.kt"); diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 7497764b71d..195c0479a05 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -13544,6 +13544,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } @Test + @TestMetadata("kt52702.kt") + public void testKt52702() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/kt52702.kt"); + } + + @Test @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index b817f4119ce..e110ce8e1d3 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -13670,6 +13670,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } @Test + @TestMetadata("kt52702.kt") + public void testKt52702() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/kt52702.kt"); + } + + @Test @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 4dd95575857..6aacaad36f4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -11018,6 +11018,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/defaultArguments/kt48391.kt"); } + @TestMetadata("kt52702.kt") + public void testKt52702() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/kt52702.kt"); + } + @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); @@ -13961,11 +13966,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Fir extends AbstractLightAnalysisModeTest { - @TestMetadata("flexibleIntegerLiterals.kt") - public void ignoreFlexibleIntegerLiterals() throws Exception { - runTest("compiler/testData/codegen/box/fir/flexibleIntegerLiterals.kt"); - } - @TestMetadata("SuspendExtension.kt") public void ignoreSuspendExtension() throws Exception { runTest("compiler/testData/codegen/box/fir/SuspendExtension.kt"); @@ -14019,6 +14019,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt"); } + @TestMetadata("flexibleIntegerLiterals.kt") + public void testFlexibleIntegerLiterals() throws Exception { + runTest("compiler/testData/codegen/box/fir/flexibleIntegerLiterals.kt"); + } + @TestMetadata("incorrectBytecodeWithEnhancedNullability.kt") public void testIncorrectBytecodeWithEnhancedNullability() throws Exception { runTest("compiler/testData/codegen/box/fir/incorrectBytecodeWithEnhancedNullability.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/checker/NewCapturedType.kt b/core/descriptors/src/org/jetbrains/kotlin/types/checker/NewCapturedType.kt index 55eb1b8207a..44093c37c4d 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/checker/NewCapturedType.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/checker/NewCapturedType.kt @@ -173,16 +173,16 @@ private fun captureArguments(type: UnwrappedType, status: CaptureStatus): List<T val newProjection = capturedArguments[index] if (oldProjection.projectionKind == Variance.INVARIANT) continue - val capturedTypeSupertypes = type.constructor.parameters[index].upperBounds.mapTo(mutableListOf()) { + val boundSupertypes = type.constructor.parameters[index].upperBounds.mapTo(mutableListOf()) { KotlinTypePreparator.Default.prepareType(substitutor.safeSubstitute(it, Variance.INVARIANT).unwrap()) } - if (!oldProjection.isStarProjection && oldProjection.projectionKind == Variance.OUT_VARIANCE) { - capturedTypeSupertypes += KotlinTypePreparator.Default.prepareType(oldProjection.type.unwrap()) - } + val projectionSupertype = if (!oldProjection.isStarProjection && oldProjection.projectionKind == Variance.OUT_VARIANCE) { + KotlinTypePreparator.Default.prepareType(oldProjection.type.unwrap()) + } else null val capturedType = newProjection.type as NewCapturedType - capturedType.constructor.initializeSupertypes(capturedTypeSupertypes) + capturedType.constructor.initializeSupertypes(projectionSupertype, boundSupertypes) } return capturedArguments @@ -243,18 +243,32 @@ class NewCapturedTypeConstructor( original: NewCapturedTypeConstructor? = null ) : this(projection, { supertypes }, original) - private val _supertypes by lazy(LazyThreadSafetyMode.PUBLICATION) { + // supertypes from the corresponding type parameter upper bounds + private val boundSupertypes by lazy(LazyThreadSafetyMode.PUBLICATION) { supertypesComputation?.invoke() } - fun initializeSupertypes(supertypes: List<UnwrappedType>) { + private var projectionSupertype: UnwrappedType? = null + + fun initializeSupertypes(projectionSupertype: UnwrappedType?, boundSupertypes: List<UnwrappedType>) { assert(this.supertypesComputation == null) { - "Already initialized! oldValue = ${this.supertypesComputation}, newValue = $supertypes" + "Already initialized! oldValue = ${this.supertypesComputation}, newValue = $boundSupertypes" } - this.supertypesComputation = { supertypes } + this.projectionSupertype = projectionSupertype + this.supertypesComputation = { boundSupertypes } + } + + override fun getSupertypes(): List<UnwrappedType> = buildList { + projectionSupertype?.let { add(it) } + boundSupertypes?.let { addAll(it) } + } + + fun transformSupertypes(transformation: (UnwrappedType) -> UnwrappedType): Pair<UnwrappedType?, List<UnwrappedType>> { + val projectionSupertypeTransformed = projectionSupertype?.let(transformation) + val boundSupertypesTransformed = boundSupertypes?.map(transformation) ?: emptyList() + return projectionSupertypeTransformed to boundSupertypesTransformed } - override fun getSupertypes() = _supertypes ?: emptyList() override fun getParameters(): List<TypeParameterDescriptor> = emptyList() override fun isFinal() = false diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 97f0b04e35c..6d36f238a6e 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -2120,10 +2120,10 @@ <sha256 value="f1dc5b9c242d0d90401c6287458db184978b855e12ce0c412fecad361dca0213" origin="Generated by Gradle"/> </artifact> </component> - <component group="com.gradle.publish" name="plugin-publish-plugin" version="0.20.0"> - <artifact name="plugin-publish-plugin-0.20.0.jar"> - <md5 value="7332672ea82e8ba857b8474837deae6e" origin="Generated by Gradle"/> - <sha256 value="e71dc838ada62842fb9d1ea3f64a5615d09a032adb7f7e6a9e52235e9a80e77d" origin="Generated by Gradle"/> + <component group="com.gradle.publish" name="plugin-publish-plugin" version="1.0.0-rc-3"> + <artifact name="plugin-publish-plugin-1.0.0-rc-3.jar"> + <md5 value="e8f8cf5cc8cab2b7df87b227772a9089" origin="Generated by Gradle"/> + <sha256 value="3441a5772dcb9461146aa59caf2eb5a665826ed393340d10b16f1346d11340c0" origin="Generated by Gradle"/> </artifact> </component> <component group="com.ibm.icu" name="icu4j" version="53.1"> diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index 5206c552095..ec43e650578 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -10204,6 +10204,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } @Test + @TestMetadata("kt52702.kt") + public void testKt52702() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/kt52702.kt"); + } + + @Test @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index b17f4de25cd..b3674f8e98a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -10246,6 +10246,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } @Test + @TestMetadata("kt52702.kt") + public void testKt52702() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/kt52702.kt"); + } + + @Test @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 5917b91d984..fd561093313 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -8980,6 +8980,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/defaultArguments/kt48391.kt"); } + @TestMetadata("kt52702.kt") + public void testKt52702() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/kt52702.kt"); + } + @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); diff --git a/libraries/tools/atomicfu/src/main/kotlin/org/jetbrains/kotlinx/atomicfu/gradle/AtomicfuKotlinGradleSubplugin.kt b/libraries/tools/atomicfu/src/common/kotlin/org/jetbrains/kotlinx/atomicfu/gradle/AtomicfuKotlinGradleSubplugin.kt index 05f76c7b3e6..05f76c7b3e6 100644 --- a/libraries/tools/atomicfu/src/main/kotlin/org/jetbrains/kotlinx/atomicfu/gradle/AtomicfuKotlinGradleSubplugin.kt +++ b/libraries/tools/atomicfu/src/common/kotlin/org/jetbrains/kotlinx/atomicfu/gradle/AtomicfuKotlinGradleSubplugin.kt diff --git a/libraries/tools/atomicfu/src/main/resources/META-INF/gradle-plugins/kotlinx-atomicfu.properties b/libraries/tools/atomicfu/src/common/resources/META-INF/gradle-plugins/kotlinx-atomicfu.properties index b07d10d4109..b07d10d4109 100644 --- a/libraries/tools/atomicfu/src/main/resources/META-INF/gradle-plugins/kotlinx-atomicfu.properties +++ b/libraries/tools/atomicfu/src/common/resources/META-INF/gradle-plugins/kotlinx-atomicfu.properties diff --git a/libraries/tools/atomicfu/src/main/resources/META-INF/services/org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin b/libraries/tools/atomicfu/src/common/resources/META-INF/services/org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin index 82e8567f12c..82e8567f12c 100644 --- a/libraries/tools/atomicfu/src/main/resources/META-INF/services/org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin +++ b/libraries/tools/atomicfu/src/common/resources/META-INF/services/org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts index 030e963bbcd..d59ad76d55c 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts @@ -38,6 +38,11 @@ dependencies { requireCapability("org.jetbrains.kotlin:kotlin-sam-with-receiver-common") } } + testImplementation(project(":atomicfu")) { + capabilities { + requireCapability("org.jetbrains.kotlin:atomicfu-common") + } + } testImplementation(project(":kotlin-gradle-plugin-model")) testImplementation(project(":kotlin-gradle-build-metrics")) testImplementation(project(":kotlin-project-model")) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt index 7d25e28148a..9d47bb6606c 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ConfigurationCacheIT.kt @@ -61,13 +61,13 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() { @MppGradlePluginTests @DisplayName("works with MPP publishing") @GradleTest - @OptIn(ExperimentalStdlibApi::class) fun testMppWithMavenPublish(gradleVersion: GradleVersion) { project("new-mpp-lib-and-app/sample-lib", gradleVersion) { // KT-49933: Support Gradle Configuration caching with HMPP val publishedTargets = listOf(/*"kotlinMultiplatform",*/ "jvm6", "nodeJs") testConfigurationCacheOf( + ":buildKotlinToolingMetadata", // Remove it when KT-49933 is fixed and `kotlinMultiplatform` publication works *(publishedTargets.map { ":publish${it.replaceFirstChar { it.uppercaseChar() }}PublicationToMavenRepository" }.toTypedArray()), checkUpToDateOnRebuild = false ) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt index c65442dde88..9d5a082ad9c 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt @@ -675,7 +675,7 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation } build("assemble") { - assertOutputContains("Non-incremental compilation will be performed: CACHE_CORRUPTION") + assertOutputContains("Non-incremental compilation will be performed: INCREMENTAL_COMPILATION_FAILED") } val lookupFile = projectPath.resolve("lib/build/kotlin/${compileKotlinTaskName}/cacheable/${compileCacheFolderName}/lookups/file-to-id.tab") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt index 35325fdf1ff..a88f7467641 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/PluginsDslIT.kt @@ -40,7 +40,11 @@ class PluginsDslIT : KGPBaseTest() { "org.jetbrains.kotlin.allopen.gradle.AllOpenGradleSubplugin", "org.jetbrains.kotlin.allopen.gradle.SpringGradleSubplugin", "org.jetbrains.kotlin.noarg.gradle.NoArgGradleSubplugin", - "org.jetbrains.kotlin.noarg.gradle.KotlinJpaSubplugin" + "org.jetbrains.kotlin.noarg.gradle.KotlinJpaSubplugin", + "org.jetbrains.kotlinx.atomicfu.gradle.AtomicfuKotlinGradleSubplugin", + "org.jetbrains.kotlin.lombok.gradle.LombokSubplugin", + "org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverGradleSubplugin", + "org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin" ) build("build") { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt index f9647c59479..0cc45064a34 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt @@ -21,8 +21,11 @@ import org.jetbrains.kotlin.konan.target.CompilerOutputKind import org.jetbrains.kotlin.konan.target.HostManager import org.jetbrains.kotlin.konan.target.KonanTarget import org.jetbrains.kotlin.konan.target.presetName -import org.junit.* -import org.junit.rules.TemporaryFolder +import org.junit.Assume +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.rules.ErrorCollector import java.io.File import java.nio.file.Files import java.util.* @@ -98,13 +101,6 @@ private fun BaseGradleIT.Project.configureSingleNativeTarget(preset: String = Ho } } -internal fun BaseGradleIT.BuildOptions.withCustomKonanDataDir( - customKonanDataDir: File -) = this.copy( - customEnvironmentVariables = this.customEnvironmentVariables + - ("KONAN_DATA_DIR" to customKonanDataDir.absolutePath) -) - class GeneralNativeIT : BaseGradleIT() { val nativeHostTargetName = MPPNativeTargets.current @@ -1101,131 +1097,6 @@ class GeneralNativeIT : BaseGradleIT() { } @Test - fun `check offline mode is propagated to the compiler`() = with( - transformNativeTestProjectWithPluginDsl( - "executables", - directoryPrefix = "native-binaries" - ) - ) { - val buildOptions = defaultBuildOptions() - - val linkTask = ":linkDebugExecutableHost" - val compileTask = ":compileKotlinHost" - - build(linkTask, options = buildOptions) { - assertSuccessful() - } - - // Check that --offline works when all the dependencies are already downloaded: - val buildOptionsOffline = buildOptions.copy(freeCommandLineArgs = buildOptions.freeCommandLineArgs + "--offline") - - build("clean", linkTask, options = buildOptionsOffline) { - assertSuccessful() - withNativeCommandLineArguments(compileTask, linkTask) { - assertTrue(it.contains("-Xoverride-konan-properties=airplaneMode=true")) - } - } - - // Check that --offline fails when there are no downloaded dependencies: - run { - val customKonanDataDir = tempDir.newFolder() - val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir) - - build("clean", linkTask, options = buildOptionsOfflineWithCustomKonanDataDir) { - assertFailed() - assertTasksNotExecuted(listOf(linkTask)) - } - - checkNoDependenciesDownloaded(customKonanDataDir) - } - - // Check that the compiler is not extracted if it is not cached: - run { - val customKonanDataDir = tempDir.newFolder() - val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir) - build( - "clean", linkTask, "-Pkotlin.native.version=1.6.20-M1-9999", - options = buildOptionsOfflineWithCustomKonanDataDir - ) { - assertFailed() - assertTasksNotExecuted(listOf(linkTask, compileTask)) - } - - assertTrue(customKonanDataDir.listFiles().isNullOrEmpty()) - } - } - - private fun checkNoDependenciesDownloaded(customKonanDataDir: File) { - // Check that no files have actually been downloaded or extracted, - // except for maybe the compiler itself, which can be extracted from the Gradle cache - // (see NativeCompilerDownloader, it uses regular dependency resolution, - // so supports --offline properly by default). - val cacheDirName = "cache" - val dependenciesDirName = "dependencies" - - fun assertDirectoryHasNothingButMaybe(directory: File, vararg names: String) { - assertEquals(emptyList(), directory.listFiles().orEmpty().map { it.name } - names) - } - - assertDirectoryHasNothingButMaybe(File(customKonanDataDir, cacheDirName), ".lock") - assertDirectoryHasNothingButMaybe(File(customKonanDataDir, dependenciesDirName), ".extracted") - - val customKonanDataDirFiles = customKonanDataDir.listFiles().orEmpty().map { it.name } - setOf(cacheDirName, dependenciesDirName) - if (customKonanDataDirFiles.isNotEmpty()) { - assertEquals(1, customKonanDataDirFiles.size, message = customKonanDataDirFiles.toString()) - assertTrue(customKonanDataDirFiles.single().startsWith("kotlin-native-"), message = customKonanDataDirFiles.single()) - } - } - - @Test - fun `check offline mode is propagated to the cinterop`() = with(transformNativeTestProjectWithPluginDsl("native-cinterop")) { - val buildOptions = defaultBuildOptions() - val cinteropTask = ":projectLibrary:cinteropAnotherNumberHost" - - build(cinteropTask, options = buildOptions) { - assertSuccessful() - } - - // Check that --offline works when all the dependencies are already downloaded: - val buildOptionsOffline = buildOptions.copy(freeCommandLineArgs = buildOptions.freeCommandLineArgs + "--offline") - - build("clean", cinteropTask, options = buildOptionsOffline) { - assertSuccessful() - withNativeCommandLineArguments(cinteropTask, toolName = "cinterop") { - assertTrue(it.containsSequentially("-Xoverride-konan-properties", "airplaneMode=true")) - } - } - - // Check that --offline fails when there are no downloaded dependencies: - run { - val customKonanDataDir = tempDir.newFolder() - val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir) - - build("clean", cinteropTask, options = buildOptionsOfflineWithCustomKonanDataDir) { - assertFailed() - } - - checkNoDependenciesDownloaded(customKonanDataDir) - } - - // Check that the compiler is not extracted if it is not cached: - run { - val customKonanDataDir = tempDir.newFolder() - val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir) - - build( - "clean", cinteropTask, "-Pkotlin.native.version=1.6.20-M1-9999", - options = buildOptionsOfflineWithCustomKonanDataDir - ) { - assertFailed() - assertTasksNotExecuted(listOf(cinteropTask)) - } - - assertTrue(customKonanDataDir.listFiles().isNullOrEmpty()) - } - } - - @Test fun allowToOverrideDownloadUrl() { with(transformNativeTestProjectWithPluginDsl("native-parallel")) { gradleProperties().appendText( @@ -1320,15 +1191,5 @@ class GeneralNativeIT : BaseGradleIT() { toolName: String = "konanc", check: (Map<String, String>) -> Unit ) = taskPaths.forEach { taskPath -> check(extractNativeCustomEnvironment(taskPath, toolName)) } - - @field:ClassRule - @JvmField - val tempDir = TemporaryFolder() - - @JvmStatic - @AfterClass - fun deleteTempDir() { - tempDir.delete() - } } }
\ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt index dc3a107ae3a..a95107353b0 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativePlatformLibsIT.kt @@ -20,9 +20,9 @@ import org.jetbrains.kotlin.konan.target.HostManager import org.jetbrains.kotlin.konan.target.KonanTarget import org.jetbrains.kotlin.konan.target.presetName import org.jetbrains.kotlin.konan.util.DependencyDirectories -import org.junit.* -import org.junit.rules.TemporaryFolder -import kotlin.test.assertFalse +import org.junit.Assume +import org.junit.BeforeClass +import org.junit.Test import kotlin.test.assertTrue class NativePlatformLibsIT : BaseGradleIT() { @@ -35,16 +35,6 @@ class NativePlatformLibsIT : BaseGradleIT() { // We temporary disable it for windows until a proper fix is found. Assume.assumeFalse(HostManager.hostIsMingw) } - - @field:ClassRule - @JvmField - val tempDir = TemporaryFolder() - - @JvmStatic - @AfterClass - fun deleteTempDir() { - tempDir.delete() - } } override val defaultGradleVersion: GradleVersionRequired @@ -85,11 +75,8 @@ class NativePlatformLibsIT : BaseGradleIT() { } } - private fun Project.buildWithLightDist( - vararg tasks: String, - options: BuildOptions = defaultBuildOptions(), - check: CompiledProject.() -> Unit - ) = build(*tasks, "-Pkotlin.native.distribution.type=light", options = options, check = check) + private fun Project.buildWithLightDist(vararg tasks: String, check: CompiledProject.() -> Unit) = + build(*tasks, "-Pkotlin.native.distribution.type=light", check = check) @Test fun testNoGenerationForOldCompiler() = with(platformLibrariesProject("linuxX64")) { @@ -319,50 +306,4 @@ class NativePlatformLibsIT : BaseGradleIT() { assertContains("Generate platform libraries for linux_x64") } } - - @Test - fun `check offline mode is propagated to the platform libs generator`() = with(platformLibrariesProject("linuxX64")) { - deleteInstalledCompilers() - - // Install the compiler at the first time. Don't build to reduce execution time. - buildWithLightDist("tasks") { - assertSuccessful() - assertContains("Generate platform libraries for linux_x64") - } - - deleteInstalledCompilers() - - // Check that --offline works when all the dependencies are already downloaded: - val buildOptionsOffline = defaultBuildOptions() - .let { it.copy(freeCommandLineArgs = it.freeCommandLineArgs + "--offline") } - - buildWithLightDist("tasks", options = buildOptionsOffline) { - assertSuccessful() - assertContains("Generate platform libraries for linux_x64") - } - - // Check that --offline fails when there are no downloaded dependencies: - run { - val customKonanDataDir = tempDir.newFolder() - val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir) - - buildWithLightDist("tasks", options = buildOptionsOfflineWithCustomKonanDataDir) { - assertFailed() - assertContains("Generate platform libraries for linux_x64") - } - } - - // The build above have extracted the cached compiler to the custom KONAN_DATA_DIR; remove it: - run { - val customKonanDataDir = tempDir.newFolder() - val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir) - // Check that the compiler is not extracted if it is not cached: - buildWithLightDist("tasks", "-Pkotlin.native.version=1.6.20-M1-9999", options = buildOptionsOfflineWithCustomKonanDataDir) { - assertFailed() - assertNotContains("Generate platform libraries for linux_x64") - } - - assertTrue(customKonanDataDir.listFiles().isNullOrEmpty()) - } - } } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt index 129cd62ae22..227ab8f56a1 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/projectSetupDefaults.kt @@ -34,6 +34,7 @@ internal val DEFAULT_GROOVY_SETTINGS_FILE = id "org.jetbrains.kotlin.plugin.serialization" version "${'$'}kotlin_version" id "org.jetbrains.kotlin.test.fixes.android" version "${'$'}test_fixes_version" id "org.jetbrains.kotlin.gradle-subplugin-example" version "${'$'}kotlin_version" + id "org.jetbrains.kotlin.plugin.atomicfu" version "${'$'}kotlin_version" } resolutionStrategy { @@ -86,6 +87,7 @@ internal val DEFAULT_KOTLIN_SETTINGS_FILE = id("org.jetbrains.kotlin.plugin.serialization") version kotlin_version id("org.jetbrains.kotlin.test.fixes.android") version test_fixes_version id("org.jetbrains.kotlin.gradle-subplugin-example") version kotlin_version + id("org.jetbrains.kotlin.plugin.atomicfu") version kotlin_version } resolutionStrategy { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyAllPlugins/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyAllPlugins/build.gradle index b68c8164126..16a73a5da06 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyAllPlugins/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/pluginsDsl/applyAllPlugins/build.gradle @@ -5,6 +5,10 @@ plugins { id 'org.jetbrains.kotlin.plugin.spring' id 'org.jetbrains.kotlin.plugin.noarg' id 'org.jetbrains.kotlin.plugin.jpa' + id 'org.jetbrains.kotlin.plugin.atomicfu' + id 'org.jetbrains.kotlin.plugin.lombok' + id 'org.jetbrains.kotlin.plugin.sam.with.receiver' + id 'org.jetbrains.kotlin.plugin.serialization' } repositories { diff --git a/libraries/tools/kotlin-gradle-plugin-npm-versions-codegen/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-npm-versions-codegen/build.gradle.kts index c3384cabd69..b0f468181b6 100644 --- a/libraries/tools/kotlin-gradle-plugin-npm-versions-codegen/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-npm-versions-codegen/build.gradle.kts @@ -17,6 +17,6 @@ val generateNpmVersions by generator( listOf(generateNpmVersions).forEach { it.systemProperty( "org.jetbrains.kotlin.generators.gradle.targets.js.outputSourceRoot", - project(":kotlin-gradle-plugin").projectDir.resolve("src/main/kotlin").absolutePath + project(":kotlin-gradle-plugin").projectDir.resolve("src/common/kotlin").absolutePath ) }
\ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt index c2dde3adb6f..49074724d84 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt @@ -54,9 +54,6 @@ abstract class KotlinToolRunner( abstract val mustRunViaExec: Boolean open fun transformArgs(args: List<String>): List<String> = args - internal open val defaultArguments: List<String> - get() = emptyList() - // for the purpose if there is a way to specify JVM args, for instance, straight in project configs open fun getCustomJvmArgs(): List<String> = emptyList() @@ -80,9 +77,8 @@ abstract class KotlinToolRunner( fun run(args: List<String>) { checkClasspath() - val argsWithDefault = args + defaultArguments - if (mustRunViaExec) runViaExec(argsWithDefault) else runInProcess(argsWithDefault) + if (mustRunViaExec) runViaExec(args) else runInProcess(args) } private fun runViaExec(args: List<String>) { diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/nativeToolRunners.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/nativeToolRunners.kt index a0ec6523237..d1b70a33ad4 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/nativeToolRunners.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/nativeToolRunners.kt @@ -146,13 +146,6 @@ internal class KotlinNativeCInteropRunner private constructor(project: Project) fun runWithContext(action: () -> Unit) } - override val defaultArguments: List<String> - get() = mutableListOf<String>().apply { - if (project.gradle.startParameter.isOffline) { - addAll(listOf("-Xoverride-konan-properties", "airplaneMode=true")) - } - } - companion object { fun ExecutionContext.run(args: List<String>) { val runner = KotlinNativeCInteropRunner(project) @@ -182,13 +175,6 @@ internal class KotlinNativeCompilerRunner(project: Project) : KotlinNativeToolRu return listOf(toolName, "@${argFile.absolutePath}") } - - override val defaultArguments: List<String> - get() = mutableListOf<String>().apply { - if (project.gradle.startParameter.isOffline) { - add("-Xoverride-konan-properties=airplaneMode=true") - } - } } /** Platform libraries generation tool. Runs the cinterop tool under the hood. */ @@ -196,11 +182,4 @@ internal class KotlinNativeLibraryGenerationRunner(project: Project) : AbstractKotlinNativeCInteropRunner("generatePlatformLibraries", project) { // The library generator works for a long time so enabling C2 can improve performance. override val disableC2: Boolean = false - - override val defaultArguments: List<String> - get() = mutableListOf<String>().apply { - if (project.gradle.startParameter.isOffline) { - addAll(listOf("-Xoverride-konan-properties", "airplaneMode=true")) - } - } } diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/KotlinMultiplatformPlugin.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/KotlinMultiplatformPlugin.kt index cf3e3e05b22..a286962d86d 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/KotlinMultiplatformPlugin.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/KotlinMultiplatformPlugin.kt @@ -30,7 +30,6 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.registerDefaultVariantFactori import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.setupFragmentsMetadataForKpmModules import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.setupKpmModulesPublication import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.copyAttributes -import org.jetbrains.kotlin.gradle.plugin.sources.CleanupStaleSourceSetMetadataEntriesService import org.jetbrains.kotlin.gradle.plugin.sources.DefaultLanguageSettingsBuilder import org.jetbrains.kotlin.gradle.plugin.sources.SourceSetMetadataStorageForIde import org.jetbrains.kotlin.gradle.plugin.sources.checkSourceSetVisibilityRequirements @@ -126,24 +125,6 @@ class KotlinMultiplatformPlugin : Plugin<Project> { project.pluginManager.apply(ScriptingGradleSubplugin::class.java) exportProjectStructureMetadataForOtherBuilds(project) - - SingleActionPerBuild.run(project.rootProject, "cleanup-processed-metadata") { - if (isConfigurationCacheAvailable(project.gradle)) { - BuildEventsListenerRegistryHolder.getInstance(project).listenerRegistry.onTaskCompletion( - project.gradle.sharedServices - .registerIfAbsent( - "cleanup-stale-sourceset-metadata", - CleanupStaleSourceSetMetadataEntriesService::class.java - ) { - CleanupStaleSourceSetMetadataEntriesService.configure(it, project) - } - ) - } else { - project.gradle.buildFinished { - SourceSetMetadataStorageForIde.cleanupStaleEntries(project) - } - } - } } private fun exportProjectStructureMetadataForOtherBuilds( diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/SourceSetMetadataStorageForIde.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/SourceSetMetadataStorageForIde.kt index 67c15bc3f5e..9f32202f5a3 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/SourceSetMetadataStorageForIde.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/SourceSetMetadataStorageForIde.kt @@ -17,31 +17,9 @@ import org.jetbrains.kotlin.gradle.dsl.multiplatformExtensionOrNull import java.io.File object SourceSetMetadataStorageForIde { - fun cleanupStaleEntries(project: Project) { - val projectStorageDirectories = project.rootProject.allprojects - .associate { projectStorage(it) to it.multiplatformExtensionOrNull?.sourceSets.orEmpty().map { it.name } } - cleanupStaleEntries(getStorageRoot(project), projectStorageDirectories) - } - - fun cleanupStaleEntries(projectStorageRoot: File, projectStorageDirectories: Map<File, List<String>>) { - projectStorageRoot.listFiles().orEmpty().filter { it.isDirectory }.forEach { directory -> - // If no project corresponds to the directory, remove the directory - if (directory !in projectStorageDirectories) { - directory.deleteRecursively() - } else { - // Under the project's directory, delete subdirectories that don't correspond to any source set: - val sourceSetNames = projectStorageDirectories.getValue(directory) - directory.listFiles().orEmpty().filter { it.isDirectory }.forEach { subdirectory -> - if (subdirectory.name !in sourceSetNames) - subdirectory.deleteRecursively() - } - } - } - } + private fun getStorageRoot(project: Project): File = project.rootDir.resolve(".gradle/kotlin/sourceSetMetadata") - internal fun getStorageRoot(project: Project): File = project.rootDir.resolve(".gradle/kotlin/sourceSetMetadata") - - internal fun projectStorage(project: Project): File { + private fun projectStorage(project: Project): File { val projectPathSegments = generateSequence(project) { it.parent }.map { it.name } return getStorageRoot(project).resolve( // Escape dots in project names to avoid ambiguous paths. @@ -54,27 +32,3 @@ object SourceSetMetadataStorageForIde { internal fun sourceSetStorageWithScope(project: Project, sourceSetName: String, scope: KotlinDependencyScope) = sourceSetStorage(project, sourceSetName).resolve(scope.scopeName) } - -abstract class CleanupStaleSourceSetMetadataEntriesService : BuildService<CleanupStaleSourceSetMetadataEntriesService.Parameters>, AutoCloseable, OperationCompletionListener { - interface Parameters : BuildServiceParameters { - val projectStorageRoot: Property<File> - val projectStorageDirectories: MapProperty<File, List<String>> - } - - override fun onFinish(event: FinishEvent?) { - // noop - } - - override fun close() { - SourceSetMetadataStorageForIde.cleanupStaleEntries(parameters.projectStorageRoot.get(), parameters.projectStorageDirectories.get()) - } - - companion object { - fun configure(spec: BuildServiceSpec<Parameters>, project: Project) { - spec.parameters.projectStorageRoot.set(SourceSetMetadataStorageForIde.getStorageRoot(project)) - spec.parameters.projectStorageDirectories.set(project.rootProject.allprojects.associate { - SourceSetMetadataStorageForIde.projectStorage(it) to it.multiplatformExtensionOrNull?.sourceSets.orEmpty().map { it.name } - }) - } - } -}
\ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/NpmVersions.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/NpmVersions.kt index d0bbd9ae781..2302f97c032 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/NpmVersions.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/NpmVersions.kt @@ -17,19 +17,19 @@ class NpmVersions : Serializable { val webpackCli3 = NpmPackageVersion("webpack-cli", "3.3.12") val webpackDevServer3 = NpmPackageVersion("webpack-dev-server", "3.11.2") val sourceMapLoader1 = NpmPackageVersion("source-map-loader", "1.1.0") - val webpack = NpmPackageVersion("webpack", "5.69.1") - val webpackCli = NpmPackageVersion("webpack-cli", "4.9.2") + val webpack = NpmPackageVersion("webpack", "5.73.0") + val webpackCli = NpmPackageVersion("webpack-cli", "4.10.0") val webpackBundleAnalyzer = NpmPackageVersion("webpack-bundle-analyzer", "4.5.0") - val webpackDevServer = NpmPackageVersion("webpack-dev-server", "4.7.4") - val sourceMapLoader = NpmPackageVersion("source-map-loader", "3.0.1") + val webpackDevServer = NpmPackageVersion("webpack-dev-server", "4.9.2") + val sourceMapLoader = NpmPackageVersion("source-map-loader", "4.0.0") val sourceMapSupport = NpmPackageVersion("source-map-support", "0.5.21") - val cssLoader = NpmPackageVersion("css-loader", "6.6.0") + val cssLoader = NpmPackageVersion("css-loader", "6.7.1") val styleLoader = NpmPackageVersion("style-loader", "3.3.1") val toStringLoader = NpmPackageVersion("to-string-loader", "1.2.0") - val miniCssExtractPlugin = NpmPackageVersion("mini-css-extract-plugin", "2.5.3") - val mocha = NpmPackageVersion("mocha", "9.2.1") - val karma = NpmPackageVersion("karma", "6.3.16") - val karmaChromeLauncher = NpmPackageVersion("karma-chrome-launcher", "3.1.0") + val miniCssExtractPlugin = NpmPackageVersion("mini-css-extract-plugin", "2.6.1") + val mocha = NpmPackageVersion("mocha", "10.0.0") + val karma = NpmPackageVersion("karma", "6.4.0") + val karmaChromeLauncher = NpmPackageVersion("karma-chrome-launcher", "3.1.1") val karmaPhantomjsLauncher = NpmPackageVersion("karma-phantomjs-launcher", "1.0.4") val karmaFirefoxLauncher = NpmPackageVersion("karma-firefox-launcher", "2.1.2") val karmaOperaLauncher = NpmPackageVersion("karma-opera-launcher", "1.0.0") diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/tooling/BuildKotlinToolingMetadataTask.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/tooling/BuildKotlinToolingMetadataTask.kt index 19b616503c9..007664d0071 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/tooling/BuildKotlinToolingMetadataTask.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/tooling/BuildKotlinToolingMetadataTask.kt @@ -94,16 +94,14 @@ abstract class BuildKotlinToolingMetadataTask : DefaultTask() { abstract class FromKpmModule @Inject constructor (@get:Internal val module: KotlinGradleModule) : BuildKotlinToolingMetadataTask() { - override val outputDirectory: File - get() = project.buildDir.resolve("kotlinToolingMetadata").resolve(module.name) + override val outputDirectory: File = project.buildDir.resolve("kotlinToolingMetadata").resolve(module.name) override fun buildKotlinToolingMetadata() = module.getKotlinToolingMetadata() } abstract class FromKotlinExtension : BuildKotlinToolingMetadataTask() { - override val outputDirectory: File - get() = project.buildDir.resolve("kotlinToolingMetadata") + override val outputDirectory: File = project.buildDir.resolve("kotlinToolingMetadata") override fun buildKotlinToolingMetadata() = project.kotlinExtension.getKotlinToolingMetadata() } diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index df8e562f1ed..e256e4bfb89 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -11174,6 +11174,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest } @Test + @TestMetadata("kt52702.kt") + public void testKt52702() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/kt52702.kt"); + } + + @Test @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); diff --git a/plugins/atomicfu/atomicfu-compiler/build.gradle.kts b/plugins/atomicfu/atomicfu-compiler/build.gradle.kts index d3c8ee20ac6..a8128b49ada 100644 --- a/plugins/atomicfu/atomicfu-compiler/build.gradle.kts +++ b/plugins/atomicfu/atomicfu-compiler/build.gradle.kts @@ -75,6 +75,7 @@ dependencies { testRuntimeOnly(commonDependency("org.fusesource.jansi", "jansi")) atomicfuClasspath("org.jetbrains.kotlinx:atomicfu-js:0.16.3") { isTransitive = false } + atomicfuRuntimeForTests(project(":kotlinx-atomicfu-runtime")) { isTransitive = false } embedded(project(":kotlinx-atomicfu-runtime")) { @@ -130,4 +131,4 @@ fun Test.setUpJsIrBoxTests() { systemProperty("kotlin.js.kotlin.test.path", "libraries/kotlin.test/js-ir/build/classes/kotlin/js/main") systemProperty("kotlin.js.kotlin.test.path", "libraries/kotlin.test/js-ir/build/classes/kotlin/js/main") systemProperty("kotlin.js.test.root.out.dir", "$buildDir/") -}
\ No newline at end of file +} diff --git a/plugins/atomicfu/atomicfu-runtime/build.gradle.kts b/plugins/atomicfu/atomicfu-runtime/build.gradle.kts index 4f56da71569..7049ad62b02 100644 --- a/plugins/atomicfu/atomicfu-runtime/build.gradle.kts +++ b/plugins/atomicfu/atomicfu-runtime/build.gradle.kts @@ -2,6 +2,7 @@ description = "Runtime library for the Atomicfu compiler plugin" plugins { kotlin("js") + `maven-publish` } group = "org.jetbrains.kotlin" @@ -23,4 +24,14 @@ kotlin { } } } -}
\ No newline at end of file +} + +configureCommonPublicationSettingsForGradle() + +publishing { + publications { + create<MavenPublication>("maven") { + from(components["kotlin"]) + } + } +} |