@@ -2,20 +2,92 @@ package io.github.edricchan03.koogle_api.plugin.generator
22
33import io.github.edricchan03.koogle_api.plugin.generator.tasks.SchemaFileNameMapper
44import org.gradle.api.file.DirectoryProperty
5+ import org.gradle.api.file.RegularFile
56import org.gradle.api.file.RegularFileProperty
67import org.gradle.api.provider.Property
7- import java.net.URL
8+ import org.gradle.api.provider.Provider
9+ import java.io.File
10+ import java.net.URI
11+ import java.nio.file.Path
812
913/* *
1014 * Configuration options for the [Koogle API generator plugin][KoogleApiGeneratorPlugin].
1115 */
1216public abstract class KoogleApiGeneratorPluginExtension {
13- /* * The discovery URL to use. */
14- public abstract val discoveryUrl: Property <URL >
17+ /* *
18+ * The discovery URL to use.
19+ *
20+ * A file path can be used.
21+ * @since 0.1.0
22+ */
23+ public abstract val discoveryUrl: Property <URI >
1524
16- /* * The discovery URL to use. */
25+ /* *
26+ * The discovery URL to use.
27+ * @since 0.1.0
28+ */
1729 public fun discoveryUrl (url : String ) {
18- discoveryUrl.set(URL (url))
30+ discoveryUrl.set(URI (url))
31+ }
32+
33+ /* *
34+ * The discovery URL to use, as a [Provider].
35+ * @since 0.1.0
36+ */
37+ @JvmName(" discoveryUrlProviderString" )
38+ public fun discoveryUrl (url : Provider <String >) {
39+ discoveryUrl.set(url.map { URI (it) })
40+ }
41+
42+ /* *
43+ * The discovery file to use.
44+ * @since 0.1.0
45+ */
46+ public fun discoveryUrl (file : File ) {
47+ discoveryUrl.set(file.toURI())
48+ }
49+
50+ /* *
51+ * The discovery file to use, as a [Provider].
52+ * @since 0.1.0
53+ */
54+ @JvmName(" discoveryUrlProviderFile" )
55+ public fun discoveryUrl (file : Provider <File >) {
56+ discoveryUrl.set(file.map { it.toURI() })
57+ }
58+
59+ /* *
60+ * The discovery file to use, as a [Path].
61+ * @since 0.1.0
62+ */
63+ public fun discoveryUrl (path : Path ) {
64+ discoveryUrl.set(path.toUri())
65+ }
66+
67+ /* *
68+ * The discovery file to use, as a [Provider] of [Path].
69+ * @since 0.1.0
70+ */
71+ @JvmName(" discoveryUrlProviderPath" )
72+ public fun discoveryUrl (path : Provider <Path >) {
73+ discoveryUrl.set(path.map { it.toUri() })
74+ }
75+
76+ /* *
77+ * The discovery file to use, as a [RegularFile].
78+ * @since 0.1.0
79+ */
80+ public fun discoveryUrl (file : RegularFile ) {
81+ discoveryUrl.set(file.asFile.toURI())
82+ }
83+
84+ /* *
85+ * The discovery file to use, as a [Provider] of [RegularFile].
86+ * @since 0.1.0
87+ */
88+ @JvmName(" discoveryUrlProviderRegularFile" )
89+ public fun discoveryUrl (file : Provider <RegularFile >) {
90+ discoveryUrl.set(file.map { it.asFile.toURI() })
1991 }
2092
2193 /* *
0 commit comments