playframework
playframework copied to clipboard
Add twirl toolchain support
Allows for the overriding of the java version used to invoke the twirl template compiler.
Resulting build.gradle.kts syntax would look like
tasks.compilePlayTwirlTemplates {
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(8))
})
}
Note that if you're using a new version of java already, you can set the version of java used by the scala compiler via
tasks.compileScala {
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(8))
})
}
I've updated the mr to not directly depend on the JavaLauncher class being available, and have moved the code to a new extended TwirlCompile class. The code should now be compatible with the full gradle range currently supported.
So it looks like the integration tests are failing for this reason
Property 'javaLauncher' annotated with @Internal should not be also annotated with @Optional. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.8/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
I had fixed a similar issue in https://github.com/gradle/playframework/pull/175
I misread, that error was about optional and not nullable. I've removed the @Optional annotation.
@JLLeitschuh any chance somebody at https://github.com/gradle can check a look?
Unfortunately, I'm not with Gradle anymore
@JLLeitschuh Sorry for the ping then.
@big-guy hello! Any chance somebody at gradle can review these changes?
So toolchains were added in gradle 6.7, so versions under that would now be unsupported.
Example failure on Gradle 6.6
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:compilePlayTwirlTemplates'.
> Could not create task of type 'TwirlCompile'.
> Could not generate a decorated class for type TwirlCompile.
> org/gradle/jvm/toolchain/JavaLauncher