Simplify jflex configuration
MODIFY
gradle/enforcement/checkstyle.xml
gradle/enforcement/checkstyle.xml
<!-- skip jflex generated files -->
<module name="SuppressionSingleFilter">
<property name="checks" value=".*"/>
- <property name="files" value="instrumentation-api[/\\]build[/\\]generated[/\\]jflex"/>
+ <property name="files" value="instrumentation-api[/\\]build[/\\]generated[/\\]sources[/\\]jflex"/>
</module>
<module name="SuppressionSingleFilter">
<property name="checks" value="MethodName"/>

MODIFY
instrumentation-api/build.gradle
instrumentation-api/build.gradle
plugins {
- id 'org.xbib.gradle.plugin.jflex' version '1.5.0'
+ id("org.xbib.gradle.plugin.jflex") version "1.5.0"
+
id("otel.java-conventions")
id("otel.jacoco-conventions")
id("otel.publish-conventions")
}
-group = 'io.opentelemetry.instrumentation'
-
-def jflexTargetDir = file"${project.buildDir}/generated/jflex/sql"
-
-def sqlSanitizerJflex = tasks.register("sqlSanitizerJflex", org.xbib.gradle.plugin.JFlexTask) {
- group = 'jflex'
- description = 'Generate SqlSanitizer'
- source = [file("${project.projectDir}/src/main/jflex/SqlSanitizer.flex")]
- target = jflexTargetDir
+sourceSets {
+ main {
+ java {
+ // gradle-jflex-plugin has a bug in that it always looks for the last srcDir in this source
+ // set to generate into. By default it would be the src/main directory itself.
+ srcDir("${buildDir}/generated/sources/jflex")
}
-
-tasks.named("compileJava").configure {
- dependsOn(sqlSanitizerJflex)
}
-
-tasks.named("javadoc").configure {
- dependsOn(sqlSanitizerJflex)
-}
-
-tasks.named("sourcesJar").configure {
- dependsOn(sqlSanitizerJflex)
}
-sourceSets.main.java.srcDir(jflexTargetDir)
+group = "io.opentelemetry.instrumentation"
dependencies {
api project(":instrumentation-api-caching")

RENAME
instrumentation-api/src/main/jflex/SqlSanitizer.flex
instrumentation-api/src/main/jflex/SqlSanitizer.jflex
Simplify jflex configuration (#3431)