Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: Enable spotless for streams-scala when Java 11+ is used #13311

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/

def doValidation() {
// Run all the tasks associated with `check` except for `test` - the latter is executed via `doTest`
sh """
./retry_zinc ./gradlew -PscalaVersion=$SCALA_VERSION clean compileJava compileScala compileTestJava compileTestScala \
checkstyleMain checkstyleTest spotbugsMain rat \
./retry_zinc ./gradlew -PscalaVersion=$SCALA_VERSION clean check -x test \
--profile --continue -PxmlSpotBugsReport=true -PkeepAliveMode="session"
"""
}
Expand Down
24 changes: 14 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.

import org.ajoberstar.grgit.Grgit
import org.gradle.api.JavaVersion

import java.nio.charset.StandardCharsets

Expand All @@ -30,26 +31,18 @@ buildscript {
}

plugins {
id 'com.diffplug.spotless' version '6.13.0' // newer versions require Java 11, so we can't use them until Kafka 4.0
id 'com.github.ben-manes.versions' version '0.44.0'
id 'idea'
id 'java-library'
id 'org.owasp.dependencycheck' version '8.0.2'
id 'org.nosphere.apache.rat' version "0.8.0"
id "io.swagger.core.v3.swagger-gradle-plugin" version "2.2.0"

id "com.github.spotbugs" version '5.0.13' apply false
id 'org.gradle.test-retry' version '1.5.1' apply false
id 'org.scoverage' version '7.0.1' apply false
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id "io.swagger.core.v3.swagger-gradle-plugin" version "2.2.0"
}

spotless {
scala {
target 'streams/**/*.scala'
scalafmt("$versions.scalafmt").configFile('checkstyle/.scalafmt.conf').scalaMajorVersion(versions.baseScala)
licenseHeaderFile 'checkstyle/java.header', 'package'
}
id 'com.diffplug.spotless' version '6.14.0' apply false // 6.14.1 and newer require Java 11 at compile time, so we can't upgrade until AK 4.0
}

ext {
Expand Down Expand Up @@ -2116,6 +2109,17 @@ project(':streams:streams-scala') {
dependsOn 'copyDependantLibs'
}

// spotless 6.14 requires Java 11 at runtime
if (JavaVersion.current().isJava11Compatible()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it imply the developers who want to contribute code to streams-scala must use JDK11 as our Ci will check that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CI will check it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, developers don't have to use Java 11. They can rely on CI for the rare case where this module is being updated and they didn't follow the style rules. It is more practical to use Java 11 or newer though. I don't think it's a problem - Java 8 support is more for deployments than for contributors.

apply plugin: 'com.diffplug.spotless'
spotless {
scala {
target '**/*.scala'
scalafmt("$versions.scalafmt").configFile('../../checkstyle/.scalafmt.conf').scalaMajorVersion(versions.baseScala)
licenseHeaderFile '../../checkstyle/java.header', 'package'
}
}
}
}

project(':streams:test-utils') {
Expand Down