Cake icon indicating copy to clipboard operation
Cake copied to clipboard

How to share Modules between multiple projects

Open hiroshihorie opened this issue 6 years ago • 8 comments

Sorry this must be a really basic question, but once i've built Modules (custom frameworks etc.), i would like to share them with my other projects.

What is the best practice to do this with Cake ?

hiroshihorie avatar Mar 15 '19 10:03 hiroshihorie

There are several ways you could mean “share” could you be more specific?

mxcl avatar Mar 15 '19 13:03 mxcl

I was thinking earlier that it would be nice to have a menu option for exporting a module into a new 'Caked' project so you could easily make it stand alone for sharing between separate projects or making a new open source project from that module.

gcox avatar Mar 15 '19 13:03 gcox

If you want a module in another Cake project, you can just copy the folder, no need to have menu items.

mxcl avatar Mar 15 '19 13:03 mxcl

True. I still haven't gotten used to how simple Cake makes this sort of thing.

gcox avatar Mar 15 '19 13:03 gcox

Thank you for your reply. Since the Sources.Model folder is a folder reference (blue folder), somehow i thought adding (drag & drop) the same module folder to another Cake project's Sources.Module will reference the same module, so then I can edit the source code of the same module from both projects. But what seems to happen is that Cake copies the code instead, so when i edit the code, i also need to copy it back to the other project.

If you want a module in another Cake project, you can just copy the folder, no need to have menu items.

Yes, still copying back to other project(s) anytime there is modifications would be required. Perhaps sharing the module across multiple projects was not the intended use case but i just had expectations that Cake will also handle this since it is already handling modules well.

I'm new to modules and I must be doing something wrong or this is not what Cake is for.

Thanks for Cake!

hiroshihorie avatar Mar 16 '19 02:03 hiroshihorie

To share modules across multiple projects you would need to convert it to a Swift package.

In theory we could support local file references as dependencies though. I have no particular motivation for this personally so cannot envisage the design very well.

mxcl avatar Mar 21 '19 12:03 mxcl

I understand you don't have motivation for this personally. Thank you for your reply and hard work.

hiroshihorie avatar Mar 21 '19 12:03 hiroshihorie

Well, I'm not saying I don’t want this feature, merely that I have not needed it (yet) so I do not have a good idea for how it would work. I'd welcome discussion.

mxcl avatar Mar 21 '19 12:03 mxcl