Skip to content

Commit 2095bb6

Browse files
committed
Improve docs
- Use Dokka HTML format which is better for Kotlin - Move Model classes to new package so docs are better organized - Hide internal package from generated docs, along with OpenApi infrastructure packages
1 parent 2a57af9 commit 2095bb6

File tree

7 files changed

+30
-12
lines changed

7 files changed

+30
-12
lines changed

.openapi-generator-ignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build/generated/openapi-generator/api/*
44
build/generated/openapi-generator/gradle/**/*
55
build/generated/openapi-generator/docs/*
66
build/generated/openapi-generator/src/main/AndroidManifest.xml
7-
build/generated/openapi-generator/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/ApiClient.kt
7+
build/generated/openapi-generator/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/infrastructure/ApiClient.kt
88
build/generated/openapi-generator/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/BuildsApi.kt
99
build/generated/openapi-generator/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/BuildCacheApi.kt
1010
build/generated/openapi-generator/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/MetaApi.kt

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ api.getBuild(id = "hy5nxbzfjxe5k")
128128
It's recommended to learn about endpoints and their responses through IDE auto-complete. Javadoc
129129
appearing in auto-complete is the full API manual, same as Gradle's online docs.
130130

131-
This library provides a few helper functions on top of the regular API:
131+
This library provides a few extension functions on top of the regular API:
132132

133133
```kotlin
134134
// Regular query to /api/builds, limited to 1000 builds server-side
@@ -161,11 +161,12 @@ api.getGradleAttributesFlow(since = lastMonth)
161161
your GE instance, decreasing this value should help.
162162
- The script will keep running for an extra ~60s after code finishes, as an [expected behavior
163163
of OkHttp][4], unless you call `shutdown()` (global function).
164-
- All classes are in the same package, so that if you need to make small edits to scripts where
165-
there's no auto-complete, a single wildcard import can be used:
164+
- All classes live in these two packages. If you need to make small edits to scripts where
165+
there's no auto-complete, wildcard imports can be used:
166166

167167
```kotlin
168168
import com.gabrielfeo.gradle.enterprise.api.*
169+
import com.gabrielfeo.gradle.enterprise.api.model.*
169170
```
170171

171172
### Internals

build.gradle.kts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import org.jetbrains.dokka.DokkaConfiguration.Visibility.PUBLIC
2+
import org.jetbrains.dokka.gradle.DokkaTask
3+
14
plugins {
25
val kotlinVersion = "1.7.10"
36
id("org.jetbrains.kotlin.jvm") version kotlinVersion
@@ -8,7 +11,7 @@ plugins {
811
}
912

1013
group = "com.github.gabrielfeo"
11-
version = "1.0"
14+
version = "0.7"
1215

1316
val downloadApiSpec by tasks.registering {
1417
val geVersion = providers.gradleProperty("gradle.enterprise.version").get()
@@ -30,9 +33,9 @@ openApiGenerate {
3033
val ignoreFile = project.layout.projectDirectory.file(".openapi-generator-ignore")
3134
ignoreFileOverride.set(ignoreFile.asFile.absolutePath)
3235
apiPackage.set("com.gabrielfeo.gradle.enterprise.api")
33-
modelPackage.set("com.gabrielfeo.gradle.enterprise.api")
34-
packageName.set("com.gabrielfeo.gradle.enterprise.api")
35-
invokerPackage.set("com.gabrielfeo.gradle.enterprise.api")
36+
modelPackage.set("com.gabrielfeo.gradle.enterprise.api.model")
37+
packageName.set("com.gabrielfeo.gradle.enterprise.api.internal")
38+
invokerPackage.set("com.gabrielfeo.gradle.enterprise.api.internal")
3639
additionalProperties.put("library", "jvm-retrofit2")
3740
}
3841

@@ -52,8 +55,20 @@ java {
5255
}
5356
}
5457

58+
tasks.withType<DokkaTask>().configureEach {
59+
dokkaSourceSets.all {
60+
jdkVersion.set(8)
61+
suppressGeneratedFiles.set(false)
62+
documentedVisibilities.set(setOf(PUBLIC))
63+
perPackageOption {
64+
matchingRegex.set(""".*\.internal.*""")
65+
suppress.set(true)
66+
}
67+
}
68+
}
69+
5570
tasks.named<Jar>("javadocJar") {
56-
from(tasks.dokkaJavadoc)
71+
from(tasks.dokkaHtml)
5772
}
5873

5974
publishing {

src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/GradleEnterpriseApiExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.gabrielfeo.gradle.enterprise.api
22

3+
import com.gabrielfeo.gradle.enterprise.api.model.*
34
import kotlinx.coroutines.CoroutineScope
45
import kotlinx.coroutines.GlobalScope
56
import kotlinx.coroutines.async
67
import kotlinx.coroutines.flow.*
7-
import retrofit2.HttpException
88
import retrofit2.await
99

1010
private const val API_MAX_BUILDS = 1000

src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/ModelExtensions.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.gabrielfeo.gradle.enterprise.api
22

3+
import com.gabrielfeo.gradle.enterprise.api.model.*
4+
35
operator fun List<BuildAttributesValue>.get(name: String): String? {
46
return find { it.name == name }?.value
57
}

src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/internal/OkHttpClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.gabrielfeo.gradle.enterprise.api.internal
22

3-
import com.gabrielfeo.gradle.enterprise.api.auth.HttpBearerAuth
3+
import com.gabrielfeo.gradle.enterprise.api.internal.auth.HttpBearerAuth
44
import com.gabrielfeo.gradle.enterprise.api.internal.caching.CacheEnforcingInterceptor
55
import com.gabrielfeo.gradle.enterprise.api.internal.caching.CacheHitLoggingInterceptor
66
import com.gabrielfeo.gradle.enterprise.api.internal.caching.cache

src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/internal/Retrofit.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.gabrielfeo.gradle.enterprise.api.internal
22

33
import com.gabrielfeo.gradle.enterprise.api.baseUrl
4-
import com.gabrielfeo.gradle.enterprise.api.infrastructure.Serializer
4+
import com.gabrielfeo.gradle.enterprise.api.internal.infrastructure.Serializer
55
import retrofit2.Retrofit
66
import retrofit2.converter.moshi.MoshiConverterFactory
77
import retrofit2.converter.scalars.ScalarsConverterFactory

0 commit comments

Comments
 (0)