Skip to content

Commit 23b6ee0

Browse files
SONARJAVA-6182 Switch Guava project used in ruling tests to Java 21 (#59)
1 parent 3c837d5 commit 23b6ee0

File tree

9 files changed

+24
-90
lines changed

9 files changed

+24
-90
lines changed

.github/scripts/resolve-sonar-java-plugin-version.sh

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

.github/workflows/build.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
pull_request:
99
workflow_dispatch:
1010
schedule:
11-
- cron: "30 1 * * *" # Run daily at 1:30 AM UTC
11+
- cron: "30 1 * * *"
1212

1313
concurrency:
1414
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -37,8 +37,8 @@ jobs:
3737
id: build-step
3838
with:
3939
deploy-pull-request: true
40-
artifactory-reader-role: private-reader # Override default public-reader
41-
artifactory-deployer-role: qa-deployer # Override default public-deployer
40+
artifactory-reader-role: private-reader
41+
artifactory-deployer-role: qa-deployer
4242
use-develocity: ${{ env.USE_DEVELOCITY }}
4343
develocity-url: ${{ env.DEVELOCITY_URL }}
4444

@@ -52,10 +52,8 @@ jobs:
5252
fail-fast: false
5353
matrix:
5454
item:
55-
- { name: "with Lastest SonarJava Plugin", profile: "without-sonarqube-project", java_plugin_version: "LATEST_MASTER" }
56-
- { name: "for SonarQube Project Only", profile: "only-sonarqube-project", java_plugin_version: "LATEST_MASTER" }
57-
- { name: "for Guava Project Only", profile: "only-guava-project", java_plugin_version: "LATEST_MASTER", java_version: "17", sonar-runtime: "LATEST_RELEASE[2025.4]" }
58-
- { name: "with Prod SonarJava Plugin", profile: "without-sonarqube-project", java_plugin_version: "POM_PROPERTY" }
55+
- { name: "with Latest SonarJava Plugin", profile: "without-sonarqube-project" }
56+
- { name: "for SonarQube Project Only", profile: "only-sonarqube-project" }
5957
name: "QA Tests ${{ matrix.item.name }}"
6058
env:
6159
BUILD_NUMBER: ${{ needs.build.outputs.build-number }}
@@ -66,17 +64,7 @@ jobs:
6664
submodules: recursive
6765
- uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd # v3.2.0
6866
with:
69-
working-directory: its/ruling
7067
version: 2025.7.12
71-
- name: Override Java version for specific profiles
72-
if: ${{ matrix.item.java_version }}
73-
run: |
74-
# We must 'cd' into the target directory because mise 'use' commands are
75-
# scoped to the current working directory. Changing directories ensures
76-
# the java version is pinned specifically for the 'its/ruling' path
77-
# by creating/updating a local .mise.toml file there.
78-
cd its/ruling
79-
mise use java@${{ matrix.item.java_version }}
8068
- name: Get GitHub Token for QA Licenses
8169
id: secrets
8270
uses: SonarSource/vault-action-wrapper@v3
@@ -87,38 +75,28 @@ jobs:
8775
id: configure-maven
8876
uses: SonarSource/ci-github-actions/config-maven@v1
8977
with:
90-
artifactory-reader-role: private-reader # Override default public-reader
78+
artifactory-reader-role: private-reader
9179
use-develocity: ${{ env.USE_DEVELOCITY }}
9280
develocity-url: ${{ env.DEVELOCITY_URL }}
93-
- name: Get Sonar Java plugin version
94-
id: resolve-sonar-java-plugin-version
95-
run: |
96-
VERSION=$(.github/scripts/resolve-sonar-java-plugin-version.sh "${{ matrix.item.java_plugin_version }}")
97-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
9881
- name: Run QA Tests
9982
working-directory: its/ruling
10083
env:
10184
GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
10285
BUILD_NUMBER: ${{ needs.build.outputs.build-number }}
10386
MAVEN_OPTS: "-Xmx3g"
104-
SONAR_JAVA_VERSION: ${{ steps.resolve-sonar-java-plugin-version.outputs.version }}
105-
SONAR_RUNTIME: ${{ matrix.item.sonar-runtime || 'LATEST_RELEASE' }}
10687
run: |
10788
mvn package --batch-mode \
10889
"-Pit-ruling,${{ matrix.item.profile }}" \
109-
"-Dsonar.java.version=${SONAR_JAVA_VERSION}" \
110-
"-Dorchestrator.artifactory.accessToken=${ARTIFACTORY_ACCESS_TOKEN}" \
111-
"-Dsonar.runtimeVersion=${{ env.SONAR_RUNTIME }}" \
90+
"-Dsonar.runtimeVersion=LATEST_RELEASE" \
11291
"-Dmaven.test.redirectTestOutputToFile=false" \
113-
"-DbuildNumber=${BUILD_NUMBER}" \
11492
-B -e -V \
11593
"-Dparallel=methods" \
11694
"-DuseUnlimitedThreads=true"
11795
- name: Upload ruling artifacts on failure
11896
if: failure()
11997
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.5.0
12098
with:
121-
name: ruling-actual-${{ matrix.item.profile }}-${{ matrix.item.java_plugin_version }}
99+
name: ruling-actual-${{ matrix.item.profile }}
122100
path: its/ruling/target/actual/**/*
123101

124102
promote:

.gitmodules

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[submodule "its/sources"]
22
path = its/sources
33
url = https://github.com/SonarSource/ruling_java.git
4-
branch = se-engine

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To submit a contribution, create a pull request for this repository. Please make
3131

3232
### Build the Project and Run Unit Tests
3333

34-
Requirements: Java 17
34+
Requirements: Java 21
3535

3636
To build the plugin and run its unit tests, execute this command from the project's root directory:
3737

@@ -47,7 +47,7 @@ To run the test, first make sure the submodules are checked out:
4747

4848
git submodule update --init --recursive
4949

50-
Then, ensure that the `JAVA_HOME` environment variable is set for the ruling tests execution and that it points to your local JDK 17 installation.
50+
Then, ensure that the `JAVA_HOME` environment variable is set for the ruling tests execution and that it points to your local JDK 21 installation.
5151
Failing to do so will produce inconsistencies with the expected results.
5252

5353
From the `its/ruling` folder, launch the ruling tests:

its/ruling/mise.toml

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

its/ruling/pom.xml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
<groupId>org.apache.maven.plugins</groupId>
115115
<artifactId>maven-surefire-plugin</artifactId>
116116
<configuration>
117-
<test>!org.sonar.java.it.JavaRulingTest#sonarqube_server,!org.sonar.java.it.JavaRulingTest#guava</test>
117+
<test>!org.sonar.java.it.JavaRulingTest#sonarqube_server</test>
118118
</configuration>
119119
</plugin>
120120
</plugins>
@@ -134,20 +134,6 @@
134134
</plugins>
135135
</build>
136136
</profile>
137-
<profile>
138-
<id>only-guava-project</id>
139-
<build>
140-
<plugins>
141-
<plugin>
142-
<groupId>org.apache.maven.plugins</groupId>
143-
<artifactId>maven-surefire-plugin</artifactId>
144-
<configuration>
145-
<test>org.sonar.java.it.JavaRulingTest#guava</test>
146-
</configuration>
147-
</plugin>
148-
</plugins>
149-
</build>
150-
</profile>
151137
</profiles>
152138

153139
</project>

its/ruling/src/test/java/org/sonar/java/it/JavaRulingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void guava() throws Exception {
132132
MavenBuild build = test_project(projectKey, projectName);
133133
build
134134
// by default guava is compatible with java 6, however this is not supported with JDK 17+
135-
.setProperty("java.version", "1.7")
135+
.setProperty("java.version", "1.8")
136136
.setProperty("maven.javadoc.skip", "true")
137137
// use batch
138138
.setProperty("sonar.java.experimental.batchModeSizeInKB", "8192");
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"com.google.guava:guava:src/com/google/common/collect/StandardTable.java": [
3+
131
4+
],
5+
"com.google.guava:guava:src/com/google/common/eventbus/SubscriberRegistry.java": [
6+
198
7+
],
8+
"com.google.guava:guava:src/com/google/common/reflect/ClassPath.java": [
9+
395
10+
]
11+
}

0 commit comments

Comments
 (0)