Skip to content

Commit ca4c9d1

Browse files
committed
Add Spotless Gradle plugin configuration
1 parent 1446b5b commit ca4c9d1

File tree

5 files changed

+58
-8
lines changed

5 files changed

+58
-8
lines changed

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ scmVersion {
1313
}
1414
}
1515

16+
buildscript {
17+
repositories {
18+
maven { url 'https://plugins.gradle.org/m2' }
19+
}
20+
dependencies {
21+
classpath 'com.diffplug.spotless:spotless-plugin-gradle:7.1.0'
22+
}
23+
}
24+
1625
allprojects {
1726
// Apply common project setup
1827
apply from: "${project.rootDir}/project.gradle"

project.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,4 +387,31 @@ plugins.withType(JavaPlugin).whenPluginAdded {
387387
}
388388
}
389389

390+
plugins.apply('com.diffplug.spotless')
391+
392+
spotless {
393+
java {
394+
target '**/*.java'
395+
396+
googleJavaFormat()
397+
licenseHeaderFile rootProject.file('tools/spotless/openremote-license-header.txt')
398+
importOrder('java', 'javax', 'com', 'org')
399+
removeUnusedImports()
400+
formatAnnotations()
401+
trimTrailingWhitespace()
402+
endWithNewline()
403+
}
404+
405+
typescript {
406+
target 'src/**/*.ts'
407+
targetExclude(
408+
'src/model.ts',
409+
'src/restclient.ts'
410+
)
411+
412+
eslint().configFile(rootProject.file('ui/.eslintrc.json')).tsconfigFile(rootProject.file('ui/tsconfig.json'))
413+
licenseHeaderFile rootProject.file('tools/spotless/openremote-license-header.txt'), '(import|const|declare|export|var) '
414+
}
415+
}
416+
390417
// POM generator
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright $YEAR, OpenRemote Inc.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*
17+
* SPDX-License-Identifier: AGPL-3.0-or-later
18+
*/

ui/app/custom-react/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
buildDir = "dist"
22

3-
tasks.register('clean') {
4-
dependsOn npmClean
5-
}
6-
73
tasks.register('installDist', Copy) {
84
dependsOn npmBuild
95
mustRunAfter(resolveTask(":manager:installDist"))
106
from project.buildDir
117
into "${project(':deployment').buildDir}/image/manager/app/${projectDir.name}"
128
}
9+
10+
clean.dependsOn(npmClean)

ui/app/custom/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
buildDir = "dist"
22

3-
tasks.register('clean') {
4-
dependsOn npmClean
5-
}
6-
73
tasks.register('installDist', Copy) {
84
dependsOn npmBuild
95
mustRunAfter(resolveTask(":manager:installDist"))
106
from project.buildDir
117
into "${project(':deployment').buildDir}/image/manager/app/${projectDir.name}"
128
}
9+
10+
clean.dependsOn(npmClean)

0 commit comments

Comments
 (0)