Skip to content

Commit 7ef9a1d

Browse files
authored
Upgrade gradle version (#300)
* Upgrading to gradle 8.4 * Bumping up gradle env * Using MaxMetaspaceSize * Enabling desugaring * Using new env var mocking lib * Adding buildconfg fields for tests * Updating tests * Using Java 17
1 parent 39f0e3d commit 7ef9a1d

File tree

14 files changed

+45
-40
lines changed

14 files changed

+45
-40
lines changed

.java-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
11
1+
17

android-test/app/build.gradle

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ android {
3535

3636
testInstrumentationRunner "co.elastic.apm.android.test.base.TestRunner"
3737
}
38+
buildFeatures {
39+
buildConfig = true
40+
}
3841

3942
buildTypes {
4043
release {
@@ -45,6 +48,7 @@ android {
4548
compileOptions {
4649
sourceCompatibility jvmCompatibility
4750
targetCompatibility jvmCompatibility
51+
coreLibraryDesugaringEnabled true
4852
}
4953
kotlinOptions {
5054
jvmTarget = jvmCompatibility.toString()
@@ -63,6 +67,7 @@ dependencies {
6367
implementation "androidx.test.espresso:espresso-idling-resource:$espresso_version"
6468
implementation project(':android-test-common')
6569
implementation "androidx.fragment:fragment-testing:1.6.1"
70+
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
6671
testImplementation "io.opentelemetry:opentelemetry-exporter-otlp:1.28.0"
6772
testImplementation "org.mockito:mockito-core:$mockito_version"
6873
testImplementation "org.mockito:mockito-inline:$mockito_version"
@@ -74,18 +79,4 @@ dependencies {
7479
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
7580
androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_version"
7681
androidTestImplementation "com.squareup.okhttp3:mockwebserver:$mockwebserver_version"
77-
78-
// To avoid enforcing compileSdk > 33:
79-
constraints {
80-
add("implementation", "androidx.navigation:navigation-fragment") {
81-
version {
82-
strictly("2.6.0")
83-
}
84-
}
85-
add("implementation", "androidx.core:core") {
86-
version {
87-
strictly("1.10.1")
88-
}
89-
}
90-
}
9182
}

android-test/app/src/test/java/co/elastic/apm/android/test/attributes/logs/ResourcesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void whenALogIsCreated_osDescriptionIsSet() {
7171
LogRecordData log = captureLog();
7272

7373
Logs.verifyRecord(log)
74-
.hasResource("os.description", "Android 13, API level 33, BUILD unknown");
74+
.hasResource("os.description", "Android 14, API level 34, BUILD unknown");
7575
}
7676

7777
@Test
@@ -87,7 +87,7 @@ public void whenALogIsCreated_osVersionSet() {
8787
LogRecordData log = captureLog();
8888

8989
Logs.verifyRecord(log)
90-
.hasResource("os.version", "13");
90+
.hasResource("os.version", "14");
9191
}
9292

9393
@Test

android-test/app/src/test/java/co/elastic/apm/android/test/attributes/metrics/ResourcesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void whenAMetricIsCreated_osDescriptionIsSet() {
7171
MetricData metric = captureMetric();
7272

7373
Metrics.verify(metric)
74-
.hasResource("os.description", "Android 13, API level 33, BUILD unknown");
74+
.hasResource("os.description", "Android 14, API level 34, BUILD unknown");
7575
}
7676

7777
@Test
@@ -87,7 +87,7 @@ public void whenAMetricIsCreated_osVersionSet() {
8787
MetricData metric = captureMetric();
8888

8989
Metrics.verify(metric)
90-
.hasResource("os.version", "13");
90+
.hasResource("os.version", "14");
9191
}
9292

9393
@Test

android-test/app/src/test/java/co/elastic/apm/android/test/attributes/traces/ResourcesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void whenASpanIsCreated_osDescriptionIsSet() {
7373
SpanData customSpan = captureSpan();
7474

7575
Spans.verify(customSpan)
76-
.hasResource("os.description", "Android 13, API level 33, BUILD unknown");
76+
.hasResource("os.description", "Android 14, API level 34, BUILD unknown");
7777
}
7878

7979
@Test
@@ -89,7 +89,7 @@ public void whenASpanIsCreated_osVersionSet() {
8989
SpanData customSpan = captureSpan();
9090

9191
Spans.verify(customSpan)
92-
.hasResource("os.version", "13");
92+
.hasResource("os.version", "14");
9393
}
9494

9595
@Test

android-test/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ propertiesFile.withInputStream {
55
}
66

77
ext {
8-
jvmCompatibility = JavaVersion.VERSION_11
8+
jvmCompatibility = JavaVersion.VERSION_17
99
junit_version = '4.13.2'
1010
espresso_version = '3.5.1'
1111
mockito_version = '4.9.0'
12-
agp_version = '7.4.0'
12+
agp_version = '8.3.0'
1313
mockwebserver_version = '4.10.0'
14-
androidCompileSdk = 33
14+
androidCompileSdk = 34
1515
androidMinSdk = 26
1616
agent_version = agentProperties["version"]
1717
}

android-test/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# AndroidX package structure to make it clearer which packages are bundled with the
22
# Android operating system, and which are packaged with your app"s APK
33
# https://developer.android.com/topic/libraries/support-library/androidx-rn
4-
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
4+
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
55
android.useAndroidX=true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

android-test/plugin-test/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ dependencies {
1111
implementation "co.elastic.apm:android-plugin:$agent_version"
1212
testImplementation "co.elastic.apm:android-common:$agent_version"
1313
testImplementation "junit:junit:$junit_version"
14-
testImplementation "com.github.stefanbirkner:system-rules:1.19.0"
14+
testImplementation "uk.org.webcompere:system-stubs-junit4:2.1.6"
1515
}

android-test/plugin-test/src/test/java/co/elastic/apm/android/plugin/CompilationConfigTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424
import org.junit.Before;
2525
import org.junit.Rule;
2626
import org.junit.Test;
27-
import org.junit.contrib.java.lang.system.EnvironmentVariables;
2827
import org.junit.rules.TemporaryFolder;
2928

3029
import java.io.File;
3130
import java.util.Properties;
3231

3332
import co.elastic.apm.android.common.ApmInfo;
33+
import uk.org.webcompere.systemstubs.rules.EnvironmentVariablesRule;
3434

3535
public class CompilationConfigTest extends BaseAssetsVerificationTest {
3636

3737
@Rule
38-
public EnvironmentVariables environmentVariables = new EnvironmentVariables();
38+
public EnvironmentVariablesRule environmentVariables = new EnvironmentVariablesRule();
3939

4040
@Rule
4141
public TemporaryFolder projectTemporaryFolder = new TemporaryFolder();

0 commit comments

Comments
 (0)