Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
27 changes: 26 additions & 1 deletion disk-buffering/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import de.undercouch.gradle.tasks.download.Download
import ru.vyarus.gradle.plugin.animalsniffer.AnimalSniffer

plugins {
Expand All @@ -8,6 +9,7 @@ plugins {
id("me.champeau.jmh") version "0.7.3"
id("ru.vyarus.animalsniffer") version "2.0.0"
id("com.squareup.wire") version "5.3.1"
id("de.undercouch.download")
}

description = "Exporter implementations that store signals on disk"
Expand Down Expand Up @@ -49,11 +51,14 @@ jmh {
timeUnit.set("ms")
}

val protoVersion = "1.5.0"
val protoArchive = layout.buildDirectory.file("archives/opentelemetry-proto-$protoVersion.zip").get().asFile
Copy link
Contributor

@LikeTheSalad LikeTheSalad Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @laurit! Although I think it's better if we don't have to rely on third-party plugins. I was checking and I think we could make it work by replacing the wire block with the following changes, wdyt?

val wireDependencies =
  configurations.detachedConfiguration(project.dependencies.create("io.opentelemetry.proto:opentelemetry-proto:1.5.0-alpha"))
wireDependencies.setTransitive(false)

val wireSrcDirCollector = tasks.register("wireSrcJarCollect", Sync::class) {
  from(provider {
    wireDependencies.map {
      zipTree(it).matching {
        setIncludes(listOf("**/*.proto"))
      }
    }
  })
  into(layout.buildDirectory.dir("protos/opentelemetry-proto"))
}

wire {
  java {}

  sourcePath {
    srcDir(wireSrcDirCollector)
  }

  root(
    "opentelemetry.proto.trace.v1.TracesData",
    "opentelemetry.proto.metrics.v1.MetricsData",
    "opentelemetry.proto.logs.v1.LogsData",
  )
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the dependency on the download task. If you believe further changes are needed create a PR. We can merge that PR and recreate this one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. If the build passes, I'm ok with leaving it as is. Though if there are further issues, I'll create a separate PR, as you suggest, to sort them out.


wire {
java {}

sourcePath {
srcJar("io.opentelemetry.proto:opentelemetry-proto:1.5.0-alpha")
srcDir(layout.buildDirectory.dir("protos/opentelemetry-proto-$protoVersion"))
}

root(
Expand All @@ -63,6 +68,26 @@ wire {
)
}

afterEvaluate {
tasks {
val downloadProtoArchive by registering(Download::class) {
onlyIf { !protoArchive.exists() }
src("https://github.com/open-telemetry/opentelemetry-proto/archive/v$protoVersion.zip")
dest(protoArchive)
}

val unzipProtoArchive by registering(Copy::class) {
dependsOn(downloadProtoArchive)
from(zipTree(protoArchive))
into(layout.buildDirectory.dir("protos"))
}

named("generateMainProtos") {
dependsOn(unzipProtoArchive)
}
}
}

tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("")
configurations = emptyList() // To avoid embedding any dependencies as we only need to rename some local packages.
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=8d97a97984f6cbd2b85fe4c60a743440a347544bf18818048e611f5288d46c94
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pluginManagement {
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id("com.gradle.develocity") version "3.19.2"
id("de.undercouch.download") version "5.6.0"
}
}

Expand Down
Loading