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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
apply plugin: 'java'
apply from: "${rootDir}/gradle/xtext-common.gradle"
dependencies {
implementation project(':refinery-language')
implementation project(':refinery-language-ide')
implementation "org.eclipse.xtext:org.eclipse.xtext.xbase.web:${xtextVersion}"
implementation "org.eclipse.xtext:org.eclipse.xtext.web.servlet:${xtextVersion}"
implementation "org.eclipse.xtend:org.eclipse.xtend.lib:${xtextVersion}"
implementation "org.eclipse.jetty:jetty-server:${jettyVersion}"
implementation "org.eclipse.jetty:jetty-servlet:${jettyVersion}"
implementation "org.slf4j:slf4j-simple:${slf4JVersion}"
}
def generateXtext = project(':refinery-language').tasks.named('generateXtext')
tasks.named('compileJava') {
dependsOn generateXtext
}
tasks.named('processResources') {
dependsOn generateXtext
}
def webpackOutputDir = "${buildDir}/webpack"
def productionResources = "${webpackOutputDir}/production"
def mainClass = 'org.eclipse.viatra.solver.language.web.ServerLauncher'
apply plugin: 'org.siouan.frontend-jdk11'
import org.siouan.frontendgradleplugin.infrastructure.gradle.RunNpmYarn
frontend {
nodeVersion = project.ext.nodeVersion
nodeInstallDirectory = file("${rootDir}/.gradle/node")
yarnEnabled = true
yarnVersion = project.ext.yarnVersion
yarnInstallDirectory = file("${rootDir}/.gradle/yarn")
assembleScript = 'run assemble'
}
def installFrontend = tasks.named('installFrontend')
def assembleFrontend = tasks.named('assembleFrontend')
assembleFrontend.configure {
dependsOn generateXtext
inputs.dir 'src/main/css'
inputs.dir 'src/main/html'
inputs.dir 'src/main/js'
inputs.dir "${buildDir}/generated/sources/xtext/js"
inputs.files('package.json', 'yarn.lock', 'webpack.config.js')
outputs.dir productionResources
}
tasks.register('webpackStats', RunNpmYarn) {
dependsOn installFrontend
dependsOn generateXtext
inputs.dir 'src/main/css'
inputs.dir 'src/main/html'
inputs.dir 'src/main/js'
inputs.dir "${buildDir}/generated/sources/xtext/js"
inputs.files('package.json', 'yarn.lock', 'webpack.config.js')
outputs.file "${buildDir}/webpack/stats.json"
script = 'run stats'
}
def eslint = tasks.register('eslint', RunNpmYarn) {
dependsOn installFrontend
inputs.dir 'src/main/js'
inputs.files('.eslintrc.js', 'tsconfig.json')
script = 'run check:eslint'
group = 'verification'
description = 'Check for TypeScript errors.'
}
def stylelint = tasks.register('stylelint', RunNpmYarn) {
dependsOn installFrontend
inputs.dir 'src/main/css'
inputs.file '.stylelintrc.js'
script = 'run check:stylelint'
group = 'verification'
description = 'Check for Sass errors.'
}
tasks.named('check') {
dependsOn(eslint, stylelint)
}
tasks.named('jar') {
dependsOn assembleFrontend
from(productionResources) {
into 'webapp'
}
}
apply plugin: 'application'
mainClassName = mainClass
distTar.enabled = false
distZip.enabled = false
apply plugin: 'com.github.johnrengelman.shadow'
shadowDistTar.enabled = false
shadowDistZip.enabled = false
tasks.named('shadowJar') {
dependsOn assembleFrontend
from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)
configurations = [project.configurations.runtimeClasspath]
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA','schema/*',
'.options', '.api_description', '*.profile', 'about.*', 'about_*.html', 'about_files/*',
'plugin.xml', 'systembundle.properties', 'profile.list', 'META-INF/resources/xtext/**')
append('plugin.properties')
from(productionResources) {
into 'webapp'
}
}
def jettyRun = tasks.register('jettyRun', JavaExec) {
dependsOn assembleFrontend
dependsOn sourceSets.main.runtimeClasspath
classpath = sourceSets.main.runtimeClasspath.filter{it.exists()}
main = mainClass
standardInput = System.in
environment BASE_RESOURCE: productionResources
group = 'run'
description = 'Start a Jetty web server serving the Xtex API and assets (without rebuilding assets).'
}
tasks.register('webpackServe', RunNpmYarn) {
dependsOn installFrontend
dependsOn generateXtext
outputs.dir "${webpackOutputDir}/development"
script = 'run serve'
group = 'run'
description = 'Start a Webpack dev server with hot module replacement.'
}
sonarqube.properties {
properties['sonar.sources'] += [
'src/main/css',
'src/main/html',
'src/main/js',
]
properties['sonar.exclusions'] += [
'src/main/css/xtext/**',
'src/main/js/xtext/**',
]
}
eclipse {
project.file.whenMerged {
natures.remove('org.eclipse.wst.common.modulecore.ModuleCoreNature')
}
}
|