From 490d595fcc4f13920012d18eabde7c50db48596e Mon Sep 17 00:00:00 2001 From: "Kartikaya Gupta (kats)" Date: Fri, 3 Jan 2025 16:25:06 -0500 Subject: [PATCH] Explicitly set the working directory for running miskweb for compat across gradle versions GitOrigin-RevId: 83dd4597f7f21c42ca5e897531a989dc17622539 --- misk-admin/build.gradle.kts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/misk-admin/build.gradle.kts b/misk-admin/build.gradle.kts index bf4c4fb66b7..2999b49b079 100644 --- a/misk-admin/build.gradle.kts +++ b/misk-admin/build.gradle.kts @@ -86,6 +86,9 @@ abstract class MiskWebBuildTask @Inject constructor( @get:Internal abstract val rootDir: RegularFileProperty + @get:Internal + abstract val projectDir: RegularFileProperty + @get:PathSensitive(PathSensitivity.RELATIVE) @get:InputFiles abstract val inputFiles: ConfigurableFileCollection @@ -96,6 +99,7 @@ abstract class MiskWebBuildTask @Inject constructor( @TaskAction fun buildTabs() { val rootFile = rootDir.asFile.get() + val projectDir = projectDir.asFile.get() logger.lifecycle("Running miskweb build...") @@ -123,8 +127,9 @@ abstract class MiskWebBuildTask @Inject constructor( miskWebPath, "ci-build", "-e", ) { // this should run in one of the parent directories of the one containing the miskTab.json. - // By default, the execOps will run it in the project directory for the current project, which - // in our case will be the "service" directory, and that's just fine. + // What ExecOps does varies by gradle version, it seems, so use the project directory for + // the current project explicitly. + workingDir = projectDir isIgnoreExitValue = true // we will assert ourselves after dumping stdout // We need miskweb to be on the PATH. In some environments we have multiple hermit environments // and the misk hermit env is not the one that is active, so the misk/node_modules/.bin folder @@ -163,6 +168,7 @@ val buildMiskWeb = tasks.register("buildMiskWeb", MiskWebBuildTask::class.java) File(tabDir, "lib") } rootDir.set(project.rootDir) + projectDir.set(project.projectDir) inputFiles.setFrom(inputs) outputFiles.setFrom(outputs) }