@@ -64,11 +64,20 @@ val buildDirectory = layout.buildDirectory.asFile.get()
6464
6565val downloadConfigurationSchema by tasks.registering(Download ::class ) {
6666 src(configurationRepoZip)
67- dest(" $buildDirectory /configuration/opentelemetry-configuration.zip" )
67+ // The version is encoded in the filename so that a configurationTag change results in a new
68+ // path that doesn't yet exist, triggering a fresh download. On subsequent builds with the same
69+ // tag the file already exists and overwrite(false) skips the network request. Note: the
70+ // de.undercouch Download task always reports itself as not up-to-date, so overwrite(false) is
71+ // the intended mechanism for avoiding redundant downloads.
72+ //
73+ // The zip is stored in tmp/ so it is outside the Sync task's output directory (configuration/).
74+ dest(" $buildDirectory /tmp/opentelemetry-configuration-v$configurationTag .zip" )
6875 overwrite(false )
6976}
7077
71- val unzipConfigurationSchema by tasks.registering(Copy ::class ) {
78+ val unzipConfigurationSchema by tasks.registering(Sync ::class ) {
79+ // Sync (not Copy) removes stale files from the destination when the source changes, ensuring
80+ // files deleted or renamed between schema versions don't linger in the build dir.
7281 dependsOn(downloadConfigurationSchema)
7382
7483 from(zipTree(downloadConfigurationSchema.get().dest))
@@ -78,6 +87,7 @@ val unzipConfigurationSchema by tasks.registering(Copy::class) {
7887 path = pathParts.subList(1 , pathParts.size).joinToString(" /" )
7988 })
8089 into(" $buildDirectory /configuration/" )
90+ includeEmptyDirs = false
8191}
8292
8393jsonSchema2Pojo {
0 commit comments