diff options
author | 2023-04-08 22:56:44 +0200 | |
---|---|---|
committer | 2023-04-08 22:58:21 +0200 | |
commit | 561fac70fd3dc3ebe1cfbc50146757495fb828d5 (patch) | |
tree | 20aa72bbe438aaa70c8de264ff0d366758e7772d /subprojects/frontend/build.gradle | |
parent | refactor: remove TupleLike (diff) | |
download | refinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.tar.gz refinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.tar.zst refinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.zip |
build: convert Gradle scripts to Kotlin
Improves IDE support build scripts in IntelliJ.
There is no Eclipse IDE support, but Eclipse didn't have support for Groovy
either, so there is no degradation of functionality.
Diffstat (limited to 'subprojects/frontend/build.gradle')
-rw-r--r-- | subprojects/frontend/build.gradle | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/subprojects/frontend/build.gradle b/subprojects/frontend/build.gradle deleted file mode 100644 index 4cc2c5d7..00000000 --- a/subprojects/frontend/build.gradle +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | plugins { | ||
2 | id 'refinery-frontend-workspace' | ||
3 | id 'refinery-sonarqube' | ||
4 | } | ||
5 | |||
6 | import org.siouan.frontendgradleplugin.infrastructure.gradle.RunYarn | ||
7 | |||
8 | def viteOutputDir = "${buildDir}/vite" | ||
9 | def productionResources = file("${viteOutputDir}/production") | ||
10 | |||
11 | frontend { | ||
12 | assembleScript = 'run build' | ||
13 | } | ||
14 | |||
15 | configurations { | ||
16 | productionAssets { | ||
17 | canBeConsumed = true | ||
18 | canBeResolved = false | ||
19 | } | ||
20 | } | ||
21 | |||
22 | def installFrontend = tasks.named('installFrontend') | ||
23 | |||
24 | def sourcesWithoutTypegen = fileTree('src') { | ||
25 | exclude '**/*.typegen.ts' | ||
26 | } | ||
27 | |||
28 | def assembleFrontend = tasks.named('assembleFrontend') | ||
29 | assembleFrontend.configure { | ||
30 | dependsOn generateXStateTypes | ||
31 | inputs.dir 'public' | ||
32 | inputs.files sourcesWithoutTypegen | ||
33 | inputs.file 'index.html' | ||
34 | inputs.files('package.json', 'tsconfig.json', 'tsconfig.base.json', 'vite.config.ts') | ||
35 | inputs.file rootProject.file('yarn.lock') | ||
36 | outputs.dir productionResources | ||
37 | } | ||
38 | |||
39 | artifacts { | ||
40 | productionAssets(productionResources) { | ||
41 | builtBy assembleFrontend | ||
42 | } | ||
43 | } | ||
44 | |||
45 | def generateXStateTypes = tasks.register('generateXStateTypes', RunYarn) { | ||
46 | dependsOn installFrontend | ||
47 | inputs.files sourcesWithoutTypegen | ||
48 | inputs.file 'package.json' | ||
49 | inputs.file rootProject.file('yarn.lock') | ||
50 | outputs.dir 'src' | ||
51 | script = 'run typegen' | ||
52 | description = 'Generate TypeScript typings for XState state machines.' | ||
53 | } | ||
54 | |||
55 | def typecheckFrontend = tasks.register('typecheckFrontend', RunYarn) { | ||
56 | dependsOn installFrontend | ||
57 | dependsOn generateXStateTypes | ||
58 | inputs.dir 'src' | ||
59 | inputs.dir 'types' | ||
60 | inputs.files('package.json', 'tsconfig.json', 'tsconfig.base.json', 'tsconfig.node.json') | ||
61 | inputs.file rootProject.file('yarn.lock') | ||
62 | outputs.dir "${buildDir}/typescript" | ||
63 | script = 'run typecheck' | ||
64 | group = 'verification' | ||
65 | description = 'Check for TypeScript type errors.' | ||
66 | } | ||
67 | |||
68 | def lintFrontend = tasks.register('lintFrontend', RunYarn) { | ||
69 | dependsOn installFrontend | ||
70 | dependsOn generateXStateTypes | ||
71 | dependsOn typecheckFrontend | ||
72 | inputs.dir 'src' | ||
73 | inputs.dir 'types' | ||
74 | inputs.files('.eslintrc.cjs', 'prettier.config.cjs') | ||
75 | inputs.files('package.json', 'tsconfig.json', 'tsconfig.base.json', 'tsconfig.node.json') | ||
76 | inputs.file rootProject.file('yarn.lock') | ||
77 | if (project.hasProperty('ci')) { | ||
78 | outputs.file "${buildDir}/eslint.json" | ||
79 | script = 'run lint:ci' | ||
80 | } else { | ||
81 | script = 'run lint' | ||
82 | } | ||
83 | group = 'verification' | ||
84 | description = 'Check for TypeScript lint errors and warnings.' | ||
85 | } | ||
86 | |||
87 | def prettier = tasks.register('fixFrontend', RunYarn) { | ||
88 | dependsOn installFrontend | ||
89 | dependsOn generateXStateTypes | ||
90 | dependsOn typecheckFrontend | ||
91 | inputs.dir 'src' | ||
92 | inputs.dir 'types' | ||
93 | inputs.files('.eslintrc.cjs', 'prettier.config.cjs') | ||
94 | inputs.files('package.json', 'tsconfig.json', 'tsconfig.base.json', 'tsconfig.node.json') | ||
95 | inputs.file rootProject.file('yarn.lock') | ||
96 | script = 'run lint:fix' | ||
97 | group = 'verification' | ||
98 | description = 'Fix TypeScript lint errors and warnings.' | ||
99 | } | ||
100 | |||
101 | tasks.named('check') { | ||
102 | dependsOn(typecheckFrontend) | ||
103 | dependsOn(lintFrontend) | ||
104 | } | ||
105 | |||
106 | tasks.register('serveFrontend', RunYarn) { | ||
107 | dependsOn installFrontend | ||
108 | dependsOn generateXStateTypes | ||
109 | inputs.dir 'public' | ||
110 | inputs.files sourcesWithoutTypegen | ||
111 | inputs.file 'index.html' | ||
112 | inputs.files('package.json', 'tsconfig.json', 'tsconfig.base.json', 'vite.config.ts') | ||
113 | inputs.file rootProject.file('yarn.lock') | ||
114 | outputs.dir "${viteOutputDir}/development" | ||
115 | script = 'run serve' | ||
116 | group = 'run' | ||
117 | description = 'Start a Vite dev server with hot module replacement.' | ||
118 | } | ||
119 | |||
120 | tasks.named('clean') { | ||
121 | delete 'dev-dist' | ||
122 | delete fileTree('src') { | ||
123 | include '**/*.typegen.ts' | ||
124 | } | ||
125 | } | ||
126 | |||
127 | sonarqube.properties { | ||
128 | properties['sonar.sources'] = 'src' | ||
129 | property 'sonar.nodejs.executable', "${frontend.nodeInstallDirectory.get()}/bin/node" | ||
130 | property 'sonar.eslint.reportPaths', "${buildDir}/eslint.json" | ||
131 | } | ||