Hello, I've seen a surprising info message in my b...
# gradle
l
Hello, I've seen a surprising info message in my build where some script seemingly gets loaded:
Copy code
Calculating task graph as configuration cache cannot be reused because content of 2nd init script, '../../../../../private/var/folders/yk/qprymb3x2yx5q0htfc4f12740000gn/T/ijresolvers.gradle', has changed.
Does it speak to anyone?
w
Seems to be an init script injected by IntelliJ, I don’t know exactly what those init scripts do, but it’s expected that IJ injects them
Although if the script changes a lot, I’d report it to Jetbrains, as it does affect configuration cache
a
IntelliJ creates & injects an init.gradle script in every Gradle command, so IJ can do things like display live-updates of running tests it’s actually a bit annoying - one of the scripts forcibly disables all caching of the test tasks, so all test always re-run, even if no files have changed https://github.com/JetBrains/intellij-community/blob/4a52c9b758fb09fdb270dec444c887146956d134/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/init/testFilterInit.gradle#L16
w
all test always re-run, even if no files have changed
Arguably that’s what I’d expect from the IDE — if I run tests, I expect them to actually run and not report success because they did that at some point in the past
w
Sure, from Gradle/CI standpoint that makes sense. I just think it’s a bit different when running tests from the IDE
a
but I can understand your POV The problem is • if I have 10 Gradle subprojects (no inter-dependencies), • I run
./gradlew test
, all tests pass. • I change a file in subproject-alpha On the command line
./gradlew test
, only tests in subproject-alpha will re-run. In IntelliJ, all tests will re-run
IJ also causes extra work if I run
./gradlew jacocoAggregation
. On the command line, no tests will run. In IJ, all tests will run, even if nothing has changed. It makes Gradle behave worse than its best
w
Yep I see that, I guess it’s workflow question — I never verify stuff from IDE, it’s only for development for me. So if I run tests from IDE, I explicitly want all of them to run, if I want to check if I’m ready for a PR, I’ll always use Gradle no matter what. I’ve been bitten by different behavior in IDE too many times, which I guess is the point you’re making 🙂
a
making it an option would be wonderful. Especially now since there’s
--rerun
https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:builtin_task_options It’s also useful feedback if you were to try to run a test in IJ, and the report says “nothing changed”. At the moment, that’s not possible.
l
Probably worth reporting on https://youtrack.jetbrains.com/
a