Fix gradle build deprecation warnings (#5759)
This commit is contained in:
parent
3b1c6d9108
commit
d855771dc3
|
@ -65,6 +65,6 @@ class OtelVersionClassPlugin : Plugin<Project> {
|
|||
}
|
||||
|
||||
private fun buildOutDir(project: Project): File {
|
||||
return File(project.buildDir, "generated/sources/version/java/main")
|
||||
return File(project.layout.buildDirectory.asFile.get(), "generated/sources/version/java/main")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,20 @@ package io.opentelemetry.gradle
|
|||
import com.squareup.wire.schema.SchemaHandler
|
||||
|
||||
class ProtoFieldsWireHandlerFactory : SchemaHandler.Factory{
|
||||
@Deprecated("deprecated in parent")
|
||||
override fun create(): SchemaHandler {
|
||||
return ProtoFieldsWireHandler()
|
||||
}
|
||||
}
|
||||
|
||||
override fun create(
|
||||
includes: List<String>,
|
||||
excludes: List<String>,
|
||||
exclusive: Boolean,
|
||||
outDirectory: String,
|
||||
options: Map<String, String>
|
||||
): SchemaHandler {
|
||||
@Suppress("DEPRECATION")
|
||||
return create()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ afterEvaluate {
|
|||
.filter { it.plugins.hasPlugin("maven-publish") }
|
||||
|
||||
generateBuildSubstitutions {
|
||||
val outputFile = File(buildDir, "substitutions.gradle.kts")
|
||||
val outputFile = File(layout.buildDirectory.asFile.get(), "substitutions.gradle.kts")
|
||||
outputs.file(outputFile)
|
||||
val substitutionSnippet = bomProjects.joinToString(
|
||||
separator = "\n",
|
||||
|
|
|
@ -163,7 +163,7 @@ plugins.withId("otel.publish-conventions") {
|
|||
tasks {
|
||||
register("generateVersionResource") {
|
||||
val moduleName = otelJava.moduleName
|
||||
val propertiesDir = moduleName.map { File(buildDir, "generated/properties/${it.replace('.', '/')}") }
|
||||
val propertiesDir = moduleName.map { File(layout.buildDirectory.asFile.get(), "generated/properties/${it.replace('.', '/')}") }
|
||||
|
||||
inputs.property("project.version", project.version.toString())
|
||||
outputs.dir(propertiesDir)
|
||||
|
@ -176,7 +176,7 @@ plugins.withId("otel.publish-conventions") {
|
|||
|
||||
sourceSets {
|
||||
main {
|
||||
output.dir("$buildDir/generated/properties", "builtBy" to "generateVersionResource")
|
||||
output.dir("${layout.buildDirectory.asFile.get()}/generated/properties", "builtBy" to "generateVersionResource")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,9 @@ jmh {
|
|||
}
|
||||
|
||||
jmhReport {
|
||||
jmhResultPath = file("$buildDir/results/jmh/results.json").absolutePath
|
||||
jmhReportOutput = file("$buildDir/results/jmh").absolutePath
|
||||
val buildDirectory = layout.buildDirectory.asFile.get()
|
||||
jmhResultPath = file("$buildDirectory/results/jmh/results.json").absolutePath
|
||||
jmhReportOutput = file("$buildDirectory/results/jmh").absolutePath
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
|
|
@ -50,10 +50,11 @@ dependencies {
|
|||
// TODO(jack-berg): update ref to be released version when available
|
||||
val configurationRef = "2107dbb6f2a6c99fe2f55d550796ee7e2286fd1d"
|
||||
val configurationRepoZip = "https://github.com/open-telemetry/opentelemetry-configuration/archive/$configurationRef.zip"
|
||||
val buildDirectory = layout.buildDirectory.asFile.get()
|
||||
|
||||
val downloadConfigurationSchema by tasks.registering(Download::class) {
|
||||
src(configurationRepoZip)
|
||||
dest("$buildDir/configuration/opentelemetry-configuration.zip")
|
||||
dest("$buildDirectory/configuration/opentelemetry-configuration.zip")
|
||||
overwrite(false)
|
||||
}
|
||||
|
||||
|
@ -66,12 +67,12 @@ val unzipConfigurationSchema by tasks.registering(Copy::class) {
|
|||
val pathParts = path.split("/")
|
||||
path = pathParts.subList(1, pathParts.size).joinToString("/")
|
||||
})
|
||||
into("$buildDir/configuration/")
|
||||
into("$buildDirectory/configuration/")
|
||||
}
|
||||
|
||||
jsonSchema2Pojo {
|
||||
sourceFiles = setOf(file("$buildDir/configuration/schema"))
|
||||
targetDirectory = file("$buildDir/generated/sources/js2p/java/main")
|
||||
sourceFiles = setOf(file("$buildDirectory/configuration/schema"))
|
||||
targetDirectory = file("$buildDirectory/generated/sources/js2p/java/main")
|
||||
targetPackage = "io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model"
|
||||
|
||||
// Clear old source files to avoid contaminated source dir when updating
|
||||
|
@ -99,8 +100,8 @@ generateJsonSchema2Pojo.dependsOn(unzipConfigurationSchema)
|
|||
val jsonSchema2PojoPostProcessing by tasks.registering(Copy::class) {
|
||||
dependsOn(generateJsonSchema2Pojo)
|
||||
|
||||
from("$buildDir/generated/sources/js2p")
|
||||
into("$buildDir/generated/sources/js2p-tmp")
|
||||
from("$buildDirectory/generated/sources/js2p")
|
||||
into("$buildDirectory/generated/sources/js2p-tmp")
|
||||
filter {
|
||||
it
|
||||
// Remove @Nullable annotation so it can be deterministically added later
|
||||
|
@ -116,13 +117,13 @@ val jsonSchema2PojoPostProcessing by tasks.registering(Copy::class) {
|
|||
val overwriteJs2p by tasks.registering(Copy::class) {
|
||||
dependsOn(jsonSchema2PojoPostProcessing)
|
||||
|
||||
from("$buildDir/generated/sources/js2p-tmp")
|
||||
into("$buildDir/generated/sources/js2p")
|
||||
from("$buildDirectory/generated/sources/js2p-tmp")
|
||||
into("$buildDirectory/generated/sources/js2p")
|
||||
}
|
||||
val deleteJs2pTmp by tasks.registering(Delete::class) {
|
||||
dependsOn(overwriteJs2p)
|
||||
|
||||
delete("$buildDir/generated/sources/js2p-tmp/")
|
||||
delete("$buildDirectory/generated/sources/js2p-tmp/")
|
||||
}
|
||||
|
||||
tasks.getByName("compileJava").dependsOn(deleteJs2pTmp)
|
||||
|
@ -138,7 +139,7 @@ tasks {
|
|||
environment(
|
||||
mapOf(
|
||||
// Expose the kitchen sink example file to tests
|
||||
"CONFIG_EXAMPLE_DIR" to "$buildDir/configuration/examples/"
|
||||
"CONFIG_EXAMPLE_DIR" to "$buildDirectory/configuration/examples/"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue