From affedf632135baf09502408955e6ad7f3edaad55 Mon Sep 17 00:00:00 2001 From: Philipp Schirmer Date: Fri, 10 Jan 2025 12:12:44 +0100 Subject: [PATCH] Fix subproject setup for sonar plugin --- build.gradle.kts | 2 +- .../main/kotlin/com/bakdata/gradle/SonarPlugin.kt | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a134a96..6951966 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ plugins { id("com.bakdata.release") version "1.4.0" // eat your own dog food - apply the plugins to this plugin project id("com.bakdata.sonar") version "1.4.0" - id("com.bakdata.sonatype") version "1.4.0" + id("com.bakdata.sonatype") version "1.4.1" id("org.gradle.kotlin.kotlin-dsl") version "4.1.2" apply false id("com.gradle.plugin-publish") version "1.2.1" apply false } diff --git a/sonar/src/main/kotlin/com/bakdata/gradle/SonarPlugin.kt b/sonar/src/main/kotlin/com/bakdata/gradle/SonarPlugin.kt index a191024..85cc928 100644 --- a/sonar/src/main/kotlin/com/bakdata/gradle/SonarPlugin.kt +++ b/sonar/src/main/kotlin/com/bakdata/gradle/SonarPlugin.kt @@ -1,7 +1,7 @@ /* * The MIT License * - * Copyright (c) 2024 bakdata GmbH + * Copyright (c) 2025 bakdata GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -69,7 +69,7 @@ class SonarPlugin : Plugin { } tasks.withType { - reports.xml.getRequired().set(true) + reports.xml.required.set(true) } rootProject.tasks.named("sonarqube") { dependsOn(tasks.withType(), tasks.withType()) } @@ -80,11 +80,12 @@ class SonarPlugin : Plugin { tasks.register("jacocoRootReport") { subprojects { executionData(tasks.withType().map { it.executionData }) + + afterEvaluate { + sourceDirectories.from(files(project.the()["main"].allSource.srcDirs)) + classDirectories.from(files(project.the()["main"].output)) + } } - sourceDirectories.from(files(subprojects.map { - it.the()["main"].allSource.srcDirs - })) - classDirectories.from(files(subprojects.map { it.the()["main"].output })) reports { html.required.set(true) xml.required.set(true)