[Gradle] Check that *sourcesElements is not exposed withSourcesJar(publish=false)

^KT-57652 In Progress
This commit is contained in:
Anton Lakotka
2023-03-29 13:27:15 +02:00
committed by Space Team
parent 39d466b695
commit 1833347a7d
@@ -201,6 +201,18 @@ class MppPublicationTest {
}
}
@Test
fun `test that no sourcesElements should be exposed when sources are not published`() {
kotlin.linuxX64("linux")
kotlin.withSourcesJar(publish = false)
project.evaluate()
kotlin.targets.forEach {
if (it.sourcesElementsConfigurationName in project.configurations.names)
fail("Configuration '${it.sourcesElementsConfigurationName}' should not be created")
}
}
private fun SoftwareComponent.attributesOfUsageContext(usageContextName: String): AttributeContainer {
this as SoftwareComponentInternal
return usages.first { it.name == usageContextName }.attributes