@@ -72,22 +72,27 @@ configurations.testImplementation {
7272 exclude group : ' com.typesafe.play' , module : " play-test_$scalaVer "
7373}
7474
75- // Fix for flaky error: Source directory '/dd-smoke-tests/play-2.8/build/src/play/routes' is not a directory.
76- tasks. register(' cleanRoutes' ) {
77- description = ' Deletes routes path if it is a file instead of directory'
78- group = ' build cleanup'
79-
80- doFirst {
81- def routesPath = layout. buildDirectory. dir(' src/play/routes' ). get(). asFile
82- if (routesPath. exists() && ! routesPath. isDirectory()) {
83- logger. lifecycle(" Removing file that blocks routes directory: ${ routesPath} " )
84- routesPath. delete()
75+ // Fix for flaky test on CI: Source directory '/dd-smoke-tests/play-2.8/build/src/play/routes' is not a directory.
76+ // Probably, GitLab somehow creates (or restores from cache) file instead of folder.
77+ def isCI = System . getenv(" CI" ) != null
78+
79+ if (isCI) {
80+ tasks. register(' fixPlayRoutesDirectory' ) {
81+ description = ' Deletes routes path if it is a file instead of directory'
82+ group = ' build cleanup'
83+
84+ doFirst {
85+ def routesPath = layout. buildDirectory. dir(' src/play/routes' ). get(). asFile
86+ if (routesPath. exists() && ! routesPath. isDirectory()) {
87+ logger. lifecycle(" Removing file that blocks routes directory: ${ routesPath} " )
88+ routesPath. delete()
89+ }
8590 }
8691 }
87- }
8892
89- tasks. named(' compileScala' ) {
90- dependsOn tasks. named(' cleanRoutes' )
93+ tasks. named(' compileScala' ) {
94+ dependsOn tasks. named(' fixPlayRoutesDirectory' )
95+ }
9196}
9297
9398tasks. named(' compileTestGroovy' ). configure {
0 commit comments