Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compose-helper module is exposed and gets published #2430

Merged
merged 7 commits into from Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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> {
markushi marked this conversation as resolved.
Show resolved Hide resolved
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
}