com.jtransc.gen.haxe.haxelib.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-gen-haxe Show documentation
Show all versions of jtransc-gen-haxe Show documentation
JVM AOT compiler currently generating JavaScript, Haxe, with initial focus on Kotlin and games.
package com.jtransc.gen.haxe
import com.jtransc.text.toUcFirst
import com.jtransc.vfs.CwdVfs
object HaxeLib {
data class LibraryRef(val name: String, val version: String) {
val id = name.toUcFirst() // Remove symbols!
val nameWithVersion = "$name:$version"
companion object {
fun fromVersion(it:String): LibraryRef {
val parts = it.split(':')
return LibraryRef(parts[0], parts[1])
}
}
}
val vfs by lazy { CwdVfs() }
fun exists(lib: LibraryRef):Boolean {
return vfs.exec("haxelib", "--always", "path", lib.nameWithVersion).success
}
fun install(lib: LibraryRef) {
vfs.passthru("haxelib", "--always", "install", lib.name, lib.version)
}
fun installIfNotExists(lib: LibraryRef) {
if (!exists(lib)) {
install(lib)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy