Skip to content

Commit

Permalink
feat: support enforcedPlatform as a dependency capability.
Browse files Browse the repository at this point in the history
  • Loading branch information
autonomousapps committed Oct 24, 2024
1 parent bd5f6a1 commit 8dedc2e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,22 @@ public data class DependencyDeclaration(
*/
public enum class Capability {
DEFAULT,
ENFORCED_PLATFORM,
PLATFORM,
TEST_FIXTURES,
;

public companion object {
private val capabilities = listOf("testFixtures", "platform")
private val capabilities = listOf("testFixtures", "enforcedPlatform", "platform")

public fun isCapability(value: String): Boolean = value in capabilities

public fun of(value: String): Capability {
return when (value) {
"testFixtures" -> TEST_FIXTURES
"enforcedPlatform" -> ENFORCED_PLATFORM
"platform" -> PLATFORM
else -> error(
"Unrecognized capability: '$value'. Expected one of '$capabilities'."
)
else -> error("Unrecognized capability: '$value'. Expected one of '$capabilities'.")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ internal class DependencyExtractorTest {
capability = Capability.TEST_FIXTURES,
type = Type.PROJECT,
),
TestCase(
displayName = "platform capability for version catalog dependency",
fullText = "implementation(platform(libs.bigBom))",
configuration = "implementation",
identifier = "libs.bigBom",
capability = Capability.PLATFORM,
type = Type.MODULE,
),
TestCase(
displayName = "enforcedPlatform capability for version catalog dependency",
fullText = "implementation(enforcedPlatform(libs.bigBom))",
configuration = "implementation",
identifier = "libs.bigBom",
capability = Capability.ENFORCED_PLATFORM,
type = Type.MODULE,
),
TestCase(
displayName = "gradleApi",
fullText = "api(gradleApi())",
Expand Down

0 comments on commit 8dedc2e

Please sign in to comment.