[Gradle, JS] Check if resourcesDir exists and resourceDir is input directory

This commit is contained in:
Ilya Goncharov
2019-12-02 13:14:51 +03:00
parent 053469dcec
commit fe9ddd9f22
2 changed files with 18 additions and 5 deletions
@@ -182,11 +182,14 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
}
it.doLast { _ ->
compilation.output.resourcesDir
.copyRecursively(
target = it.destinationDirectory!!,
overwrite = true
)
val resourcesDir = compilation.output.resourcesDir
if (resourcesDir.exists()) {
resourcesDir
.copyRecursively(
target = it.destinationDirectory!!,
overwrite = true
)
}
}
}
@@ -101,6 +101,16 @@ open class KotlinWebpack : DefaultTask(), RequiresNpmDependencies {
open val evaluatedConfigFile: File
@OutputFile get() = reportDir.resolve("webpack.config.evaluated.js")
val resourcesDir: File?
@Optional
@InputDirectory
get() {
val resourcesDir = compilation.output.resourcesDir
return if (resourcesDir.exists()) {
resourcesDir
} else null
}
@Input
var bin: String = "webpack/bin/webpack.js"