Fix Gradle
Some checks failed
ScriptCraft/pipeline/head There was a failure building this commit

This commit is contained in:
TheBrokenRail 2020-05-30 22:15:53 -04:00
parent d8b0a1ddbe
commit 3bea7e841b
2 changed files with 17 additions and 10 deletions

View File

@ -5,18 +5,22 @@ import org.gradle.api.tasks.Delete
import org.gradle.api.tasks.Exec
import org.gradle.kotlin.dsl.*
import java.io.File
import java.util.concurrent.Callable
class JNIPlugin : Plugin<Project> {
open class JNIConfig(private val project: Project) {
fun addPlatform(name: String, libExtension: String) = project.run {
val cDir = File(projectDir.absolutePath, "src/main/c")
var root: File = File(project.rootDir, "src/main/c")
val buildDir = File(cDir, "build-${name}")
fun addPlatform(name: String, libExtension: String) = project.run {
val buildDir = Callable {
File(root, "build-${name}")
}
tasks.register<Exec>("cmake-${name}") {
doFirst {
if (!buildDir.exists()) {
buildDir.mkdir()
val file = buildDir.call()
if (!file.exists()) {
file.mkdir()
}
}

View File

@ -15,8 +15,9 @@ class TypeScriptPlugin : Plugin<Project> {
open class NPMTask : DefaultTask() {
@get:Input
lateinit var taskName: String
@get:Optional
@get:Input
lateinit var outputDir: String
var outputDir: String? = null
@TaskAction
fun exec() {
@ -39,14 +40,16 @@ class TypeScriptPlugin : Plugin<Project> {
}
}
@Optional
@OutputDirectory
fun getOutput(): Callable<File>? {
return if (this::outputDir.isInitialized) {
val dir = outputDir
return if (dir != null) {
Callable {
if (File(outputDir).isAbsolute) {
File(outputDir)
if (File(dir).isAbsolute) {
File(dir)
} else {
File(project.the<TypeScriptConfig>().root, outputDir)
File(project.the<TypeScriptConfig>().root, dir)
}
}
} else {