Thread
#multiplatform
    f

    fkrauthan

    2 years ago
    And one last issue. I've created a multiplatform project that has
    jvm
    ,
    macosX64
    and
    linuxX64
    as targets as well as a
    commonMain
    with most of my code and a
    posixMain
    source set where macos and linux main source sets are depending on. But for some reason I don't seem to have access to any of the default interops e,g,
    platform.posix
    nether in
    posixMain
    nor in
    linuxMain
    and
    macosMain
    . Is there anything else I need to configure to be able to access them (preferable in my
    posixMain
    source set?
    russhwolf

    russhwolf

    2 years ago
    The IDE support with intermediate source-sets like that is lacking, but it should build from gradle/command-line
    Can try setting
    kotlin.mpp.enableGranularSourceSetsMetadata=true
    in your
    gradle.properties
    which enables an experimental project model that will eventually make this work better. Might not help though.
    f

    fkrauthan

    2 years ago
    But is there any way to not get red error warnings etc? E.g. manual add meta info for IDE?
    russhwolf

    russhwolf

    2 years ago
    There’s various workarounds but all a little imperfect. You can do something like manually adding srcDirs from the shared code into your platform code. You get some IDE warnings but the inference works.
    f

    fkrauthan

    2 years ago
    The strange thing is if I open the project structure it shows for posixMain that traget platform is
    Native
    How would you do the src Dirs workaround? Like I don't have an issue with accessing my common Kotlin code in my posixMain codebase but I get errors saying the import
    platform
    does not exist
    russhwolf

    russhwolf

    2 years ago
    Right. It won't see platform things in intermediate sources
    This is the workaround I use in Multiplatform Settings for shared apple stuff https://github.com/russhwolf/multiplatform-settings/blob/master/buildSrc/src/main/kotlin/BuildHelpers.kt#L107-L110
    f

    fkrauthan

    2 years ago
    The strange thing is I don't even see it in the main native source targets like
    linuxMain
    russhwolf

    russhwolf

    2 years ago
    Not the only way to do it though. Other people might have better configs
    f

    fkrauthan

    2 years ago
    Ok cool I check it out. Thank you very much
    And you are right even though my IDE is not happy accessing cinterop works finish 😄
    Hmm unfortunately your fix does not work for me 😞 I'll keep looking.