Skip to content

Commit

Permalink
Fix subproject setup for sonar plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 committed Jan 10, 2025
1 parent 34c4926 commit affedf6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
13 changes: 7 additions & 6 deletions sonar/src/main/kotlin/com/bakdata/gradle/SonarPlugin.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -69,7 +69,7 @@ class SonarPlugin : Plugin<Project> {
}

tasks.withType<JacocoReport> {
reports.xml.getRequired().set(true)
reports.xml.required.set(true)
}

rootProject.tasks.named("sonarqube") { dependsOn(tasks.withType<JacocoReport>(), tasks.withType<Test>()) }
Expand All @@ -80,11 +80,12 @@ class SonarPlugin : Plugin<Project> {
tasks.register<JacocoReport>("jacocoRootReport") {
subprojects {
executionData(tasks.withType<JacocoReport>().map { it.executionData })

afterEvaluate {
sourceDirectories.from(files(project.the<SourceSetContainer>()["main"].allSource.srcDirs))
classDirectories.from(files(project.the<SourceSetContainer>()["main"].output))
}
}
sourceDirectories.from(files(subprojects.map {
it.the<SourceSetContainer>()["main"].allSource.srcDirs
}))
classDirectories.from(files(subprojects.map { it.the<SourceSetContainer>()["main"].output }))
reports {
html.required.set(true)
xml.required.set(true)
Expand Down

0 comments on commit affedf6

Please sign in to comment.