diff --git a/docs/changelog/0.5.0.md b/docs/changelog/0.5.0.md index 7c74492..627a02a 100644 --- a/docs/changelog/0.5.0.md +++ b/docs/changelog/0.5.0.md @@ -11,6 +11,8 @@ _Not Released Yet_ - The purpose of this platform is to provide more convenient development experience. The implicit platform should be filtered when creating distributions. +- Experimentally exposed the match functions for `Architecture` and + `OperatingSystem` as public API. #### Fixes diff --git a/src/main/kotlin/com/osmerion/gradle/lwjgl3/Architecture.kt b/src/main/kotlin/com/osmerion/gradle/lwjgl3/Architecture.kt index 669f205..1dfb9b9 100644 --- a/src/main/kotlin/com/osmerion/gradle/lwjgl3/Architecture.kt +++ b/src/main/kotlin/com/osmerion/gradle/lwjgl3/Architecture.kt @@ -49,6 +49,7 @@ public fun Architecture(matches: Predicate): Architecture = * * @since 0.1.0 */ +@OptIn(ExperimentalPlatformApi::class) public sealed class Architecture { internal abstract val artifactClassifierComponent: String? @@ -59,7 +60,17 @@ public sealed class Architecture { } - internal abstract fun matches(arch: String): Boolean + /** + * Checks if the given `arch` matches this architecture. + * + * @param arch the architecture to match + * + * @return `true` if the given `arch` matches this architecture, or `false` otherwise + * + * @since 0.5.0 + */ + @ExperimentalPlatformApi + public abstract fun matches(arch: String): Boolean /** * The ARM32 architecture. diff --git a/src/main/kotlin/com/osmerion/gradle/lwjgl3/ExperimentalPlatformApi.kt b/src/main/kotlin/com/osmerion/gradle/lwjgl3/ExperimentalPlatformApi.kt new file mode 100644 index 0000000..2ccf7bb --- /dev/null +++ b/src/main/kotlin/com/osmerion/gradle/lwjgl3/ExperimentalPlatformApi.kt @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023-2024 Leon Linhart + * All rights reserved. + */ +package com.osmerion.gradle.lwjgl3 + +/** + * Marks APIs that are experimental parts of the platform (i.e. OS and + * architecture) matching APIs. + * + * @since 0.5.0 + */ +@RequiresOptIn +public annotation class ExperimentalPlatformApi \ No newline at end of file diff --git a/src/main/kotlin/com/osmerion/gradle/lwjgl3/OperatingSystem.kt b/src/main/kotlin/com/osmerion/gradle/lwjgl3/OperatingSystem.kt index ca66fe4..483fce1 100644 --- a/src/main/kotlin/com/osmerion/gradle/lwjgl3/OperatingSystem.kt +++ b/src/main/kotlin/com/osmerion/gradle/lwjgl3/OperatingSystem.kt @@ -49,6 +49,7 @@ public fun OperatingSystem(matches: Predicate): OperatingSystem = * * @since 0.1.0 */ +@OptIn(ExperimentalPlatformApi::class) public sealed class OperatingSystem { internal abstract val artifactClassifierComponent: String @@ -59,7 +60,17 @@ public sealed class OperatingSystem { } - internal abstract fun matches(osName: String): Boolean + /** + * Checks if the given operating system name matches this operating system. + * + * @param osName the name of the operating system to match + * + * @return `true` if the given operating system name matches this operating system, + * + * @since 0.5.0 + */ + @ExperimentalPlatformApi + public abstract fun matches(osName: String): Boolean /** * The FreeBSD operating system family.