Fix creation of temp file in case of bad parent dir for Gradle
newTmpFile can fail, if you pass non-existent path as temp parent directory or java.io.tmpdir is empty or invalid. Now we try to create non-existent dirs and provide more info if it also fails. Also fix error throwing in JPS part(46c0c4f9)
#KT-51374 Fixed
This commit is contained in:
committed by
Space
parent
4022918ea2
commit
ee756638a0
@@ -269,15 +269,12 @@ class KotlinJvmModuleBuildTarget(kotlinContext: KotlinCompileContext, jpsModuleB
|
||||
} catch (e: NoSuchFileException) {
|
||||
val parentDir = File(e.file).parentFile
|
||||
if (parentDir != null && !parentDir.exists()) {
|
||||
try {
|
||||
parentDir.mkdirs()
|
||||
} catch (e: IOException) {
|
||||
val message: String?
|
||||
if (dir == null) {
|
||||
if (!parentDir.mkdirs()) {
|
||||
val message = if (dir == null) {
|
||||
val tmpPath = System.getProperty("java.io.tmpdir", null).trim().ifEmpty { null }
|
||||
message = "java.io.tmpdir is set to $tmpPath and it does not exist. Attempt to create it failed with exception"
|
||||
"java.io.tmpdir is set to $tmpPath and it does not exist. Attempt to create it failed with exception"
|
||||
} else {
|
||||
message = "kotlin.jps.dir.for.module.files is set to $dir and it does not exist. " +
|
||||
"kotlin.jps.dir.for.module.files is set to $dir and it does not exist. " +
|
||||
"Attempt to create it failed with exception"
|
||||
}
|
||||
throwException(e, dir, message)
|
||||
|
||||
Reference in New Issue
Block a user