Skip to content

Commit 3b49efb

Browse files
authored
Improve setup instructions (#85)
1 parent 551793c commit 3b49efb

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ A Kotlin library to access the [Gradle Enterprise API][1], easy to use from:
99
- [Kotlin scripts (`kts`)][27]
1010
- [Kotlin projects][28]
1111

12+
Using the API is as easy as this:
13+
1214
```kotlin
1315
GradleEnterpriseApi.buildsApi.getBuilds(since = yesterdayMilli).forEach {
1416
println(it)
1517
}
1618
```
1719

20+
The library takes care of caching under the hood (opt-in) and provides some convenience extensions.
21+
1822
## Setup
1923

2024
Set up once and use the library from anywhere in your machine:
@@ -23,13 +27,25 @@ Set up once and use the library from anywhere in your machine:
2327
- [`GRADLE_ENTERPRISE_API_TOKEN`][17] environment variable: an API access token for the Gradle
2428
Enterprise instance.
2529
- Or a macOS keychain entry labeled `gradle-enterprise-api-token` (recommended).
30+
- <details>
31+
32+
<summary>How to get an API token</summary>
33+
34+
The Gradle Enterprise user must have the “Export build data via the API” permission.
35+
36+
1. Sign in to Gradle Enterprise
37+
2. Go to "My settings" from the user menu in the top right-hand corner of the page
38+
3. Go to "Access keys" from the sidebar
39+
4. Click "Generate" on the right-hand side and copy the generated token.
40+
41+
</details>
2642

27-
That's it! You can now use the library without any code configuration from notebooks, scripts or
43+
That's it! You can now use the library without any code configuration from notebooks, scripts or
2844
projects.
2945

3046
### Setup snippets
3147

32-
ℹ️ The library is now published to Maven Central under `com.gabrielfeo`. Maven Central is
48+
ℹ️ The library is now published to Maven Central under `com.gabrielfeo`. Maven Central is
3349
recommended over JitPack.
3450

3551
<details>

examples/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exampleTestTasks += tasks.register<Exec>("runExampleScript") {
77
}
88

99
exampleTestTasks += tasks.register<GradleBuild>("runExampleProject") {
10-
group = "Verification"
10+
group = "Application"
1111
description = "Runs examples/example-project as a standalone build"
1212
dir = file("example-project")
1313
tasks = listOf("run")
@@ -32,7 +32,7 @@ exampleTestTasks += notebooks.map { notebook ->
3232
}
3333
}
3434

35-
tasks.register("runExamples") {
35+
tasks.register("runAll") {
3636
group = "Application"
3737
description = "Runs everything in 'examples' directory"
3838
dependsOn(exampleTestTasks)

examples/example-notebooks/MostFrequentBuilds.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,27 @@
2525
]
2626
},
2727
{
28+
"attachments": {},
2829
"cell_type": "markdown",
2930
"id": "79661abe-8aea-48c2-9938-e9452c0161d0",
3031
"metadata": {},
3132
"source": [
3233
"## Setup\n",
3334
"\n",
34-
"`%use` is a [line magic](https://github.com/Kotlin/kotlin-jupyter#line-magics) of the Kotlin kernel that can do much more than adding the library. To illustrate, this setup:\n",
35+
"Add libraries to use, via line magics. `%use` is a [line magic](https://github.com/Kotlin/kotlin-jupyter#line-magics) of the Kotlin kernel that can do much more than adding the library. To illustrate, this setup can be replaced with a single line magic.\n",
3536
"\n",
3637
"```kotlin\n",
3738
"@file:DependsOn(\"com.gabrielfeo:gradle-enterprise-api-kotlin:0.16.2\")\n",
3839
"\n",
3940
"import com.gabrielfeo.gradle.enterprise.api.*\n",
4041
"import com.gabrielfeo.gradle.enterprise.api.model.*\n",
42+
"import com.gabrielfeo.gradle.enterprise.api.extension.*\n",
4143
"```\n",
4244
"\n",
43-
"can be entirely replaced by:\n",
45+
"is the same as:\n",
4446
"\n",
4547
"```\n",
46-
"%use gradle-enterprise-api-kotlin\n",
48+
"%use gradle-enterprise-api-kotlin(version=0.16.2)\n",
4749
"```"
4850
]
4951
},

0 commit comments

Comments
 (0)