Skip to content

Commit 620eb63

Browse files
committed
build(gradle): Do not publish "funTest" feature variants
These are only needed locally. This speeds up publishing and works around a bogus "Dependency version information is missing" error on Sonatype Central Portal when publishing releases. Note that the lookup in `components` throws instead of returning `null` if "java" is not present. Also see [1] which explains to do the same for test fixtures, which in fact are just feature variants. [1]: https://docs.gradle.org/current/userguide/java_testing.html#ex-disable-publishing-of-test-fixtures-variants Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 56a6d18 commit 620eb63

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

buildSrc/src/main/kotlin/ort-publication-conventions.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ plugins {
2424
id("com.vanniktech.maven.publish")
2525
}
2626

27+
runCatching {
28+
components["java"] as AdhocComponentWithVariants
29+
}.onSuccess {
30+
it.withVariantsFromConfiguration(configurations["funTestApiElements"]) { skip() }
31+
it.withVariantsFromConfiguration(configurations["funTestRuntimeElements"]) { skip() }
32+
}
33+
2734
fun getGroupId(parent: Project?): String =
2835
parent?.let { "${getGroupId(it.parent)}.${it.name.replace("-", "")}" }.orEmpty()
2936

0 commit comments

Comments
 (0)