Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop JDK7 #316

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 0 additions & 2 deletions .github/release.sh → .github/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ elif [[ -z $VERSION ]]; then
elif ! [[ $VERSION =~ $SEMVER_REGEX ]]; then
echo "Skipping release. Bad version used."
else
# Gradle needs the absolute path to the secring
export GPG_KEY_LOCATION="$(realpath "$GPG_KEY_LOCATION")"

if [[ ${BASH_REMATCH[5]} == 'SNAPSHOT' ]]; then
echo "Doing SNAPSHOT release..."
Expand Down
Binary file removed .github/secring.gpg.enc
Binary file not shown.
134 changes: 51 additions & 83 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,54 @@
name: rollbar-java CI
on:
workflow_call:
secrets:
RELEASE_GPG_PRIVATE_KEY:
required: true
RELEASE_GPG_PRIVATE_KEY_PASSPHRASE:
required: true
NEXUS_USERNAME:
required: true
NEXUS_PASSWORD:
required: true
push:
branches: [master]
branches: [ master ]
pull_request:
branches: [master]
branches: [ master ]


jobs:
validation:
name: Gradle wrapper validation
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3

build:
runs-on: ubuntu-20.04
name: Java ${{ matrix.java }}
name: Build with Java ${{ matrix.java }}
needs: [ validation ]
strategy:
fail-fast: false
matrix:
java: [8, 11]
# Must upgrade Gradle before we can go past Java 15 here.
# https://docs.gradle.org/current/userguide/compatibility.html
java: [ 8, 11 ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Fetch git tags
run: ./.github/fetch_to_tag.sh

# Our build uses JDK7's rt.jar to make sure the artifact is fully
# compatible with Java 7, so we let this action set Java 7 up for us
# and we store its JAVA_HOME
- name: Set up Java 7
uses: actions/setup-java@v1
with:
java-version: 7

- name: Capture JDK7_HOME
run: echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home
run: ./.github/scripts/fetch_to_tag.sh

- name: Set up Java 17 (needed for Spring Boot 3)
uses: actions/setup-java@v1
with:
java-version: 17

- name: Capture JDK17_HOME
run: echo "export JDK17_HOME=\"$JAVA_HOME\"" > ~/.jdk17_home

# This is the JDK that'll run the build
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
cache: 'gradle'

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

- name: Environment info
run: |
Expand All @@ -63,26 +60,26 @@ jobs:
echo ANDROID_SDK_ROOT: ${ANDROID_SDK_ROOT}

- name: Build
run: 'source ~/.jdk7_home && ./gradlew clean build'
run: ./gradlew clean build

- name: Check
run: 'source ~/.jdk7_home && ./gradlew clean check'

- name: Cleanup Gradle cache
# Recommended by https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Upload build reports
if: always()
uses: actions/upload-artifact@v4
with:
name: java-${{ matrix.java }}-build-reports
path: |
**/build/reports/*

release:
runs-on: ubuntu-20.04
name: Release
# It would be nice to run this as part of the build job, since it would be
# faster and have less duplicated Yaml, it would not be possible to check
# for all matrix results before publishing if this were just another step
# in that job.
needs: build
needs: [ build ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Java 11 for the Android SDK Manager
uses: actions/setup-java@v1
Expand All @@ -94,47 +91,18 @@ jobs:
echo "Android SDK Manager version: `${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --version`"
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "platforms;android-27" "build-tools;28.0.3"

- name: Set up Java 7
uses: actions/setup-java@v1
with:
java-version: 7

- name: Capture JDK7_HOME
run: echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home

- name: Set up Java 8
uses: actions/setup-java@v1
- name: Set up Java 8 for the build
uses: actions/setup-java@v4
with:
java-version: 8

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-8-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-8-
distribution: 'zulu'
cache: 'gradle'

- name: Release
env:
SECRING_GPG_IV: ${{ secrets.SECRING_GPG_IV }}
SECRING_GPG_KEY: ${{ secrets.SECRING_GPG_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
ENCRYPTED_GPG_KEY_LOCATION: ./.github/secring.gpg.enc
GPG_KEY_LOCATION: ./.github/secring.gpg
RELEASE_GPG_PRIVATE_KEY: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }}
RELEASE_GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.RELEASE_GPG_PRIVATE_KEY_PASSPHRASE }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
if test "$GITHUB_REPOSITORY" = "rollbar/rollbar-java" -a "$GITHUB_BASE_REF" = ""; then
openssl enc -aes-256-cbc -K "$SECRING_GPG_KEY" -iv "$SECRING_GPG_IV" -in "$ENCRYPTED_GPG_KEY_LOCATION" -out "$GPG_KEY_LOCATION" -d
fi &&
source ~/.jdk7_home &&
./.github/release.sh

- name: Cleanup Gradle cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
./gradlew -Dorg.gradle.internal.http.socketTimeout=300000 -Dorg.gradle.internal.http.connectionTimeout=300000 publishToSonatype
10 changes: 0 additions & 10 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

21 changes: 6 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ allprojects {
}

subprojects { project ->
if (!project.name.contains('android') &&
!project.parent.name.equals("examples") &&
!project.name.contains('examples')) {
if (!project.name.contains('android') && !project.parent.name.equals("examples") && !project.name.contains('examples')) {
apply plugin: 'java-library'

apply from: "$rootDir/gradle/release.gradle"
Expand Down Expand Up @@ -62,23 +60,16 @@ subprojects { project ->
}

compileJava {
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_9) >= 0) {
// Use the --release javac flag, available since JDK9, which is equivalent to setting
// the source, target, and bootstrap classpath, and catches all usages of stdlib
// features not available in the target version.
options.release = 7
if (JavaVersion.current().isJava9Compatible()) {
options.release = 8
} else {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

if (System.env.JDK7_HOME) {
options.bootstrapClasspath = files("${System.env.JDK7_HOME}/jre/lib/rt.jar")
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

compileTestJava {
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_9) >= 0) {
if (JavaVersion.current().isJava9Compatible()) {
options.release = 8
} else {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
6 changes: 4 additions & 2 deletions examples/rollbar-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.android.tools.build:gradle:4.2.2'
}
}

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "28.0.3"
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.rollbar.example.android"
minSdkVersion 16
// FIXME: Pending further discussion
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 27
versionCode 1
versionName "1.0"
Expand Down
6 changes: 5 additions & 1 deletion examples/rollbar-spring-boot3-webmvc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ plugins {

group = 'com.rollbar.example'
version = VERSION_NAME
sourceCompatibility = '17'

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
mavenLocal()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.10.3
VERSION_NAME=2.0.0-SNAPSHOT
GROUP=com.rollbar

POM_DESCRIPTION=For connecting your applications built on the JVM to Rollbar for Error Reporting
Expand Down
21 changes: 8 additions & 13 deletions gradle/release.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apply plugin: 'signing'
apply plugin: 'maven-publish'


apply plugin: "de.marcphilipp.nexus-publish"

nexusPublishing {
repositories {
sonatype {
Expand All @@ -12,16 +11,6 @@ nexusPublishing {
}
}

gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
allprojects {
ext."signing.keyId" = System.getenv("GPG_KEY_ID")
ext."signing.secretKeyRingFile" = System.getenv("GPG_KEY_LOCATION")
ext."signing.password" = System.getenv("GPG_PASSPHRASE")
}
}
}

afterEvaluate {
if (project.parent != null && !project.parent.name.equals("examples") && !project.name.contains('examples')) {
if (!project.hasProperty('android')) {
Expand Down Expand Up @@ -93,6 +82,9 @@ afterEvaluate {

signing {
required true
useInMemoryPgpKeys(
findProperty("signingKey") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY"),
findProperty("signingPassword") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY_PASSPHRASE"))
sign publishing.publications.maven
}
}
Expand Down Expand Up @@ -147,7 +139,7 @@ afterEvaluate {
name = POM_NAME
description = POM_DESCRIPTION
url = POM_URL

scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
Expand Down Expand Up @@ -175,6 +167,9 @@ afterEvaluate {
}
signing {
required true
useInMemoryPgpKeys(
findProperty("signingKey") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY"),
findProperty("signingPassword") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY_PASSPHRASE"))
sign publishing.publications.release
}
}
Expand Down
6 changes: 4 additions & 2 deletions rollbar-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.android.tools.build:gradle:4.2.2'
}
}

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

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

defaultConfig {
minSdkVersion 16
// FIXME: Pending further discussion
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 27
consumerProguardFiles 'proguard-rules.pro'
manifestPlaceholders = [notifierVersion: VERSION_NAME]
Expand Down
4 changes: 2 additions & 2 deletions rollbar-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="android.permission.INTERNET" />

<application>
<meta-data android:name="com.rollbar.android._notifier.version" android:value="${notifierVersion}" />
</application>

<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public class VersionHelperTest {
@Test
public void shouldReturnVersion() {
VersionHelper helper = new VersionHelper();
// It will fail when we upgrade to 2.x, but it's stable enough. Better than nothing when running
// It will fail when we upgrade to 3.x, but it's stable enough. Better than nothing when running
// from an IDE, without the version property that we set in Gradle.
assertThat(helper.version(), startsWith("1."));
assertThat(helper.version(), startsWith("2."));
}

@Test
Expand Down
Loading
Loading