diff --git a/buildSrc/src/main/kotlin/buildsrc/convention/maven-publish.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/convention/maven-publish.gradle.kts index 9d88c844..5a672846 100644 --- a/buildSrc/src/main/kotlin/buildsrc/convention/maven-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/convention/maven-publish.gradle.kts @@ -41,6 +41,7 @@ tasks.withType().configureEach { // Gradle warns about some signing tasks using publishing task outputs without explicit // dependencies. I'm not going to go through them all and fix them, so here's a quick fix. dependsOn(tasks.withType()) + mustRunAfter(tasks.withType()) doLast { logger.lifecycle("[${this.name}] ${project.group}:${project.name}:${project.version}") @@ -64,9 +65,12 @@ afterEvaluate { // too early, before all the publications are added. // Use .all { }, not .configureEach { }, otherwise the signing plugin doesn't create the tasks // soon enough. - publishing.publications.withType().all { - signing.sign(this) - logger.lifecycle("configuring signature for publication ${this.name}") + + if (sonatypeRepositoryCredentials.isPresent()) { + publishing.publications.withType().all { + signing.sign(this) + logger.lifecycle("configuring signature for publication ${this.name}") + } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 38162c67..bbbf3365 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,13 +10,12 @@ kotlinCompileTesting = "1.4.8" # https://github.com/tschuchortdev/kotlin kotlinx-serialization = "1.3.3" # https://github.com/Kotlin/kotlinx.serialization/releases/tag/v1.3.3 kotlinx-knit = "0.4.0" # https://github.com/Kotlin/kotlinx-knit/releases -kotlinx-coroutines = "1.6.1" # https://github.com/Kotlin/kotlinx.coroutines/releases +kotlinx-coroutines = "1.6.3" # https://github.com/Kotlin/kotlinx.coroutines/releases kotlinx-kover = "0.5.1" # https://github.com/Kotlin/kotlinx-kover/releases -okio = "3.1.0" # https://search.maven.org/artifact/com.squareup.okio/okio +okio = "3.2.0" # https://search.maven.org/artifact/com.squareup.okio/okio -kotest = "5.3.0" # https://github.com/kotest/kotest/releases -kotestSnapshot = "5.3.0.1010-SNAPSHOT" +kotest = "5.3.1" # https://github.com/kotest/kotest/releases kotlinProcess = "1.3.1" # https://github.com/pgreze/kotlin-process/releases @@ -53,7 +52,7 @@ kotlinCompileTesting-ksp = { group = "com.github.tschuchortdev", name = "kotlin- ## Kotest ## -kotest-bom = { group = "io.kotest", name = "kotest-bom", version.ref = "kotestSnapshot" } +kotest-bom = { group = "io.kotest", name = "kotest-bom", version.ref = "kotest" } kotest-assertionsCore = { group = "io.kotest", name = "kotest-assertions-core" } kotest-assertionsJson = { group = "io.kotest", name = "kotest-assertions-json" } kotest-property = { group = "io.kotest", name = "kotest-property" } diff --git a/modules/kxs-ts-gen-core/src/commonMain/kotlin/dev/adamko/kxstsgen/KxsTsConfig.kt b/modules/kxs-ts-gen-core/src/commonMain/kotlin/dev/adamko/kxstsgen/KxsTsConfig.kt index 61016b93..17509da4 100644 --- a/modules/kxs-ts-gen-core/src/commonMain/kotlin/dev/adamko/kxstsgen/KxsTsConfig.kt +++ b/modules/kxs-ts-gen-core/src/commonMain/kotlin/dev/adamko/kxstsgen/KxsTsConfig.kt @@ -19,7 +19,7 @@ import kotlinx.serialization.modules.SerializersModuleCollector * @param[indent] Define the indentation that is used when generating source code * @param[declarationSeparator] The string that is used when joining [TsDeclaration]s * @param[namespaceConfig] (UNIMPLEMENTED) How elements are grouped into [TsDeclaration.TsNamespace]s. - * @param[typeAliasTyping] (UNIMPLEMENTED) Control if type aliases are simple, or 'branded'. + * @param[typeAliasTyping] Control whether type aliases are simple, or 'branded'. * @param[serializersModule] Used to obtain contextual and polymorphic information. */ data class KxsTsConfig( @@ -27,7 +27,6 @@ data class KxsTsConfig( val declarationSeparator: String = "\n\n", @UnimplementedKxsTsGenApi val namespaceConfig: NamespaceConfig = NamespaceConfig.Disabled, - @UnimplementedKxsTsGenApi val typeAliasTyping: TypeAliasTypingConfig = TypeAliasTypingConfig.None, val serializersModule: SerializersModule = EmptySerializersModule, ) { diff --git a/modules/kxs-ts-gen-core/src/commonMain/kotlin/dev/adamko/kxstsgen/core/TsSourceCodeGenerator.kt b/modules/kxs-ts-gen-core/src/commonMain/kotlin/dev/adamko/kxstsgen/core/TsSourceCodeGenerator.kt index 6fb157af..73b950b7 100644 --- a/modules/kxs-ts-gen-core/src/commonMain/kotlin/dev/adamko/kxstsgen/core/TsSourceCodeGenerator.kt +++ b/modules/kxs-ts-gen-core/src/commonMain/kotlin/dev/adamko/kxstsgen/core/TsSourceCodeGenerator.kt @@ -6,13 +6,11 @@ import dev.adamko.kxstsgen.KxsTsConfig /** * Writes [TsElement]s as TypeScript source code. */ -abstract class TsSourceCodeGenerator( - val config: KxsTsConfig = KxsTsConfig(), -) { +interface TsSourceCodeGenerator { - abstract fun groupElementsBy(element: TsElement): String? + fun groupElementsBy(element: TsElement): String? - open fun generateDeclaration(element: TsDeclaration): String { + fun generateDeclaration(element: TsDeclaration): String { return when (element) { is TsDeclaration.TsEnum -> generateEnum(element) is TsDeclaration.TsInterface -> generateInterface(element) @@ -23,21 +21,21 @@ abstract class TsSourceCodeGenerator( } } - abstract fun generateEnum(enum: TsDeclaration.TsEnum): String - abstract fun generateInterface(element: TsDeclaration.TsInterface): String - abstract fun generateNamespace(namespace: TsDeclaration.TsNamespace): String - abstract fun generateTypeAlias(element: TsDeclaration.TsTypeAlias): String - abstract fun generateTypeUnion(element: TsDeclaration.TsTypeUnion): String - abstract fun generateTuple(tuple: TsDeclaration.TsTuple): String + fun generateEnum(enum: TsDeclaration.TsEnum): String + fun generateInterface(element: TsDeclaration.TsInterface): String + fun generateNamespace(namespace: TsDeclaration.TsNamespace): String + fun generateTypeAlias(element: TsDeclaration.TsTypeAlias): String + fun generateTypeUnion(element: TsDeclaration.TsTypeUnion): String + fun generateTuple(tuple: TsDeclaration.TsTuple): String - abstract fun generateMapTypeReference(tsMap: TsLiteral.TsMap): String + fun generateMapTypeReference(tsMap: TsLiteral.TsMap): String - abstract fun generatePrimitive(primitive: TsLiteral.Primitive): String - abstract fun generateTypeReference(typeRef: TsTypeRef): String + fun generatePrimitive(primitive: TsLiteral.Primitive): String + fun generateTypeReference(typeRef: TsTypeRef): String open class Default( - config: KxsTsConfig, - ) : TsSourceCodeGenerator(config) { + private val config: KxsTsConfig, + ) : TsSourceCodeGenerator { override fun groupElementsBy(element: TsElement): String {