From 443f5293267e5cbdc44a711498376b1a47f54b1f Mon Sep 17 00:00:00 2001 From: nlam-atlassian Date: Wed, 23 Oct 2024 15:36:16 +1100 Subject: [PATCH 1/2] Add a flag to configure whether we check attributes against the schema (#48) Not sure why `checkAttrs` was added to `Node.toJSON` in the original TS code, especially since `Node.toJSON` doesn't check if the node structure is correct anyway. Since we want to be able to parse JSON and render it, even if it doesn't conform to the schema, I've added a flag to toggle whether we should call `checkAttrs` or not. Context: `checkAttrs` throws a RangeException if it sees an attribute that it isn't expecting based on the schema. --- model/config/ktlint/baseline.xml | 39 +++++++++++-------- .../atlassian/prosemirror/model/Fragment.kt | 4 +- .../com/atlassian/prosemirror/model/Mark.kt | 6 ++- .../com/atlassian/prosemirror/model/Node.kt | 10 +++-- .../com/atlassian/prosemirror/model/Schema.kt | 8 ++-- version.properties | 2 +- 6 files changed, 39 insertions(+), 30 deletions(-) diff --git a/model/config/ktlint/baseline.xml b/model/config/ktlint/baseline.xml index 21a9070..8c6fa02 100644 --- a/model/config/ktlint/baseline.xml +++ b/model/config/ktlint/baseline.xml @@ -104,7 +104,8 @@ - + + @@ -227,12 +228,13 @@ - + + - - - + + + @@ -302,19 +304,20 @@ - + + - - - - - - - - - + + + + + + + + + @@ -528,10 +531,12 @@ - + + - + + diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Fragment.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Fragment.kt index e2d03d8..a9e93ae 100644 --- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Fragment.kt +++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Fragment.kt @@ -305,10 +305,10 @@ class Fragment { companion object { // Deserialize a fragment from its JSON representation. - fun fromJSON(schema: Schema, value: JsonArray?, withId: Boolean = false): Fragment { + fun fromJSON(schema: Schema, value: JsonArray?, withId: Boolean = false, check: Boolean = false): Fragment { if (value == null) return empty // if (!Array.isArray(value)) throw RangeError("Invalid input for Fragment.fromJSON") - return Fragment(value.map { el -> schema.nodeFromJSON(el.jsonObject, withId) }) + return Fragment(value.map { el -> schema.nodeFromJSON(el.jsonObject, withId, check) }) } // Build a fragment from an array of nodes. Ensures that adjacent text nodes with the same diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Mark.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Mark.kt index 39be245..6761aac 100644 --- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Mark.kt +++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Mark.kt @@ -101,7 +101,7 @@ open class Mark constructor( val none = emptyList() // Deserialize a mark from JSON. - fun fromJSON(schema: Schema, json: JsonObject?, withId: Boolean = false): Mark { + fun fromJSON(schema: Schema, json: JsonObject?, withId: Boolean = false, check: Boolean = false): Mark { if (json == null) throw RangeError("Invalid input for Mark.fromJSON") val jsonType = json["type"]?.jsonPrimitive?.contentOrNull val type = schema.marks[jsonType] @@ -120,7 +120,9 @@ open class Mark constructor( } else { type.create(attrs).also { (it as? UnsupportedMark)?.originalMarkName = jsonType } } - type.checkAttrs(mark.attrs) + if (check) { + type.checkAttrs(mark.attrs) + } return mark } diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Node.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Node.kt index c9e0e81..6020594 100644 --- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Node.kt +++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Node.kt @@ -632,12 +632,12 @@ open class Node constructor( // Deserialize a node from its JSON representation. @Suppress("ThrowsCount", "SwallowedException", "ComplexMethod") - fun fromJSON(schema: Schema, json: JsonObject?, withId: Boolean = false): Node { + fun fromJSON(schema: Schema, json: JsonObject?, withId: Boolean = false, check: Boolean = false): Node { if (json == null) throw RangeError("Invalid input for Node.fromJSON") var marks: List? = null if (json.containsKey("marks")) { val marksArray = json["marks"]!!.jsonArray - marks = marksArray.map { schema.markFromJSON(it.jsonObject, withId) } + marks = marksArray.map { schema.markFromJSON(it.jsonObject, withId, check) } } val type = json["type"]?.jsonPrimitive?.contentOrNull if (type == "text") { @@ -645,7 +645,7 @@ open class Node constructor( if (text?.isString != true) throw RangeError("Invalid text node in JSON") return schema.text(text.content, marks) } - val content = Fragment.fromJSON(schema, json["content"]?.jsonArray, withId) + val content = Fragment.fromJSON(schema, json["content"]?.jsonArray, withId, check) val attrs = json["attrs"]?.jsonObject?.mapValues { if (it.value is JsonNull) null else JSON.decodeFromJsonElement(it.value) } @@ -674,7 +674,9 @@ open class Node constructor( // for round tripping node.unknownFields = json.fieldsExcept("marks", "type", "content", "attrs") } - node.type.checkAttrs(node.attrs) + if (check) { + node.type.checkAttrs(node.attrs) + } return node } } diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt index 190d825..7f4c19c 100644 --- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt +++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt @@ -794,13 +794,13 @@ class Schema { } // Deserialize a node from its JSON representation. This method is bound. - fun nodeFromJSON(json: JsonObject?, withId: Boolean = false): Node { - return Node.fromJSON(this, json, withId) + fun nodeFromJSON(json: JsonObject?, withId: Boolean = false, check: Boolean = false): Node { + return Node.fromJSON(this, json, withId, check) } // Deserialize a mark from its JSON representation. This method is bound. - fun markFromJSON(json: JsonObject?, withId: Boolean = false): Mark { - return Mark.fromJSON(this, json, withId) + fun markFromJSON(json: JsonObject?, withId: Boolean = false, check: Boolean = false): Mark { + return Mark.fromJSON(this, json, withId, check) } fun nodeType(name: String): NodeType { diff --git a/version.properties b/version.properties index 90c1ae3..48b2ae6 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -projectVersion=1.1.3 +projectVersion=1.1.4 From ec498fdcbd7b3abb093e0c952108d078b8f89e33 Mon Sep 17 00:00:00 2001 From: nlam-atlassian Date: Wed, 23 Oct 2024 15:57:57 +1100 Subject: [PATCH 2/2] Cleanup gradle (#49) Changes - moved dokka, publishing and signing to the top level - update the url for pom and dokka to the correct one - only sign if the build is running on CI --- build.gradle.kts | 112 +++++++++++++++++++++++++++++++++- collab/build.gradle.kts | 103 +------------------------------ history/build.gradle.kts | 103 +------------------------------ model/build.gradle.kts | 103 +------------------------------ state/build.gradle.kts | 103 +------------------------------ test-builder/build.gradle.kts | 103 +------------------------------ transform/build.gradle.kts | 103 +------------------------------ util/build.gradle.kts | 103 +------------------------------ 8 files changed, 125 insertions(+), 708 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index acac8a0..f889c6a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import java.io.FileInputStream +import java.net.URL import java.util.Properties plugins { @@ -7,6 +8,8 @@ plugins { alias(libs.plugins.kotlin.serialization) alias(libs.plugins.ktlint) alias(libs.plugins.dokka) + id("maven-publish") + id("signing") } repositories { @@ -27,7 +30,114 @@ versionProperties.load(FileInputStream("version.properties")) allprojects { group = "com.atlassian.prosemirror" - version = versionProperties.get("projectVersion") as String + version = versionProperties["projectVersion"] as String +} + +subprojects { + apply(plugin = "maven-publish") + apply(plugin = "signing") + apply(plugin = "org.jetbrains.dokka") // TODO: use alias + + afterEvaluate { // afterEvaluate so that project.ext values will be available + project.tasks.dokkaHtml { + dokkaSourceSets { + val urlPrefix = project.ext.get("srcUrl") as String + val commonMain by getting { + sourceLink { + // Unix based directory relative path to the root of the project (where you execute gradle respectively). + localDirectory.set(file("src/commonMain/kotlin")) + + // URL showing where the source code can be accessed through the web browser + remoteUrl.set(URL("${urlPrefix}src/main/src/commonMain/kotlin")) + + // Suffix which is used to append the line number to the URL. Use #L for GitHub + remoteLineSuffix.set("#lines-") + } + } + + val jvmMain by getting { + sourceLink { + // Unix based directory relative path to the root of the project (where you execute gradle respectively). + localDirectory.set(file("src/jvmMain/kotlin")) + + // URL showing where the source code can be accessed through the web browser + remoteUrl.set(URL("${urlPrefix}src/main/src/jvmMain/kotlin")) + + // Suffix which is used to append the line number to the URL. Use #L for GitHub + remoteLineSuffix.set("#lines-") + } + } + + val nativeMain by getting { + sourceLink { + // Unix based directory relative path to the root of the project (where you execute gradle respectively). + localDirectory.set(file("src/nativeMain/kotlin")) + + // URL showing where the source code can be accessed through the web browser + remoteUrl.set(URL("${urlPrefix}src/main/src/nativeMain/kotlin")) + + // Suffix which is used to append the line number to the URL. Use #L for GitHub + remoteLineSuffix.set("#lines-") + } + } + } + } + + publishing { + publications { + publications.withType { + pom { + name.set(project.name) + description.set(project.ext.get("pomDescription") as String) + url.set(project.ext.get("srcUrl") as String) + + scm { + connection.set("git@github.com:atlassian-labs/prosemirror-kotlin.git") + url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git") + } + developers { + developer { + id.set("dmarques") + name.set("Douglas Marques") + email.set("dmarques@atlassian.com") + } + developer { + id.set("achernykh") + name.set("Aleksei Chernykh") + email.set("achernykh@atlassian.com") + } + } + licenses { + license { + name.set("Apache License 2.0") + url.set("https://www.apache.org/licenses/LICENSE-2.0") + distribution.set("repo") + } + } + } + } + } + + repositories { + maven { + url = uri("https://packages.atlassian.com/maven-central") + credentials { + username = System.getenv("ARTIFACTORY_USERNAME") + password = System.getenv("ARTIFACTORY_API_KEY") + } + } + } + } + + signing { + setRequired { System.getenv("SIGNING_KEY") == "" } // only sign if the key is available (usually on CI) + useInMemoryPgpKeys( + System.getenv("SIGNING_KEY"), + System.getenv("SIGNING_PASSWORD"), + ) + sign(publishing.publications) + } + } } val javaVersion = JavaVersion.VERSION_17 diff --git a/collab/build.gradle.kts b/collab/build.gradle.kts index 4b648d2..12e0582 100644 --- a/collab/build.gradle.kts +++ b/collab/build.gradle.kts @@ -1,12 +1,8 @@ -import java.net.URL import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.ktlint) - alias(libs.plugins.dokka) - id("maven-publish") - id("signing") } kotlin { @@ -46,103 +42,8 @@ kotlin { implementation(libs.test.assertk) } } - - tasks.dokkaHtml { - dokkaSourceSets { - val commonMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/commonMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/collab/src/main/src/commonMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val jvmMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/jvmMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/collab/src/main/src/jvmMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val nativeMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/nativeMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/collab/src/main/src/nativeMain/kotlin/")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - } - } } description = "prosemirror-state" - -publishing { - publications { - publications.withType { - pom { - name.set(project.name) - description.set("Collaborative editing for ProseMirror") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin/tree/collab/") - - scm { - connection.set("git@github.com:atlassian-labs/prosemirror-kotlin.git") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git") - } - developers { - developer { - id.set("dmarques") - name.set("Douglas Marques") - email.set("dmarques@atlassian.com") - } - developer { - id.set("achernykh") - name.set("Aleksei Chernykh") - email.set("achernykh@atlassian.com") - } - } - licenses { - license { - name.set("Apache License 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0") - distribution.set("repo") - } - } - } - } - } - - repositories { - maven { - url = uri("https://packages.atlassian.com/maven-central") - credentials { - username = System.getenv("ARTIFACTORY_USERNAME") - password = System.getenv("ARTIFACTORY_API_KEY") - } - } - } -} - -signing { - useInMemoryPgpKeys( - System.getenv("SIGNING_KEY"), - System.getenv("SIGNING_PASSWORD"), - ) - sign(publishing.publications) -} +ext.set("pomDescription", "Collaborative editing for ProseMirror") +ext.set("srcUrl", "https://github.com/atlassian-labs/prosemirror-kotlin/tree/main/collab/") diff --git a/history/build.gradle.kts b/history/build.gradle.kts index 5a0e14d..4683391 100644 --- a/history/build.gradle.kts +++ b/history/build.gradle.kts @@ -1,12 +1,8 @@ -import java.net.URL import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.ktlint) - alias(libs.plugins.dokka) - id("maven-publish") - id("signing") } kotlin { @@ -48,103 +44,8 @@ kotlin { implementation(libs.test.assertk) } } - - tasks.dokkaHtml { - dokkaSourceSets { - val commonMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/commonMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/history/src/main/src/commonMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val jvmMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/jvmMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/history/src/main/src/jvmMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val nativeMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/nativeMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/history/src/main/src/nativeMain/kotlin/")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - } - } } description = "prosemirror-history" - -publishing { - publications { - publications.withType { - pom { - name.set(project.name) - description.set("Undo history for ProseMirror") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin/tree/history/") - - scm { - connection.set("git@github.com:atlassian-labs/prosemirror-kotlin.git") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git") - } - developers { - developer { - id.set("dmarques") - name.set("Douglas Marques") - email.set("dmarques@atlassian.com") - } - developer { - id.set("achernykh") - name.set("Aleksei Chernykh") - email.set("achernykh@atlassian.com") - } - } - licenses { - license { - name.set("Apache License 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0") - distribution.set("repo") - } - } - } - } - } - - repositories { - maven { - url = uri("https://packages.atlassian.com/maven-central") - credentials { - username = System.getenv("ARTIFACTORY_USERNAME") - password = System.getenv("ARTIFACTORY_API_KEY") - } - } - } -} - -signing { - useInMemoryPgpKeys( - System.getenv("SIGNING_KEY"), - System.getenv("SIGNING_PASSWORD"), - ) - sign(publishing.publications) -} +ext.set("pomDescription", "Undo history for ProseMirror") +ext.set("srcUrl", "https://github.com/atlassian-labs/prosemirror-kotlin/tree/main/history/") diff --git a/model/build.gradle.kts b/model/build.gradle.kts index 14e6d73..c5a9c38 100644 --- a/model/build.gradle.kts +++ b/model/build.gradle.kts @@ -1,14 +1,10 @@ -import java.net.URL import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.kotlin.atomicfu) alias(libs.plugins.ktlint) - alias(libs.plugins.dokka) id("kotlinx-serialization") - id("maven-publish") - id("signing") } kotlin { @@ -49,103 +45,8 @@ kotlin { implementation(libs.test.assertk) } } - - tasks.dokkaHtml { - dokkaSourceSets { - val commonMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/commonMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/model/src/main/src/commonMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val jvmMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/jvmMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/model/src/main/src/jvmMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val nativeMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/nativeMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/model/src/main/src/nativeMain/kotlin/")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - } - } } description = "prosemirror-model" - -publishing { - publications { - publications.withType { - pom { - name.set(project.name) - description.set("ProseMirror's document model") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin/tree/model/") - - scm { - connection.set("git@github.com:atlassian-labs/prosemirror-kotlin.git") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git") - } - developers { - developer { - id.set("dmarques") - name.set("Douglas Marques") - email.set("dmarques@atlassian.com") - } - developer { - id.set("achernykh") - name.set("Aleksei Chernykh") - email.set("achernykh@atlassian.com") - } - } - licenses { - license { - name.set("Apache License 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0") - distribution.set("repo") - } - } - } - } - } - - repositories { - maven { - url = uri("https://packages.atlassian.com/maven-central") - credentials { - username = System.getenv("ARTIFACTORY_USERNAME") - password = System.getenv("ARTIFACTORY_API_KEY") - } - } - } -} - -signing { - useInMemoryPgpKeys( - System.getenv("SIGNING_KEY"), - System.getenv("SIGNING_PASSWORD"), - ) - sign(publishing.publications) -} +ext.set("pomDescription", "ProseMirror document model") +ext.set("srcUrl", "https://github.com/atlassian-labs/prosemirror-kotlin/tree/main/model/") diff --git a/state/build.gradle.kts b/state/build.gradle.kts index e3d71e7..400da92 100644 --- a/state/build.gradle.kts +++ b/state/build.gradle.kts @@ -1,12 +1,8 @@ -import java.net.URL import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.ktlint) - alias(libs.plugins.dokka) - id("maven-publish") - id("signing") } kotlin { @@ -48,103 +44,8 @@ kotlin { implementation(libs.test.assertk) } } - - tasks.dokkaHtml { - dokkaSourceSets { - val commonMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/commonMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/state/src/main/src/commonMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val jvmMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/jvmMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/state/src/main/src/jvmMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val nativeMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/nativeMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/state/src/main/src/nativeMain/kotlin/")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - } - } } description = "prosemirror-state" - -publishing { - publications { - publications.withType { - pom { - name.set(project.name) - description.set("ProseMirror editor state") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin/tree/transform/") - - scm { - connection.set("git@github.com:atlassian-labs/prosemirror-kotlin.git") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git") - } - developers { - developer { - id.set("dmarques") - name.set("Douglas Marques") - email.set("dmarques@atlassian.com") - } - developer { - id.set("achernykh") - name.set("Aleksei Chernykh") - email.set("achernykh@atlassian.com") - } - } - licenses { - license { - name.set("Apache License 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0") - distribution.set("repo") - } - } - } - } - } - - repositories { - maven { - url = uri("https://packages.atlassian.com/maven-central") - credentials { - username = System.getenv("ARTIFACTORY_USERNAME") - password = System.getenv("ARTIFACTORY_API_KEY") - } - } - } -} - -signing { - useInMemoryPgpKeys( - System.getenv("SIGNING_KEY"), - System.getenv("SIGNING_PASSWORD"), - ) - sign(publishing.publications) -} +ext.set("pomDescription", "ProseMirror editor state") +ext.set("srcUrl", "https://github.com/atlassian-labs/prosemirror-kotlin/tree/main/state/") diff --git a/test-builder/build.gradle.kts b/test-builder/build.gradle.kts index aee5298..4f80879 100644 --- a/test-builder/build.gradle.kts +++ b/test-builder/build.gradle.kts @@ -1,12 +1,8 @@ -import java.net.URL import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.ktlint) - alias(libs.plugins.dokka) - id("maven-publish") - id("signing") } kotlin { @@ -44,103 +40,8 @@ kotlin { commonTest.dependencies { } } - - tasks.dokkaHtml { - dokkaSourceSets { - val commonMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/commonMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/test-builder/src/main/src/commonMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val jvmMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/jvmMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/test-builder/src/main/src/jvmMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val nativeMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/nativeMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/test-builder/src/main/src/nativeMain/kotlin/")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - } - } } description = "prosemirror-test-builder" - -publishing { - publications { - publications.withType { - pom { - name.set(project.name) - description.set("Document building utilities for writing tests") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin/tree/test-builder/") - - scm { - connection.set("git@github.com:atlassian-labs/prosemirror-kotlin.git") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git") - } - developers { - developer { - id.set("dmarques") - name.set("Douglas Marques") - email.set("dmarques@atlassian.com") - } - developer { - id.set("achernykh") - name.set("Aleksei Chernykh") - email.set("achernykh@atlassian.com") - } - } - licenses { - license { - name.set("Apache License 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0") - distribution.set("repo") - } - } - } - } - } - - repositories { - maven { - url = uri("https://packages.atlassian.com/maven-central") - credentials { - username = System.getenv("ARTIFACTORY_USERNAME") - password = System.getenv("ARTIFACTORY_API_KEY") - } - } - } -} - -signing { - useInMemoryPgpKeys( - System.getenv("SIGNING_KEY"), - System.getenv("SIGNING_PASSWORD"), - ) - sign(publishing.publications) -} +ext.set("pomDescription", "Document building utilities for writing tests") +ext.set("srcUrl", "https://github.com/atlassian-labs/prosemirror-kotlin/tree/main/test-builder/") diff --git a/transform/build.gradle.kts b/transform/build.gradle.kts index f8c3546..1d1d78f 100644 --- a/transform/build.gradle.kts +++ b/transform/build.gradle.kts @@ -1,12 +1,8 @@ -import java.net.URL import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.ktlint) - alias(libs.plugins.dokka) - id("maven-publish") - id("signing") } kotlin { @@ -46,103 +42,8 @@ kotlin { implementation(libs.test.assertk) } } - - tasks.dokkaHtml { - dokkaSourceSets { - val commonMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/commonMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/transform/src/main/src/commonMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val jvmMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/jvmMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/transform/src/main/src/jvmMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val nativeMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/nativeMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/transform/src/main/src/nativeMain/kotlin/")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - } - } } description = "prosemirror-transform" - -publishing { - publications { - publications.withType { - pom { - name.set(project.name) - description.set("ProseMirror document transformations") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin/tree/transform/") - - scm { - connection.set("git@github.com:atlassian-labs/prosemirror-kotlin.git") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git") - } - developers { - developer { - id.set("dmarques") - name.set("Douglas Marques") - email.set("dmarques@atlassian.com") - } - developer { - id.set("achernykh") - name.set("Aleksei Chernykh") - email.set("achernykh@atlassian.com") - } - } - licenses { - license { - name.set("Apache License 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0") - distribution.set("repo") - } - } - } - } - } - - repositories { - maven { - url = uri("https://packages.atlassian.com/maven-central") - credentials { - username = System.getenv("ARTIFACTORY_USERNAME") - password = System.getenv("ARTIFACTORY_API_KEY") - } - } - } -} - -signing { - useInMemoryPgpKeys( - System.getenv("SIGNING_KEY"), - System.getenv("SIGNING_PASSWORD"), - ) - sign(publishing.publications) -} +ext.set("pomDescription", "ProseMirror document transformations") +ext.set("srcUrl", "https://github.com/atlassian-labs/prosemirror-kotlin/tree/main/transform/") diff --git a/util/build.gradle.kts b/util/build.gradle.kts index db3178d..3d57d16 100644 --- a/util/build.gradle.kts +++ b/util/build.gradle.kts @@ -1,12 +1,8 @@ -import java.net.URL import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.ktlint) - alias(libs.plugins.dokka) - id("maven-publish") - id("signing") } kotlin { @@ -43,103 +39,8 @@ kotlin { implementation(libs.test.assertk) } } - - tasks.dokkaHtml { - dokkaSourceSets { - val commonMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/commonMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/util/src/main/src/commonMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val jvmMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/jvmMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/util/src/main/src/jvmMain/kotlin")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - - val nativeMain by getting { - sourceLink { - // Unix based directory relative path to the root of the project (where you execute gradle respectively). - localDirectory.set(file("src/nativeMain/kotlin")) - - // URL showing where the source code can be accessed through the web browser - remoteUrl.set(URL("https://github.com/atlassian-labs/prosemirror-kotlin/util/src/main/src/nativeMain/kotlin/")) - - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#lines-") - } - } - } - } } description = "prosemirror-util" - -publishing { - publications { - publications.withType { - pom { - name.set(project.name) - description.set("ProseMirror utilities") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin/tree/util/") - - scm { - connection.set("git@github.com:atlassian-labs/prosemirror-kotlin.git") - url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git") - } - developers { - developer { - id.set("dmarques") - name.set("Douglas Marques") - email.set("dmarques@atlassian.com") - } - developer { - id.set("achernykh") - name.set("Aleksei Chernykh") - email.set("achernykh@atlassian.com") - } - } - licenses { - license { - name.set("Apache License 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0") - distribution.set("repo") - } - } - } - } - } - - repositories { - maven { - url = uri("https://packages.atlassian.com/maven-central") - credentials { - username = System.getenv("ARTIFACTORY_USERNAME") - password = System.getenv("ARTIFACTORY_API_KEY") - } - } - } -} - -signing { - useInMemoryPgpKeys( - System.getenv("SIGNING_KEY"), - System.getenv("SIGNING_PASSWORD"), - ) - sign(publishing.publications) -} +ext.set("pomDescription", "ProseMirror utilities") +ext.set("srcUrl", "https://github.com/atlassian-labs/prosemirror-kotlin/tree/main/util/")