Hi, I’m trying to translate a build.gradle file to...
# dsl
g
Hi, I’m trying to translate a build.gradle file to a build.gradle.kts one Is this
Copy code
task copyFramework {
    def buildType = project.findProperty('kotlin.build.type') ?: 'DEBUG'
    def target = project.findProperty('kotlin.target') ?: 'ios'
    dependsOn kotlin.targets."$target".compilations.main.linkTaskName('FRAMEWORK', buildType)

    doLast {
        def srcFile = kotlin.targets."$target".compilations.main.getBinary('FRAMEWORK', buildType)
        def targetDir = getProperty('configuration.build.dir')
        copy {
            from srcFile.parent
            into targetDir
            include 'app.framework/**'
            include 'app.framework.dSYM'
        }
    }
}
the correct translation of this:
Copy code
task("copyFramework") {
    val buildType = (project.findProperty("kotlin.build.type") ?: "DEBUG").toString()
    val target = project.findProperty("kotlin.target") ?: "ios"
    dependsOn((kotlin.targets["$target"].compilations["main"] as KotlinNativeCompilation).linkTaskName("FRAMEWORK", buildType))

    doLast {
        val srcFile = (kotlin.targets["$target"].compilations["main"] as KotlinNativeCompilation).getBinary("FRAMEWORK", buildType)
        val targetDir = System.getProperty("configuration.build.dir")
        copy {
            from(srcFile.parent) {
                into(targetDir)
                include("main.framework/**")
                include("main.framework.dSYM")
            }
        }
    }
}