Skip to content

Commit 775de4c

Browse files
committed
ProcessingPlugin fixes
1 parent 47d9c80 commit 775de4c

8 files changed

Lines changed: 33 additions & 24 deletions

File tree

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ dependencies {
142142
testImplementation(libs.mockitoKotlin)
143143
testImplementation(libs.junitJupiter)
144144
testImplementation(libs.junitJupiterParams)
145+
146+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
145147

146148
}
147149

app/utils/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ repositories {
1010
dependencies {
1111
testImplementation(platform("org.junit:junit-bom:5.10.0"))
1212
testImplementation("org.junit.jupiter:junit-jupiter")
13+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
1314
}
1415

1516
publishing{
@@ -23,4 +24,4 @@ publishing{
2324

2425
tasks.test {
2526
useJUnitPlatform()
26-
}
27+
}

gradle/plugins/library/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ repositories {
2323

2424
dependencies {
2525
testImplementation(kotlin("test"))
26+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
2627
}
2728

2829
tasks.test {
2930
useJUnitPlatform()
3031
}
3132
kotlin {
3233
jvmToolchain(17)
33-
}
34+
}

gradle/wrapper/gradle-wrapper.jar

1.95 KB
Binary file not shown.

gradlew

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/gradle/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.gradle.api.internal.tasks.testing.junit.JUnitTestFramework
2+
13
plugins{
24
`java-gradle-plugin`
35
alias(libs.plugins.gradlePublish)

java/gradle/src/main/kotlin/ProcessingPlugin.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,12 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
255255
project.dependencies.add("runtimeOnly", "org.jogamp.jogl:newt:2.6.0:natives-$variant")
256256
}
257257

258+
// Reduce each import to its package prefix: `a.b.*` and `a.b.C` both become `a.b`,
259+
// mirroring how the PDE preprocessor normalizes import statements
258260
val imports = sketchDirs
259261
.flatMap { dir -> dir.walkTopDown().filter { it.extension == "pde" }.toList() }
260-
.flatMap { Regex("""^\s*import\s+([\w.]+)\s*;""", RegexOption.MULTILINE).findAll(it.readText()).map { m -> m.groupValues[1] } }
262+
.flatMap { Regex("""^\s*import\s+(?:static\s+)?([\w.]+(?:\.\*)?)\s*;""", RegexOption.MULTILINE).findAll(it.readText()).map { m -> m.groupValues[1] } }
263+
.map { it.removeSuffix(".*") }
261264
.toSet()
262265
if (imports.isEmpty()) return
263266

@@ -274,7 +277,7 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
274277
val hit = jf.entries().asSequence()
275278
.filter { it.name.endsWith(".class") }
276279
.map { it.name.substringBeforeLast('/').replace('/', '.') }
277-
.any { it.startsWith(import) }
280+
.any { pkg -> pkg == import || pkg.startsWith("$import.") || import.startsWith("$pkg.") }
278281
if (hit) matched.add(jar)
279282
}
280283
}

0 commit comments

Comments
 (0)