Skip to content

Commit 58221ac

Browse files
committed
Add Spotless Gradle plugin configuration
1 parent 14d5a34 commit 58221ac

File tree

4 files changed

+56
-4
lines changed

4 files changed

+56
-4
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.0.3'
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
@@ -389,4 +389,31 @@ plugins.withType(JavaPlugin).whenPluginAdded {
389389
}
390390
}
391391

392+
plugins.apply('com.diffplug.spotless')
393+
394+
spotless {
395+
java {
396+
target '**/*.java'
397+
398+
googleJavaFormat()
399+
licenseHeaderFile rootProject.file('tools/spotless/openremote-license-header.txt')
400+
importOrder('java', 'javax', 'com', 'org')
401+
removeUnusedImports()
402+
formatAnnotations()
403+
trimTrailingWhitespace()
404+
endWithNewline()
405+
}
406+
407+
typescript {
408+
target 'src/**/*.ts'
409+
targetExclude(
410+
'src/model.ts',
411+
'src/restclient.ts'
412+
)
413+
414+
eslint().configFile(rootProject.file('ui/.eslintrc.json')).tsconfigFile(rootProject.file('ui/tsconfig.json'))
415+
licenseHeaderFile rootProject.file('tools/spotless/openremote-license-header.txt'), '(import|const|declare|export|var) '
416+
}
417+
}
418+
392419
// 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/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)