Skip to content

Commit 893780c

Browse files
Fixed flaky test for play-2.8: Source directory '.../routes' is not a directory. (#9328)
1 parent 0eeb9e5 commit 893780c

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

dd-smoke-tests/play-2.8/build.gradle

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,30 @@ dependencies {
6969
}
7070

7171
configurations.testImplementation {
72-
exclude group:'com.typesafe.play', module:"play-test_$scalaVer"
72+
exclude group: 'com.typesafe.play', module: "play-test_$scalaVer"
73+
}
74+
75+
// Fix for flaky error: 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+
tasks.register('fixPlayRoutesDirectory') {
78+
group = 'build cleanup'
79+
description = 'Deletes routes path if it is a file instead of directory'
80+
81+
def routesPath = layout.buildDirectory.dir('src/play/routes')
82+
destroyables.register(routesPath)
83+
84+
doFirst {
85+
def routesPathFile = routesPath.get().asFile
86+
87+
if (routesPathFile.exists() && !routesPathFile.isDirectory()) {
88+
logger.lifecycle("Removing file that blocks routes directory: ${routesPathFile}")
89+
project.delete(routesPathFile)
90+
}
91+
}
92+
}
93+
94+
tasks.named('compilePlayRoutes') {
95+
dependsOn tasks.named('fixPlayRoutesDirectory')
7396
}
7497

7598
tasks.named('compileTestGroovy').configure {

0 commit comments

Comments
 (0)