Skip to content

Commit

Permalink
Fixed spotless configuration to support groovy and gradle. (apache#100)
Browse files Browse the repository at this point in the history
* Fixed spotless configuration to support groovy and gradle
* Spotless applied

Co-authored-by: Murtuza Boxwala <[email protected]>
Co-authored-by: Kamilla Aslami <[email protected]>
Co-authored-by: Jacob Barrett <[email protected]>
  • Loading branch information
3 people committed Aug 21, 2019
1 parent f4c2390 commit 8e29d0b
Show file tree
Hide file tree
Showing 8 changed files with 307 additions and 291 deletions.
24 changes: 10 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@
* limitations under the License.
*/
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath 'com.bmuschko:gradle-docker-plugin:4.0.4'
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.16.0"
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
}
repositories { gradlePluginPortal() }
dependencies {
classpath 'com.bmuschko:gradle-docker-plugin:4.0.4'
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.16.0"
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
}
}


plugins {
id "org.nosphere.apache.rat" version "0.3.1"
}
plugins { id "org.nosphere.apache.rat" version "0.3.1" }

apply plugin: 'com.bmuschko.docker-remote-api'

Expand All @@ -42,9 +38,9 @@ dependencyVersions.keys().each{ k -> project.ext[k] = dependencyVersions[k]}

// Use task types
task buildTestingImage(type: DockerBuildImage) {
inputDir = file(project.rootDir)
dockerFile = file('images/geode-performance/Dockerfile')
tag = 'geode-performance-testing:latest'
inputDir = file(project.rootDir)
dockerFile = file('images/geode-performance/Dockerfile')
tag = 'geode-performance-testing:latest'
}

apply from: "gradle/spotless.gradle"
Expand Down
34 changes: 34 additions & 0 deletions etc/greclipse.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#Whether to use 'space', 'tab' or 'mixed' (both) characters for indentation.
#The default value is 'tab'.
org.eclipse.jdt.core.formatter.tabulation.char=space

#Number of spaces used for indentation in case 'space' characters
#have been selected. The default value is 4.
org.eclipse.jdt.core.formatter.tabulation.size=2

#Number of spaces used for indentation in case 'mixed' characters
#have been selected. The default value is 4.
org.eclipse.jdt.core.formatter.indentation.size=2

#Whether or not indentation characters are inserted into empty lines.
#The default value is 'true'.
org.eclipse.jdt.core.formatter.indent_empty_lines=false

#Number of spaces used for multiline indentation.
#The default value is 2.
groovy.formatter.multiline.indentation=1

#Length after which list are considered too long. These will be wrapped.
#The default value is 30.
groovy.formatter.longListLength=30

#Whether opening braces position shall be the next line.
#The default value is 'same'.
groovy.formatter.braces.start=same

#Whether closing braces position shall be the next line.
#The default value is 'next'.
groovy.formatter.braces.end=next

#Remove unnecessary semicolons. The default value is 'false'.
groovy.formatter.remove.unnecessary.semicolons=true
88 changes: 41 additions & 47 deletions geode-benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
* limitations under the License.
*/

plugins {
id 'java'
}
plugins { id 'java' }

