diff --git a/dd-smoke-tests/play-2.8-split-routes/build.gradle b/dd-smoke-tests/play-2.8-split-routes/build.gradle index 3c540f3f436..c5ef21ab5df 100644 --- a/dd-smoke-tests/play-2.8-split-routes/build.gradle +++ b/dd-smoke-tests/play-2.8-split-routes/build.gradle @@ -3,6 +3,7 @@ plugins { } apply from: "$rootDir/gradle/java.gradle" +apply from: "$rootDir/dd-smoke-tests/play-common/fix-play-routes.gradle" def playVer = "2.8.15" def scalaVer = System.getProperty("scala.version", /* default = */ "2.13") @@ -66,7 +67,7 @@ dependencies { } configurations.testImplementation { - exclude group:'com.typesafe.play', module:"play-test_$scalaVer" + exclude group: 'com.typesafe.play', module: "play-test_$scalaVer" } tasks.named('compileTestGroovy').configure { diff --git a/dd-smoke-tests/play-2.8/build.gradle b/dd-smoke-tests/play-2.8/build.gradle index f1cdd480ede..2878364f2ef 100644 --- a/dd-smoke-tests/play-2.8/build.gradle +++ b/dd-smoke-tests/play-2.8/build.gradle @@ -3,6 +3,7 @@ plugins { } apply from: "$rootDir/gradle/java.gradle" +apply from: "$rootDir/dd-smoke-tests/play-common/fix-play-routes.gradle" def playVer = "2.8.15" def scalaVer = System.getProperty("scala.version", /* default = */ "2.13") @@ -72,29 +73,6 @@ configurations.testImplementation { exclude group: 'com.typesafe.play', module: "play-test_$scalaVer" } -// Fix for flaky error: Source directory '/dd-smoke-tests/play-2.8/build/src/play/routes' is not a directory. -// Probably, GitLab somehow creates (or restores from cache) file instead of folder. -tasks.register('fixPlayRoutesDirectory') { - group = 'build cleanup' - description = 'Deletes routes path if it is a file instead of directory' - - def routesPath = layout.buildDirectory.dir('src/play/routes') - destroyables.register(routesPath) - - doFirst { - def routesPathFile = routesPath.get().asFile - - if (routesPathFile.exists() && !routesPathFile.isDirectory()) { - logger.lifecycle("Removing file that blocks routes directory: ${routesPathFile}") - project.delete(routesPathFile) - } - } -} - -tasks.named('compilePlayRoutes') { - dependsOn tasks.named('fixPlayRoutesDirectory') -} - tasks.named('compileTestGroovy').configure { dependsOn 'stageMainDist' outputs.upToDateWhen { diff --git a/dd-smoke-tests/play-common/fix-play-routes.gradle b/dd-smoke-tests/play-common/fix-play-routes.gradle new file mode 100644 index 00000000000..79b3b180d36 --- /dev/null +++ b/dd-smoke-tests/play-common/fix-play-routes.gradle @@ -0,0 +1,22 @@ +// Fix for flaky error: Source directory '/dd-smoke-tests/play-2.8/build/src/play/routes' is not a directory. +// Probably, GitLab somehow creates (or restores from cache) file instead of folder. +tasks.register('fixPlayRoutesDirectory') { + group = 'build cleanup' + description = 'Deletes routes path if it is a file instead of directory' + + def routesPath = layout.buildDirectory.dir('src/play/routes') + destroyables.register(routesPath) + + doFirst { + def routesPathFile = routesPath.get().asFile + + if (routesPathFile.exists() && !routesPathFile.isDirectory()) { + logger.lifecycle("Removing file that blocks routes directory: ${routesPathFile}") + project.delete(routesPathFile) + } + } +} + +tasks.named('processResources') { + dependsOn tasks.named('fixPlayRoutesDirectory') +}