From a0935402dffe1691ee3c7b5632012f9878480122 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 27 Nov 2024 22:45:38 +0100 Subject: [PATCH] build(web-app): Make cross-project sharing of outputs more reliable Follow the instructions at [1]. Fixes #9515. [1]: https://docs.gradle.org/current/samples/sample_cross_project_output_sharing.html Signed-off-by: Sebastian Schuberth --- plugins/reporters/web-app-template/build.gradle.kts | 8 ++++++++ plugins/reporters/web-app/build.gradle.kts | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/plugins/reporters/web-app-template/build.gradle.kts b/plugins/reporters/web-app-template/build.gradle.kts index 20bd26c99ddff..71747463bf6ff 100644 --- a/plugins/reporters/web-app-template/build.gradle.kts +++ b/plugins/reporters/web-app-template/build.gradle.kts @@ -120,3 +120,11 @@ tasks.register("clean") { delete("node_modules") delete("yarn-error.log") } + +val webAppTemplateConfiguration by configurations.creating { + isCanBeResolved = false +} + +artifacts { + add(webAppTemplateConfiguration.name, yarnBuild) +} diff --git a/plugins/reporters/web-app/build.gradle.kts b/plugins/reporters/web-app/build.gradle.kts index da056def27026..aeed950912634 100644 --- a/plugins/reporters/web-app/build.gradle.kts +++ b/plugins/reporters/web-app/build.gradle.kts @@ -22,12 +22,17 @@ plugins { id("ort-plugin-conventions") } +val webAppTemplateConfiguration by configurations.creating { + isCanBeConsumed = false +} + +dependencies { + webAppTemplateConfiguration(project(":plugins:reporters:web-app-template", "webAppTemplateConfiguration")) +} + val generatedResourcesDir = layout.buildDirectory.dir("generated-resources/main") val copyWebAppTemplate by tasks.registering(Copy::class) { - val webAppTemplateProject = project.project(projects.plugins.reporters.webAppTemplate.path) - dependsOn(webAppTemplateProject.tasks["yarnBuild"]) - - from(webAppTemplateProject.file("build")) { + from(webAppTemplateConfiguration) { include("scan-report-template.html") }