Skip to content

Commit

Permalink
Merge pull request #631 from KovalevAndrey/2.x-fix-publication
Browse files Browse the repository at this point in the history
Use artifact id only for Android and Java library publications.
  • Loading branch information
KovalevAndrey authored Nov 7, 2023
2 parents 726a42d + e801b3f commit c50a14b
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 42 deletions.
2 changes: 1 addition & 1 deletion appyx-interactions/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ kotlin {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
api(project(":utils:multiplatform"))
api(project(":utils:utils-multiplatform"))
implementation(libs.kotlinx.serialization.json)
}
}
Expand Down
4 changes: 2 additions & 2 deletions appyx-navigation/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ kotlin {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
api(project(":utils:multiplatform"))
api(project(":utils:utils-multiplatform"))
implementation(libs.kotlinx.serialization.json)
api(project(":utils:customisations"))
api(project(":utils:utils-customisations"))
api(project(":appyx-interactions:appyx-interactions"))
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ allprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.bumble.appyx:customisations"))
.using(project(":utils:customisations"))
.using(project(":utils:utils-customisations"))
.because("RIBs uses Appyx customisations as external dependency")
}
}
Expand Down
2 changes: 1 addition & 1 deletion demos/appyx-interactions/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
implementation(project(":appyx-components:experimental:modal:modal"))
implementation(project(":appyx-components:experimental:puzzle15:android"))
implementation(project(":appyx-components:internal:test-drive:android"))
implementation(project(":utils:material3"))
implementation(project(":utils:utils-material3"))

implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat)
Expand Down
6 changes: 3 additions & 3 deletions demos/appyx-navigation/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ kotlin {
api(compose.material3)
implementation(libs.kotlinx.serialization.json)
api(project(":appyx-interactions:appyx-interactions"))
api(project(":utils:customisations"))
api(project(":utils:material3"))
api(project(":utils:multiplatform"))
api(project(":utils:utils-customisations"))
api(project(":utils:utils-material3"))
api(project(":utils:utils-multiplatform"))
api(project(":demos:image-loader:common"))
implementation(project(":appyx-components:experimental:cards:cards"))
implementation(project(":appyx-components:experimental:modal:modal"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kotlin {
api(compose.material)
implementation(project(":appyx-interactions:appyx-interactions"))
implementation(project(":appyx-components:internal:test-drive:test-drive"))
implementation(project(":utils:multiplatform"))
implementation(project(":utils:utils-multiplatform"))
}
}
val jsMain by getting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kotlin {
api(compose.material)
implementation(project(":appyx-interactions:appyx-interactions"))
implementation(project(":appyx-components:internal:test-drive:test-drive"))
implementation(project(":utils:multiplatform"))
implementation(project(":utils:utils-multiplatform"))
}
}
val jsMain by getting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kotlin {
api(compose.material)
implementation(project(":appyx-interactions:appyx-interactions"))
implementation(project(":appyx-components:internal:test-drive:test-drive"))
implementation(project(":utils:multiplatform"))
implementation(project(":utils:utils-multiplatform"))
}
}
val jsMain by getting {
Expand Down
7 changes: 3 additions & 4 deletions demos/sandbox-appyx-navigation/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ plugins {
id("org.jetbrains.compose")
id("com.android.library")
id("kotlin-parcelize")
id("appyx-publish-multiplatform")
id("com.google.devtools.ksp")
}

Expand Down Expand Up @@ -36,9 +35,9 @@ kotlin {
api(compose.material3)
implementation(libs.kotlinx.serialization.json)
api(project(":appyx-interactions:appyx-interactions"))
api(project(":utils:material3"))
api(project(":utils:customisations"))
api(project(":utils:multiplatform"))
api(project(":utils:utils-material3"))
api(project(":utils:utils-customisations"))
api(project(":utils:utils-multiplatform"))
implementation(project(":appyx-components:experimental:cards:cards"))
implementation(project(":appyx-components:experimental:modal:modal"))
implementation(project(":appyx-components:experimental:promoter:promoter"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ internal class AndroidAppyxPublishPlugin : ProjectPlugin() {
}
}

override fun apply(project: Project) {
project.extensions.create("publishingPlugin", ProjectPluginExtension::class.java)
super.apply(project)
}

override fun PublicationContainer.createPublications(project: Project) {
create<MavenPublication>("androidRelease") {
val artifactId = project.extensions.getByType(ProjectPluginExtension::class.java).artifactId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.get

internal class JavaAppyxPublishPlugin : ProjectPlugin() {

override fun apply(project: Project) {
project.extensions.create("publishingPlugin", ProjectPluginExtension::class.java)
super.apply(project)
}

override fun configureDocAndSources(project: Project) {
project.configure<JavaPluginExtension> {
withJavadocJar()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.publish.PublicationContainer
Expand All @@ -7,20 +6,33 @@ import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar

internal class MultiplatformAppyxPublishPlugin : ProjectPlugin() {
override fun apply(project: Project) {
super.apply(project)
project.gradle.projectsEvaluated {
if (project.name == "common") {
throw IllegalArgumentException(
"Multiplatform project with path ${project.projectDir} should not have its name as common." +
" This will make artifacts rewrite each other." +
" Please change the name of the project in settings.gradle"
)
}
}
}

override fun PublicationContainer.createPublications(project: Project) = Unit

override fun PublishingExtension.configurePublications(project: Project) {
publications.withType(MavenPublication::class.java).configureEach {
val publication = this
val javadocJar = project.tasks.register("${publication.name}JavadocJar", Jar::class.java) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles ${publication.name} Kotlin docs into a Javadoc jar"
archiveClassifier.set("javadoc")

// https://github.com/gradle/gradle/issues/26091
archiveBaseName.set("${archiveBaseName.get()}-${publication.name}")
}
val javadocJar =
project.tasks.register("${publication.name}JavadocJar", Jar::class.java) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles ${publication.name} Kotlin docs into a Javadoc jar"
archiveClassifier.set("javadoc")

// https://github.com/gradle/gradle/issues/26091
archiveBaseName.set("${archiveBaseName.get()}-${publication.name}")
}
artifact(javadocJar)
configurePublication(project)
}
Expand Down
5 changes: 0 additions & 5 deletions plugins/publish-plugin/src/main/kotlin/ProjectPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import org.gradle.kotlin.dsl.configure
import org.gradle.plugins.signing.SigningExtension


open class ProjectPluginExtension {
var artifactId: String = ""
}

internal abstract class ProjectPlugin : Plugin<Project> {

companion object {
Expand All @@ -20,7 +16,6 @@ internal abstract class ProjectPlugin : Plugin<Project> {
}

override fun apply(project: Project) {
project.extensions.create("publishingPlugin", ProjectPluginExtension::class.java)
project.pluginManager.apply {
apply("maven-publish")
apply("signing")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Artifact id for Android and Java publications. When applied to multiplatform project, publication
* creates wrong artifacts. To configure correct artifactId for Multiplatform module publication please
* change a project name for the module in settings.gradle file
*/
open class ProjectPluginExtension {
var artifactId: String = ""
}
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,6 @@ project(":appyx-components:experimental:puzzle15:common").name = "puzzle15"
project(":appyx-components:experimental:puzzle15:web").name = "puzzle15-web"
project(":appyx-components:internal:test-drive:common").name = "test-drive"
project(":demos:sandbox-appyx-navigation:web").name = "navigation-web"
project(":utils:customisations").name = "utils-customisations"
project(":utils:material3").name = "utils-material3"
project(":utils:multiplatform").name = "utils-multiplatform"
4 changes: 0 additions & 4 deletions utils/customisations/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ appyx {
androidNamespace.set("com.bumble.appyx.utils.customisation")
}

publishingPlugin {
artifactId = "utils-customisations"
}

kotlin {
androidTarget {
publishLibraryVariants("release")
Expand Down
4 changes: 0 additions & 4 deletions utils/material3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ appyx {
androidNamespace.set("com.bumble.appyx.utils.material3")
}

publishingPlugin {
artifactId = "utils-material3"
}

kotlin {
androidTarget {
publishLibraryVariants("release")
Expand Down
4 changes: 0 additions & 4 deletions utils/multiplatform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ appyx {
androidNamespace.set("com.bumble.appyx.utils.multiplatform")
}

publishingPlugin {
artifactId = "utils-multiplatform"
}

kotlin {
androidTarget {
publishLibraryVariants("release")
Expand Down
2 changes: 1 addition & 1 deletion utils/testing-unit-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ appyx {

dependencies {
api(project(":appyx-navigation:appyx-navigation"))
implementation(project(":utils:customisations"))
implementation(project(":utils:utils-customisations"))
implementation(libs.kotlin.test)
}

0 comments on commit c50a14b

Please sign in to comment.