Skip to content

Commit 606823f

Browse files
markushiromtsngetsentry-bot
authored
Fix compose-helper module is exposed and gets published (#2430)
Co-authored-by: Roman Zavarnitsyn <[email protected]> Co-authored-by: Sentry Github Bot <[email protected]>
1 parent 81a3c32 commit 606823f

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ subprojects {
104104
}
105105
}
106106

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

110110
val sep = File.separator

sentry-compose/build.gradle.kts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import com.android.build.gradle.internal.tasks.LibraryAarJarsTask
2+
import groovy.util.Node
3+
import groovy.util.NodeList
24
import io.gitlab.arturbosch.detekt.Detekt
35
import org.jetbrains.dokka.gradle.DokkaTask
46

@@ -159,3 +161,32 @@ dependencies {
159161
tasks.withType<LibraryAarJarsTask> {
160162
mainScopeClassFiles.setFrom(embedComposeHelperConfig)
161163
}
164+
165+
// we embed the sentry-compose-helper classes to the same .jar above
166+
// so we need to exclude the dependency from the .pom publication and .module metadata
167+
configure<PublishingExtension> {
168+
publications.withType(MavenPublication::class.java).all {
169+
this.pom {
170+
this.withXml {
171+
(asNode().get("dependencies") as NodeList)
172+
.flatMap {
173+
if (it is Node) it.children() else NodeList()
174+
}
175+
.filterIsInstance<Node>()
176+
.filter { dependency ->
177+
val artifactIdNodes = dependency.get("artifactId") as NodeList
178+
artifactIdNodes.any {
179+
(it is Node && it.value().toString().contains("sentry-compose-helper"))
180+
}
181+
}
182+
.forEach { dependency ->
183+
dependency.parent().remove(dependency)
184+
}
185+
}
186+
}
187+
}
188+
}
189+
190+
tasks.withType<GenerateModuleMetadata> {
191+
enabled = false
192+
}

0 commit comments

Comments
 (0)