Skip to content

Commit

Permalink
Fix compose-helper module is exposed and gets published (#2430)
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
  • Loading branch information
3 people committed Dec 15, 2022
1 parent 81a3c32 commit 606823f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Expand Up @@ -104,7 +104,7 @@ subprojects {
}
}

if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-test-support") {
if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-test-support" && this.name != "sentry-compose-helper") {
apply<DistributionPlugin>()

val sep = File.separator
Expand Down
31 changes: 31 additions & 0 deletions sentry-compose/build.gradle.kts
@@ -1,4 +1,6 @@
import com.android.build.gradle.internal.tasks.LibraryAarJarsTask
import groovy.util.Node
import groovy.util.NodeList
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.dokka.gradle.DokkaTask

Expand Down Expand Up @@ -159,3 +161,32 @@ dependencies {
tasks.withType<LibraryAarJarsTask> {
mainScopeClassFiles.setFrom(embedComposeHelperConfig)
}

// we embed the sentry-compose-helper classes to the same .jar above
// so we need to exclude the dependency from the .pom publication and .module metadata
configure<PublishingExtension> {
publications.withType(MavenPublication::class.java).all {
this.pom {
this.withXml {
(asNode().get("dependencies") as NodeList)
.flatMap {
if (it is Node) it.children() else NodeList()
}
.filterIsInstance<Node>()
.filter { dependency ->
val artifactIdNodes = dependency.get("artifactId") as NodeList
artifactIdNodes.any {
(it is Node && it.value().toString().contains("sentry-compose-helper"))
}
}
.forEach { dependency ->
dependency.parent().remove(dependency)
}
}
}
}
}

tasks.withType<GenerateModuleMetadata> {
enabled = false
}

0 comments on commit 606823f

Please sign in to comment.