Skip to content

Commit dda3d7a

Browse files
Fix for play-2.8 'Source directory xxx is not a directory.` (#9357)
1 parent 12e10fb commit dda3d7a

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
}
44

55
apply from: "$rootDir/gradle/java.gradle"
6+
apply from: "$rootDir/dd-smoke-tests/play-common/fix-play-routes.gradle"
67

78
def playVer = "2.8.15"
89
def scalaVer = System.getProperty("scala.version", /* default = */ "2.13")
@@ -66,7 +67,7 @@ dependencies {
6667
}
6768

6869
configurations.testImplementation {
69-
exclude group:'com.typesafe.play', module:"play-test_$scalaVer"
70+
exclude group: 'com.typesafe.play', module: "play-test_$scalaVer"
7071
}
7172

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

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

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
}
44

55
apply from: "$rootDir/gradle/java.gradle"
6+
apply from: "$rootDir/dd-smoke-tests/play-common/fix-play-routes.gradle"
67

78
def playVer = "2.8.15"
89
def scalaVer = System.getProperty("scala.version", /* default = */ "2.13")
@@ -72,29 +73,6 @@ configurations.testImplementation {
7273
exclude group: 'com.typesafe.play', module: "play-test_$scalaVer"
7374
}
7475

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')
96-
}
97-
9876
tasks.named('compileTestGroovy').configure {
9977
dependsOn 'stageMainDist'
10078
outputs.upToDateWhen {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Fix for flaky error: Source directory '/dd-smoke-tests/play-2.8/build/src/play/routes' is not a directory.
2+
// Probably, GitLab somehow creates (or restores from cache) file instead of folder.
3+
tasks.register('fixPlayRoutesDirectory') {
4+
group = 'build cleanup'
5+
description = 'Deletes routes path if it is a file instead of directory'
6+
7+
def routesPath = layout.buildDirectory.dir('src/play/routes')
8+
destroyables.register(routesPath)
9+
10+
doFirst {
11+
def routesPathFile = routesPath.get().asFile
12+
13+
if (routesPathFile.exists() && !routesPathFile.isDirectory()) {
14+
logger.lifecycle("Removing file that blocks routes directory: ${routesPathFile}")
15+
project.delete(routesPathFile)
16+
}
17+
}
18+
}
19+
20+
tasks.named('processResources') {
21+
dependsOn tasks.named('fixPlayRoutesDirectory')
22+
}

0 commit comments

Comments
 (0)