Skip to content
Closed
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
15 changes: 15 additions & 0 deletions .github/ci-files/run-sanity-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set +e

./gradlew rewriteDryRun -Dorg.gradle.jvmargs=-Xmx8G \
--configure-on-demand \
--console plain \
--max-workers=1 \
-Pqa --profile

gradle_return_code=$?

set -e

exit $gradle_return_code
15 changes: 9 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import org.sonar.build.BlackBoxTest

import static org.gradle.api.JavaVersion.VERSION_17

plugins {
// Ordered alphabetically
plugins { // natural order
id 'com.github.hierynomus.license' version '0.16.1'
id "com.github.hierynomus.license-report" version "0.16.1" apply false
id 'com.gradleup.shadow' version '8.3.6' apply false
id 'com.github.hierynomus.license-report' version '0.16.1' apply false
id 'com.google.protobuf' version '0.8.19' apply false
id 'com.gradleup.shadow' version '8.3.6' apply false
id 'com.jfrog.artifactory' version '6.0.2'
id "de.undercouch.download" version "5.6.0" apply false
id 'de.undercouch.download' version '5.6.0' apply false
id 'io.spring.dependency-management' version '1.1.7'
id "org.cyclonedx.bom" version "2.3.1" apply false
id 'org.cyclonedx.bom' version '2.3.1' apply false
id 'org.openrewrite.rewrite' version '7.19.0' apply false
id 'org.sonarqube' version '7.0.0.6105'
}

Expand Down Expand Up @@ -200,7 +200,10 @@ allprojects {
}
}

apply from: 'gradle/rewrite.gradle'

apply plugin: 'org.sonarqube'

sonar {
properties {
property 'sonar.projectName', projectTitle
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pluginApiVersion=13.3.0.3209
description=Open source platform for continuous inspection of code quality
projectTitle=SonarQube
org.gradle.jvmargs=-Xmx2048m
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.vfs.watch=true
elasticSearchServerVersion=8.16.6
Expand Down
25 changes: 25 additions & 0 deletions gradle/rewrite.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

apply plugin: 'org.openrewrite.rewrite'

rewrite {
activeRecipe('org.opensearch.openrewrite.SanityCheck')
exclusion('**package-info.java')
setExportDatatables(true)
setFailOnDryRunResults(true)
}

dependencies {
rewrite(platform('org.openrewrite.recipe:rewrite-recipe-bom:3.17.0'))
rewrite('org.openrewrite.recipe:rewrite-migrate-java:3.20.0')
rewrite('org.openrewrite.recipe:rewrite-java-security:3.19.2')
rewrite('org.openrewrite.recipe:rewrite-rewrite:0.14.1')
rewrite('org.openrewrite.recipe:rewrite-static-analysis:2.20.0')
rewrite('org.openrewrite.recipe:rewrite-third-party:0.30.0')
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

locally not running anymore. Maybe on CI or someone can fix the missing part, thank you.

* Where:
Build file '/Users/vincent.potucek/IdeaProjects/sonarqube/build.gradle' line: 712

* What went wrong:
A problem occurred evaluating root project 'sonarqube'.
> Failed to apply plugin 'com.google.protobuf'.
   > Could not get unknown property 'convention' for project ':sonar-core' of type org.gradle.api.Project.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving from Gradle 8 to Gradle 9 has to be checked properly with our full build process.
Very often plugins break (like protobuf in this case) and the whole operation has to be planned.

distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=df67a32e86e3276d011735facb1535f64d0d88df84fa87521e90becc2d735444
13 changes: 6 additions & 7 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions gradlew.bat
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions rewrite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
type: specs.openrewrite.org/v1beta/recipe
name: org.opensearch.openrewrite.SanityCheck
displayName: Apply all Java & Gradle best practices
description: Comprehensive code quality recipe combining modernization, security, and best practices.
tags:
- java
- gradle
- static-analysis
- cleanup
recipeList:
- org.openrewrite.gradle.EnableGradleBuildCache
- org.openrewrite.gradle.EnableGradleParallelExecution
- org.openrewrite.gradle.GradleBestPractices
---