From 432efece7cbb23d4058ce4718fbacf1f960f97cd Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Sun, 18 Oct 2020 17:10:13 -0700 Subject: [PATCH 1/2] Add Play 2.8.x compatibility Play's 2.8 changelog does not mention much actually needing to change from the build pipeline perspective, so an easy string replacement for the integration test fixtures to verify and test should be enough to verify. Based on the previous PR from gradle/playframework#133, this expands the changes to ensure the integration tests pass as well. Signed-off-by: Gabriel Harris-Rouquette --- .travis.yml | 2 ++ src/docs/asciidoc/00-intro.adoc | 2 +- src/docs/asciidoc/11-play-framework.adoc | 4 ++++ .../playframework/fixtures/multiversion/PlayCoverage.groovy | 3 +-- .../advancedplayapp/app/controllers/Application.scala.ftl | 2 +- .../advancedplayapp/app/controllers/jva/PureJava.java.ftl | 2 +- .../advancedplayapp/app/controllers/scla/MixedJava.java.ftl | 2 +- .../app/special/strangename/Application.scala.ftl | 2 +- .../fixtures/app/advancedplayapp/build.gradle.ftl | 2 +- .../fixtures/app/advancedplayapp/conf/routes.ftl | 2 +- .../fixtures/app/advancedplayapp/conf/scala.routes.ftl | 2 +- .../app/basicplayapp/app/controllers/Application.scala.ftl | 2 +- .../playframework/fixtures/app/basicplayapp/build.gradle.ftl | 2 +- .../playframework/fixtures/app/basicplayapp/conf/routes.ftl | 2 +- .../app/controllers/Application.scala.ftl | 2 +- .../fixtures/app/playappwithdependencies/build.gradle.ftl | 2 +- .../fixtures/app/playappwithdependencies/conf/routes.ftl | 2 +- .../playcompositebuild/app/controllers/Application.scala.ftl | 2 +- .../fixtures/app/playcompositebuild/build.gradle.ftl | 2 +- .../fixtures/app/playcompositebuild/conf/routes.ftl | 2 +- .../fixtures/app/playmultiproject/build.gradle.ftl | 2 +- .../primary/app/controllers/Application.scala.ftl | 2 +- .../fixtures/app/playmultiproject/primary/build.gradle.ftl | 2 +- .../app/playmultiproject/primary/conf/application.conf.ftl | 2 +- .../fixtures/app/playmultiproject/primary/conf/routes.ftl | 2 +- .../app/controllers/submodule/Application.scala.ftl | 2 +- .../fixtures/app/playmultiproject/submodule/build.gradle.ftl | 2 +- .../fixtures/app/shared/conf/application.conf.ftl | 2 +- .../playframework/extensions/internal/PlayMajorVersion.java | 5 ++--- .../tools/internal/routes/RoutesCompilerFactory.java | 1 + 30 files changed, 35 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a9779d1..15f07a63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ jobs: env: GRADLE_TASK=integrationTest PLAY_VERSION=2.6.25 - name: "Play 2.7.5 Integration Tests" env: GRADLE_TASK=integrationTest PLAY_VERSION=2.7.5 + - name: "Play 2.8.2 Integration Tests" + env: GRADLE_TASK=integrationTest PLAY_VERSION=2.8.2 - name: "Documentation Tests" env: GRADLE_TASK=docTest PLAY_VERSION=not_used diff --git a/src/docs/asciidoc/00-intro.adoc b/src/docs/asciidoc/00-intro.adoc index 53d1a421..7a9ac2fc 100644 --- a/src/docs/asciidoc/00-intro.adoc +++ b/src/docs/asciidoc/00-intro.adoc @@ -13,7 +13,7 @@ The Play plugin defines the following requirements for a consuming build. * The build has to be run with Java 8 or higher. * The build has to use Gradle 5.0 or higher. -* The supported Play versions are 2.4.x, 2.5.x, 2.6.x, and 2.7.x. +* The supported Play versions are 2.4.x, 2.5.x, 2.6.x, 2.7.x, and 2.8.x. === Limitations diff --git a/src/docs/asciidoc/11-play-framework.adoc b/src/docs/asciidoc/11-play-framework.adoc index bdff0933..4763ebe5 100644 --- a/src/docs/asciidoc/11-play-framework.adoc +++ b/src/docs/asciidoc/11-play-framework.adoc @@ -9,6 +9,10 @@ The following versions of Play and Scala are supported: |=== | Play | Scala | Java +| 2.8.x +| 2.12 and 2.13 +| 1.8 + | 2.7.x | 2.11, 2.12 and 2.13 | 1.8 diff --git a/src/integTestFixtures/groovy/org/gradle/playframework/fixtures/multiversion/PlayCoverage.groovy b/src/integTestFixtures/groovy/org/gradle/playframework/fixtures/multiversion/PlayCoverage.groovy index ec088c11..be3b7ff3 100644 --- a/src/integTestFixtures/groovy/org/gradle/playframework/fixtures/multiversion/PlayCoverage.groovy +++ b/src/integTestFixtures/groovy/org/gradle/playframework/fixtures/multiversion/PlayCoverage.groovy @@ -14,8 +14,7 @@ final class PlayCoverage { VersionNumber.parse('2.4.11'), VersionNumber.parse('2.5.19'), VersionNumber.parse('2.7.5'), - // Not supported yet - // VersionNumber.parse('2.8.0'), + VersionNumber.parse('2.8.0'), DEFAULT ] } diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/Application.scala.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/Application.scala.ftl index 3d757f70..fa5ba3ef 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/Application.scala.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/Application.scala.ftl @@ -16,7 +16,7 @@ package controllers -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> import javax.inject._ import play.api._ import play.api.mvc._ diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/jva/PureJava.java.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/jva/PureJava.java.ftl index fa02fed1..d5ca4b32 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/jva/PureJava.java.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/jva/PureJava.java.ftl @@ -21,7 +21,7 @@ import jva.html.*; public class PureJava extends Controller { -<#if playVersion == "2.7"> +<#if playVersion == "2.8" || playVersion == "2.7"> public Result index() { <#else> public static Result index() { diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/scla/MixedJava.java.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/scla/MixedJava.java.ftl index 38dae35c..275d95b2 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/scla/MixedJava.java.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/controllers/scla/MixedJava.java.ftl @@ -22,7 +22,7 @@ import views.html.*; public class MixedJava extends Controller { -<#if playVersion == "2.7"> +<#if playVersion == "2.8" || playVersion == "2.7"> public Result index() { <#else> public static Result index() { diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/special/strangename/Application.scala.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/special/strangename/Application.scala.ftl index d153a2e2..12211120 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/special/strangename/Application.scala.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/app/special/strangename/Application.scala.ftl @@ -16,7 +16,7 @@ package special.strangename -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> import javax.inject._ import play.api._ import play.api.mvc._ diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/build.gradle.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/build.gradle.ftl index f740dfff..5056ae50 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/build.gradle.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/build.gradle.ftl @@ -14,7 +14,7 @@ sourceSets { } } -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> dependencies { implementation "com.typesafe.play:play-guice_2.12:2.6.15" implementation "ch.qos.logback:logback-classic:1.2.3" diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/conf/routes.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/conf/routes.ftl index 4682b520..633e6d8d 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/conf/routes.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/conf/routes.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> # Routes GET / @controllers.Application.index GET /root @controllers.Application.root diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/conf/scala.routes.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/conf/scala.routes.ftl index b369cf96..a513c1d4 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/conf/scala.routes.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/advancedplayapp/conf/scala.routes.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> GET /one controllers.scla.MixedJava.index POST /two @special.strangename.Application.index diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/app/controllers/Application.scala.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/app/controllers/Application.scala.ftl index 39db1edb..499edf7d 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/app/controllers/Application.scala.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/app/controllers/Application.scala.ftl @@ -16,7 +16,7 @@ package controllers -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> import javax.inject._ import play.api._ import play.api.mvc._ diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/build.gradle.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/build.gradle.ftl index 3664629d..fc886ae1 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/build.gradle.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/build.gradle.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> plugins { id 'org.gradle.playframework' } diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/conf/routes.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/conf/routes.ftl index 6d724563..94e9450d 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/conf/routes.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/basicplayapp/conf/routes.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> # Routes # Home page GET / @controllers.Application.index diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/app/controllers/Application.scala.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/app/controllers/Application.scala.ftl index a13bd84c..d7401c04 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/app/controllers/Application.scala.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/app/controllers/Application.scala.ftl @@ -16,7 +16,7 @@ package controllers -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> import javax.inject._ import com.google.common.base.Strings import play.api._ diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/build.gradle.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/build.gradle.ftl index 39aafe74..e25819e4 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/build.gradle.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/build.gradle.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> plugins { id 'org.gradle.playframework' } diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/conf/routes.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/conf/routes.ftl index 6d724563..94e9450d 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/conf/routes.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playappwithdependencies/conf/routes.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> # Routes # Home page GET / @controllers.Application.index diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/app/controllers/Application.scala.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/app/controllers/Application.scala.ftl index 6d69a2f2..5da4d306 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/app/controllers/Application.scala.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/app/controllers/Application.scala.ftl @@ -1,6 +1,6 @@ package controllers -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> import javax.inject._ import play.api._ import play.api.mvc._ diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/build.gradle.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/build.gradle.ftl index 47d52b96..eb5f3b18 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/build.gradle.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/build.gradle.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> plugins { id 'org.gradle.playframework' } diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/conf/routes.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/conf/routes.ftl index dbba7a04..937a9756 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/conf/routes.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playcompositebuild/conf/routes.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> GET / @controllers.Application.index GET /shutdown @controllers.Application.shutdown GET /assets/*file @controllers.Assets.at(path="/public", file) diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/build.gradle.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/build.gradle.ftl index a6708b50..525dcb84 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/build.gradle.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/build.gradle.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> plugins { id 'org.gradle.playframework' } diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/app/controllers/Application.scala.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/app/controllers/Application.scala.ftl index 6d69a2f2..5da4d306 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/app/controllers/Application.scala.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/app/controllers/Application.scala.ftl @@ -1,6 +1,6 @@ package controllers -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> import javax.inject._ import play.api._ import play.api.mvc._ diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/build.gradle.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/build.gradle.ftl index 83d9f8f1..fd2f7d59 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/build.gradle.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/build.gradle.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> plugins { id 'org.gradle.playframework' } diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/conf/application.conf.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/conf/application.conf.ftl index 2a307aea..c21bc393 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/conf/application.conf.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/conf/application.conf.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> # https://www.playframework.com/documentation/2.6.x/ApplicationSecret play.http.secret.key="somethingsecret" diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/conf/routes.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/conf/routes.ftl index 8c47ca18..735b7a33 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/conf/routes.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/primary/conf/routes.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> GET / @controllers.Application.index GET /shutdown @controllers.Application.shutdown GET /submodule @controllers.submodule.Application.index diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/submodule/app/controllers/submodule/Application.scala.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/submodule/app/controllers/submodule/Application.scala.ftl index 1a367dc6..bf70fbef 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/submodule/app/controllers/submodule/Application.scala.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/submodule/app/controllers/submodule/Application.scala.ftl @@ -1,6 +1,6 @@ package controllers.submodule -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> import javax.inject._ import play.api._ import play.api.mvc._ diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/submodule/build.gradle.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/submodule/build.gradle.ftl index a6708b50..525dcb84 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/submodule/build.gradle.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/playmultiproject/submodule/build.gradle.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> plugins { id 'org.gradle.playframework' } diff --git a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/shared/conf/application.conf.ftl b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/shared/conf/application.conf.ftl index eb94ad71..39b82aea 100644 --- a/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/shared/conf/application.conf.ftl +++ b/src/integTestFixtures/resources/org/gradle/playframework/fixtures/app/shared/conf/application.conf.ftl @@ -1,4 +1,4 @@ -<#if playVersion == "2.7" || playVersion == "2.6"> +<#if playVersion == "2.8" || playVersion == "2.7" || playVersion == "2.6"> play.http.secret.key="TY9[b`xw2MeXUt;M diff --git a/src/main/java/org/gradle/playframework/extensions/internal/PlayMajorVersion.java b/src/main/java/org/gradle/playframework/extensions/internal/PlayMajorVersion.java index 0e427771..502550c1 100644 --- a/src/main/java/org/gradle/playframework/extensions/internal/PlayMajorVersion.java +++ b/src/main/java/org/gradle/playframework/extensions/internal/PlayMajorVersion.java @@ -13,9 +13,8 @@ public enum PlayMajorVersion { PLAY_2_4_X("2.4.x", true, "2.11", "2.10"), PLAY_2_5_X("2.5.x", true,"2.11"), PLAY_2_6_X("2.6.x", true, "2.12", "2.11"), - PLAY_2_7_X("2.7.x", false, "2.13", "2.12", "2.11"); - // Not supported yet - // PLAY_2_8_X("2.8.x", false, "2.13", "2.12"); + PLAY_2_7_X("2.7.x", false, "2.13", "2.12", "2.11"), + PLAY_2_8_X("2.8.x", false, "2.13", "2.12"); private final String name; private final boolean supportForStaticRoutes; diff --git a/src/main/java/org/gradle/playframework/tools/internal/routes/RoutesCompilerFactory.java b/src/main/java/org/gradle/playframework/tools/internal/routes/RoutesCompilerFactory.java index dcf56597..c9746720 100644 --- a/src/main/java/org/gradle/playframework/tools/internal/routes/RoutesCompilerFactory.java +++ b/src/main/java/org/gradle/playframework/tools/internal/routes/RoutesCompilerFactory.java @@ -24,6 +24,7 @@ public static VersionedRoutesCompilerAdapter createAdapter(PlayPlatform playPlat case PLAY_2_6_X: return new RoutesCompilerAdapterV24X(playVersion, scalaVersion); case PLAY_2_7_X: + case PLAY_2_8_X: default: return new RoutesCompilerAdapterV27X(playVersion, scalaVersion); } From 02894f7756545218a97477309b80edac6ba158e2 Mon Sep 17 00:00:00 2001 From: "iacopo.pace" Date: Thu, 11 Mar 2021 20:36:44 -0800 Subject: [PATCH 2/2] Complete support for scala 2.8.x, adding tests and plugin support for java-forms. Forked from branch "gabizou:play-2.8" following PR "gradle/playframework#154" Signed-off-by: iacopo.pace --- .../plugins/PlayApplicationPlugin.java | 1 + .../internal/twirl/PlayTwirlAdapterV28X.java | 50 +++++++++++++++++++ .../internal/twirl/TwirlCompilerFactory.java | 4 +- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/gradle/playframework/tools/internal/twirl/PlayTwirlAdapterV28X.java diff --git a/src/main/java/org/gradle/playframework/plugins/PlayApplicationPlugin.java b/src/main/java/org/gradle/playframework/plugins/PlayApplicationPlugin.java index 06850f67..5c24dc80 100644 --- a/src/main/java/org/gradle/playframework/plugins/PlayApplicationPlugin.java +++ b/src/main/java/org/gradle/playframework/plugins/PlayApplicationPlugin.java @@ -103,6 +103,7 @@ private void addAutomaticDependencies(DependencyHandler dependencies, PlayPlatfo // if the project is Java or Scala based. case PLAY_2_6_X: case PLAY_2_7_X: + case PLAY_2_8_X: dependencies.add(PLATFORM_CONFIGURATION, playPlatform.getDependencyNotation("play-java-forms").get()); } } diff --git a/src/main/java/org/gradle/playframework/tools/internal/twirl/PlayTwirlAdapterV28X.java b/src/main/java/org/gradle/playframework/tools/internal/twirl/PlayTwirlAdapterV28X.java new file mode 100644 index 00000000..3b85bb5d --- /dev/null +++ b/src/main/java/org/gradle/playframework/tools/internal/twirl/PlayTwirlAdapterV28X.java @@ -0,0 +1,50 @@ +package org.gradle.playframework.tools.internal.twirl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.gradle.playframework.sourcesets.TwirlImports; + +class PlayTwirlAdapterV28X implements VersionedPlayTwirlAdapter { + + // Based on https://github.com/playframework/playframework/blob/2.8.x/dev-mode/build-link/src/main/java/play/TemplateImports.java + private static List defaultTemplateImports = Collections.unmodifiableList( + Arrays.asList( + "models._", + "controllers._", + "play.api.i18n._", + "play.api.templates.PlayMagic._" + )); + + private static final List DEFAULT_JAVA_IMPORTS; + private static final List DEFAULT_SCALA_IMPORTS; + static { + List minimalJavaImports = new ArrayList(); + minimalJavaImports.addAll(defaultTemplateImports); + minimalJavaImports.add("java.lang._"); + minimalJavaImports.add("java.util._"); + minimalJavaImports.add("play.core.j.PlayMagicForJava._"); + minimalJavaImports.add("play.mvc._"); + minimalJavaImports.add("play.api.data.Field"); + + List defaultJavaImports = new ArrayList(); + defaultJavaImports.addAll(minimalJavaImports); + defaultJavaImports.add("play.data._"); + defaultJavaImports.add("play.core.j.PlayFormsMagicForJava._"); + DEFAULT_JAVA_IMPORTS = Collections.unmodifiableList(defaultJavaImports); + + List scalaImports = new ArrayList(); + scalaImports.addAll(defaultTemplateImports); + scalaImports.add("play.api.mvc._"); + scalaImports.add("play.api.data._"); + DEFAULT_SCALA_IMPORTS = Collections.unmodifiableList(scalaImports); + } + + @Override + public List getDefaultImports(TwirlImports language) { + return language == TwirlImports.JAVA ? DEFAULT_JAVA_IMPORTS : DEFAULT_SCALA_IMPORTS; + } +} + diff --git a/src/main/java/org/gradle/playframework/tools/internal/twirl/TwirlCompilerFactory.java b/src/main/java/org/gradle/playframework/tools/internal/twirl/TwirlCompilerFactory.java index 26e99b2f..a8ef5152 100644 --- a/src/main/java/org/gradle/playframework/tools/internal/twirl/TwirlCompilerFactory.java +++ b/src/main/java/org/gradle/playframework/tools/internal/twirl/TwirlCompilerFactory.java @@ -34,8 +34,10 @@ public static VersionedPlayTwirlAdapter createPlayTwirlAdapter(PlayPlatform play return new PlayTwirlAdapterV23X(); case PLAY_2_6_X: case PLAY_2_7_X: - default: return new PlayTwirlAdapterV26X(); + case PLAY_2_8_X: + default: + return new PlayTwirlAdapterV28X(); } }