Skip to content

Commit f4ae923

Browse files
committed
Enable Gradle configuration cache
1 parent 5da7503 commit f4ae923

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
org.gradle.parallel=true
22
org.gradle.caching=true
3+
org.gradle.configuration-cache=true
34

45
org.gradle.priority=low
56

instrumentation-api-incubator/build.gradle.kts

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
plugins {
2-
id("org.xbib.gradle.plugin.jflex")
3-
42
id("otel.java-conventions")
53
id("otel.animalsniffer-conventions")
64
id("otel.jacoco-conventions")
@@ -10,7 +8,17 @@ plugins {
108

119
group = "io.opentelemetry.instrumentation"
1210

11+
// JFlex configuration - manual integration for configuration cache compatibility
12+
configurations {
13+
val jflex by creating {
14+
isTransitive = true
15+
}
16+
}
17+
1318
dependencies {
19+
"jflex"("de.jflex:jflex:1.9.1")
20+
"jflex"("com.github.vbmacher:java-cup-runtime:11b-20160615")
21+
1422
api("io.opentelemetry.semconv:opentelemetry-semconv")
1523
api(project(":instrumentation-api"))
1624
api("io.opentelemetry:opentelemetry-api-incubator")
@@ -24,6 +32,41 @@ dependencies {
2432
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")
2533
}
2634

35+
// Manual JFlex task - configuration cache compatible
36+
val generateJflex by tasks.registering(JavaExec::class) {
37+
description = "Generate Java code from JFlex files"
38+
group = "build"
39+
40+
classpath = configurations.getByName("jflex")
41+
mainClass.set("jflex.Main")
42+
43+
val jflexSourceDir = file("src/main/jflex")
44+
val jflexOutputDir = file("build/generated/sources/jflex")
45+
46+
inputs.dir(jflexSourceDir)
47+
outputs.dir(jflexOutputDir)
48+
49+
doFirst {
50+
jflexOutputDir.mkdirs()
51+
}
52+
53+
args(
54+
"-d", jflexOutputDir,
55+
"--nobak",
56+
"$jflexSourceDir/SqlSanitizer.jflex"
57+
)
58+
}
59+
60+
sourceSets {
61+
main {
62+
java.srcDir(generateJflex.map { it.outputs.files.singleFile })
63+
}
64+
}
65+
66+
tasks.compileJava {
67+
dependsOn(generateJflex)
68+
}
69+
2770
tasks {
2871
// exclude auto-generated code
2972
named<Checkstyle>("checkstyleMain") {
@@ -38,7 +81,11 @@ tasks {
3881
}
3982

4083
sourcesJar {
41-
dependsOn("generateJflex")
84+
dependsOn(generateJflex)
85+
// Avoid configuration cache issue by not capturing task reference
86+
from("src/main/jflex") {
87+
include("**/*.java")
88+
}
4289
}
4390

4491
val testStableSemconv by registering(Test::class) {

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pluginManagement {
55
id("com.gradle.plugin-publish") version "2.0.0"
66
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
77
id("org.jetbrains.kotlin.jvm") version "2.2.21"
8-
id("org.xbib.gradle.plugin.jflex") version "3.0.2"
98
id("com.github.bjornvester.xjc") version "1.8.2"
109
id("org.graalvm.buildtools.native") version "0.11.2"
1110
id("com.google.osdetector") version "1.7.3"

0 commit comments

Comments
 (0)