Skip to content

Commit

Permalink
update gradle
Browse files Browse the repository at this point in the history
Signed-off-by: neo <1100909+neowu@users.noreply.github.com>
  • Loading branch information
neowu committed Nov 18, 2024
1 parent 9c4dae6 commit 8b92159
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 10 additions & 4 deletions buildSrc/src/main/kotlin/frontend.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ tasks.named("mkdir") {
}
}

interface ExecSupport {
@get:Inject
val operation: ExecOperations
}

afterEvaluate {
if (!project.extensions.extraProperties.has("frontendDir")) throw Error("project does not have frontendDir property, assign by project.ext[\"frontendDir\"]")
val frontendDir = file(project.extensions.extraProperties.get("frontendDir") as String)
Expand All @@ -13,17 +18,18 @@ afterEvaluate {
doLast {
if (!frontendDir.exists()) throw Error("$frontendDir does not exist")

exec {
val support = project.objects.newInstance<ExecSupport>()
support.operation.exec {
workingDir(frontendDir)
commandLine(Frontend.commandLine(listOf("yarn", "install")))
commandLine(Frontend.commandLine(listOf("pnpm", "install")))
}

val command = mutableListOf("yarn", "run", "build")
val command = mutableListOf("pnpm", "run", "build")

val env = project.properties["env"] // use gradlew -Penv=${env} to pass
if (env != null) command.addAll(listOf("--env", env as String))

exec {
support.operation.exec {
workingDir(frontendDir)
commandLine(Frontend.commandLine(command))
}
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
org.gradle.caching=true
org.gradle.warning.mode=all
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true

0 comments on commit 8b92159

Please sign in to comment.