diff options
Diffstat (limited to 'language-web/build.gradle')
-rw-r--r-- | language-web/build.gradle | 77 |
1 files changed, 61 insertions, 16 deletions
diff --git a/language-web/build.gradle b/language-web/build.gradle index 3e0008da..ff0f9e9c 100644 --- a/language-web/build.gradle +++ b/language-web/build.gradle | |||
@@ -1,31 +1,76 @@ | |||
1 | plugins { | ||
2 | id 'war' | ||
3 | } | ||
4 | |||
5 | dependencies { | 1 | dependencies { |
6 | compile project(':language') | 2 | compile project(':language') |
7 | compile project(':language-ide') | 3 | compile project(':language-ide') |
8 | compile "org.eclipse.xtext:org.eclipse.xtext.xbase.web:${xtextVersion}" | 4 | compile "org.eclipse.xtext:org.eclipse.xtext.xbase.web:${xtextVersion}" |
9 | compile "org.eclipse.xtext:org.eclipse.xtext.web.servlet:${xtextVersion}" | 5 | compile "org.eclipse.xtext:org.eclipse.xtext.web.servlet:${xtextVersion}" |
10 | compile "org.eclipse.xtend:org.eclipse.xtend.lib:${xtextVersion}" | 6 | compile "org.eclipse.xtend:org.eclipse.xtend.lib:${xtextVersion}" |
11 | compile "org.webjars:requirejs:2.3.6" | 7 | compile "org.eclipse.jetty:jetty-server:9.4.42.v20210604" |
12 | compile "org.webjars:requirejs-text:2.0.15" | 8 | compile "org.eclipse.jetty:jetty-annotations:9.4.42.v20210604" |
13 | compile "org.webjars:jquery:3.6.0" | 9 | compile "org.slf4j:slf4j-simple:1.7.31" |
14 | // CodeMirror 5.53.0 and later is incompatible with Xtext due to | 10 | } |
15 | // https://github.com/codemirror/CodeMirror/commit/b2d26b4ccb1d0994ae84d18ad8b84018de176da9#commitcomment-41525744 | 11 | |
16 | compile "org.webjars.npm:codemirror:5.52.2" | 12 | def webpackOutputDir = "${buildDir}/webpack" |
17 | providedCompile "org.eclipse.jetty:jetty-annotations:9.4.42.v20210604" | 13 | def productionResources = "${webpackOutputDir}/production" |
18 | providedCompile "org.eclipse.jetty:jetty-rewrite:9.4.42.v20210604" | 14 | def mainClass = 'org.eclipse.viatra.solver.language.web.ServerLauncher' |
19 | providedCompile "org.slf4j:slf4j-simple:1.7.31" | 15 | |
16 | apply plugin: 'com.moowork.node' | ||
17 | |||
18 | for (environment in ['production', 'development']) { | ||
19 | def taskName = 'webpack' + environment.substring(0, 1).toUpperCase() + environment.substring(1); | ||
20 | task(taskName, type: NpmTask) { | ||
21 | dependsOn ':language:generateXtext' | ||
22 | inputs.dir 'src/main/css' | ||
23 | inputs.dir 'src/main/html' | ||
24 | inputs.dir 'src/main/js' | ||
25 | inputs.dir "${buildDir}/generated/sources/xtext/js" | ||
26 | inputs.file 'webpack.config.js' | ||
27 | outputs.dir "${webpackOutputDir}/${environment}" | ||
28 | args = ['run', 'build'] | ||
29 | setEnvironment NODE_ENV: environment | ||
30 | } | ||
31 | } | ||
32 | |||
33 | apply plugin: 'application' | ||
34 | mainClassName = mainClass | ||
35 | distZip.enabled = false | ||
36 | |||
37 | jar { | ||
38 | dependsOn webpackProduction | ||
39 | from(productionResources) { | ||
40 | into 'webapp' | ||
41 | } | ||
42 | } | ||
43 | |||
44 | apply plugin: 'com.github.johnrengelman.shadow' | ||
45 | shadowDistZip.enabled = false | ||
46 | |||
47 | shadowJar { | ||
48 | dependsOn webpackProduction | ||
49 | from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output) | ||
50 | configurations = [project.configurations.runtime] | ||
51 | exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA','schema/*', | ||
52 | '.options', '.api_description', '*.profile', 'about.*', 'about_*.html', 'about_files/*', | ||
53 | 'plugin.xml', 'systembundle.properties', 'profile.list', 'META-INF/resources/xtext/**') | ||
54 | append('plugin.properties') | ||
55 | from(productionResources) { | ||
56 | into 'webapp' | ||
57 | } | ||
20 | } | 58 | } |
21 | 59 | ||
22 | task jettyRun(type:JavaExec) { | 60 | task jettyRun(type: JavaExec) { |
23 | dependsOn(sourceSets.main.runtimeClasspath) | 61 | dependsOn webpackDevelopment |
62 | dependsOn sourceSets.main.runtimeClasspath | ||
24 | classpath = sourceSets.main.runtimeClasspath.filter{it.exists()} | 63 | classpath = sourceSets.main.runtimeClasspath.filter{it.exists()} |
25 | main = 'org.eclipse.viatra.solver.language.web.ServerLauncher' | 64 | main = mainClass |
26 | standardInput = System.in | 65 | standardInput = System.in |
27 | group = 'run' | 66 | group = 'run' |
28 | description = 'Starts an example Jetty server with your language' | 67 | description = 'Starts an example Jetty server with your language' |
68 | environment( | ||
69 | DEV_MODE: 'true', | ||
70 | LISTEN_ADDRESS: 'localhost', | ||
71 | LISTEN_PORT: '1313', | ||
72 | BASE_RESOURCE: "${webpackOutputDir}/development" | ||
73 | ) | ||
29 | } | 74 | } |
30 | 75 | ||
31 | eclipse { | 76 | eclipse { |