From d0f6c0f30751f9f2bd8a2799386a5bbb57762d2c Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Fri, 18 Sep 2026 16:38:11 +0200 Subject: [PATCH] Create directory fido-mds-cache in runtime phase Before this, `./gradlew clean integrationTest` fails because the `fido-mds-cache` directory does not exist. This is because the `mkdirs()` statement in the `integrationTest` task configuration executes in the configuration phase, while the `clean` task executes in the runtime phase and deletes the directory after the `mkdirs()` statement has created it (or it already existed). Putting the `mkdirs()` statement in a separate prerequisite task ensures that it executes after the `clean` task but before the `integrationTest` task (unless the user explicitly runs `./gradlew makeMdsCacheDir clean integrationTest`, but that's on them in that case). --- webauthn-server-attestation/build.gradle.kts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/webauthn-server-attestation/build.gradle.kts b/webauthn-server-attestation/build.gradle.kts index fcced5a71..4dc2597e3 100644 --- a/webauthn-server-attestation/build.gradle.kts +++ b/webauthn-server-attestation/build.gradle.kts @@ -48,6 +48,14 @@ dependencies { testImplementation("org.slf4j:slf4j-api") } +val mdsCacheDir = project.layout.buildDirectory.dir("fido-mds-cache").get().asFile +tasks.register("makeMdsCacheDir") { + outputs.dir(mdsCacheDir) + doLast { + mdsCacheDir.mkdirs() + } +} + val integrationTest = tasks.register("integrationTest") { description = "Runs integration tests." group = "verification" @@ -55,10 +63,8 @@ val integrationTest = tasks.register("integrationTest") { testClassesDirs = sourceSets["integrationTest"].output.classesDirs classpath = sourceSets["integrationTest"].runtimeClasspath shouldRunAfter(tasks.test) - val mdsCacheDir = project.layout.buildDirectory.dir("fido-mds-cache").get().asFile - mdsCacheDir.mkdirs() + dependsOn(tasks["makeMdsCacheDir"]) environment("FIDO_MDS_CACHE_DIR", mdsCacheDir.absolutePath) - inputs.dir(mdsCacheDir) } tasks["check"].dependsOn(integrationTest)