group 'org.apache.geode-benchmark'
version '1.0-SNAPSHOT'
Expand All @@ -28,62 +26,58 @@ def outputDir = project.hasProperty('outputDir') ? project.findProperty('outputD
def geodeVersion = project.hasProperty('geodeVersion') ? project.findProperty('geodeVersion') : '1.+'

def getDate() {
new Date().format('yyyyMMddHHmmss')
new Date().format('yyyyMMddHHmmss')
}


repositories {
mavenLocal()
mavenCentral()
mavenLocal()
mavenCentral()
}

dependencies {
compile(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: project.'junit-jupiter-engine.version')
compile(group: 'org.junit-pioneer', name: 'junit-pioneer', version: project.'junit-pioneer.version')
compile(group: 'org.apache.geode', name: 'geode-core', version: geodeVersion)
compile(group: 'org.slf4j', name: 'slf4j-simple', version: project.'slf4j-simple.version')
compile(project(':harness'))
compile(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: project.'junit-jupiter-engine.version')
compile(group: 'org.junit-pioneer', name: 'junit-pioneer', version: project.'junit-pioneer.version')
compile(group: 'org.apache.geode', name: 'geode-core', version: geodeVersion)
compile(group: 'org.slf4j', name: 'slf4j-simple', version: project.'slf4j-simple.version')
compile(project(':harness'))

// Required for missing dependency on geode-core.
runtime(group: 'org.eclipse.jetty', name: 'jetty-webapp', version: '9.4.12.v20180830')
// Required for missing dependency on geode-core.
runtime(group: 'org.eclipse.jetty', name: 'jetty-webapp', version: '9.4.12.v20180830')

testCompile(group: 'org.mockito', name: 'mockito-all', version: project.'mockito-all.version')
testCompile(group: 'org.assertj', name: 'assertj-core', version: project.'assertj-core.version')
testCompile(group: 'org.mockito', name: 'mockito-all', version: project.'mockito-all.version')
testCompile(group: 'org.assertj', name: 'assertj-core', version: project.'assertj-core.version')
}

test{
useJUnitPlatform()
}
test{ useJUnitPlatform() }

task benchmark(type: Test) {
if (project.hasProperty('testJVM') && !testJVM.trim().isEmpty()) {
executable = "${testJVM}/bin/java"
}
outputs.upToDateWhen { false }
testClassesDirs = project.sourceSets.main.output.classesDirs
classpath = project.sourceSets.main.runtimeClasspath
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}

exclude "**/Replicated*QueryBenchmark.class"
exclude "**/ReplicatedFunctionExecution*Benchmark.class"
exclude "**/PartitionedNonIndexedQueryBenchmark.class"
exclude "**/*PutAllBenchmark.class"

forkEvery 1

systemProperty 'TEST_HOSTS', project.findProperty('hosts')
systemProperty 'TEST_METADATA', project.findProperty('metadata')
systemProperty 'OUTPUT_DIR', outputDir
systemProperty 'withSsl', project.hasProperty('withSsl')
systemProperty 'withSecurityManager', project.hasProperty('withSecurityManager')
systemProperty 'benchmark.profiler.argument', project.findProperty('benchmark.profiler.argument')

doFirst {
if(!project.hasProperty('hosts')) {
throw new GradleException("You must set the hosts property to a comma separated list of hosts. Eg ./gradlew benchmark -Phosts=localhost,localhost,localhost")
}
if (project.hasProperty('testJVM') && !testJVM.trim().isEmpty()) {
executable = "${testJVM}/bin/java"
}
outputs.upToDateWhen { false }
testClassesDirs = project.sourceSets.main.output.classesDirs
classpath = project.sourceSets.main.runtimeClasspath
useJUnitPlatform()
testLogging { exceptionFormat = 'full' }

exclude "**/Replicated*QueryBenchmark.class"
exclude "**/ReplicatedFunctionExecution*Benchmark.class"
exclude "**/PartitionedNonIndexedQueryBenchmark.class"
exclude "**/*PutAllBenchmark.class"

forkEvery 1

systemProperty 'TEST_HOSTS', project.findProperty('hosts')
systemProperty 'TEST_METADATA', project.findProperty('metadata')
systemProperty 'OUTPUT_DIR', outputDir
systemProperty 'withSsl', project.hasProperty('withSsl')
systemProperty 'withSecurityManager', project.hasProperty('withSecurityManager')
systemProperty 'benchmark.profiler.argument', project.findProperty('benchmark.profiler.argument')

doFirst {
if(!project.hasProperty('hosts')) {
throw new GradleException("You must set the hosts property to a comma separated list of hosts. Eg ./gradlew benchmark -Phosts=localhost,localhost,localhost")
}
}
}
109 changes: 52 additions & 57 deletions gradle/rat.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,57 @@
apply plugin: "org.nosphere.apache.rat"

rat {
excludes = [
'.travis.yml',
'.git/**',
'**/output/**',
'**/output-*/**',
'**/build/**',
'**/out/**',
'README.md',

// IDE
'etc/eclipse-java-google-style.xml',
'etc/intellij-java-modified-google-style.xml',
'etc/eclipseOrganizeImports.importorder',
'**/.project',
'**/.classpath',
'**/.settings/**',
'**/build-eclipse/**',
'**/*.iml',
'**/*.ipr',
'**/*.iws',
'.idea/**',
'**/tags',
'**/out/**',

// gradle
'**/.gradle/**',
'.gradle/**',
'gradlew*',
'gradle/**',
'gradle/wrapper/gradle-wrapper.properties',
'caches/**',
'daemon/**',
'native/**',
'wrapper/**',
'**/build/**',
'**/build-*/**',
'.buildinfo',

// text files
'**/*.fig',
'**/*.txt',
'**/*.md',
'**/*.json',
'**/*.tx0',
'**/*.txo',
'**/*.log',
'**/*.patch',
'**/*.diff',
'**/*.rej',
'**/*.orig',
'**/*.MF',
'**/*.cfg',

]
excludes = [
'.travis.yml',
'.git/**',
'**/output/**',
'**/output-*/**',
'**/build/**',
'**/out/**',
'README.md',
// IDE
'etc/eclipse-java-google-style.xml',
'etc/intellij-java-modified-google-style.xml',
'etc/eclipseOrganizeImports.importorder',
'etc/greclipse.properties',
'**/.project',
'**/.classpath',
'**/.settings/**',
'**/build-eclipse/**',
'**/*.iml',
'**/*.ipr',
'**/*.iws',
'.idea/**',
'**/tags',
'**/out/**',
// gradle
'**/.gradle/**',
'.gradle/**',
'gradlew*',
'gradle/**',
'gradle/wrapper/gradle-wrapper.properties',
'caches/**',
'daemon/**',
'native/**',
'wrapper/**',
'**/build/**',
'**/build-*/**',
'.buildinfo',
// text files
'**/*.fig',
'**/*.txt',
'**/*.md',
'**/*.json',
'**/*.tx0',
'**/*.txo',
'**/*.log',
'**/*.patch',
'**/*.diff',
'**/*.rej',
'**/*.orig',
'**/*.MF',
'**/*.cfg',
]
}

subprojects {
check.dependsOn rat
}
subprojects { check.dependsOn rat }
8 changes: 2 additions & 6 deletions gradle/resolve-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->
subProject.buildscript.configurations.each { configuration ->
resolveConfiguration(configuration)
}
subProject.configurations.each { configuration ->
resolveConfiguration(configuration)
}
subProject.buildscript.configurations.each { configuration -> resolveConfiguration(configuration) }
subProject.configurations.each { configuration -> resolveConfiguration(configuration) }
}
}
}
Expand Down
Loading

0 comments on commit 8e29d0b

Please sign in to comment.