]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17565 Support running SonarQube with Java 17
authorZipeng WU <zipeng.wu@sonarsource.com>
Tue, 6 Dec 2022 10:32:02 +0000 (11:32 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 9 Dec 2022 20:03:10 +0000 (20:03 +0000)
.cirrus.yml
build.gradle
server/sonar-main/src/test/java/org/sonar/application/es/EsKeyStoreCliTest.java

index bfc10017e670f3114ee470ad9c100f98324cf98a..3e9f71bb73f12b2fe39a8e1a6d5823e72a6fae78 100644 (file)
@@ -298,6 +298,32 @@ qa_task:
     - ./private/cirrus/cirrus-qa.sh postgres
   <<: *DEFAULT_ARTIFACTS_TEMPLATE
 
+qa_java11_task:
+  <<: *DEFAULT_TEMPLATE
+  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
+  <<: *GRADLE_CACHE_TEMPLATE
+  <<: *JAR_CACHE_TEMPLATE
+  gke_container:
+    dockerfile: private/docker/Dockerfile-build-java11
+    builder_image_project: sonarqube-team
+    builder_image_name: family/docker-builder
+    cluster_name: cirrus-ci-cluster
+    zone: us-central1-a
+    namespace: default
+    cpu: 2
+    memory: 6Gb
+    additional_containers:
+      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
+  env:
+    matrix:
+      - QA_CATEGORY: Cat1
+      - QA_CATEGORY: CommunityEditionWithPlugins
+      - QA_CATEGORY: ComputeEngine
+      - QA_CATEGORY: Upgrade
+  script:
+    - ./private/cirrus/cirrus-qa.sh postgres
+  <<: *DEFAULT_ARTIFACTS_TEMPLATE
+
 task: #bitbucket
   <<: *DEFAULT_TEMPLATE
   <<: *BUILD_DEPENDANT_TASK_TEMPLATE
index 3b440b30bbf7a4022269d0839a1077fd435f69f8..62a1a37a74525cce72e14fc21c9299e2cf4c01a4 100644 (file)
@@ -146,6 +146,9 @@ subprojects {
   // do not deploy to Artifactory by default
   artifactoryPublish.skip = true
 
+  // Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17
+  compileJava.options.release = 11
+
   compileJava.options.encoding = "UTF-8"
   compileTestJava.options.encoding = "UTF-8"
 
index 089200e62b426e47dffbd20aaa7d1f2d3301a867..5c508ad4021c550e7c710d66ad01a43828a32361 100644 (file)
@@ -34,6 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.argThat;
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -79,7 +80,7 @@ public class EsKeyStoreCliTest {
       "-Des.distribution.type=tar");
 
     verify(process.getOutputStream()).write(argThat(new ArrayContainsMatcher("value1\nvalue2\nvalue3\n")), eq(0), eq(21));
-    verify(process.getOutputStream()).flush();
+    verify(process.getOutputStream(), atLeastOnce()).flush();
     verify(process.getMock()).waitFor(1L, TimeUnit.MINUTES);
   }