Skip to content

Commit

Permalink
Adding spotless plugin to project build.gradle.
Browse files Browse the repository at this point in the history
Signed-off-by: Mitchell Gale <[email protected]>

Remove commented out spotless changes.

Signed-off-by: Mitchell Gale <[email protected]>

Adding Spotless to DEVELOPER_GUIDE.rst

Signed-off-by: Mitchell Gale <[email protected]>

Added Google Java format to spotless.

Signed-off-by: Mitchell Gale <[email protected]>

Update DEVELOPER_GUIDE.rst

Co-authored-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
MitchellGale and Yury-Fridlyand committed Jul 12, 2023
1 parent f5031a7 commit 120b5a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
8 changes: 6 additions & 2 deletions DEVELOPER_GUIDE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ Note that missing license header will be detected by Gradle license plugin and f
Making Code Changes
===================

Project Strucure
----------------
Project Structure
-----------------

The plugin codebase is in standard layout of Gradle project::

Expand Down Expand Up @@ -226,6 +226,10 @@ Most of the time you just need to run ./gradlew build which will make sure you p
- Build plugin by run all tasks above (this takes time).
* - ./gradlew pitest
- Run PiTest mutation testing (see more info in `#1204 <https://github.com/opensearch-project/sql/pull/1204>`_)
* - ./gradlew spotlessCheck
- Runs Spotless to check for code style.
* - ./gradlew spotlessApply
- Automatically apply spotless code style changes.

For integration test, you can use ``-Dtests.class`` “UT full path” to run a task individually. For example ``./gradlew :integ-test:integTest -Dtests.class="*QueryIT"``.

Expand Down
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ plugins {
id 'checkstyle'
id "io.freefair.lombok" version "6.4.0"
id 'jacoco'
id 'com.diffplug.spotless' version '6.19.0'
}

// import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94
Expand All @@ -79,6 +80,20 @@ repositories {
maven { url 'https://jitpack.io' }
}

spotless {
java {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**'
}
importOrder()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
googleJavaFormat()
}
}

allprojects {
version = opensearch_version.tokenize('-')[0] + '.0'
if (buildVersionQualifier) {
Expand Down

0 comments on commit 120b5a4

Please sign in to comment.