diff --git a/Jenkinsfile b/Jenkinsfile index 57fd6db08c1..d9777978b61 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,10 +43,15 @@ node('ubuntu') { timeout(time: 1, unit: 'HOURS') { withEnv(["Path+JDK=$JAVA_JDK_17/bin","JAVA_HOME=$JAVA_JDK_17"]) { withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) { - if ( env.BRANCH_NAME.startsWith("PR-") ) { - sh './gradlew build --no-parallel --no-daemon jacocoAggregateTestReport sonar -PenableJacoco -Porg.sonarqube.version=4.4.1.3373 -Dsonar.pullrequest.branch=${CHANGE_BRANCH} -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID} -Dsonar.token=${SONAR_TOKEN}' + def JVM_ARGS = "-XX:+UseG1GC -Xmx1536m -XX:MaxMetaspaceSize=512m" + def COMMON_ARGS = "build --no-parallel --no-daemon jacocoAggregateTestReport sonar -PenableJacoco -Porg.sonarqube.version=4.4.1.3373 -Dsonar.token=${SONAR_TOKEN} -Dorg.gradle.jvmargs='${JVM_ARGS}' " + + if (env.BRANCH_NAME.startsWith("PR-")) { + def PR_ARGS = "-Dsonar.pullrequest.branch=${CHANGE_BRANCH} -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID}" + sh "./gradlew ${COMMON_ARGS} ${PR_ARGS}" } else { - sh './gradlew build --no-parallel --no-daemon jacocoAggregateTestReport sonar -PenableJacoco -Porg.sonarqube.version=4.4.1.3373 -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.token=${SONAR_TOKEN}' + def BRANCH_ARGS = "-Dsonar.branch.name=${BRANCH_NAME}" + sh "./gradlew ${COMMON_ARGS} ${BRANCH_ARGS}" } } } diff --git a/gradle.properties b/gradle.properties index 5b77abc3799..da36ecc1b96 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -org.gradle.jvmargs=-XX:+UseG1GC -Xmx1536m -XX:MaxMetaspaceSize=512m +org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -XX:MaxMetaspaceSize=512m org.gradle.parallel=true # Build cache can be disabled with --no-build-cache option org.gradle.caching=true