Skip to content

Commit

Permalink
Fix references to Gradle buildDirectory since upgrading to 8.4 (#2379)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Oct 9, 2023
1 parent aa962c0 commit 9623871
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies {

val copyAgentTask = project.tasks.register<Copy>("copyAgent") {
from(agentDeps)
into("${project.layout.buildDirectory}/agent")
into("${project.layout.buildDirectory.dir("agent").get().asFile}")
rename("applicationinsights-agent(.+).jar", "agent.jar")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class ClassPathPlugin : Plugin<Project> {
classDirectories.files.map { project.fileTree(it) { exclude(extension.jacocoExclusions) } }
)
)
executionData.setFrom(project.fileTree(project.layout.buildDirectory).include("/jacoco/*.exec"))
executionData
.setFrom(project.fileTree(project.layout.buildDirectory.get().asFile.path)
.include("/jacoco/*.exec"))
reports {
html.required.set(true)
xml.required.set(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class JibConfigPlugin : Plugin<Project> {
extraDirectories {
paths {
path {
setFrom("${project.rootProject.layout.buildDirectory}")
setFrom("${project.rootProject.layout.buildDirectory.get().asFile}")
includes.add("agent/agent.jar")
}
path {
setFrom("${project.layout.buildDirectory}/agent")
setFrom("${project.layout.buildDirectory.dir("agent").get().asFile}")
includes.add("applicationinsights*.json")
into = "/agent"
}
Expand All @@ -45,7 +45,7 @@ class JibConfigPlugin : Plugin<Project> {
val copyAgent = project.rootProject.tasks.named("copyAgent")
val copyAppInsightsConfig = project.tasks.register<Copy>("copyAppInsightsConfig") {
from("${project.projectDir}/applicationinsights.json")
into("${project.layout.buildDirectory}/agent")
into("${project.layout.buildDirectory.dir("agent").get().asFile}")
}
val assemble = project.tasks.named("assemble")
project.tasks.withType<BuildImageTask>().named("jib") {
Expand All @@ -69,14 +69,15 @@ class JibConfigPlugin : Plugin<Project> {
}
dependsOn(copyAgent, copyAppInsightsConfig, assemble)
inputs.dir("deploy")
val buildDir = project.layout.buildDirectory.get().asFile.path
inputs.files(
"${project.layout.buildDirectory}/agent",
"${project.layout.buildDirectory}/classes",
"${project.layout.buildDirectory}/generated",
"${project.layout.buildDirectory}/resources",
"$buildDir/agent",
"$buildDir/classes",
"$buildDir/generated",
"$buildDir/resources",
project.configurations[jib!!.configurationName.get()].resolvedConfiguration.files
)
outputs.file("${project.layout.buildDirectory}/jib-image.id")
outputs.file("$buildDir/jib-image.id")
outputs.cacheIf { true }
}
}
Expand Down

0 comments on commit 9623871

Please sign in to comment.