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

[build] Use Spotless plugin to enforce/update copyright headers #2729

Merged
merged 3 commits into from
Jun 30, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: 8
- uses: eskatos/gradle-command-action@v1
name: gradle
name: license header
with:
arguments: check -x :reactor-core:test --no-daemon
arguments: spotlessCheck -PspotlessFrom=origin/${{ github.base_ref }}
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
#the above should exclude jcstress in master, adding a 3rd job below for jcstress
- uses: eskatos/gradle-command-action@v1
name: other tests
with:
arguments: check -x :reactor-core:test --no-daemon
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
22 changes: 22 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ plugins {
id 'biz.aQute.bnd.builder' version '5.0.1' apply false
id 'io.spring.nohttp' version '0.0.5.RELEASE'
id "io.github.reyerizo.gradle.jcstress" version "0.8.11" apply false
id "com.diffplug.spotless" version "5.14.0"
}

apply plugin: "io.reactor.gradle.detect-ci"
Expand Down Expand Up @@ -106,6 +107,27 @@ nohttp {
allowlistFile = project.file('codequality/nohttp/allowlist.lines')
}

spotless {
if (project.hasProperty("spotlessFrom")) {
println "[Spotless] Ratchet from $project.spotlessFrom"
ratchetFrom project.spotlessFrom
}
else if (isCiServer) {
println "[Spotless] CI detected without explicit branch, not enforcing check"
enforceCheck false
}
else {
String spotlessBranch = "origin/3.3.x"
println "[Spotless] Local run detected, ratchet from $spotlessBranch"
ratchetFrom spotlessBranch
}
java {
target '**/*.java'
targetExclude '**/java8stubs/**/*', '**/java9stubs/**/*'
licenseHeaderFile('codequality/spotless/licenseSlashstarStyle.txt')
}
}

configure(subprojects) { p ->
apply plugin: 'java'
apply plugin: 'jacoco'
Expand Down
16 changes: 16 additions & 0 deletions codequality/spotless/licenseSlashstarStyle.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2011-$today.year VMware Inc. or its affiliates, All Rights Reserved.
*
* Licensed 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
*
* https://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.
*/