build.gradle 3.98 KB
Newer Older
Ubbo Veentjer's avatar
Ubbo Veentjer committed
1
plugins {
2
    id 'org.springframework.boot' version '2.3.0.RELEASE'
3
4
    id 'com.github.node-gradle.node' version '2.2.4'
    id 'io.miret.etienne.sass' version '1.1.1'
Ubbo Veentjer's avatar
Ubbo Veentjer committed
5
6
7
8
}

apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
Ubbo Veentjer's avatar
Ubbo Veentjer committed
9
apply plugin: 'jacoco'
Ubbo Veentjer's avatar
Ubbo Veentjer committed
10
apply plugin: 'war'
Ubbo Veentjer's avatar
Ubbo Veentjer committed
11

Ubbo Veentjer's avatar
semver    
Ubbo Veentjer committed
12
group = 'info.textgrid.rep'
Ubbo Veentjer's avatar
Ubbo Veentjer committed
13
version = '3.1.7'
Ubbo Veentjer's avatar
semver    
Ubbo Veentjer committed
14
15
sourceCompatibility = '1.8'

Ubbo Veentjer's avatar
Ubbo Veentjer committed
16
17
18
19
20
21
22
repositories {
    mavenCentral()
    maven {
        url 'https://nexus.gwdg.de/repository/maven-dariah-public'
    }
}

23
24
25
26
configurations {
  closureCompiler
}

Ubbo Veentjer's avatar
Ubbo Veentjer committed
27
28
29
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
Ubbo Veentjer's avatar
Ubbo Veentjer committed
30
    implementation 'javax.servlet:jstl'
31
    implementation 'org.apache.cxf:cxf-rt-rs-client:3.3.6'
Ubbo Veentjer's avatar
Ubbo Veentjer committed
32
33
    implementation 'io.jsonwebtoken:jjwt:0.9.1'
    implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider'
34
    implementation 'com.atlassian.commonmark:commonmark:0.14.0'
35
    implementation 'com.atlassian.commonmark:commonmark-ext-heading-anchor:0.14.0'
36
    implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0'
37
    implementation 'com.atlassian.commonmark:commonmark-ext-yaml-front-matter:0.14.0'
38
    implementation 'info.textgrid.middleware.clients:textgrid-clients:3.4.3'
39
    developmentOnly("org.springframework.boot:spring-boot-devtools")
Ubbo Veentjer's avatar
Ubbo Veentjer committed
40
41
42
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
43
    closureCompiler 'com.google.javascript:closure-compiler:v20200614'
Ubbo Veentjer's avatar
Ubbo Veentjer committed
44
45
46
47
}

test {
    useJUnitPlatform()
Ubbo Veentjer's avatar
Ubbo Veentjer committed
48
49
}

50
51
52
53
54
// show deprecation and unchecked warnings when compiling java src
tasks.withType(JavaCompile) {
    options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}

Ubbo Veentjer's avatar
Ubbo Veentjer committed
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
*  node / npm dependencies
*/
node {
    // Version of node to use.
    version = '12.14.1'
    // Version of npm to use.
    npmVersion = '6.13.4'
    // If true, it will download node using above parameters.
    // If false, it will try to use globally installed node.
    download = true
}

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
task compileJs(type: JavaExec) {
  classpath configurations.closureCompiler
  main = 'com.google.javascript.jscomp.CommandLineRunner'

  def closureArgs = []
  //append all your command line options here
  // https://github.com/google/closure-compiler/wiki/Flags-and-Options
  closureArgs << "--compilation_level=SIMPLE"
  // possible values: https://github.com/leobia/JsGradleCompiler#use-the-plugin
  closureArgs << "--language_in=ECMASCRIPT_2020"
  closureArgs << "--language_out=ECMASCRIPT5"
  //closureArgs << "--formatting=PRETTY_PRINT"
  closureArgs << "--create_source_map=./build/js/main.js.map"
  closureArgs << "--source_map_include_content"
  closureArgs << "--output_wrapper=//# sourceMappingURL=main.js.map\n%output%"
  closureArgs << "--js_output_file=./build/js/main.min.js"
  closureArgs << "./src/main/javascript/"

  args closureArgs
}

89
90
// npm install should be run before processResources
processResources.dependsOn npmInstall
91
processResources.dependsOn compileSass
Ubbo Veentjer's avatar
Ubbo Veentjer committed
92
processResources.dependsOn compileJs
93
94

// copy static files to web application
95
processResources {
96
97
98
    from ('docs') {
        into 'docs'
    }
99
100
101
    from ('docs/images') {
        into '/static/docs/images'
    }
102
103
104
105
106
107
    from('node_modules/font-awesome/fonts') {
        into 'static/fonts'
    }
    from ('node_modules/jquery/dist/jquery.min.js') {
        into 'static/js'
    }
108
109
110
111
    from ('node_modules/@sentry/browser/build/bundle.min.js') {
        rename '(.*)', 'sentry.$1'
        into 'static/js'
    }
112
113
114
115
116
    from ('node_modules/openseadragon/build/openseadragon/openseadragon.min.js') {
        into 'static/js'
    }
    from ('node_modules/openseadragon/build/openseadragon/images') {
        into 'static/images/openseadragon'
117
    }
118
119
120
    from ("${buildDir}/sass/") {
        into 'static/css'
    }
Ubbo Veentjer's avatar
Ubbo Veentjer committed
121
122
123
124
125
    from ("${buildDir}/js/") {
        into 'static/js'
    }
}

Ubbo Veentjer's avatar
Ubbo Veentjer committed
126
127
128
129
compileSass {
  style = compressed
}

Ubbo Veentjer's avatar
Ubbo Veentjer committed
130
131
132
133
134
135
136
137
138
139
test {
    finalizedBy jacocoTestReport
}

jacocoTestReport {
  reports {
    csv.enabled true
  }
}