aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/build.gradle
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-11-19 20:17:56 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-11-20 03:00:38 +0100
commit40ebe0088bc97f644889d915b0524b49d4a21e4c (patch)
tree3d8a22d8f36634e3ac678f83600d9f443b47bc90 /language-web/build.gradle
parentbuild: fix cross-project group and version config (diff)
downloadrefinery-40ebe0088bc97f644889d915b0524b49d4a21e4c.tar.gz
refinery-40ebe0088bc97f644889d915b0524b49d4a21e4c.tar.zst
refinery-40ebe0088bc97f644889d915b0524b49d4a21e4c.zip
build: upgrade to yarn 3
Also upgrades various frontend dependencies. We can't upgrade to typescript 4.5 yet, because https://github.com/yarnpkg/berry/pull/3760 is not released yet.
Diffstat (limited to 'language-web/build.gradle')
-rw-r--r--language-web/build.gradle40
1 files changed, 29 insertions, 11 deletions
diff --git a/language-web/build.gradle b/language-web/build.gradle
index 7306869b..b1ad86a7 100644
--- a/language-web/build.gradle
+++ b/language-web/build.gradle
@@ -4,7 +4,7 @@ plugins {
4 id 'refinery-xtext-conventions' 4 id 'refinery-xtext-conventions'
5} 5}
6 6
7import org.siouan.frontendgradleplugin.infrastructure.gradle.RunNpmYarn 7import org.siouan.frontendgradleplugin.infrastructure.gradle.RunYarn
8 8
9dependencies { 9dependencies {
10 implementation project(':refinery-language') 10 implementation project(':refinery-language')
@@ -34,17 +34,35 @@ def serverMainClass = 'tools.refinery.language.web.ServerLauncher'
34def nodeDirectory = "${rootDir}/.gradle/node" 34def nodeDirectory = "${rootDir}/.gradle/node"
35 35
36frontend { 36frontend {
37 nodeVersion = project.ext.nodeVersion 37 nodeVersion = project.ext['frontend.nodeVersion']
38 nodeInstallDirectory = file(nodeDirectory) 38 nodeInstallDirectory = file('.node')
39 yarnEnabled = true 39 yarnEnabled = true
40 yarnVersion = project.ext.yarnVersion 40 yarnVersion = project.ext['frontend.yarnVersion']
41 yarnInstallDirectory = file("${rootDir}/.gradle/yarn")
42 assembleScript = 'run assemble:webpack' 41 assembleScript = 'run assemble:webpack'
43} 42}
44 43
44tasks.named('installYarnGlobally') {
45 // Do not check for updates all the time, since we only use yarn 1 for calling yarn berry.
46 outputs.dir "${frontend.nodeInstallDirectory.get()}/lib/node_modules/yarn"
47}
48
49tasks.named('enableYarnBerry') {
50 // Yarn berry is checked into the repository, so there's no need to install it.
51 enabled = false
52}
53
54tasks.named('installYarn') {
55 // Yarn berry is checked into the repository, so there's no need to install it.
56 enabled = false
57}
58
45def installFrontend = tasks.named('installFrontend') 59def installFrontend = tasks.named('installFrontend')
60installFrontend.configure {
61 inputs.files('package.json', 'yarn.lock')
62 outputs.file '.pnp.cjs'
63}
46 64
47def generateLezerGrammar = tasks.register('generateLezerGrammar', RunNpmYarn) { 65def generateLezerGrammar = tasks.register('generateLezerGrammar', RunYarn) {
48 dependsOn installFrontend 66 dependsOn installFrontend
49 inputs.file('src/main/js/language/problem.grammar') 67 inputs.file('src/main/js/language/problem.grammar')
50 inputs.files('package.json', 'yarn.lock') 68 inputs.files('package.json', 'yarn.lock')
@@ -65,7 +83,7 @@ assembleFrontend.configure {
65 outputs.dir productionResources 83 outputs.dir productionResources
66} 84}
67 85
68def eslint = tasks.register('eslint', RunNpmYarn) { 86def eslint = tasks.register('eslint', RunYarn) {
69 dependsOn installFrontend 87 dependsOn installFrontend
70 inputs.dir 'src/main/js' 88 inputs.dir 'src/main/js'
71 inputs.files('.eslintrc.js', 'tsconfig.json') 89 inputs.files('.eslintrc.js', 'tsconfig.json')
@@ -79,7 +97,7 @@ def eslint = tasks.register('eslint', RunNpmYarn) {
79 description = 'Check for TypeScript errors.' 97 description = 'Check for TypeScript errors.'
80} 98}
81 99
82def stylelint = tasks.register('stylelint', RunNpmYarn) { 100def stylelint = tasks.register('stylelint', RunYarn) {
83 dependsOn installFrontend 101 dependsOn installFrontend
84 inputs.dir 'src/main/css' 102 inputs.dir 'src/main/css'
85 inputs.file '.stylelintrc.js' 103 inputs.file '.stylelintrc.js'
@@ -127,10 +145,10 @@ def jettyRun = tasks.register('jettyRun', JavaExec) {
127 standardInput = System.in 145 standardInput = System.in
128 environment BASE_RESOURCE: productionResources 146 environment BASE_RESOURCE: productionResources
129 group = 'run' 147 group = 'run'
130 description = 'Start a Jetty web server serving the Xtex API and assets (without rebuilding assets).' 148 description = 'Start a Jetty web server serving the Xtex API and assets.'
131} 149}
132 150
133tasks.register('webpackServe', RunNpmYarn) { 151tasks.register('webpackServe', RunYarn) {
134 dependsOn installFrontend 152 dependsOn installFrontend
135 dependsOn generateLezerGrammar 153 dependsOn generateLezerGrammar
136 outputs.dir "${webpackOutputDir}/development" 154 outputs.dir "${webpackOutputDir}/development"
@@ -145,7 +163,7 @@ sonarqube.properties {
145 'src/main/html', 163 'src/main/html',
146 'src/main/js', 164 'src/main/js',
147 ] 165 ]
148 property 'sonar.nodejs.executable', "${nodeDirectory}/bin/node" 166 property 'sonar.nodejs.executable', "${frontend.nodeInstallDirectory.get()}/bin/node"
149 property 'sonar.eslint.reportPaths', "${buildDir}/eslint.json" 167 property 'sonar.eslint.reportPaths', "${buildDir}/eslint.json"
150 property 'sonar.css.stylelint.reportPaths', "${buildDir}/stylelint.json" 168 property 'sonar.css.stylelint.reportPaths', "${buildDir}/stylelint.json"
151 // SonarJS does not pick up typescript files with `exactOptionalPropertyTypes` 169 // SonarJS does not pick up typescript files with `exactOptionalPropertyTypes`