Skip to content

Commit

Permalink
Upgrade gradle to 7.6.2 and fix sonarqube pipeline (#1393)
Browse files Browse the repository at this point in the history
the `sonarqube` pipeline requires a newer version of the jvm and that's
a good excuse for upgrading gradle on the project as the version we have
currently is very old.
  • Loading branch information
DiegoTavares authored Oct 1, 2024
1 parent 2809037 commit 798bfa6
Show file tree
Hide file tree
Showing 8 changed files with 295 additions and 216 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/sonar-cloud-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

analyze_cuebot:
runs-on: ubuntu-latest
container: aswf/ci-opencue:2020
container: aswf/ci-opencue:2024.1
name: Analyze Cuebot
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
Expand All @@ -48,5 +48,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sudo yum -y install java-17-openjdk.x86_64
sudo yum -y install java-17-openjdk-devel.x86_64
sudo alternatives --set java java-17-openjdk.x86_64
sudo alternatives --set javac java-17-openjdk.x86_64
sudo alternatives --set jre_openjdk java-17-openjdk.x86_64
chown -R aswfuser:aswfgroup .
su -c "cd cuebot && ./gradlew jacocoTestReport sonarqube -Dsonar.login=$(SONAR_TOKEN)" aswfuser
su -c "cd cuebot && ./gradlew jacocoTestReport sonar" aswfuser
128 changes: 53 additions & 75 deletions cuebot/build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,19 @@

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.2.1.RELEASE'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'
}
plugins {
id 'java'
id('eclipse')
id('idea')
id('org.springframework.boot') version "2.2.1.RELEASE"
id('io.spring.dependency-management') version "1.1.4"
id('com.google.protobuf') version "0.9.1"
id('jacoco')
id('org.sonarqube') version "2.8"
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.google.protobuf'
apply plugin: 'jacoco'
apply plugin: 'org.sonarqube'

sourceCompatibility = 1.8
targetCompatibility = 1.8

ext {
activemqVersion = '5.12.0'
}
sourceCompatibility = 11
targetCompatibility = 11

configurations {
testCompile
compile.exclude module: 'spring-boot-starter-logging'
}

Expand All @@ -39,49 +22,54 @@ repositories {
jcenter()
}

def grpcVersion = '1.47.0'
def protobufVersion = '3.21.2'
def activemqVersion = '5.12.0'

// Spring dependency versions are managed by the io.spring.dependency-management plugin.
// Appropriate versions will be pulled based on the spring boot version specified in the
// spring-boot-gradle-plugin.
dependencies {
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
compile group: 'com.google.guava', name: 'guava', version: '26.0-android'
compile group: 'com.sun.mail', name: 'mailapi', version: '1.5.4'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'io.grpc', name: 'grpc-all', version: '1.47.0'
compile group: 'org.apache.activemq', name: 'activemq-pool', version: activemqVersion
compile group: 'org.apache.velocity', name: 'velocity', version: '1.7'
compile group: 'org.jdom', name: 'jdom', version: '1.1.3'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'
compile group: 'org.springframework', name: 'spring-context-support'
compile group: 'org.springframework', name: 'spring-jms'
compile group: 'org.quartz-scheduler', name: 'quartz', version: '2.2.1', { exclude group: 'c3p0', module: 'c3p0' }
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.2'
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.21.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.16.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.16.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.16.0'
compile group: 'io.sentry', name: 'sentry-log4j2', version: '7.11.0'
compile group: 'io.prometheus', name: 'simpleclient', version: '0.16.0'
compile group: 'io.prometheus', name: 'simpleclient_servlet', version: '0.16.0'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
implementation group: 'com.google.guava', name: 'guava', version: '26.0-android'
implementation group: 'com.sun.mail', name: 'mailapi', version: '1.5.4'
implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
implementation group: 'io.grpc', name: 'grpc-all', version: "${grpcVersion}"
implementation group: 'org.apache.activemq', name: 'activemq-pool', version: activemqVersion
implementation group: 'org.apache.velocity', name: 'velocity', version: '1.7'
implementation group: 'org.jdom', name: 'jdom', version: '1.1.3'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework', name: 'spring-context-support'
implementation group: 'org.springframework', name: 'spring-jms'
implementation group: 'org.quartz-scheduler', name: 'quartz', version: '2.2.1', { exclude group: 'c3p0', module: 'c3p0' }
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.2'
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: "${protobufVersion}"
implementation group: 'log4j', name: 'log4j', version: '1.2.17'
implementation group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.26'
implementation group: 'io.sentry', name: 'sentry-log4j2', version: '7.11.0'
implementation group: 'io.prometheus', name: 'simpleclient', version: '0.16.0'
implementation group: 'io.prometheus', name: 'simpleclient_servlet', version: '0.16.0'

protobuf fileTree("../proto/")

testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.8.0'
testCompile group: 'io.zonky.test', name: 'embedded-postgres', version: '1.3.1'
testCompile group: 'org.flywaydb', name: 'flyway-core', version: '5.2.0'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.8.0'
testImplementation group: 'io.zonky.test', name: 'embedded-postgres', version: '1.3.1'
testImplementation group: 'org.flywaydb', name: 'flyway-core', version: '5.2.0'

// Use newer version of Postgres for tests: https://github.com/zonkyio/embedded-postgres/issues/78
implementation enforcedPlatform('io.zonky.test.postgres:embedded-postgres-binaries-bom:11.13.0')
}

compileJava {
dependsOn generateProto
options.compilerArgs << "-Xlint:all" << "-Werror"
}

compileTestJava {
dependsOn generateProto
options.compilerArgs << "-Xlint:all" << "-Werror"
}

Expand All @@ -93,7 +81,7 @@ protobuf {
plugins {
grpc {
// Generate gRPC stubs.
artifact = 'io.grpc:protoc-gen-grpc-java:1.47.0'
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
Expand All @@ -118,12 +106,16 @@ sourceSets {
}
}

jar {
enabled = true
}

bootJar {
baseName = 'cuebot'
}

jacoco {
toolVersion = "0.8.5"
toolVersion = "0.8.11"
}

jacocoTestReport {
Expand All @@ -147,6 +139,7 @@ jacocoTestReport {

sonarqube {
properties {
property "sonar.java.source", "11"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "academysoftwarefoundation"
property "sonar.projectKey", "AcademySoftwareFoundation_OpenCue_Cuebot"
Expand Down Expand Up @@ -174,25 +167,10 @@ tasks.withType(AbstractArchiveTask) {
reproducibleFileOrder = true
}

tasks.withType(Test) {
// Configure logging when running Gradle with --info or --debug.
test {
testLogging {
info {
// Don't show STANDARD_OUT messages, these clutter up the output
// and make it hard to find actual failures.
events TestLogEvent.FAILED
exceptionFormat TestExceptionFormat.FULL
showStandardStreams false
}
debug {
// Show everything.
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
testLogging {
exceptionFormat = 'full'
}
}
}
Binary file modified cuebot/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions cuebot/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 26 18:34:57 PST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
Loading

0 comments on commit 798bfa6

Please sign in to comment.