Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ plugins.withId("otel.publish-conventions") {
register("generateVersionResource") {
val moduleName = otelJava.moduleName
val propertiesDir = moduleName.map { layout.buildDirectory.file("generated/properties/${it.replace('.', '/')}") }
val projectVersion = project.version.toString()

inputs.property("project.version", project.version.toString())
inputs.property("project.version", projectVersion)
outputs.dir(propertiesDir)

doLast {
File(propertiesDir.get().get().asFile, "version.properties").writeText("contrib.version=${project.version}")
File(propertiesDir.get().get().asFile, "version.properties").writeText("contrib.version=${projectVersion}")
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions buildSrc/src/main/kotlin/otel.spotless-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ spotless {
licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|public|// Includes work from:)")
target("src/**/*.java")
}
plugins.withId("groovy") {
groovy {
licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|class)")
}
}
// commented out for now due to incompatibility with gradle cache configuration
// plugins.withId("groovy") {
// groovy {
// licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|class)")
// }
// }
plugins.withId("scala") {
scala {
scalafmt()
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true

org.gradle.priority=low

Expand Down
28 changes: 17 additions & 11 deletions opamp-client/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import de.undercouch.gradle.tasks.download.DownloadExtension
import java.io.FileOutputStream
import java.io.InputStream
import java.net.URL

plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
id("otel.animalsniffer-conventions")
id("de.undercouch.download") version "5.6.0"
id("com.squareup.wire") version "5.4.0"
}

Expand All @@ -23,11 +24,11 @@ dependencies {
testImplementation("com.squareup.okhttp3:mockwebserver3-junit5")
}

val opampProtos = tasks.register<DownloadOpampProtos>("opampProtoDownload", download)
opampProtos.configure {
val opampProtos = tasks.register<DownloadAndExtractOpampProtos>("opampProtoDownload") {
group = "opamp"
outputProtosDir.set(project.layout.buildDirectory.dir("opamp/protos"))
downloadedZipFile.set(project.layout.buildDirectory.file("intermediate/$name/release.zip"))
downloadedZipFile.set(project.layout.buildDirectory.file("intermediate/opampProtoDownload/release.zip"))
zipUrl.set("https://github.com/open-telemetry/opamp-spec/zipball/v0.14.0")
}

wire {
Expand All @@ -37,8 +38,7 @@ wire {
}
}

abstract class DownloadOpampProtos @Inject constructor(
private val download: DownloadExtension,
abstract class DownloadAndExtractOpampProtos @Inject constructor(
private val archiveOps: ArchiveOperations,
private val fileOps: FileSystemOperations,
) : DefaultTask() {
Expand All @@ -49,14 +49,20 @@ abstract class DownloadOpampProtos @Inject constructor(
@get:Internal
abstract val downloadedZipFile: RegularFileProperty

@get:Input
abstract val zipUrl: Property<String>

@TaskAction
fun execute() {
val zipUrl = "https://github.com/open-telemetry/opamp-spec/zipball/v0.14.0"
val url = URL(zipUrl.get())
downloadedZipFile.get().asFile.parentFile.mkdirs()

download.run {
src(zipUrl)
dest(downloadedZipFile)
url.openStream().use { input: InputStream ->
downloadedZipFile.get().asFile.outputStream().use { output: FileOutputStream ->
input.copyTo(output)
}
}

val protos = archiveOps.zipTree(downloadedZipFile).matching {
setIncludes(listOf("**/*.proto"))
}
Expand Down
Loading