Skip to content

Commit 3248430

Browse files
authored
Merge pull request #8 from bitrise-io/gradle-analytics-upgrade-to-v2.0-RC1
Gradle Analytics Plugin upgrade to version 2.0-RC1
2 parents 78afcf3 + 2385997 commit 3248430

File tree

4 files changed

+28
-33
lines changed

4 files changed

+28
-33
lines changed

internal/config/gradle/gradleconfig.go

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"text/template"
99

1010
"github.com/bitrise-io/bitrise-build-cache-cli/internal/config/common"
11+
"github.com/bitrise-io/bitrise-build-cache-cli/internal/consts"
1112
)
1213

1314
//go:embed initd.gradle.kts.gotemplate
@@ -21,30 +22,18 @@ var (
2122
type templateInventory struct {
2223
AuthToken string
2324
CacheEndpointURLWithPort string
24-
CacheVersion string
25+
CachePluginVersion string
2526
PushEnabled bool
2627
DebugEnabled bool
2728
ValidationLevel string
28-
MetricsEnabled bool
29-
MetricsVersion string
30-
MetricsEndpoint string
31-
MetricsPort int
29+
AnalyticsEnabled bool
30+
AnalyticsPluginVersion string
31+
AnalyticsEndpoint string
32+
AnalyticsPort int
3233
// Metadata
3334
CacheConfigMetadata common.CacheConfigMetadata
3435
}
3536

36-
// Sync the major version of this step and the library.
37-
// Use the latest 1.x version of our dependency, so we don't have to update this definition after every lib release.
38-
// But don't forget to update this to `2.+` if the library reaches version 2.0!
39-
const gradleRemoteBuildCachePluginDepVersion = "1.+"
40-
41-
// Sync the major version of this step and the plugin.
42-
// Use the latest 1.x version of the plugin, so we don't have to update this definition after every plugin release.
43-
// But don't forget to update this to `2.+` if the library reaches version 2.0!
44-
const analyticsPluginDepVersion = "0.+"
45-
const analyticsEndpoint = "gradle-analytics.services.bitrise.io"
46-
const analyticsPort = 443
47-
4837
// Generate init.gradle content.
4938
// Recommended to save the content into $HOME/.gradle/init.d/ instead of
5039
// overwriting the $HOME/.gradle/init.gradle file.
@@ -62,14 +51,14 @@ func GenerateInitGradle(endpointURL, authToken string, analyticsEnabled bool, ca
6251
inventory := templateInventory{
6352
AuthToken: authToken,
6453
CacheEndpointURLWithPort: endpointURL,
65-
CacheVersion: gradleRemoteBuildCachePluginDepVersion,
54+
CachePluginVersion: consts.GradleRemoteBuildCachePluginDepVersion,
6655
PushEnabled: true,
6756
DebugEnabled: true,
6857
ValidationLevel: "warning",
69-
MetricsEnabled: analyticsEnabled,
70-
MetricsVersion: analyticsPluginDepVersion,
71-
MetricsEndpoint: analyticsEndpoint,
72-
MetricsPort: analyticsPort,
58+
AnalyticsEnabled: analyticsEnabled,
59+
AnalyticsPluginVersion: consts.GradleAnalyticsPluginDepVersion,
60+
AnalyticsEndpoint: consts.GradleAnalyticsEndpoint,
61+
AnalyticsPort: consts.GradleAnalyticsPort,
7362
CacheConfigMetadata: cacheConfigMetadata,
7463
}
7564

internal/config/gradle/gradleconfig_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,10 @@ initscript {
108108
mavenCentral()
109109
google()
110110
maven(url="https://jitpack.io")
111-
maven(url="https://s01.oss.sonatype.org/content/repositories/snapshots/")
112111
}
113112
dependencies {
114113
classpath("io.bitrise.gradle:remote-cache:1.+")
115-
classpath("io.bitrise.gradle:gradle-analytics:main-SNAPSHOT")
114+
classpath("io.bitrise.gradle:gradle-analytics:2.0-RC1")
116115
}
117116
}
118117
@@ -163,11 +162,10 @@ initscript {
163162
mavenCentral()
164163
google()
165164
maven(url="https://jitpack.io")
166-
maven(url="https://s01.oss.sonatype.org/content/repositories/snapshots/")
167165
}
168166
dependencies {
169167
classpath("io.bitrise.gradle:remote-cache:1.+")
170-
classpath("io.bitrise.gradle:gradle-analytics:main-SNAPSHOT")
168+
classpath("io.bitrise.gradle:gradle-analytics:2.0-RC1")
171169
}
172170
}
173171
@@ -215,7 +213,6 @@ initscript {
215213
mavenCentral()
216214
google()
217215
maven(url="https://jitpack.io")
218-
maven(url="https://s01.oss.sonatype.org/content/repositories/snapshots/")
219216
}
220217
dependencies {
221218
classpath("io.bitrise.gradle:remote-cache:1.+")

internal/config/gradle/initd.gradle.kts.gotemplate

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ initscript {
77
mavenCentral()
88
google()
99
maven(url="https://jitpack.io")
10-
maven(url="https://s01.oss.sonatype.org/content/repositories/snapshots/")
1110
}
1211
dependencies {
13-
classpath("io.bitrise.gradle:remote-cache:1.+")
14-
{{- if .MetricsEnabled }}
15-
classpath("io.bitrise.gradle:gradle-analytics:main-SNAPSHOT")
12+
classpath("io.bitrise.gradle:remote-cache:{{ .CachePluginVersion }}")
13+
{{- if .AnalyticsEnabled }}
14+
classpath("io.bitrise.gradle:gradle-analytics:{{ .AnalyticsPluginVersion }}")
1615
{{- end }}
1716
}
1817
}
@@ -34,13 +33,13 @@ settingsEvaluated {
3433
}
3534
}
3635

37-
{{- if .MetricsEnabled }}
36+
{{- if .AnalyticsEnabled }}
3837

3938
rootProject {
4039
apply<io.bitrise.gradle.analytics.AnalyticsPlugin>()
4140

4241
extensions.configure<io.bitrise.gradle.analytics.AnalyticsPluginExtension>{
43-
endpoint.set("{{ .MetricsEndpoint }}:{{ .MetricsPort }}")
42+
endpoint.set("{{ .AnalyticsEndpoint }}:{{ .AnalyticsPort }}")
4443
authToken.set("{{ .AuthToken }}")
4544
dumpEventsToFiles.set({{ .DebugEnabled }})
4645
debug.set({{ .DebugEnabled }})

internal/consts/consts.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,14 @@ const (
44
EndpointURLDefault = "grpcs://remote-build-cache.services.bitrise.io"
55
EndpointURLLAS1 = "grpc://las-cache.services.bitrise.io:6666"
66
EndpointURLATL1 = "grpc://atl-cache.services.bitrise.io:6666"
7+
8+
// Gradle Remote Build Cache related consts
9+
// Use the latest 1.x version of our dependency, so we don't have to update this definition after every lib release.
10+
// But don't forget to update this to `2.+` if the library reaches version 2.0!
11+
GradleRemoteBuildCachePluginDepVersion = "1.+"
12+
13+
// Gradle Analytics related consts
14+
GradleAnalyticsPluginDepVersion = "2.0-RC1"
15+
GradleAnalyticsEndpoint = "gradle-analytics.services.bitrise.io"
16+
GradleAnalyticsPort = 443
717
)

0 commit comments

Comments
 (0)