File tree 4 files changed +12
-8
lines changed
src/main/kotlin/com/gabrielfeo/gradle/enterprise/api
4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ api.getBuilds(since = yesterday).forEach {
16
16
17
17
Set up once and use the library from any script in your machine:
18
18
19
- - ` GRADLE_ENTERPRISE_URL ` environment variable: the URL of your Gradle Enterprise instance
20
- - ` GRADLE_ENTERPRISE_API_TOKEN ` environment variable: an API access token for the Gradle
19
+ - [ ` GRADLE_ENTERPRISE_URL ` ] [ 16 ] environment variable: the URL of your Gradle Enterprise instance
20
+ - [ ` GRADLE_ENTERPRISE_API_TOKEN ` ] [ 17 ] environment variable: an API access token for the Gradle
21
21
Enterprise instance. Alternatively, can be a macOS keychain entry labeled
22
22
` gradle-enterprise-api-token ` (recommended).
23
23
@@ -128,3 +128,5 @@ API classes such as `GradleEnterpriseApi` and response models are generated from
128
128
[ 13 ] : https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/gradle-enterprise-api-kotlin/com.gabrielfeo.gradle.enterprise.api/-options/-cache/index.html
129
129
[ 14 ] : https://jitpack.io/#gabrielfeo/gradle-enterprise-api-kotlin
130
130
[ 15 ] : https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/
131
+ [ 16 ] : https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/gradle-enterprise-api-kotlin/com.gabrielfeo.gradle.enterprise.api/-options/-gradle-enterprise-instance/index.html#1947291631%2FProperties%2F769193423
132
+ [ 17 ] : https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/gradle-enterprise-api-kotlin/com.gabrielfeo.gradle.enterprise.api/-options/-gradle-enterprise-instance/index.html#-1521379912%2FProperties%2F769193423
Original file line number Diff line number Diff line change @@ -23,18 +23,18 @@ object Options {
23
23
object GradleEnterpriseInstance {
24
24
25
25
/* *
26
- * Provides the URL of a Gradle Enterprise API instance. By default, uses environment variable
27
- * `GRADLE_ENTERPRISE_URL`.
26
+ * Provides the URL of a Gradle Enterprise API instance (without `/api`) . By default, uses
27
+ * environment variable `GRADLE_ENTERPRISE_URL`.
28
28
*/
29
- var baseUrl : () -> String = {
29
+ var url : () -> String = {
30
30
requireBaseUrl(envName = " GRADLE_ENTERPRISE_URL" )
31
31
}
32
32
33
33
/* *
34
34
* Provides the access token for a Gradle Enterprise API instance. By default, uses keychain entry
35
35
* `gradle-enterprise-api-token` or environment variable `GRADLE_ENTERPRISE_URL`.
36
36
*/
37
- var accessToken : () -> String = {
37
+ var token : () -> String = {
38
38
requireToken(
39
39
keychainName = " gradle-enterprise-api-token" ,
40
40
envName = " GRADLE_ENTERPRISE_API_TOKEN" ,
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ internal val okHttpClient: OkHttpClient by lazy {
16
16
if (Options .Debugging .debugLoggingEnabled && Options .Cache .cacheEnabled) {
17
17
addInterceptor(CacheHitLoggingInterceptor ())
18
18
}
19
- addInterceptor(HttpBearerAuth (" bearer" , Options .GradleEnterpriseInstance .accessToken ()))
19
+ addInterceptor(HttpBearerAuth (" bearer" , Options .GradleEnterpriseInstance .token ()))
20
20
if (Options .Cache .cacheEnabled) {
21
21
addNetworkInterceptor(buildCacheEnforcingInterceptor())
22
22
}
Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ import retrofit2.converter.moshi.MoshiConverterFactory
7
7
import retrofit2.converter.scalars.ScalarsConverterFactory
8
8
9
9
internal val retrofit: Retrofit by lazy {
10
+ val url = Options .GradleEnterpriseInstance .url()
11
+ check(" /api" !in url) { " Instance URL must be the plain instance URL, without /api" }
10
12
Retrofit .Builder ()
11
- .baseUrl(Options . GradleEnterpriseInstance .baseUrl() )
13
+ .baseUrl(url )
12
14
.addConverterFactory(ScalarsConverterFactory .create())
13
15
.addConverterFactory(MoshiConverterFactory .create(Serializer .moshi))
14
16
.client(okHttpClient)
You can’t perform that action at this time.
0 commit comments