Youssef Shoaib [MOD]
08/01/2023, 8:52 PMtargets.all {
compilations.all {
compilerOptions.options.freeCompilerArgs.add("-Xcontext-receivers")
}
}
but that doesn't seem to work. I want to have contextual declarations in commonMain. I know that context receivers aren't implemented yet for non-jvm sources. Does that mean I'd have to make a jvmShared sourceSet so that I can have contextual code there?dmitriy.novozhilov
08/01/2023, 9:10 PMCasey Brooks
08/01/2023, 9:23 PMYoussef Shoaib [MOD]
08/01/2023, 9:50 PMJavier
08/01/2023, 10:27 PMCasey Brooks
08/01/2023, 10:34 PMdmitriy.novozhilov
08/02/2023, 8:34 AMYoussef Shoaib [MOD]
08/02/2023, 8:48 AMtargetHierarchy experimental API, setting a group for desktop + android, and I enabled context receivers not using the compiler option, but using languageOptions.enableLanguageFeature("ContextReceivers") on all source sets, and that seemed to do the trick. Sadly, the language feature for context receivers doesn't seem to be documented anywhere at all. It would be nice if that was documented, because it seems like the compiler options way only works for targets, not for shared source sets, while enableLanguageFeature works for source setsdmitriy.novozhilov
08/02/2023, 8:49 AMtapchicoma
08/02/2023, 8:50 AMbut that doesn't seem to workDo you mean in IDEA context receivers was not working?
Youssef Shoaib [MOD]
08/02/2023, 8:50 AMfreeCompilerArgs didn't apply for that shared JVM source-setYoussef Shoaib [MOD]
08/02/2023, 8:51 AMfreeCompilerArgs is for compilation, but I'm not sure. Still, enableLanguageFeature worked flawlessly in IDE and compilertapchicoma
08/02/2023, 8:52 AMkotlin {
compilerOptions {
// common compiler arguments applied to all targets and shared source sets
}
}tapchicoma
08/02/2023, 8:53 AMlanguageSettings in MPP projects until 1.9.20 releaseYoussef Shoaib [MOD]
08/02/2023, 8:54 AMContextReceivers really was a valid optionYoussef Shoaib [MOD]
08/02/2023, 8:54 AMenableLanguageFeature listing some of them would be nicetapchicoma
08/02/2023, 8:55 AMLanguageFeatures directly, but some compiler argument instead (-X...). Also there is plan to expose such experimental compiler arguments in compilerOptions DSL as wellYoussef Shoaib [MOD]
08/02/2023, 8:57 AMcompilerOptions DSL would definitely be the best solution here; I wanna just have an easy enable(ContextReceivers) call or something, so I don't have to think about strings or go hunting around for the right onetapchicoma
08/02/2023, 8:58 AMYoussef Shoaib [MOD]
08/02/2023, 9:00 AM