Skip to content

Commit 445501f

Browse files
committed
Refactor build scripts
1 parent ce94066 commit 445501f

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ tasks.withType(JavaCompile).configureEach {
3535
}
3636

3737
tasks.register('processUiResources', Copy) {
38-
from project(':ui').tasks.named('buildFrontend')
38+
from project(':ui').layout.buildDirectory.dir('dist')
3939
into layout.buildDirectory.dir('resources/main/console')
40+
dependsOn project(':ui').tasks.named('assemble')
4041
shouldRunAfter tasks.named('processResources')
4142
}
4243

ui/build.gradle

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
plugins {
2-
id 'base'
3-
id "com.github.node-gradle.node" version "7.1.0"
2+
id 'base'
3+
id "com.github.node-gradle.node" version "7.1.0"
44
}
55

66
group 'run.halo.starter.ui'
77

88
tasks.register('buildFrontend', PnpmTask) {
9-
args = ['build']
10-
dependsOn tasks.named('pnpmInstall')
11-
inputs.dir(layout.projectDirectory.dir('src'))
12-
inputs.files(fileTree(
13-
dir: layout.projectDirectory,
14-
includes: ['*.cjs', '*.ts', '*.js', '*.json', '*.yaml']))
15-
outputs.dir(layout.buildDirectory.dir('dist'))
16-
shouldRunAfter(tasks.named('check'))
9+
group = 'build'
10+
description = 'Builds the UI project using pnpm.'
11+
args = ['build']
12+
dependsOn tasks.named('pnpmInstall')
13+
inputs.dir(layout.projectDirectory.dir('src'))
14+
inputs.files(fileTree(
15+
dir: layout.projectDirectory,
16+
includes: ['*.cjs', '*.ts', '*.js', '*.json', '*.yaml']))
17+
outputs.dir(layout.buildDirectory.dir('dist'))
1718
}
1819

19-
tasks.register('checkFrontend', PnpmTask) {
20-
args = ['test:unit']
21-
dependsOn tasks.named('pnpmInstall')
20+
tasks.register('pnpmCheck', PnpmTask) {
21+
group = 'verification'
22+
description = 'Runs unit tests using pnpm.'
23+
args = ['test:unit']
24+
dependsOn tasks.named('pnpmInstall')
2225
}
2326

2427
tasks.named('check') {
25-
dependsOn tasks.named('checkFrontend')
28+
dependsOn tasks.named('pnpmCheck')
2629
}
2730

28-
tasks.named('build') {
29-
dependsOn tasks.named('buildFrontend')
31+
tasks.named('assemble') {
32+
dependsOn tasks.named('buildFrontend')
3033
}

0 commit comments

Comments
 (0)