Skip to content
Draft
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
11 changes: 11 additions & 0 deletions assertk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,14 @@ kotlin {
}
}
}

dependencies {
constraints {
commonMainImplementation("com.willowtreeapps.assertk:assert:${rootProject.version}") {
because("groupId migration")
}
commonMainApi("com.willowtreeapps.assertk:assert:${rootProject.version}") {
because("groupId migration")
}
}
}
20 changes: 20 additions & 0 deletions buildSrc/src/main/kotlin/MigrationHelper.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import org.gradle.api.Project
import org.gradle.api.publish.maven.MavenPublication

// Copyright (C) 2018 Vanniktech - Niklas Baudy
//Licensed under the Apache License, Version 2.0
fun forMultiplatform(artifactId: String, publication: MavenPublication, project: Project): String {
val projectName = project.name
return if (publication.artifactId == projectName) {
artifactId
} else if (publication.artifactId.startsWith("$projectName-")) {
// Publications for specific platform targets use derived artifact ids (e.g. library, library-jvm,
// library-js) and the suffix needs to be preserved
publication.artifactId.replace("$projectName-", "$artifactId-")
} else {
throw IllegalStateException(
"The plugin can't handle the publication ${publication.name} artifactId " +
"${publication.artifactId} in project $projectName",
)
}
}
65 changes: 65 additions & 0 deletions buildSrc/src/main/kotlin/assertk.migration.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
plugins {
`maven-publish`
signing
}

group = "com.willowtreeapps.assertk"
version = rootProject.version

repositories {
mavenCentral()
}

val emptyJavadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

publishing {
publications.all {
if (this is MavenPublication) {
artifact(emptyJavadocJar)

val siteUrl = "https://github.com/assertk-org/assertk"
val gitUrl = "https://github.com/assertk-org/assertk.git"

pom {
name.set(project.name)
description.set("Assertions for Kotlin inspired by assertj")
url.set(siteUrl)

scm {
url.set(siteUrl)
connection.set(gitUrl)
developerConnection.set(gitUrl)
}

licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}

developers {
developer {
id.set("evant")
name.set("Eva Tatarka")
}
}
}
}
}
}

signing {
setRequired {
findProperty("signing.keyId") != null
}
publishing.publications.all { sign(this) }
}

// TODO: remove after https://youtrack.jetbrains.com/issue/KT-46466 is fixed
project.tasks.withType(AbstractPublishToMaven::class.java).configureEach {
dependsOn(project.tasks.withType(Sign::class.java))
}
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/assertk.publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tasks.withType<DokkaTask>().configureEach {
// Set source links to github
sourceLink {
localDirectory.set(file("src"))
remoteUrl.set(java.net.URL("https://github.com/willowtreeapps/assertk/tree/v${project.version}/${project.name}/src"))
remoteUrl.set(java.net.URL("https://github.com/assertk-org/assertk"))
remoteLineSuffix.set("#L")
}
}
Expand All @@ -42,8 +42,8 @@ publishing {
if (this is MavenPublication) {
artifact(dokkaJavadocCommonJar)

val siteUrl = "https://github.com/willowtreeapps/assertk"
val gitUrl = "https://github.com/willowtreeapps/assertk.git"
val siteUrl = "https://github.com/assertk-org/assertk"
val gitUrl = "https://github.com/assertk-org/assertk.git"

pom {
name.set(project.name)
Expand Down
1 change: 1 addition & 0 deletions migration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Empty artifact for migrating from com.willowtreeaps.assertk to org.assertk
26 changes: 26 additions & 0 deletions migration/assertk-coroutines/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id("assertk.multiplatform")
id("assertk.migration")
}

repositories {
mavenLocal()
}

kotlin {
sourceSets {
commonMain {
dependencies {
implementation("org.assertk:assertk:${rootProject.version}")
}
}
}
}

publishing {
publications.all {
if (this is MavenPublication) {
artifactId = forMultiplatform("assertk-coroutines", this, project)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package assertk
26 changes: 26 additions & 0 deletions migration/assertk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id("assertk.multiplatform")
id("assertk.migration")
}

repositories {
mavenLocal()
}

kotlin {
sourceSets {
commonMain {
dependencies {
implementation("org.assertk:assertk:${rootProject.version}")
}
}
}
}

publishing {
publications.all {
if (this is MavenPublication) {
artifactId = forMultiplatform("assertk", this, project)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package assertk
7 changes: 6 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ rootProject.name = "assertk-project"
include(
":assertk",
":assertk-coroutines",
)
":migration-assertk",
":migration-assertk-coroutines"
)

project(":migration-assertk").projectDir = file("migration/assertk")
project(":migration-assertk-coroutines").projectDir = file("migration/assertk-coroutines")