I often get confused in Kotlin MP with the notions of projects, modules, directories, especially the module one. In the context of my SDK (for Android, iOS consumers), I have a single project, but when it's time to partition the code (1-cross platform, 2-native Android, 3-native iOS), is it preferable to have 3 modules for that or 3 folders would do the job? I suspect that 3 modules are better, but not 100% sure.
(The end goal is to have 2 build pipelines generating respectively .jar/.framework files.)Edit: Basically, the more general questio around that is, in the context of a Kotlin Multiplatform project, do you always structure your code/build files by modules (1 shared, 1 for each target) or do you sometimes separate with plain/regular directories?
Edit 2: On 2nd thought, I think the project/module/directory nomenclature may be closer to the IDE I use (IntelliJ) than the Kotlin language itself.
k
Kris Wong
10/23/2019, 8:51 PM
the most recent versions of the multiplatform plugin are based on source sets, which are basically just directories
Kris Wong
10/23/2019, 8:51 PM
if you create a new project with the multiplatform template, it will create the shell for you
Kris Wong
10/23/2019, 8:53 PM
modules/projects still apply to separate different pieces of functionality or features
s
Sylvain Patenaude
10/23/2019, 9:03 PM
Yeah, based on source sets (with each source having its own target) makes sense I guess. The shell my template generated looks something like this in terms of modules:
- MySDK
- commonMain
- iosMain
- jvmMain
- commonTest
...
- MySDK
where the 1st 'MySDK' is the project and the 2nd one is the shared/crossplatform module. So based on that shell, I could further partition the shared module in directories, but no need to create other modules I guess.