Skip to content

Commit 32abb9e

Browse files
csaba-ilonka-rollbarbuongarzonichristianbuon
authored
Drop JDK7 (#316)
* Drop JDK7 * Test toolset * bump version to 2.0.0-SNAPSHOT * fix failing test --------- Co-authored-by: Christian Ricardo <57886390+buongarzoni@users.noreply.github.com> Co-authored-by: chris <christian.buongarzoni@gmail.com>
1 parent 2f88e1e commit 32abb9e

File tree

14 files changed

+83
-145
lines changed

14 files changed

+83
-145
lines changed
File renamed without changes.

.github/release.sh renamed to .github/scripts/release.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ elif [[ -z $VERSION ]]; then
3838
elif ! [[ $VERSION =~ $SEMVER_REGEX ]]; then
3939
echo "Skipping release. Bad version used."
4040
else
41-
# Gradle needs the absolute path to the secring
42-
export GPG_KEY_LOCATION="$(realpath "$GPG_KEY_LOCATION")"
4341

4442
if [[ ${BASH_REMATCH[5]} == 'SNAPSHOT' ]]; then
4543
echo "Doing SNAPSHOT release..."

.github/secring.gpg.enc

-1.3 KB
Binary file not shown.

.github/workflows/ci.yml

Lines changed: 51 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,54 @@
11
name: rollbar-java CI
22
on:
3+
workflow_call:
4+
secrets:
5+
RELEASE_GPG_PRIVATE_KEY:
6+
required: true
7+
RELEASE_GPG_PRIVATE_KEY_PASSPHRASE:
8+
required: true
9+
NEXUS_USERNAME:
10+
required: true
11+
NEXUS_PASSWORD:
12+
required: true
313
push:
4-
branches: [master]
14+
branches: [ master ]
515
pull_request:
6-
branches: [master]
16+
branches: [ master ]
17+
718

819
jobs:
20+
validation:
21+
name: Gradle wrapper validation
22+
runs-on: ubuntu-20.04
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: gradle/actions/wrapper-validation@v3
26+
927
build:
1028
runs-on: ubuntu-20.04
11-
name: Java ${{ matrix.java }}
29+
name: Build with Java ${{ matrix.java }}
30+
needs: [ validation ]
1231
strategy:
32+
fail-fast: false
1333
matrix:
14-
java: [8, 11]
34+
# Must upgrade Gradle before we can go past Java 15 here.
35+
# https://docs.gradle.org/current/userguide/compatibility.html
36+
java: [ 8, 11 ]
1537
steps:
16-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
1739

1840
- name: Fetch git tags
19-
run: ./.github/fetch_to_tag.sh
20-
21-
# Our build uses JDK7's rt.jar to make sure the artifact is fully
22-
# compatible with Java 7, so we let this action set Java 7 up for us
23-
# and we store its JAVA_HOME
24-
- name: Set up Java 7
25-
uses: actions/setup-java@v1
26-
with:
27-
java-version: 7
28-
29-
- name: Capture JDK7_HOME
30-
run: echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home
41+
run: ./.github/scripts/fetch_to_tag.sh
3142

32-
- name: Set up Java 17 (needed for Spring Boot 3)
33-
uses: actions/setup-java@v1
34-
with:
35-
java-version: 17
36-
37-
- name: Capture JDK17_HOME
38-
run: echo "export JDK17_HOME=\"$JAVA_HOME\"" > ~/.jdk17_home
39-
40-
# This is the JDK that'll run the build
4143
- name: Set up Java ${{ matrix.java }}
42-
uses: actions/setup-java@v1
44+
uses: actions/setup-java@v4
4345
with:
4446
java-version: ${{ matrix.java }}
47+
distribution: 'zulu'
48+
cache: 'gradle'
4549

46-
- name: Cache Gradle packages
47-
uses: actions/cache@v2
48-
with:
49-
path: |
50-
~/.gradle/caches
51-
~/.gradle/wrapper
52-
key: ${{ runner.os }}-gradle-${{ matrix.java }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
53-
restore-keys: |
54-
${{ runner.os }}-gradle-${{ matrix.java }}-
50+
# gradle/actions/setup-gradle@v3 might offer better caching and other benefits through better integration.
51+
# https://github.com/gradle/actions/blob/main/docs/setup-gradle.md
5552

5653
- name: Environment info
5754
run: |
@@ -63,26 +60,26 @@ jobs:
6360
echo ANDROID_SDK_ROOT: ${ANDROID_SDK_ROOT}
6461
6562
- name: Build
66-
run: 'source ~/.jdk7_home && ./gradlew clean build'
63+
run: ./gradlew clean build
6764

68-
- name: Check
69-
run: 'source ~/.jdk7_home && ./gradlew clean check'
70-
71-
- name: Cleanup Gradle cache
72-
# Recommended by https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle
73-
run: |
74-
rm -f ~/.gradle/caches/modules-2/modules-2.lock
75-
rm -f ~/.gradle/caches/modules-2/gc.properties
65+
- name: Upload build reports
66+
if: always()
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: java-${{ matrix.java }}-build-reports
70+
path: |
71+
**/build/reports/*
7672
7773
release:
7874
runs-on: ubuntu-20.04
75+
name: Release
7976
# It would be nice to run this as part of the build job, since it would be
8077
# faster and have less duplicated Yaml, it would not be possible to check
8178
# for all matrix results before publishing if this were just another step
8279
# in that job.
83-
needs: build
80+
needs: [ build ]
8481
steps:
85-
- uses: actions/checkout@v2
82+
- uses: actions/checkout@v4
8683

8784
- name: Set up Java 11 for the Android SDK Manager
8885
uses: actions/setup-java@v1
@@ -94,47 +91,18 @@ jobs:
9491
echo "Android SDK Manager version: `${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --version`"
9592
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "platforms;android-27" "build-tools;28.0.3"
9693
97-
- name: Set up Java 7
98-
uses: actions/setup-java@v1
99-
with:
100-
java-version: 7
101-
102-
- name: Capture JDK7_HOME
103-
run: echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home
104-
105-
- name: Set up Java 8
106-
uses: actions/setup-java@v1
94+
- name: Set up Java 8 for the build
95+
uses: actions/setup-java@v4
10796
with:
10897
java-version: 8
109-
110-
- name: Cache Gradle packages
111-
uses: actions/cache@v2
112-
with:
113-
path: |
114-
~/.gradle/caches
115-
~/.gradle/wrapper
116-
key: ${{ runner.os }}-gradle-8-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
117-
restore-keys: |
118-
${{ runner.os }}-gradle-8-
98+
distribution: 'zulu'
99+
cache: 'gradle'
119100

120101
- name: Release
121102
env:
122-
SECRING_GPG_IV: ${{ secrets.SECRING_GPG_IV }}
123-
SECRING_GPG_KEY: ${{ secrets.SECRING_GPG_KEY }}
124-
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
125-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
126-
ENCRYPTED_GPG_KEY_LOCATION: ./.github/secring.gpg.enc
127-
GPG_KEY_LOCATION: ./.github/secring.gpg
103+
RELEASE_GPG_PRIVATE_KEY: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }}
104+
RELEASE_GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.RELEASE_GPG_PRIVATE_KEY_PASSPHRASE }}
128105
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
129106
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
130107
run: |
131-
if test "$GITHUB_REPOSITORY" = "rollbar/rollbar-java" -a "$GITHUB_BASE_REF" = ""; then
132-
openssl enc -aes-256-cbc -K "$SECRING_GPG_KEY" -iv "$SECRING_GPG_IV" -in "$ENCRYPTED_GPG_KEY_LOCATION" -out "$GPG_KEY_LOCATION" -d
133-
fi &&
134-
source ~/.jdk7_home &&
135-
./.github/release.sh
136-
137-
- name: Cleanup Gradle cache
138-
run: |
139-
rm -f ~/.gradle/caches/modules-2/modules-2.lock
140-
rm -f ~/.gradle/caches/modules-2/gc.properties
108+
./gradlew -Dorg.gradle.internal.http.socketTimeout=300000 -Dorg.gradle.internal.http.connectionTimeout=300000 publishToSonatype

.github/workflows/gradle-wrapper-validation.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

build.gradle

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ allprojects {
3131
}
3232

3333
subprojects { project ->
34-
if (!project.name.contains('android') &&
35-
!project.parent.name.equals("examples") &&
36-
!project.name.contains('examples')) {
34+
if (!project.name.contains('android') && !project.parent.name.equals("examples") && !project.name.contains('examples')) {
3735
apply plugin: 'java-library'
3836

3937
apply from: "$rootDir/gradle/release.gradle"
@@ -62,23 +60,16 @@ subprojects { project ->
6260
}
6361

6462
compileJava {
65-
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_9) >= 0) {
66-
// Use the --release javac flag, available since JDK9, which is equivalent to setting
67-
// the source, target, and bootstrap classpath, and catches all usages of stdlib
68-
// features not available in the target version.
69-
options.release = 7
63+
if (JavaVersion.current().isJava9Compatible()) {
64+
options.release = 8
7065
} else {
71-
sourceCompatibility = JavaVersion.VERSION_1_7
72-
targetCompatibility = JavaVersion.VERSION_1_7
73-
}
74-
75-
if (System.env.JDK7_HOME) {
76-
options.bootstrapClasspath = files("${System.env.JDK7_HOME}/jre/lib/rt.jar")
66+
sourceCompatibility = JavaVersion.VERSION_1_8
67+
targetCompatibility = JavaVersion.VERSION_1_8
7768
}
7869
}
7970

8071
compileTestJava {
81-
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_9) >= 0) {
72+
if (JavaVersion.current().isJava9Compatible()) {
8273
options.release = 8
8374
} else {
8475
sourceCompatibility = JavaVersion.VERSION_1_8

examples/rollbar-android/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:3.6.2'
7+
classpath 'com.android.tools.build:gradle:4.2.2'
88
}
99
}
1010

1111
apply plugin: 'com.android.application'
1212

1313
android {
1414
compileSdkVersion 27
15-
buildToolsVersion "28.0.3"
15+
buildToolsVersion "30.0.3"
1616
defaultConfig {
1717
applicationId "com.rollbar.example.android"
1818
minSdkVersion 16
19+
// FIXME: Pending further discussion
20+
//noinspection ExpiredTargetSdkVersion
1921
targetSdkVersion 27
2022
versionCode 1
2123
versionName "1.0"

examples/rollbar-spring-boot3-webmvc/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ plugins {
66

77
group = 'com.rollbar.example'
88
version = VERSION_NAME
9-
sourceCompatibility = '17'
9+
10+
java {
11+
sourceCompatibility = JavaVersion.VERSION_17
12+
targetCompatibility = JavaVersion.VERSION_17
13+
}
1014

1115
repositories {
1216
mavenLocal()

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION_NAME=1.10.3
1+
VERSION_NAME=2.0.0-SNAPSHOT
22
GROUP=com.rollbar
33

44
POM_DESCRIPTION=For connecting your applications built on the JVM to Rollbar for Error Reporting

gradle/release.gradle

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
apply plugin: 'signing'
22
apply plugin: 'maven-publish'
3-
4-
53
apply plugin: "de.marcphilipp.nexus-publish"
4+
65
nexusPublishing {
76
repositories {
87
sonatype {
@@ -12,16 +11,6 @@ nexusPublishing {
1211
}
1312
}
1413

15-
gradle.taskGraph.whenReady { taskGraph ->
16-
if (taskGraph.allTasks.any { it instanceof Sign }) {
17-
allprojects {
18-
ext."signing.keyId" = System.getenv("GPG_KEY_ID")
19-
ext."signing.secretKeyRingFile" = System.getenv("GPG_KEY_LOCATION")
20-
ext."signing.password" = System.getenv("GPG_PASSPHRASE")
21-
}
22-
}
23-
}
24-
2514
afterEvaluate {
2615
if (project.parent != null && !project.parent.name.equals("examples") && !project.name.contains('examples')) {
2716
if (!project.hasProperty('android')) {
@@ -93,6 +82,9 @@ afterEvaluate {
9382

9483
signing {
9584
required true
85+
useInMemoryPgpKeys(
86+
findProperty("signingKey") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY"),
87+
findProperty("signingPassword") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY_PASSPHRASE"))
9688
sign publishing.publications.maven
9789
}
9890
}
@@ -147,7 +139,7 @@ afterEvaluate {
147139
name = POM_NAME
148140
description = POM_DESCRIPTION
149141
url = POM_URL
150-
142+
151143
scm {
152144
url = POM_SCM_URL
153145
connection = POM_SCM_CONNECTION
@@ -175,6 +167,9 @@ afterEvaluate {
175167
}
176168
signing {
177169
required true
170+
useInMemoryPgpKeys(
171+
findProperty("signingKey") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY"),
172+
findProperty("signingPassword") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY_PASSPHRASE"))
178173
sign publishing.publications.release
179174
}
180175
}

rollbar-android/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:3.6.2'
7+
classpath 'com.android.tools.build:gradle:4.2.2'
88
}
99
}
1010

@@ -19,10 +19,12 @@ apply from: "$rootDir/gradle/android.quality.gradle"
1919

2020
android {
2121
compileSdkVersion 27
22-
buildToolsVersion '28.0.3'
22+
buildToolsVersion '30.0.3' // Going above here requires bumping the AGP to version 4+
2323

2424
defaultConfig {
2525
minSdkVersion 16
26+
// FIXME: Pending further discussion
27+
//noinspection ExpiredTargetSdkVersion
2628
targetSdkVersion 27
2729
consumerProguardFiles 'proguard-rules.pro'
2830
manifestPlaceholders = [notifierVersion: VERSION_NAME]

rollbar-android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
android:versionCode="1"
55
android:versionName="1.0" >
66

7+
<uses-permission android:name="android.permission.INTERNET" />
8+
79
<application>
810
<meta-data android:name="com.rollbar.android._notifier.version" android:value="${notifierVersion}" />
911
</application>
10-
11-
<uses-permission android:name="android.permission.INTERNET" />
1212
</manifest>

rollbar-java/src/test/java/com/rollbar/notifier/provider/notifier/VersionHelperTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public class VersionHelperTest {
1010
@Test
1111
public void shouldReturnVersion() {
1212
VersionHelper helper = new VersionHelper();
13-
// It will fail when we upgrade to 2.x, but it's stable enough. Better than nothing when running
13+
// It will fail when we upgrade to 3.x, but it's stable enough. Better than nothing when running
1414
// from an IDE, without the version property that we set in Gradle.
15-
assertThat(helper.version(), startsWith("1."));
15+
assertThat(helper.version(), startsWith("2."));
1616
}
1717

1818
@Test

0 commit comments

Comments
 (0)