Hi friends. I’m working on a long-standing Kotlin ...
# multiplatform
b
Hi friends. I’m working on a long-standing Kotlin Multiplatform project at the moment with Android Mobile + Android TV + iOS + tvOS targets. We’re in the process of migrating to the Gradle Kotlin DSL but running in to some problems with how to migrate away from
fromPreset
for our use case. Can anyone give me a steer on what I should be using instead? Example in the thread:
Copy code
targets {
        //Android
        android()

        def preset
        if (isTvOS) {
            switch (targetName) {
                case 'x86_64':
                    preset = presets.tvosX64
                    break
                case 'arm64':
                    preset = presets.tvosArm64
                    break
                default:
                    throw new Exception("Not a valid arch for tvOS")
            }
        } else {
            switch (targetName) {
                case 'x86_64':
                    preset = presets.iosX64
                    break
                case 'arm64':
                    preset = presets.iosArm64
                    break
                case 'armv7':
                    preset = presets.iosArm32
                    break
                default:
                    throw new Exception("Not a valid arch for iOS")
            }
        }

        fromPreset(preset, 'apple') {
            def subTargetDir = isTvOS ? tvOsSource : iOsSource
            def vendorDir = "$projectDir/src/$subTargetDir/vendor"

            binaries {
                def linkerOptions = ["-F${file(vendorDir).absolutePath}".toString()]

                compilations.each {
                    it.cinterops {
                      // we define a few cinterops here
                    }
                }