Fix @OutputFile annotation on a String property outputFile.

This commit is contained in:
Sergey Igushkin
2017-11-28 17:14:44 +03:00
parent 9d1091cdaa
commit d51b17c1b2
2 changed files with 7 additions and 8 deletions
@@ -296,8 +296,8 @@ internal class Kotlin2JsSourceSetProcessor(
val appliedPlugins = subpluginEnvironment.addSubpluginOptions(
project, kotlinTask, kotlinTask, null, null, sourceSet)
kotlinTask.kotlinOptions.outputFile = File(kotlinTask.outputFile).absolutePath
val outputDir = File(kotlinTask.outputFile).parentFile
kotlinTask.kotlinOptions.outputFile = kotlinTask.outputFile.absolutePath
val outputDir = kotlinTask.outputFile.parentFile
if (FileUtil.isAncestor(outputDir, project.rootDir, false))
throw InvalidUserDataException(
@@ -323,7 +323,7 @@ internal class Kotlin2JsSourceSetProcessor(
val task = project.tasks.create(taskName, Delete::class.java)
task.onlyIf { kotlinTask.kotlinOptions.sourceMap }
task.delete(object : Closure<String>(this) {
override fun call(): String? = (kotlinTask.property("outputFile") as String) + ".map"
override fun call(): String? = (kotlinTask.property("outputFile") as File).canonicalPath + ".map"
})
project.tasks.findByName("clean")?.dependsOn(taskName)
}
@@ -445,8 +445,8 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
@Suppress("unused")
@get:OutputFile
val outputFile: String
get() = kotlinOptions.outputFile ?: defaultOutputFile.canonicalPath
val outputFile: File
get() = kotlinOptions.outputFile?.let(::File) ?: defaultOutputFile
override fun findKotlinCompilerClasspath(project: Project): List<File> =
findKotlinJsCompilerClasspath(project)
@@ -458,7 +458,7 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
args.apply { fillDefaultValues() }
super.setupCompilerArgs(args, defaultsOnly)
args.outputFile = outputFile
args.outputFile = outputFile.canonicalPath
if (defaultsOnly) return
@@ -472,8 +472,7 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
internal val friendDependency
get() = friendTaskName
?.let { project.getTasksByName(it, false).singleOrNull() as? Kotlin2JsCompile }
?.outputFile
?.let { File(it).parentFile }
?.outputFile?.parentFile
?.let { if (LibraryUtils.isKotlinJavascriptLibrary(it)) it else null }
?.absolutePath