Skip to content

Commit

Permalink
Migrate task dependencies to NPM v3 plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Billing committed Feb 7, 2021
1 parent 05cc657 commit cf9c152
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/dependencies/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object Versions {

object Plugins {
val SHADOW = "6.1.0"
val NODEJS = "2.2.4"
val NODEJS = "3.0.0"
val DEPENDENCY_VERSIONS = "0.36.0"
val GIT_VERSION_TAG = "0.12.3"

Expand Down
42 changes: 21 additions & 21 deletions tnoodle-ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import com.moowork.gradle.node.NodeExtension
import com.github.gradle.node.NodeExtension

description = "A web ui for TNoodle that uses modern technology"

Expand All @@ -8,12 +8,19 @@ plugins {
}

configure<NodeExtension> {
download = true
version = "12.18.3"
download.set(true)
version.set("12.18.3")
}

tasks.getByName("yarn_build") {
dependsOn("yarn_install")
val yarnInstall = tasks.named("yarn_install") {
inputs.file("package.json")
inputs.file("yarn.lock")

outputs.dir("node_modules")
}

val yarnBuild = tasks.named("yarn_build") {
dependsOn(yarnInstall)

inputs.files(fileTree("src").exclude("*.css"))
inputs.dir("public")
Expand All @@ -23,32 +30,25 @@ tasks.getByName("yarn_build") {
outputs.file("${project.buildDir}/index.html")
}

tasks.getByName("yarn_install") {
inputs.file("package.json")
inputs.file("yarn.lock")

outputs.dir("node_modules")
val yarnTest = tasks.named("yarn_test") {
dependsOn(yarnBuild)
}

tasks.getByName("assemble") {
dependsOn("packageReactFrontend")
val yarnPrettier = tasks.named("yarn_prettier") {
dependsOn(yarnInstall)
}

tasks.getByName("check") {
dependsOn("yarn_test")
dependsOn("yarn_prettier")
dependsOn(yarnTest)
dependsOn(yarnPrettier)
}

tasks.getByName("yarn_test") {
dependsOn("yarn_install")
}

tasks.getByName("yarn_prettier") {
dependsOn("yarn_install")
tasks.getByName("assemble") {
dependsOn("packageReactFrontend")
}

tasks.create<Zip>("packageReactFrontend") {
dependsOn("yarn_build")
dependsOn(yarnBuild)

archiveBaseName.set("react-new-frontend")
archiveExtension.set("jar")
Expand Down

0 comments on commit cf9c152

Please sign in to comment.