Skip to content

Commit

Permalink
fix: set maven local publication to produce both kotlin and android l…
Browse files Browse the repository at this point in the history
…ibs (#263)
  • Loading branch information
wax911 authored Jun 11, 2024
1 parent cacbc80 commit 88d1173
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ import co.anitrend.arch.buildSrc.plugin.extensions.props
import co.anitrend.arch.buildSrc.plugin.extensions.publishingExtension
import org.gradle.api.Project
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar


internal fun Project.configureMaven() {
internal fun Project.configureMaven(sourcesJar: Jar) {
publishingExtension().publications {
val component = components.findByName("java")
val component = components.findByName("kotlin") ?: components.findByName("java")

logger.lifecycle("Configuring maven publication options for ${path}:maven with component -> ${component?.name}")
create("maven", MavenPublication::class.java) {
groupId = "co.anitrend.arch"
artifactId = project.name
version = props[PropertyTypes.VERSION]

from(component)
val releaseFile = "${layout.buildDirectory.get()}/outputs/aar/${project.name}-release.aar"
if (file(releaseFile).exists()) {
artifact(releaseFile)
}
artifact(sourcesJar)
if (component != null) {
from(component)
}

pom {
name.set("support-arch")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ internal fun Project.configureSources() {
}

afterEvaluate {
configureMaven()
configureMaven(sourcesJar)
}
}

0 comments on commit 88d1173

Please sign in to comment.