From 3cfb2205f23c36dae4318516bd54f3ba1322920a Mon Sep 17 00:00:00 2001 From: Kamil Wasilewski Date: Wed, 29 Apr 2020 17:52:44 +0200 Subject: [PATCH] Enable Spotless for .test-infra/jenkins/*.groovy files --- .test-infra/jenkins/build.gradle | 22 +++++++++++++++++++ .../jenkins/job_PreCommit_Spotless.groovy | 1 + buildSrc/greclipse.properties | 2 +- .../beam/gradle/BeamModulePlugin.groovy | 6 +++-- settings.gradle | 2 ++ 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .test-infra/jenkins/build.gradle diff --git a/.test-infra/jenkins/build.gradle b/.test-infra/jenkins/build.gradle new file mode 100644 index 000000000000..37e964d503a7 --- /dev/null +++ b/.test-infra/jenkins/build.gradle @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id 'org.apache.beam.module' +} +applyGroovyNature() diff --git a/.test-infra/jenkins/job_PreCommit_Spotless.groovy b/.test-infra/jenkins/job_PreCommit_Spotless.groovy index 7dc033dd7638..5bc6a16f6d2c 100644 --- a/.test-infra/jenkins/job_PreCommit_Spotless.groovy +++ b/.test-infra/jenkins/job_PreCommit_Spotless.groovy @@ -28,6 +28,7 @@ PrecommitJobBuilder builder = new PrecommitJobBuilder( '^runners/.*$', '^examples/java/.*$', '^examples/kotlin/.*$', + '^.test-infra/jenkins/.*$', ] ) builder.build() diff --git a/buildSrc/greclipse.properties b/buildSrc/greclipse.properties index f2e56a9eb293..c3e0eaee8219 100644 --- a/buildSrc/greclipse.properties +++ b/buildSrc/greclipse.properties @@ -18,4 +18,4 @@ org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=2 org.eclipse.jdt.core.formatter.indent_empty_lines=false -groovy.formatter.multiline.indentation=4 +groovy.formatter.multiline.indentation=2 diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 41663250e846..e560b6844ed8 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -1490,12 +1490,14 @@ class BeamModulePlugin implements Plugin { project.apply plugin: "groovy" project.apply plugin: "com.diffplug.gradle.spotless" + def disableSpotlessCheck = project.hasProperty('disableSpotlessCheck') && + project.disableSpotlessCheck == 'true' project.spotless { + enforceCheck !disableSpotlessCheck def grEclipseConfig = project.project(":").file("buildSrc/greclipse.properties") groovy { - licenseHeader javaLicenseHeader - paddedCell() // Recommended to avoid cyclic ambiguity issues greclipse().configFile(grEclipseConfig) + target project.fileTree(project.projectDir) { include '**/*.groovy' } } groovyGradle { greclipse().configFile(grEclipseConfig) } } diff --git a/settings.gradle b/settings.gradle index 94823b5f629e..d1beddb9d70b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -176,3 +176,5 @@ include "beam-test-infra-metrics" project(":beam-test-infra-metrics").dir = file(".test-infra/metrics") include "beam-test-tools" project(":beam-test-tools").dir = file(".test-infra/tools") +include "beam-test-jenkins" +project(":beam-test-jenkins").dir = file(".test-infra/jenkins")