Skip to content

Commit

Permalink
Vite. Integrate preparation tasks into the build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
porotkin committed Nov 28, 2024
1 parent 986e94a commit d7dfecc
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,28 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.register

private const val ROLLUP_PLUGIN_SOURCEMAPS = "rollup-plugin-sourcemaps"

class ViteApplicationPlugin : Plugin<Project> {
override fun apply(target: Project): Unit = with(target) {
tasks.register<KotlinVitePreparationTask>(Vite.developmentPreparationTask) {
group = DEFAULT_TASK_GROUP

dependsOn("jsDevelopmentExecutableCompileSync")
}
tasks.register<KotlinVitePreparationTask>(Vite.productionPreparationTask) {
group = DEFAULT_TASK_GROUP

dependsOn("jsProductionExecutableCompileSync")
}

tasks.create<KotlinViteBuildTask>(Vite.productionTask) {
group = DEFAULT_TASK_GROUP

dependsOn(Vite.productionPreparationTask)

mode.set(ViteMode.PRODUCTION)
outputDirectory.convention(getProductionDistDirectory())

Expand All @@ -21,6 +35,8 @@ class ViteApplicationPlugin : Plugin<Project> {
tasks.create<KotlinViteBuildTask>(Vite.developmentTask) {
group = DEFAULT_TASK_GROUP

dependsOn(Vite.developmentPreparationTask)

mode.set(ViteMode.DEVELOPMENT)
outputDirectory.convention(getDevelopmentDistDirectory())

Expand All @@ -34,6 +50,8 @@ class ViteApplicationPlugin : Plugin<Project> {
tasks.create<KotlinViteDevTask>(Vite.runTask) {
group = DEFAULT_TASK_GROUP

dependsOn(Vite.developmentPreparationTask)

mode.set(ViteMode.DEVELOPMENT)

dependOnCompile(COMPILE_DEVELOPMENT)
Expand Down

0 comments on commit d7dfecc

Please sign in to comment.