I want to be able to share my own source code between my projects I work on locally. When I change that shared source code, I want all projects that use it locally, to pick up the changes, that is, when I run a project.
Yes, I can create a local library or repository or something like this, but will this give me a flexibity I want?
Namely, when I change it, will the changes be automatically picked up by my projects? Or will I have to delete the mix.lock file and do other stuff?
I can publish it on my github also, however, this will require me to re-publish it each time I change it locally and also increment its version – too much effort.
Also, when I deploy a project, that shared local library should embed the current shapshot of itself into a project as it is currently. Or at least its latest build.
The bottom line is that I want to be able to share code locally effortlessly.
You can use :path-dependencies, those are updated on every run of mix deps.update $name. But you really shouldn’t use those. Those projects can’t (easily) worked on on different workstations.
Also, picking up changes automatically isn’t what you want. I’ve been there, done that… Believe me, it makes development easier in the first instance, at least it seems it were. But after you had a running A, then changed the shared codebase S to make something work in B, and you are happy, continue to work at C and D, and don’t touch S at all. Then you need to get back to A, and without having changed anything in it, nothing works, because some old changes in S.
In a properly versioned system you can simply stick to the known to work version of S until you fixed it and A will not break.
I think, that @bobbypriambodo means, that a built release of an application will embed your shared code. A library of course can’t, except you link the shared files in terms of a filesystems soft- or hardlink directly into the not-shared file tree. Of course, this is the last thing I’d evver suggest and the first I’d advise against!