Skip to content

Commit

Permalink
Merge branch 'hbmartin-maven-central'
Browse files Browse the repository at this point in the history
  • Loading branch information
kpgalligan committed Aug 29, 2024
2 parents 97b4bf4 + b92a930 commit 38baa70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,8 @@ interface KmmBridgeExtension {
* the name in here.
*/
@Suppress("unused")
fun Project.mavenPublishArtifacts(
repository: String? = null,
publication: String? = null,
artifactSuffix: String? = null
) {
artifactManager.setAndFinalize(MavenPublishArtifactManager(this, publication, artifactSuffix, repository))
fun Project.mavenPublishArtifacts(repository: String? = null, publication: String? = null, artifactSuffix: String? = null, isMavenCentral: Boolean = false) {
artifactManager.setAndFinalize(MavenPublishArtifactManager(this, publication, artifactSuffix, repository, isMavenCentral))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class MavenPublishArtifactManager(
private val publicationName: String?,
artifactSuffix: String?,
private val repositoryName: String?,
) : ArtifactManager {
private val isMavenCentral: Boolean = false,
) : ArtifactManager {
private val group: String = project.group.toString().replace(".", "/")
private val kmmbridgeArtifactId = "${project.name}-${artifactSuffix ?: KMMBRIDGE_ARTIFACT_SUFFIX}"

Expand Down Expand Up @@ -75,8 +76,11 @@ class MavenPublishArtifactManager(
// There may be more than one repo, but it's also possible we get none. This will allow us to continue and trying
// to use the dependency should fail.
// If there are multiple repos, the repo name needs to be specified.
val mavenArtifactRepositoryUrl =
val mavenArtifactRepositoryUrl = if (!isMavenCentral) {
findArtifactRepository(publishingExtension).url.toString()
} else {
"https://repo.maven.apache.org/maven2/"
}

return artifactPath(mavenArtifactRepositoryUrl, version)
}
Expand Down

0 comments on commit 38baa70

Please sign in to comment.