Skip to content

Commit a4ac1ac

Browse files
authored
Update README and fix example (#83)
Update README to link to example notebook in nbviewer instead of GitHub. Fix example script to use new API.
1 parent 0e4ab62 commit a4ac1ac

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
[![Maven Central](https://img.shields.io/badge/Maven%20Central-0.16.2-blue)][14]
44
[![Javadoc](https://img.shields.io/badge/Javadoc-0.16.2-orange)][7]
55

6-
A Kotlin library to access the [Gradle Enterprise API][1], easy to use from Kotlin
7-
scripts, projects or Jupyter notebooks:
6+
A Kotlin library to access the [Gradle Enterprise API][1], easy to use from:
7+
8+
- [Jupyter notebooks with the Kotlin kernel][29]
9+
- [Kotlin scripts (`kts`)][27]
10+
- [Kotlin projects][28]
811

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

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

3030
### Setup snippets
3131

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

35+
<details>
36+
<summary>Add to a Jupyter notebook</summary>
37+
38+
```
39+
%useLatestDescriptors
40+
%use gradle-enterprise-api-kotlin(version=0.16.2)
41+
```
42+
43+
</details>
44+
3545
<details>
3646
<summary>Add to a Kotlin script</summary>
3747

@@ -52,16 +62,6 @@ dependencies {
5262

5363
</details>
5464

55-
<details>
56-
<summary>Add to a Jupyter notebook</summary>
57-
58-
```
59-
%useLatestDescriptors
60-
%use gradle-enterprise-api-kotlin(version=0.16.2)
61-
```
62-
63-
</details>
64-
6565
## Usage
6666

6767
The [`GradleEnterpriseApi`][9] interface represents the Gradle Enterprise REST API. It contains
@@ -185,3 +185,6 @@ import com.gabrielfeo.gradle.enterprise.api.model.extension.*
185185
[24]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api.extension/get-gradle-attributes-flow.html
186186
[25]: https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/library/com.gabrielfeo.gradle.enterprise.api.extension/index.html
187187
[26]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/
188+
[27]: ./examples/example-script.main.kts
189+
[28]: ./examples/example-project
190+
[29]: https://nbviewer.org/github/gabrielfeo/gradle-enterprise-api-kotlin/blob/main/examples/example-notebooks/MostFrequentBuilds.ipynb

examples/example-notebooks/MostFrequentBuilds.ipynb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
"- \"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",
1818
"\n",
1919
"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",
20+
"\n",
2021
"- [Kotlin for data science overview](https://kotlinlang.org/docs/data-science-overview.html)\n",
21-
"- [Kotlin for Jupyter notebooks](https://github.com/cheptsov/kotlin-jupyter-demo/blob/master/index.ipynb)"
22+
"- [Kotlin for Jupyter notebooks](https://github.com/cheptsov/kotlin-jupyter-demo/blob/master/index.ipynb)\n",
23+
"\n",
24+
"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)."
2225
]
2326
},
2427
{

examples/example-script.main.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ println(
9090
)
9191

9292
// Shutdown to end OkHttp's thread pool earlier
93-
shutdown()
93+
GradleEnterpriseApi.shutdown()

0 commit comments

Comments
 (0)