Skip to content

Commit

Permalink
ant: cleanup 'public', property access syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
yole committed Jan 7, 2016
1 parent e47e9f6 commit b72ea1f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
16 changes: 8 additions & 8 deletions ant/src/org/jetbrains/kotlin/ant/Kotlin2JsTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
14 changes: 7 additions & 7 deletions ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
}

Expand Down
10 changes: 5 additions & 5 deletions ant/src/org/jetbrains/kotlin/ant/KotlinAntTaskUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand All @@ -68,5 +68,5 @@ object KotlinAntTaskUtil {

}

public val Task.defaultModuleName: String?
val Task.defaultModuleName: String?
get() = owningTarget?.name ?: project?.name
30 changes: 15 additions & 15 deletions ant/src/org/jetbrains/kotlin/ant/KotlinCompilerBaseTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = arrayListOf()
val args: MutableList<String> = 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<Commandline.Argument> = arrayListOf()
val additionalArguments: MutableList<Commandline.Argument> = 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())
Expand All @@ -53,19 +53,19 @@ 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
}

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 })

Expand Down

0 comments on commit b72ea1f

Please sign in to comment.