ant: cleanup 'public', property access syntax
This commit is contained in:
@@ -19,22 +19,22 @@ package org.jetbrains.kotlin.ant
|
|||||||
import org.apache.tools.ant.types.Path
|
import org.apache.tools.ant.types.Path
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
public class Kotlin2JsTask : KotlinCompilerBaseTask() {
|
class Kotlin2JsTask : KotlinCompilerBaseTask() {
|
||||||
override val compilerFqName = "org.jetbrains.kotlin.cli.js.K2JSCompiler"
|
override val compilerFqName = "org.jetbrains.kotlin.cli.js.K2JSCompiler"
|
||||||
|
|
||||||
public var library: Path? = null
|
var library: Path? = null
|
||||||
public var outputPrefix: File? = null
|
var outputPrefix: File? = null
|
||||||
public var outputPostfix: File? = null
|
var outputPostfix: File? = null
|
||||||
public var sourceMap: Boolean = false
|
var sourceMap: Boolean = false
|
||||||
public var metaInfo: 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.CALL} (default) if need generate a main function call (main function will be auto detected)
|
||||||
* {@link K2JsArgumentConstants.NO_CALL} otherwise.
|
* {@link K2JsArgumentConstants.NO_CALL} otherwise.
|
||||||
*/
|
*/
|
||||||
public var main: String? = null
|
var main: String? = null
|
||||||
|
|
||||||
public fun createLibrary(): Path {
|
fun createLibrary(): Path {
|
||||||
val libraryPath = library
|
val libraryPath = library
|
||||||
if (libraryPath == null) {
|
if (libraryPath == null) {
|
||||||
val t = Path(getProject())
|
val t = Path(getProject())
|
||||||
|
|||||||
@@ -20,15 +20,15 @@ import org.apache.tools.ant.types.Path
|
|||||||
import org.apache.tools.ant.types.Reference
|
import org.apache.tools.ant.types.Reference
|
||||||
import java.io.File.pathSeparator
|
import java.io.File.pathSeparator
|
||||||
|
|
||||||
public class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
||||||
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
|
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
|
||||||
|
|
||||||
public var includeRuntime: Boolean = true
|
var includeRuntime: Boolean = true
|
||||||
public var moduleName: String? = null
|
var moduleName: String? = null
|
||||||
|
|
||||||
private var compileClasspath: Path? = null
|
private var compileClasspath: Path? = null
|
||||||
|
|
||||||
public fun setClasspath(classpath: Path) {
|
fun setClasspath(classpath: Path) {
|
||||||
if (compileClasspath == null) {
|
if (compileClasspath == null) {
|
||||||
compileClasspath = classpath
|
compileClasspath = classpath
|
||||||
}
|
}
|
||||||
@@ -37,14 +37,14 @@ public class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun setClasspathRef(ref: Reference) {
|
fun setClasspathRef(ref: Reference) {
|
||||||
if (compileClasspath == null) {
|
if (compileClasspath == null) {
|
||||||
compileClasspath = Path(getProject())
|
compileClasspath = Path(getProject())
|
||||||
}
|
}
|
||||||
compileClasspath!!.createPath().setRefid(ref)
|
compileClasspath!!.createPath().refid = ref
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun addConfiguredClasspath(classpath: Path) {
|
fun addConfiguredClasspath(classpath: Path) {
|
||||||
setClasspath(classpath)
|
setClasspath(classpath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ object KotlinAntTaskUtil {
|
|||||||
|
|
||||||
private val libPath: File by lazy {
|
private val libPath: File by lazy {
|
||||||
// Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory
|
// 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
|
val jarConnection = javaClass.getResource(resourcePath).openConnection() as? JarURLConnection
|
||||||
?: throw UnsupportedOperationException("Kotlin compiler Ant task should be loaded from the JAR file")
|
?: 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 {
|
val compilerJar: File by lazy {
|
||||||
@@ -47,7 +47,7 @@ object KotlinAntTaskUtil {
|
|||||||
|
|
||||||
private fun File.assertExists(): File {
|
private fun File.assertExists(): File {
|
||||||
if (!this.exists()) {
|
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
|
return this
|
||||||
}
|
}
|
||||||
@@ -68,5 +68,5 @@ object KotlinAntTaskUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public val Task.defaultModuleName: String?
|
val Task.defaultModuleName: String?
|
||||||
get() = owningTarget?.name ?: project?.name
|
get() = owningTarget?.name ?: project?.name
|
||||||
@@ -24,25 +24,25 @@ import org.apache.tools.ant.types.Reference
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
|
|
||||||
public abstract class KotlinCompilerBaseTask : Task() {
|
abstract class KotlinCompilerBaseTask : Task() {
|
||||||
protected abstract val compilerFqName: String
|
protected abstract val compilerFqName: String
|
||||||
|
|
||||||
public val args: MutableList<String> = arrayListOf()
|
val args: MutableList<String> = arrayListOf()
|
||||||
|
|
||||||
public var src: Path? = null
|
var src: Path? = null
|
||||||
public var output: File? = null
|
var output: File? = null
|
||||||
public var nowarn: Boolean = false
|
var nowarn: Boolean = false
|
||||||
public var verbose: Boolean = false
|
var verbose: Boolean = false
|
||||||
public var printVersion: Boolean = false
|
var printVersion: Boolean = false
|
||||||
public var failOnError: Boolean = true
|
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
|
val srcPath = src
|
||||||
if (srcPath == null) {
|
if (srcPath == null) {
|
||||||
val t = Path(getProject())
|
val t = Path(getProject())
|
||||||
@@ -53,11 +53,11 @@ public abstract class KotlinCompilerBaseTask : Task() {
|
|||||||
return srcPath.createPath()
|
return srcPath.createPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun setSrcRef(ref: Reference) {
|
fun setSrcRef(ref: Reference) {
|
||||||
createSrc().refid = ref
|
createSrc().refid = ref
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun createCompilerArg(): Commandline.Argument {
|
fun createCompilerArg(): Commandline.Argument {
|
||||||
val argument = Commandline.Argument()
|
val argument = Commandline.Argument()
|
||||||
additionalArguments.add(argument)
|
additionalArguments.add(argument)
|
||||||
return argument
|
return argument
|
||||||
@@ -65,7 +65,7 @@ public abstract class KotlinCompilerBaseTask : Task() {
|
|||||||
|
|
||||||
abstract fun fillSpecificArguments()
|
abstract fun fillSpecificArguments()
|
||||||
|
|
||||||
public fun fillArguments() {
|
fun fillArguments() {
|
||||||
val sourcePaths = src ?: throw BuildException("\"src\" should be specified")
|
val sourcePaths = src ?: throw BuildException("\"src\" should be specified")
|
||||||
args.addAll(sourcePaths.list().map { File(it).canonicalPath })
|
args.addAll(sourcePaths.list().map { File(it).canonicalPath })
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user