Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kotlin to 1.7.20-RC #2682

Merged
merged 2 commits into from Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,7 +1,7 @@
import org.jetbrains.dokka.gradle.DokkaTask

plugins {
kotlin("jvm") version "1.7.10"
kotlin("jvm") version "1.7.20-RC"
id("org.jetbrains.dokka") version ("1.7.10")
}

Expand Down
2 changes: 1 addition & 1 deletion examples/gradle/dokka-gradle-example/build.gradle.kts
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.dokka.gradle.DokkaTask
import java.net.URL

plugins {
kotlin("jvm") version "1.7.10"
kotlin("jvm") version "1.7.20-RC"
id("org.jetbrains.dokka") version ("1.7.10")
}

Expand Down
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.7.10"
kotlin("jvm") version "1.7.20-RC"
id("org.jetbrains.dokka") version ("1.7.10")
}

Expand Down
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.7.10"
kotlin("jvm") version "1.7.20-RC"
id("org.jetbrains.dokka") version ("1.7.10")
`java-library`
`maven-publish`
Expand Down
@@ -1,6 +1,6 @@
pluginManagement {
plugins {
kotlin("jvm") version "1.7.10"
kotlin("jvm") version "1.7.20-RC"
id("org.jetbrains.dokka") version ("1.7.10")
}
}
Expand Down
Expand Up @@ -4,7 +4,7 @@ import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.Platform

plugins {
kotlin("multiplatform") version "1.7.10"
kotlin("multiplatform") version "1.7.20-RC"
id("org.jetbrains.dokka") version "1.7.10"
}

Expand Down
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.7.10"
kotlin("jvm") version "1.7.20-RC"
id("org.jetbrains.dokka") version ("1.7.10") apply false
}

Expand Down
2 changes: 1 addition & 1 deletion examples/maven/pom.xml
Expand Up @@ -8,7 +8,7 @@
<artifactId>kotlin-maven-example</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<kotlin.version>1.7.10</kotlin.version>
<kotlin.version>1.7.20-RC</kotlin.version>
<dokka.version>1.7.10</dokka.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/hide-internal-api/build.gradle.kts
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI

plugins {
kotlin("jvm") version "1.7.10"
kotlin("jvm") version "1.7.20-RC"
id("org.jetbrains.dokka") version "1.7.10"
`maven-publish`
signing
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Expand Up @@ -2,10 +2,10 @@
dokka_version=1.7.20-SNAPSHOT
dokka_integration_test_parallelism=2
# Versions
kotlin_version=1.7.10
kotlin_version=1.7.20-RC
coroutines_version=1.6.3
kotlinx_html_version=0.7.5
kotlin_plugin_version=213-1.7.10-release-333-IJ6777.52
kotlin_plugin_version=213-1.7.20-199-IJ6777.52
jsoup_version=1.14.3
idea_version=213.6777.52
language_version=1.4
Expand Down
@@ -1,3 +1,3 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC
dokka_it_android_gradle_plugin_version=4.0.0
android.useAndroidX=true
@@ -1 +1 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC
@@ -1 +1 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC
@@ -1 +1 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC
@@ -1,2 +1,2 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC
react_version=18.1.0-pre.345
@@ -1 +1 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC
@@ -1 +1 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC
@@ -1,2 +1,2 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC

@@ -1,5 +1,5 @@
dokka_it_kotlin_version=1.7.10
dokka_it_kotlin_version=1.7.20-RC
#these flags are enabled by default since 1.6.20.
#remove when this test is executed with Kotlin >= 1.6.20
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
kotlin.native.enableDependencyPropagation=false
Expand Up @@ -40,9 +40,9 @@ class JsIRGradleIntegrationTest(override val versions: BuildVersions) : Abstract
return
}

val reactPropertyArg = TestedVersions.KT_REACT_WRAPPER_MAPPING[versions.kotlinVersion]
val reactVersion = TestedVersions.KT_REACT_WRAPPER_MAPPING[versions.kotlinVersion]
?: throw IllegalStateException("Unspecified version of react for kotlin " + versions.kotlinVersion)
val result = createGradleRunner(reactPropertyArg, "dokkaHtml", "-i", "-s").buildRelaxed()
val result = createGradleRunner("-Preact_version=$reactVersion", "dokkaHtml", "-i", "-s").buildRelaxed()
assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome)

