-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
95 lines (82 loc) · 2.3 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
buildscript { repositories { jcenter() } }
plugins {
id "com.diffplug.gradle.spotless" version "3.10.0"
id "com.moowork.node" version "1.2.0"
}
task installGitHooks {
doLast {
if (!file('.git/hooks/pre-commit').exists()) {
file('.git/hooks/pre-commit') << file('.pre-commit').text
if (!System.properties['os.name'].toLowerCase().contains('windows')) {
Runtime.getRuntime().exec("chmod -R +x .git/hooks/")
}
}
}
}
tasks.matching { it.name != 'installGitHooks' }.all { Task task ->
task.dependsOn installGitHooks
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
dependencies { compile project(':packages:server-java') }
task spinWatch(type: NodeTask) {
script = file('node_modules/.bin/spin')
args = ['watch']
}
task watch {
dependsOn spinWatch
dependsOn ':packages:server-java:bootRun'
}
defaultTasks 'watch'
spotless {
java {
target fileTree(rootDir) {
include '**/*.java'
exclude '.history/**'
exclude '**/node_modules/**'
exclude '**/.tmp/**'
}
eclipse().configFile '.codestyle.prefs'
}
groovy {
target fileTree(rootDir) {
include '**/*.gradle'
exclude '.history/**'
exclude '**/node_modules/**'
exclude '**/.tmp/**'
}
greclipse().configFile '.codestyle.prefs'
paddedCell()
}
format 'misc', {
target fileTree(rootDir) {
include '**/.gitignore', '**/*.md', '**/*.sh'
exclude '.history/**'
exclude '**/node_modules/**'
exclude '**/.tmp/**'
}
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
}
task format {
dependsOn 'spotlessApply'
dependsOn 'spotlessMiscApply'
}
tasks.withType(Test) { dependsOn 'format' }
eclipse {
classpath {
file {
whenMerged { classpath ->
if (System.env['VSCODE_PID'] != null) {
if (!file('.vscode/settings.json').exists()) {
file('.vscode').mkdir();
file('.vscode/settings.json') << "{\n \"editor.formatOnSave\": true\n}"
}
}
}
}
}
}