I would use that set to filter this: ```targets {...
# multiplatform
p
I would use that set to filter this:
Copy code
targets {
    presets
        .filterIsInstance<AbstractKotlinNativeTargetPreset<*>>()
        .filter { it in supportedTargets }
        .forEach { preset ->
            targetFromPreset(preset, preset.name) {
                compilations["main"].source(sourceSets["nativeMain"])
                compilations["test"].source(sourceSets["nativeTest"])
            }
        }
}
r
I tried to do this once and couldn't find a way to make it work, but interested if anyone else has figured it out.
k
take it out of the
targets
block, directly in the
kotlin
block. it seems valid, though I haven't tried to verify it works properly.
r
That code snippet is fine. The hard part is figuring out how to infer the list of
supportedTargets
by inspecting your dependencies.
☝🏼 1
k
i see
p
Follow up: I write a script to print the supported native targets of an artifact. It works for my purposes, but depends on Maven Central. It's not a complete solution, but saves me some time: https://github.com/oolong-kt/oolong/pull/106/files#diff-2ad7cff1ee7e009affe9ee2a99b6c0d5