-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.gradle.kts
89 lines (76 loc) · 2.36 KB
/
build.gradle.kts
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
/*
* SPDX-FileCopyrightText: 2021-2024 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
import org.siouan.frontendgradleplugin.infrastructure.gradle.RunYarnTaskType
import tools.refinery.gradle.MavenPublishPlugin
plugins {
alias(pluginLibs.plugins.versions)
id("tools.refinery.gradle.eclipse")
id("tools.refinery.gradle.frontend-worktree")
id("tools.refinery.gradle.sonarqube")
}
val frontendFiles: FileCollection = files(
"yarn.lock",
"package.json",
"tsconfig.json",
"tsconfig.base.json",
"eslintrc.cjs",
"prettier.config.cjs",
"vite.config.ts",
) + fileTree("scripts") {
include("**/*.cjs")
}
val mavenRepositoryDir = layout.buildDirectory.map { it.dir("repo") }
tasks {
val typeCheckFrontend by registering(RunYarnTaskType::class) {
dependsOn(installFrontend)
inputs.files(frontendFiles)
outputs.dir(layout.buildDirectory.dir("typescript"))
args.set("run typecheck")
group = "verification"
description = "Check for TypeScript type errors."
}
val lintFrontend by registering(RunYarnTaskType::class) {
dependsOn(installFrontend)
dependsOn(typeCheckFrontend)
inputs.files(frontendFiles)
outputs.file(layout.buildDirectory.file("eslint.json"))
args.set("run lint")
group = "verification"
description = "Check for TypeScript lint errors and warnings."
}
register<RunYarnTaskType>("fixFrontend") {
dependsOn(installFrontend)
dependsOn(typeCheckFrontend)
inputs.files(frontendFiles)
args.set("run lint:fix")
group = "verification"
description = "Fix TypeScript lint errors and warnings."
}
check {
dependsOn(typeCheckFrontend)
dependsOn(lintFrontend)
}
}
val cleanMavenRepository by tasks.registering(Delete::class) {
delete(mavenRepositoryDir)
}
val mavenRepository by tasks.registering(Task::class) {
dependsOn(cleanMavenRepository)
}
gradle.projectsEvaluated {
mavenRepository.configure {
for (subproject in rootProject.subprojects) {
if (subproject.plugins.hasPlugin(MavenPublishPlugin::class)) {
dependsOn(subproject.tasks.named("publishMavenJavaPublicationToFileRepository"))
}
}
dependsOn(project("refinery-gradle-plugins").tasks.named("publishAllPublicationsToFileRepository"))
}
}
sonarqube.properties {
property("sonar.nodejs.executable", "${frontend.nodeInstallDirectory.get()}/bin/node")
property("sonar.eslint.reportPaths", "${layout.buildDirectory.get()}/eslint.json")
}