val htmlOutputDir = File(projectDir, "build/dokka/html")
Expand All @@ -61,4 +61,4 @@ class JsIRGradleIntegrationTest(override val versions: BuildVersions) : Abstract
assertNoEmptySpans(file)
}
}
}
}
Expand Up @@ -5,7 +5,7 @@ internal object TestedVersions {
val BASE =
BuildVersions.permutations(
gradleVersions = listOf("7.4.2", "6.9"),
kotlinVersions = listOf("1.7.10", "1.6.21", "1.5.31", "1.4.32"),
kotlinVersions = listOf("1.7.20-RC", "1.6.21", "1.5.31", "1.4.32"),
) + BuildVersions.permutations(
gradleVersions = listOf(*ifExhaustive("7.0", "6.1.1")),
kotlinVersions = listOf(*ifExhaustive("1.6.0", "1.5.0", "1.4.0"))
Expand All @@ -18,20 +18,20 @@ internal object TestedVersions {
val ANDROID =
BuildVersions.permutations(
gradleVersions = listOf("7.4.2", *ifExhaustive("7.0")),
kotlinVersions = listOf("1.7.10", "1.6.21", "1.5.31", "1.4.32"),
kotlinVersions = listOf("1.7.20-RC", "1.6.21", "1.5.31", "1.4.32"),
androidGradlePluginVersions = listOf("7.2.0")
) + BuildVersions.permutations(
gradleVersions = listOf("6.9", *ifExhaustive("6.1.1", "5.6.4")),
kotlinVersions = listOf("1.7.10", "1.6.21", "1.5.31", "1.4.32"),
kotlinVersions = listOf("1.7.20-RC", "1.6.21", "1.5.31", "1.4.32"),
androidGradlePluginVersions = listOf("4.0.0", *ifExhaustive("3.6.3"))
)

// https://mvnrepository.com/artifact/org.jetbrains.kotlin-wrappers/kotlin-react
val KT_REACT_WRAPPER_MAPPING = mapOf(
"1.5.0" to "-Preact_version=17.0.2-pre.204-kotlin-1.5.0",
"1.6.0" to "-Preact_version=17.0.2-pre.280-kotlin-1.6.0",
"1.5.31" to "-Preact_version=17.0.2-pre.265-kotlin-1.5.31",
"1.6.21" to "-Preact_version=18.0.0-pre.332-kotlin-1.6.21",
"1.7.10" to "-Preact_version=18.2.0-pre.354"
"1.5.0" to "17.0.2-pre.204-kotlin-1.5.0",
"1.6.0" to "17.0.2-pre.280-kotlin-1.6.0",
"1.5.31" to "17.0.2-pre.265-kotlin-1.5.31",
"1.6.21" to "18.0.0-pre.332-kotlin-1.6.21",
"1.7.20-RC" to "18.2.0-pre.391",
)
}
2 changes: 1 addition & 1 deletion integration-tests/maven/projects/it-maven/pom.xml
Expand Up @@ -7,7 +7,7 @@
<version>1.0-SNAPSHOT</version>

<properties>
<kotlin.version>1.7.10</kotlin.version>
<kotlin.version>1.7.20-RC</kotlin.version>
</properties>
<build>
<plugins>
Expand Down
Expand Up @@ -362,9 +362,11 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
moduleInfo: ModuleInfo
): ResolverForModule =
CommonResolverForModuleFactory(
CommonAnalysisParameters { content ->
environment.createPackagePartProvider(content.moduleContentScope)
},
CommonAnalysisParameters(
metadataPartProviderFactory = { content ->
environment.createPackagePartProvider(content.moduleContentScope)
}
),
Comment on lines +365 to +369
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new primary constructor arg has been added (doesn't look like we need it), so have to use named parameters

CompilerEnvironment,
unspecifiedJvmPlatform,
true,
Expand Down
Expand Up @@ -10,26 +10,36 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
internal typealias KotlinCompilation =
org.jetbrains.kotlin.gradle.plugin.KotlinCompilation<KotlinCommonOptions>

internal fun Project.compilationsOf(sourceSet: KotlinSourceSet): List<KotlinCompilation> {
//KT-45412 Make sure .kotlinSourceSets and .allKotlinSourceSets include the default source set
return allCompilationsOf(sourceSet).filter { compilation ->
sourceSet in compilation.kotlinSourceSets || sourceSet == compilation.defaultSourceSet
}
}

internal fun Project.allCompilationsOf(
sourceSet: KotlinSourceSet
): List<KotlinCompilation> {
return when (val kotlin = kotlin) {
is KotlinMultiplatformExtension -> kotlin.allCompilationsOf(sourceSet)
is KotlinSingleTargetExtension -> kotlin.allCompilationsOf(sourceSet)
is KotlinMultiplatformExtension -> allCompilationsOf(kotlin, sourceSet)
is KotlinSingleTargetExtension<*> -> allCompilationsOf(kotlin, sourceSet)
else -> emptyList()
}
}

internal fun Project.compilationsOf(sourceSet: KotlinSourceSet): List<KotlinCompilation> {
//KT-45412 Make sure .kotlinSourceSets and .allKotlinSourceSets include the default source set
return allCompilationsOf(sourceSet).filter { compilation -> sourceSet in compilation.kotlinSourceSets || sourceSet == compilation.defaultSourceSet }
}

private fun KotlinMultiplatformExtension.allCompilationsOf(sourceSet: KotlinSourceSet): List<KotlinCompilation> {
val allCompilations = targets.flatMap { target -> target.compilations }
return allCompilations.filter { compilation -> sourceSet in compilation.allKotlinSourceSets || sourceSet == compilation.defaultSourceSet }
Comment on lines -23 to -30
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It failed with Overload resolution ambiguity, so refactored it a bit

e: /home/ignat/IdeaProjects/dokka/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt: (17, 51): Overload resolution ambiguity: 
private fun [Error type: Type for error type constructor (KotlinSingleTargetExtension)].allCompilationsOf(sourceSet: KotlinSourceSet): List<org.jetbrains.dokka.gradle.kotlin.KotlinCompilation /* = org.jetbrains.kotlin.gradle.plugin.KotlinCompilation<KotlinCommonOptions> */> defined in org.jetbrains.dokka.gradle.kotlin in file kotlinCompilationUtils.kt
private fun KotlinMultiplatformExtension.allCompilationsOf(sourceSet: KotlinSourceSet): List<org.jetbrains.dokka.gradle.kotlin.KotlinCompilation /* = org.jetbrains.kotlin.gradle.plugin.KotlinCompilation<KotlinCommonOptions> */> defined in org.jetbrains.dokka.gradle.kotlin in file kotlinCompilationUtils.kt
e: /home/ignat/IdeaProjects/dokka/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt: (18, 12): One type argument expected. Use 'KotlinSingleTargetExtension<*>' if you don't want to pass type arguments
e: /home/ignat/IdeaProjects/dokka/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt: (25, 12): Overload resolution ambiguity: 
private fun [Error type: Type for error type constructor (KotlinSingleTargetExtension)].allCompilationsOf(sourceSet: KotlinSourceSet): List<org.jetbrains.dokka.gradle.kotlin.KotlinCompilation /* = org.jetbrains.kotlin.gradle.plugin.KotlinCompilation<KotlinCommonOptions> */> defined in org.jetbrains.dokka.gradle.kotlin in file kotlinCompilationUtils.kt
internal fun Project.allCompilationsOf(sourceSet: KotlinSourceSet): List<org.jetbrains.dokka.gradle.kotlin.KotlinCompilation /* = org.jetbrains.kotlin.gradle.plugin.KotlinCompilation<KotlinCommonOptions> */> defined in org.jetbrains.dokka.gradle.kotlin in file kotlinCompilationUtils.kt
e: /home/ignat/IdeaProjects/dokka/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt: (25, 50): Cannot infer a type for this parameter. Please specify it explicitly.
e: /home/ignat/IdeaProjects/dokka/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt: (33, 13): One type argument expected for class KotlinSingleTargetExtension<TARGET : KotlinTarget>
e: /home/ignat/IdeaProjects/dokka/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt: (34, 41): Cannot infer a type for this parameter. Please specify it explicitly

private fun allCompilationsOf(
kotlin: KotlinMultiplatformExtension,
sourceSet: KotlinSourceSet
): List<KotlinCompilation> {
val allCompilations = kotlin.targets.flatMap { target -> target.compilations }
return allCompilations.filter { compilation ->
sourceSet in compilation.allKotlinSourceSets || sourceSet == compilation.defaultSourceSet
}
}

private fun KotlinSingleTargetExtension.allCompilationsOf(sourceSet: KotlinSourceSet): List<KotlinCompilation> {
return target.compilations.filter { compilation -> sourceSet in compilation.allKotlinSourceSets }
private fun allCompilationsOf(
kotlin: KotlinSingleTargetExtension<*>,
sourceSet: KotlinSourceSet
): List<KotlinCompilation> {
return kotlin.target.compilations.filter { compilation -> sourceSet in compilation.allKotlinSourceSets }
}
Expand Up @@ -113,7 +113,7 @@ class GradleDokkaSourceSetBuilderTest {
sourceSet.dependsOn(sourceSet.DokkaSourceSetID("s3"))
sourceSet.dependsOn(GradleDokkaSourceSetBuilder("s4", project))
sourceSet.dependsOn(GradleDokkaSourceSetBuilder("s5", project).build())
sourceSet.dependsOn(DefaultKotlinSourceSet(project, "s6"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there was some refactoring of gradle api, DefaultKotlinSourceSet is now abstract, so cannot instantiate it directly.

sourceSet.dependsOn(createDefaultKotlinSourceSet("s6"))
sourceSet.dependsOn(DefaultAndroidSourceSet("s7", project, false))

assertEquals(
Expand All @@ -123,6 +123,10 @@ class GradleDokkaSourceSetBuilderTest {
)
}

private fun createDefaultKotlinSourceSet(displayName: String): DefaultKotlinSourceSet {
return project.objects.newInstance(DefaultKotlinSourceSet::class.java, project, displayName)
}

@Test
fun samples() {
val sourceSet = GradleDokkaSourceSetBuilder("", project)
Expand Down