Skip to content

Commit

Permalink
Rename many things to Develocity (#177)
Browse files Browse the repository at this point in the history
Find and replace `gradle[-_./]enterprise` and other variations for
Develocity.

Disable README links test in PRs for now. New links remain broken until
after the repository rename and Pages publish at that path.

Part of #184
  • Loading branch information
gabrielfeo authored Apr 5, 2024
1 parent 23008ee commit fbaa91a
Show file tree
Hide file tree
Showing 56 changed files with 274 additions and 273 deletions.
8 changes: 4 additions & 4 deletions .github/scripts/test_resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
[![Maven Central](https://img.shields.io/badge/Maven%20Central-0.17.0-blue)][14]

```kotlin
@file:DependsOn("com.gabrielfeo:gradle-enterprise-api-kotlin:0.17.0")
@file:DependsOn("com.gabrielfeo:develocity-api-kotlin:0.17.0")
```

```kotlin
implementation("com.gabrielfeo:gradle-enterprise-api-kotlin:0.17.0")
implementation("com.gabrielfeo:develocity-api-kotlin:0.17.0")
```

```
%use gradle-enterprise-api-kotlin(version=0.17.0)
%use develocity-api-kotlin(version=0.17.0)
```

[14]: https://central.sonatype.com/artifact/com.gabrielfeo/gradle-enterprise-api-kotlin/0.17.0
[14]: https://central.sonatype.com/artifact/com.gabrielfeo/develocity-api-kotlin/0.17.0
2 changes: 1 addition & 1 deletion .github/scripts/test_resources/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dependencies {
implementation("com.gabrielfeo:gradle-enterprise-api-kotlin:0.17.0")
implementation("com.gabrielfeo:develocity-api-kotlin:0.17.0")
}
4 changes: 2 additions & 2 deletions .github/scripts/test_update_api_spec_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def test_main_without_update_available(self, mock_get, _):

def assert_properties_version(self, file, version):
with open(file.name) as file:
expected = f"gradle.enterprise.version={version}\nversion={version}.0\n1=2\n"
expected = f"develocity.version={version}\nversion={version}.0\n1=2\n"
self.assertEqual(file.read(), expected)

def properties_file(self, version):
file = NamedTemporaryFile()
content = f"gradle.enterprise.version={version}\nversion={version}.0\n1=2\n"
content = f"develocity.version={version}\nversion={version}.0\n1=2\n"
file.write(content.encode())
file.flush()
return file
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/update_api_spec_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_current_api_spec_version(properties_file) -> str:
if '=' not in line:
continue
k, v = line.strip().split('=', maxsplit=2)
if k == 'gradle.enterprise.version':
if k == 'develocity.version':
return v


Expand All @@ -42,7 +42,7 @@ def update_version(properties_file, new_version):
if '=' in line:
k, v = line.strip().split('=', maxsplit=2)
# Update target API spec version
if k == 'gradle.enterprise.version':
if k == 'develocity.version':
line = f"{k}={new_version}\n"
# Update library version
if k == 'version':
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ jobs:
- name: 'unittest discover'
run: python3 -m unittest discover -bs .github/scripts

readme-links-test:
uses: ./.github/workflows/test-readme-links.yml
# TODO Re-enable once rename is done (too many dead links until new javadoc is published)
# readme-links-test:
# uses: ./.github/workflows/test-readme-links.yml

generated-api-diff:
runs-on: ubuntu-latest
Expand Down
72 changes: 36 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Gradle Enterprise API Kotlin
# Develocity API Kotlin

[![Maven Central](https://img.shields.io/badge/Maven%20Central-2023.4.0-blue)][14]
[![Javadoc](https://img.shields.io/badge/Javadoc-2023.4.0-orange)][7]

A Kotlin library to access the [Gradle Enterprise API][1], easy to use from:
A Kotlin library to access the [Develocity API][1], easy to use from:

- [Jupyter notebooks with the Kotlin kernel][29]
- [Kotlin scripts (`kts`)][27]
- [Kotlin projects][28]

```kotlin
val api = GradleEnterpriseApi.newInstance()
val api = DevelocityApi.newInstance()
api.buildsApi.getBuildsFlow(fromInstant = 0, query = "buildStartTime<-1d").forEach {
println(it)
}
Expand All @@ -22,8 +22,8 @@ api.buildsApi.getBuildsFlow(fromInstant = 0, query = "buildStartTime<-1d").forEa

Set up environment variables and use the library from any notebook, script or project:

- [`GRADLE_ENTERPRISE_API_URL`][16]: the URL of your Gradle Enterprise instance
- [`GRADLE_ENTERPRISE_API_TOKEN`][17]: an [access key][31] for the Gradle Enterprise instance
- [`GRADLE_ENTERPRISE_API_URL`][16]: the URL of your Develocity instance
- [`GRADLE_ENTERPRISE_API_TOKEN`][17]: an [access key][31] for the Develocity instance
- [`GRADLE_ENTERPRISE_API_CACHE_ENABLED`][12] (optional, off by default): enables caching for some
requests (see [caveats][13])

Expand All @@ -37,7 +37,7 @@ recommended over JitPack.

```
%useLatestDescriptors
%use gradle-enterprise-api-kotlin(version=2023.4.0)
%use develocity-api-kotlin(version=2023.4.0)
```

</details>
Expand All @@ -46,7 +46,7 @@ recommended over JitPack.
<summary>Add to a Kotlin script</summary>

```kotlin
@file:DependsOn("com.gabrielfeo:gradle-enterprise-api-kotlin:2023.4.0")
@file:DependsOn("com.gabrielfeo:develocity-api-kotlin:2023.4.0")
```

</details>
Expand All @@ -56,19 +56,19 @@ recommended over JitPack.

```kotlin
dependencies {
implementation("com.gabrielfeo:gradle-enterprise-api-kotlin:2023.4.0")
implementation("com.gabrielfeo:develocity-api-kotlin:2023.4.0")
}
```

</details>

## Usage

The [`GradleEnterpriseApi`][9] interface represents the Gradle Enterprise REST API. It contains
The [`DevelocityApi`][9] interface represents the Develocity REST API. It contains
all the APIs exactly as listed in the [REST API Manual][5]:

```kotlin
interface GradleEnterpriseApi {
interface DevelocityApi {
val buildsApi: BuildsApi
val testsApi: TestsApi
val buildCacheApi: BuildCacheApi
Expand Down Expand Up @@ -106,7 +106,7 @@ off by default. Enable by simply setting [`GRADLE_ENTERPRISE_API_CACHE_ENABLED`]
### Extensions

Explore the library's convenience extensions:
[`com.gabrielfeo.gradle.enterprise.api.extension`][25].
[`com.gabrielfeo.develocity.api.extension`][25].

By default, the API's most common endpoint, `/api/builds`, is paginated. The library provides a
[`getBuildsFlow`][24] extension to handle paging under-the-hood and yield all builds as you collect
Expand All @@ -126,7 +126,7 @@ case they're needed again. This is an optimization of [OkHttp][4]. If you're wor
or have a long-living program that fetches builds continuosly, no shutdown is needed.

```kotlin
val api = GradleEnterpriseApi.newInstance()
val api = DevelocityApi.newInstance()
while (true) {
delay(2.minutes)
processNewBuilds(api.buildsApi.getBuildsFlow(query = "..."))
Expand All @@ -135,10 +135,10 @@ while (true) {
```

In other cases (i.e. fetching some builds and exiting), you might want to call
[`GradleEnterpriseApi.shutdown()`][11] so that the program exits immediately:
[`DevelocityApi.shutdown()`][11] so that the program exits immediately:

```kotlin
val api = GradleEnterpriseApi.newInstance()
val api = DevelocityApi.newInstance()
printMetrics(api.buildsApi.getBuildsFlow(query = "..."))
// Call shutdown if you expect the program to exit now
api.shutdown()
Expand Down Expand Up @@ -170,7 +170,7 @@ val config = Config(
apiToken = { vault.getGeApiToken() },
clientBuilder = existingClient.newBuilder(),
)
val api = GradleEnterpriseApi.newInstance(config)
val api = DevelocityApi.newInstance(config)
api.buildsApi.getBuilds(fromInstant = yesterdayMilli)
```

Expand All @@ -184,9 +184,9 @@ See the [`Config`][8] documentation for more.
no auto-complete, wildcard imports can be used (in notebooks, they're added automatically):

```kotlin
import com.gabrielfeo.gradle.enterprise.api.*
import com.gabrielfeo.gradle.enterprise.api.model.*
import com.gabrielfeo.gradle.enterprise.api.model.extension.*
import com.gabrielfeo.develocity.api.*
import com.gabrielfeo.develocity.api.model.*
import com.gabrielfeo.develocity.api.model.extension.*
```

[1]: https://docs.gradle.com/enterprise/api-manual/
Expand All @@ -195,27 +195,27 @@ import com.gabrielfeo.gradle.enterprise.api.model.extension.*
[4]: https://github.com/square/retrofit/issues/3144#issuecomment-508300518
[5]: https://docs.gradle.com/enterprise/api-manual/ref/2022.4.html
[6]: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc
[7]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/
[8]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-config/index.html
[9]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-gradle-enterprise-api/
[11]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-gradle-enterprise-api/shutdown.html
[12]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-config/-cache-config/cache-enabled.html
[13]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-config/-cache-config/index.html
[14]: https://central.sonatype.com/artifact/com.gabrielfeo/gradle-enterprise-api-kotlin/2023.4.0
[16]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-config/api-url.html
[17]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-config/api-token.html
[18]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-builds-api/index.html
[19]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api.model/-gradle-attributes/index.html
[20]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-builds-api/index.html
[21]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-builds-api/get-builds.html
[22]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-builds-api/get-gradle-attributes.html
[23]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api/-gradle-enterprise-api/-default-instance/index.html
[24]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api.extension/get-builds-flow.html
[25]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api.extension/index.html
[7]: https://gabrielfeo.github.io/develocity-api-kotlin/
[8]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/index.html
[9]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-develocity-api/
[11]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-develocity-api/shutdown.html
[12]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/-cache-config/cache-enabled.html
[13]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/-cache-config/index.html
[14]: https://central.sonatype.com/artifact/com.gabrielfeo/develocity-api-kotlin/2023.4.0
[16]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/api-url.html
[17]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-config/api-token.html
[18]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-builds-api/index.html
[19]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api.model/-gradle-attributes/index.html
[20]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-builds-api/index.html
[21]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-builds-api/get-builds.html
[22]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-builds-api/get-gradle-attributes.html
[23]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api/-develocity-api/-default-instance/index.html
[24]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api.extension/get-builds-flow.html
[25]: https://gabrielfeo.github.io/develocity-api-kotlin/library/com.gabrielfeo.develocity.api.extension/index.html
[26]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/
[27]: ./examples/example-scripts/example-script.main.kts
[28]: ./examples/example-project
[29]: https://nbviewer.org/github/gabrielfeo/gradle-enterprise-api-kotlin/blob/main/examples/example-notebooks/MostFrequentBuilds.ipynb
[29]: https://nbviewer.org/github/gabrielfeo/develocity-api-kotlin/blob/main/examples/example-notebooks/MostFrequentBuilds.ipynb
[30]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/run-blocking.html
[31]: ./docs/AccessKeys.md
[32]: ./examples
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,30 @@ class PostProcessGeneratedApiTest {
*/
@Test
fun apiInterfacePostProcessing() = testPostProcessing(
inputPath = "com/gabrielfeo/gradle/enterprise/api/BuildsApi.kt",
inputPath = "com/gabrielfeo/develocity/api/BuildsApi.kt",
inputContent = """
package com.gabrielfeo.gradle.enterprise.api
import com.gabrielfeo.gradle.enterprise.api.internal.infrastructure.CollectionFormats.*
package com.gabrielfeo.develocity.api
import com.gabrielfeo.develocity.api.internal.infrastructure.CollectionFormats.*
import retrofit2.http.*
import retrofit2.Response
import okhttp3.RequestBody
import com.squareup.moshi.Json
import com.gabrielfeo.gradle.enterprise.api.model.ApiProblem
import com.gabrielfeo.gradle.enterprise.api.model.Build
import com.gabrielfeo.gradle.enterprise.api.model.BuildModelQuery
import com.gabrielfeo.gradle.enterprise.api.model.BuildQuery
import com.gabrielfeo.gradle.enterprise.api.model.BuildsQuery
import com.gabrielfeo.gradle.enterprise.api.model.GradleAttributes
import com.gabrielfeo.gradle.enterprise.api.model.GradleBuildCachePerformance
import com.gabrielfeo.gradle.enterprise.api.model.GradleNetworkActivity
import com.gabrielfeo.gradle.enterprise.api.model.GradleProject
import com.gabrielfeo.gradle.enterprise.api.model.MavenAttributes
import com.gabrielfeo.gradle.enterprise.api.model.MavenBuildCachePerformance
import com.gabrielfeo.gradle.enterprise.api.model.MavenDependencyResolution
import com.gabrielfeo.gradle.enterprise.api.model.MavenModule
import com.gabrielfeo.develocity.api.model.ApiProblem
import com.gabrielfeo.develocity.api.model.Build
import com.gabrielfeo.develocity.api.model.BuildModelQuery
import com.gabrielfeo.develocity.api.model.BuildQuery
import com.gabrielfeo.develocity.api.model.BuildsQuery
import com.gabrielfeo.develocity.api.model.GradleAttributes
import com.gabrielfeo.develocity.api.model.GradleBuildCachePerformance
import com.gabrielfeo.develocity.api.model.GradleNetworkActivity
import com.gabrielfeo.develocity.api.model.GradleProject
import com.gabrielfeo.develocity.api.model.MavenAttributes
import com.gabrielfeo.develocity.api.model.MavenBuildCachePerformance
import com.gabrielfeo.develocity.api.model.MavenDependencyResolution
import com.gabrielfeo.develocity.api.model.MavenModule
interface BuildsApi {
/**
* Get the common attributes of a Build Scan.
Expand All @@ -67,18 +67,18 @@ class PostProcessGeneratedApiTest {
@GET("api/builds/{id}")
suspend fun getBuild(@Path("id") id: kotlin.String, @Query("models") models: kotlin.collections.List<BuildModelName>? = null, @Query("availabilityWaitTimeoutSecs") availabilityWaitTimeoutSecs: kotlin.Int? = null): Response<Build>
""".trimIndent(),
outputPath = "com/gabrielfeo/gradle/enterprise/api/BuildsApi.kt",
outputPath = "com/gabrielfeo/develocity/api/BuildsApi.kt",
outputContent = """
package com.gabrielfeo.gradle.enterprise.api
import com.gabrielfeo.gradle.enterprise.api.internal.infrastructure.CollectionFormats.*
package com.gabrielfeo.develocity.api
import com.gabrielfeo.develocity.api.internal.infrastructure.CollectionFormats.*
import retrofit2.http.*
import retrofit2.Response
import okhttp3.RequestBody
import com.squareup.moshi.Json
import com.gabrielfeo.gradle.enterprise.api.model.*
import com.gabrielfeo.develocity.api.model.*
@JvmSuppressWildcards
interface BuildsApi {
/**
Expand Down Expand Up @@ -106,25 +106,25 @@ class PostProcessGeneratedApiTest {
*/
@Test
fun buildModelNameEnumPostProcessing() = testPostProcessing(
inputPath = "com/gabrielfeo/gradle/enterprise/api/model/BuildModelName.kt",
inputPath = "com/gabrielfeo/develocity/api/model/BuildModelName.kt",
inputContent = """
@JsonClass(generateAdapter = false)
enum class BuildModelName(val value: kotlin.String) {
@Json(name = "gradle-attributes")
gradleMinusAttributes("gradle-attributes"),
@Json(name = "gradle-build-cache-performance")
gradleMinusBuildMinusCacheMinusPerformance("gradle-build-cache-performance"),
""".trimIndent(),
outputPath = "com/gabrielfeo/gradle/enterprise/api/model/BuildModelName.kt",
outputPath = "com/gabrielfeo/develocity/api/model/BuildModelName.kt",
outputContent = """
@JsonClass(generateAdapter = false)
enum class BuildModelName(val value: kotlin.String) {
@Json(name = "gradle-attributes")
gradleAttributes("gradle-attributes"),
@Json(name = "gradle-build-cache-performance")
gradleBuildCachePerformance("gradle-build-cache-performance"),
""".trimIndent(),
Expand Down Expand Up @@ -163,18 +163,18 @@ class PostProcessGeneratedApiTest {
// language=groovy
"""
import com.gabrielfeo.task.PostProcessGeneratedApi
plugins {
id("com.gabrielfeo.no-op")
}
tasks.register("postProcessGeneratedApi", PostProcessGeneratedApi) {
originalFiles = new File("${inputDir.absolutePath}")
modelsPackage = "com.gabrielfeo.gradle.enterprise.api.model"
modelsPackage = "com.gabrielfeo.develocity.api.model"
postProcessedFiles = new File("${outputDir.absolutePath}")
}
""".trimIndent()
)
return projectDir
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

val localSpecPath = providers.gradleProperty("localSpecPath")
val remoteSpecUrl = providers.gradleProperty("remoteSpecUrl").orElse(
providers.gradleProperty("gradle.enterprise.version").map { geVersion ->
providers.gradleProperty("develocity.version").map { geVersion ->
val majorVersion = geVersion.substringBefore('.').toInt()
val specName = when {
majorVersion <= 2023 -> "gradle-enterprise-$geVersion-api.yaml"
Expand Down Expand Up @@ -45,10 +45,10 @@ openApiGenerate {
outputDir.set(generateDir)
val ignoreFile = project.layout.projectDirectory.file(".openapi-generator-ignore")
ignoreFileOverride.set(ignoreFile.asFile.absolutePath)
apiPackage.set("com.gabrielfeo.gradle.enterprise.api")
modelPackage.set("com.gabrielfeo.gradle.enterprise.api.model")
packageName.set("com.gabrielfeo.gradle.enterprise.api.internal")
invokerPackage.set("com.gabrielfeo.gradle.enterprise.api.internal")
apiPackage.set("com.gabrielfeo.develocity.api")
modelPackage.set("com.gabrielfeo.develocity.api.model")
packageName.set("com.gabrielfeo.develocity.api.internal")
invokerPackage.set("com.gabrielfeo.develocity.api.internal")
additionalProperties.put("library", "jvm-retrofit2")
additionalProperties.put("useCoroutines", true)
cleanupOutput.set(true)
Expand Down
Loading

0 comments on commit fbaa91a

Please sign in to comment.