Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
[![Maven Central](https://img.shields.io/badge/Maven%20Central-0.16.2-blue)][14]
[![Javadoc](https://img.shields.io/badge/Javadoc-0.16.2-orange)][7]

A Kotlin library to access the [Gradle Enterprise API][1], easy to use from Kotlin
scripts, projects or Jupyter notebooks:
A Kotlin library to access the [Gradle Enterprise API][1], easy to use from:

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

```kotlin
GradleEnterpriseApi.buildsApi.getBuilds(since = yesterdayMilli).forEach {
Expand All @@ -21,17 +24,24 @@ Set up once and use the library from anywhere in your machine:
Enterprise instance.
- Or a macOS keychain entry labeled `gradle-enterprise-api-token` (recommended).

That's it! You can now use the library without any code configuration from:

- [Kotlin scripts (`kts`)](./examples/example-script.main.kts)
- [Kotlin projects](./examples/example-project)
- [Jupyter notebooks with the Kotlin kernel](./examples/example-notebooks)
That's it! You can now use the library without any code configuration from notebooks, scripts or
projects.

### Setup snippets

ℹ️ The library is now published to Maven Central under `com.gabrielfeo`. Maven Central is
recommended over JitPack.

<details>
<summary>Add to a Jupyter notebook</summary>

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

</details>

<details>
<summary>Add to a Kotlin script</summary>

Expand All @@ -52,16 +62,6 @@ dependencies {

</details>

<details>
<summary>Add to a Jupyter notebook</summary>

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

</details>

## Usage

The [`GradleEnterpriseApi`][9] interface represents the Gradle Enterprise REST API. It contains
Expand Down Expand Up @@ -185,3 +185,6 @@ import com.gabrielfeo.gradle.enterprise.api.model.extension.*
[24]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api.extension/get-gradle-attributes-flow.html
[25]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api.extension/index.html
[26]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/
[27]: ./examples/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
5 changes: 4 additions & 1 deletion examples/example-notebooks/MostFrequentBuilds.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
"- \"Some are doing `check` builds locally, which we set up to trigger our notably slow legacy tests. We should suggest they run `test` instead, leaving `check` for CI to run.\"\n",
"\n",
"This notebook will take you through using gradle-enterprise-api-kotlin in Jupyter, but it won't get into what a notebook is and how to run it. If you're not familiar with Jupyter:\n",
"\n",
"- [Kotlin for data science overview](https://kotlinlang.org/docs/data-science-overview.html)\n",
"- [Kotlin for Jupyter notebooks](https://github.com/cheptsov/kotlin-jupyter-demo/blob/master/index.ipynb)"
"- [Kotlin for Jupyter notebooks](https://github.com/cheptsov/kotlin-jupyter-demo/blob/master/index.ipynb)\n",
"\n",
"Note: GitHub preview won't render tables or graphs. I recommend previewing this in the [online Jupyter nbviewer](https://nbviewer.org/github/gabrielfeo/gradle-enterprise-api-kotlin/blob/main/examples/example-notebooks/MostFrequentBuilds.ipynb)."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/example-script.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ println(
)

// Shutdown to end OkHttp's thread pool earlier
shutdown()
GradleEnterpriseApi.shutdown()