FrayTest plugin now works with configuration caches and ignores normal junit tests#396
FrayTest plugin now works with configuration caches and ignores normal junit tests#396
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Fray Gradle plugin to be more configuration-cache friendly by removing dependency resolution from task actions, and makes frayTest run only Fray-annotated JUnit 5 tests via tagging.
Changes:
- Refactors
PrepareWorkspaceTaskto accept resolved file collections/dirs as task inputs/outputs instead of resolving dependencies internally. - Updates Gradle plugin wiring to use detached configurations and filters JUnit Platform execution to only tests tagged
FrayTest. - Adds
@Tag("FrayTest")to Fray’s JUnit5 test template annotations and adjusts JVMTI runtime extraction behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| plugins/gradle/src/main/kotlin/tasks/PrepareWorkspaceTask.kt | Makes the task cache/config-cache friendlier by using FileCollection/DirectoryProperty inputs/outputs rather than resolving Dependency objects. |
| plugins/gradle/src/main/kotlin/FrayPlugin.kt | Switches to detached configurations and configures frayTest to only run JUnit Platform tests tagged FrayTest. |
| plugins/base/src/main/kotlin/org/pastalab/fray/plugins/base/FrayWorkspaceInitializer.kt | Changes JVMTI runtime extraction to unzip regardless of prior directory existence. |
| junit/src/main/kotlin/org/pastalab/fray/junit/junit5/annotations/ConcurrencyTest.kt | Tags Fray annotations with FrayTest so Gradle filtering can select only Fray tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| val frayWorkDir = Commons.getFrayReportDir(frayBuildFolder).toString() | ||
| val frayDebugger = target.findProperty("fray.debugger")?.toString() | ||
| val frayInstrumentationPath = frayInstrumentationJar.singleFile.absolutePath | ||
| target.dependencies.add("testImplementation", "org.pastalab.fray:fray-core:$frayVersion") |
There was a problem hiding this comment.
frayInstrumentationJar.singleFile resolves the detached configuration during configuration phase (inside afterEvaluate). This is incompatible with Gradle configuration cache and likely defeats the PR’s goal. Defer resolution to task execution (e.g., compute the javaagent path inside doFirst from a FileCollection/Provider, or wire a ConfigurableFileCollection into the task and call singleFile only at execution time).
| fun createJVMTiRuntime() { | ||
| if (!jvmtiPath.exists()) { | ||
| jvmtiPath.toFile().mkdirs() | ||
| unzipFile(jvmtiJar.absolutePath, jvmtiPath) | ||
| } | ||
| unzipFile(jvmtiJar.absolutePath, jvmtiPath) | ||
| } |
There was a problem hiding this comment.
createJVMTiRuntime() now unzips the JVMTI archive on every execution, even when jvmtiPath already exists. This adds unnecessary I/O and can leave stale files if the archive contents change (files removed from the new archive would remain on disk). Consider restoring a guard (e.g., only unzip when the expected library file is missing) or deleting/cleaning the output directory before extracting when you intentionally want to refresh.
junit tests.