Hi guys, my build is not passing on CIs integratio...
# gradle
g
Hi guys, my build is not passing on CIs integrations and it looks like it is because I was not able to translate propertly theses tasks to the
build.gradle.kts
format. Does someone knows how to do that?
Copy code
task jsinterop(type: Exec) {
    workingDir projectDir
    def ext = MPPTools.isWindows() ? '.bat' : ''
    def distributionPath = project.properties['org.jetbrains.kotlin.native.home'] as String
    if (distributionPath != null) {
        def jsinteropCommand = Paths.get(file(distributionPath).path, 'bin', "jsinterop$ext").toString()

        inputs.property('jsinteropCommand', jsinteropCommand)
        inputs.property('jsinteropPackageName', packageName)
        outputs.file(jsinteropKlibFileName)

        commandLine jsinteropCommand,
                '-pkg', packageName,
                '-o', jsinteropKlibFileName,
                '-target', 'wasm32'
    } else {
        doFirst {
            // Abort build execution if the distribution path isn't specified.
            throw new GradleException("""\
                |Kotlin/Native distribution path must be specified to build the JavaScript interop.
                |Use 'org.jetbrains.kotlin.native.home' project property to specify it.
            """.stripMargin())
        }
    }
}

tasks.withType(KotlinNativeCompile).all {
    dependsOn jsinterop
}
Where I’m using this kotlin project as a basis: https://github.com/JetBrains/kotlin-native/blob/master/samples/html5Canvas/build.gradle
It looks like I was able to do the translation:
Copy code
val jsinterop = tasks.create("jsinterop", Exec::class.java) {
	workingDir = projectDir
	val os = org.gradle.internal.os.OperatingSystem.current()!!
	val ext = if (os.isWindows) ".bat" else ""
	val distributionPath = project.properties["konanHome"] as String
	val jsinteropCommand = Paths.get(file(distributionPath).path, "bin", "jsinterop$ext").toString()

	inputs.property("jsinteropCommand", jsinteropCommand)
	inputs.property("jsinteropPackageName", packageName)
	outputs.file(jsinteropKlibFileName)

	commandLine(
		jsinteropCommand,
		"-pkg",
		packageName,
		"-o",
		jsinteropKlibFileName,
		"-target",
		"wasm32"
	)
}

tasks.withType(KotlinNativeCompile::class.java).all {
	dependsOn(jsinterop)
}