File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed
src/main/kotlin/com/gabrielfeo/gradle/enterprise/api Expand file tree Collapse file tree 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 {
1616
1717Set up once and use the library from any script in your machine:
1818
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
2121 Enterprise instance. Alternatively, can be a macOS keychain entry labeled
2222 ` gradle-enterprise-api-token ` (recommended).
2323
@@ -128,3 +128,5 @@ API classes such as `GradleEnterpriseApi` and response models are generated from
128128[ 13 ] : https://gabrielfeo.github.io/gradle-enterprise-api-kotlin/gradle-enterprise-api-kotlin/com.gabrielfeo.gradle.enterprise.api/-options/-cache/index.html
129129[ 14 ] : https://jitpack.io/#gabrielfeo/gradle-enterprise-api-kotlin
130130[ 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 {
2323 object GradleEnterpriseInstance {
2424
2525 /* *
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`.
2828 */
29- var baseUrl : () -> String = {
29+ var url : () -> String = {
3030 requireBaseUrl(envName = " GRADLE_ENTERPRISE_URL" )
3131 }
3232
3333 /* *
3434 * Provides the access token for a Gradle Enterprise API instance. By default, uses keychain entry
3535 * `gradle-enterprise-api-token` or environment variable `GRADLE_ENTERPRISE_URL`.
3636 */
37- var accessToken : () -> String = {
37+ var token : () -> String = {
3838 requireToken(
3939 keychainName = " gradle-enterprise-api-token" ,
4040 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 {
1616 if (Options .Debugging .debugLoggingEnabled && Options .Cache .cacheEnabled) {
1717 addInterceptor(CacheHitLoggingInterceptor ())
1818 }
19- addInterceptor(HttpBearerAuth (" bearer" , Options .GradleEnterpriseInstance .accessToken ()))
19+ addInterceptor(HttpBearerAuth (" bearer" , Options .GradleEnterpriseInstance .token ()))
2020 if (Options .Cache .cacheEnabled) {
2121 addNetworkInterceptor(buildCacheEnforcingInterceptor())
2222 }
Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ import retrofit2.converter.moshi.MoshiConverterFactory
77import retrofit2.converter.scalars.ScalarsConverterFactory
88
99internal 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" }
1012 Retrofit .Builder ()
11- .baseUrl(Options . GradleEnterpriseInstance .baseUrl() )
13+ .baseUrl(url )
1214 .addConverterFactory(ScalarsConverterFactory .create())
1315 .addConverterFactory(MoshiConverterFactory .create(Serializer .moshi))
1416 .client(okHttpClient)
You can’t perform that action at this time.
0 commit comments