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

Drop kotlinx.serialization compiler plugin as it's unnecessary #3899

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions dokka-runners/dokka-gradle-plugin/api/dokka-gradle-plugin.api
Original file line number Diff line number Diff line change
Expand Up @@ -254,21 +254,6 @@ public abstract class org/jetbrains/dokka/gradle/engine/parameters/DokkaGenerato
public abstract fun getSuppressObviousFunctions ()Lorg/gradle/api/provider/Property;
}

public final class org/jetbrains/dokka/gradle/engine/parameters/DokkaModuleDescriptionKxs$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lorg/jetbrains/dokka/gradle/engine/parameters/DokkaModuleDescriptionKxs$$serializer;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lorg/jetbrains/dokka/gradle/engine/parameters/DokkaModuleDescriptionKxs;
public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lorg/jetbrains/dokka/gradle/engine/parameters/DokkaModuleDescriptionKxs;)V
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
}

public final class org/jetbrains/dokka/gradle/engine/parameters/DokkaModuleDescriptionKxs$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}

public abstract class org/jetbrains/dokka/gradle/engine/parameters/DokkaPackageOptionsSpec : java/io/Serializable, org/jetbrains/dokka/gradle/engine/parameters/HasConfigurableVisibilityModifiers {
public abstract fun getDocumentedVisibilities ()Lorg/gradle/api/provider/SetProperty;
public abstract fun getMatchingRegex ()Lorg/gradle/api/provider/Property;
Expand Down
3 changes: 0 additions & 3 deletions dokka-runners/dokka-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import dokkabuild.utils.skipTestFixturesPublications

plugins {
id("dokkabuild.gradle-plugin")

kotlin("plugin.serialization") version embeddedKotlinVersion

`jvm-test-suite`
`java-test-fixtures`
id("dokkabuild.dev-maven-publish")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
*/
package org.jetbrains.dokka.gradle.engine.parameters

import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.put
import org.gradle.kotlin.dsl.java
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.gradle.internal.InternalDokkaGradlePluginApi
Expand All @@ -23,7 +26,6 @@ import org.jetbrains.dokka.gradle.internal.InternalDokkaGradlePluginApi
* @see org.jetbrains.dokka.gradle.engine.parameters.DokkaModuleDescriptionKxs
* @see org.jetbrains.dokka.DokkaModuleDescriptionImpl
*/
@Serializable
@InternalDokkaGradlePluginApi
data class DokkaModuleDescriptionKxs(
/** @see DokkaConfiguration.DokkaModuleDescription.name */
Expand All @@ -34,4 +36,20 @@ data class DokkaModuleDescriptionKxs(
val moduleOutputDirName: String = "module",
/** name of the sibling directory that contains the module includes */
val moduleIncludesDirName: String = "includes",
)
) {
internal companion object {
fun toJsonObject(module: DokkaModuleDescriptionKxs): JsonObject = buildJsonObject {
put("name", module.name)
put("modulePath", module.modulePath)
put("moduleOutputDirName", module.moduleOutputDirName)
put("moduleIncludesDirName", module.moduleIncludesDirName)
}

fun fromJsonObject(obj: JsonObject): DokkaModuleDescriptionKxs = DokkaModuleDescriptionKxs(
name = obj["name"]!!.jsonPrimitive.content,
modulePath = obj["modulePath"]!!.jsonPrimitive.content,
moduleOutputDirName = obj["moduleOutputDirName"]!!.jsonPrimitive.content,
moduleIncludesDirName = obj["moduleIncludesDirName"]!!.jsonPrimitive.content,
)
Comment on lines +48 to +53
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be updated, because properties with default constructor arguments are optional.

What do you think about adding some tests? To ensure any code changes don't break things in the future.

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
package org.jetbrains.dokka.gradle.engine.parameters.builders

import kotlinx.serialization.json.JsonObject
import org.gradle.api.Project
import org.gradle.api.file.ArchiveOperations
import org.gradle.api.file.FileCollection
Expand Down Expand Up @@ -96,9 +97,11 @@ internal class DokkaParametersBuilder(
}

val moduleDescriptor: DokkaModuleDescriptionKxs =
DokkaBasePlugin.jsonMapper.decodeFromString(
DokkaModuleDescriptionKxs.serializer(),
moduleDescriptorJson.readText(),
DokkaModuleDescriptionKxs.fromJsonObject(
DokkaBasePlugin.jsonMapper.decodeFromString(
JsonObject.serializer(),
moduleDescriptorJson.readText(),
)
)

val moduleOutputDirectory = moduleDir.resolve(moduleDescriptor.moduleOutputDirName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
package org.jetbrains.dokka.gradle.tasks

import kotlinx.serialization.json.JsonObject
import org.gradle.api.file.ArchiveOperations
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.model.ObjectFactory
Expand Down Expand Up @@ -87,8 +88,8 @@ constructor(

val encodedModuleDesc =
DokkaBasePlugin.jsonMapper.encodeToString(
DokkaModuleDescriptionKxs.serializer(),
moduleDesc
JsonObject.serializer(),
DokkaModuleDescriptionKxs.toJsonObject(moduleDesc)
)

logger.info("encodedModuleDesc: $encodedModuleDesc".lines().joinToString(" "))
Expand Down
Loading