From b72ea1ff0794ed9cdd0a47bb88183b0bf38e19be Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 7 Jan 2016 17:53:32 +0100 Subject: [PATCH] ant: cleanup 'public', property access syntax --- .../org/jetbrains/kotlin/ant/Kotlin2JsTask.kt | 16 +++++----- .../jetbrains/kotlin/ant/Kotlin2JvmTask.kt | 14 ++++----- .../jetbrains/kotlin/ant/KotlinAntTaskUtil.kt | 10 +++---- .../kotlin/ant/KotlinCompilerBaseTask.kt | 30 +++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/ant/src/org/jetbrains/kotlin/ant/Kotlin2JsTask.kt b/ant/src/org/jetbrains/kotlin/ant/Kotlin2JsTask.kt index 6b395d4a636..af2234d71bd 100644 --- a/ant/src/org/jetbrains/kotlin/ant/Kotlin2JsTask.kt +++ b/ant/src/org/jetbrains/kotlin/ant/Kotlin2JsTask.kt @@ -19,22 +19,22 @@ package org.jetbrains.kotlin.ant import org.apache.tools.ant.types.Path import java.io.File -public class Kotlin2JsTask : KotlinCompilerBaseTask() { +class Kotlin2JsTask : KotlinCompilerBaseTask() { override val compilerFqName = "org.jetbrains.kotlin.cli.js.K2JSCompiler" - public var library: Path? = null - public var outputPrefix: File? = null - public var outputPostfix: File? = null - public var sourceMap: Boolean = false - public var metaInfo: Boolean = false + var library: Path? = null + var outputPrefix: File? = null + var outputPostfix: File? = null + var sourceMap: Boolean = false + var metaInfo: Boolean = false /** * {@link K2JsArgumentConstants.CALL} (default) if need generate a main function call (main function will be auto detected) * {@link K2JsArgumentConstants.NO_CALL} otherwise. */ - public var main: String? = null + var main: String? = null - public fun createLibrary(): Path { + fun createLibrary(): Path { val libraryPath = library if (libraryPath == null) { val t = Path(getProject()) diff --git a/ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt b/ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt index 0c171db4712..eb57107266d 100644 --- a/ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt +++ b/ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt @@ -20,15 +20,15 @@ import org.apache.tools.ant.types.Path import org.apache.tools.ant.types.Reference import java.io.File.pathSeparator -public class Kotlin2JvmTask : KotlinCompilerBaseTask() { +class Kotlin2JvmTask : KotlinCompilerBaseTask() { override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler" - public var includeRuntime: Boolean = true - public var moduleName: String? = null + var includeRuntime: Boolean = true + var moduleName: String? = null private var compileClasspath: Path? = null - public fun setClasspath(classpath: Path) { + fun setClasspath(classpath: Path) { if (compileClasspath == null) { compileClasspath = classpath } @@ -37,14 +37,14 @@ public class Kotlin2JvmTask : KotlinCompilerBaseTask() { } } - public fun setClasspathRef(ref: Reference) { + fun setClasspathRef(ref: Reference) { if (compileClasspath == null) { compileClasspath = Path(getProject()) } - compileClasspath!!.createPath().setRefid(ref) + compileClasspath!!.createPath().refid = ref } - public fun addConfiguredClasspath(classpath: Path) { + fun addConfiguredClasspath(classpath: Path) { setClasspath(classpath) } diff --git a/ant/src/org/jetbrains/kotlin/ant/KotlinAntTaskUtil.kt b/ant/src/org/jetbrains/kotlin/ant/KotlinAntTaskUtil.kt index 22c3727ef68..31fe9dccebd 100644 --- a/ant/src/org/jetbrains/kotlin/ant/KotlinAntTaskUtil.kt +++ b/ant/src/org/jetbrains/kotlin/ant/KotlinAntTaskUtil.kt @@ -29,12 +29,12 @@ object KotlinAntTaskUtil { private val libPath: File by lazy { // Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory - val resourcePath = "/" + javaClass.getName().replace('.', '/') + ".class" + val resourcePath = "/" + javaClass.name.replace('.', '/') + ".class" val jarConnection = javaClass.getResource(resourcePath).openConnection() as? JarURLConnection ?: throw UnsupportedOperationException("Kotlin compiler Ant task should be loaded from the JAR file") - val antTaskJarPath = File(jarConnection.getJarFileURL().toURI()) + val antTaskJarPath = File(jarConnection.jarFileURL.toURI()) - antTaskJarPath.getParentFile() + antTaskJarPath.parentFile } val compilerJar: File by lazy { @@ -47,7 +47,7 @@ object KotlinAntTaskUtil { private fun File.assertExists(): File { if (!this.exists()) { - throw IllegalStateException("${getName()} is not found in the directory of Kotlin Ant task") + throw IllegalStateException("${name} is not found in the directory of Kotlin Ant task") } return this } @@ -68,5 +68,5 @@ object KotlinAntTaskUtil { } -public val Task.defaultModuleName: String? +val Task.defaultModuleName: String? get() = owningTarget?.name ?: project?.name \ No newline at end of file diff --git a/ant/src/org/jetbrains/kotlin/ant/KotlinCompilerBaseTask.kt b/ant/src/org/jetbrains/kotlin/ant/KotlinCompilerBaseTask.kt index dbb9d1a36b0..b67a2bcaf1b 100644 --- a/ant/src/org/jetbrains/kotlin/ant/KotlinCompilerBaseTask.kt +++ b/ant/src/org/jetbrains/kotlin/ant/KotlinCompilerBaseTask.kt @@ -24,25 +24,25 @@ import org.apache.tools.ant.types.Reference import java.io.File import java.io.PrintStream -public abstract class KotlinCompilerBaseTask : Task() { +abstract class KotlinCompilerBaseTask : Task() { protected abstract val compilerFqName: String - public val args: MutableList = arrayListOf() + val args: MutableList = arrayListOf() - public var src: Path? = null - public var output: File? = null - public var nowarn: Boolean = false - public var verbose: Boolean = false - public var printVersion: Boolean = false - public var failOnError: Boolean = true + var src: Path? = null + var output: File? = null + var nowarn: Boolean = false + var verbose: Boolean = false + var printVersion: Boolean = false + var failOnError: Boolean = true - public var noStdlib: Boolean = false + var noStdlib: Boolean = false - public val additionalArguments: MutableList = arrayListOf() + val additionalArguments: MutableList = arrayListOf() - public var exitCode: Int? = null + var exitCode: Int? = null - public fun createSrc(): Path { + fun createSrc(): Path { val srcPath = src if (srcPath == null) { val t = Path(getProject()) @@ -53,11 +53,11 @@ public abstract class KotlinCompilerBaseTask : Task() { return srcPath.createPath() } - public fun setSrcRef(ref: Reference) { + fun setSrcRef(ref: Reference) { createSrc().refid = ref } - public fun createCompilerArg(): Commandline.Argument { + fun createCompilerArg(): Commandline.Argument { val argument = Commandline.Argument() additionalArguments.add(argument) return argument @@ -65,7 +65,7 @@ public abstract class KotlinCompilerBaseTask : Task() { abstract fun fillSpecificArguments() - public fun fillArguments() { + fun fillArguments() { val sourcePaths = src ?: throw BuildException("\"src\" should be specified") args.addAll(sourcePaths.list().map { File(it).canonicalPath })