Package my project code and dependencies for sharing

Hello all!

So, I've got a question- I want to be able to share/backup my entire project and all of its dependencies in a way that it can be shared easily with a computer that has zero project files, or be backed up and restored in case something happens to my local files/PC. My projects link to lots of libraries that are all stored in a central library folder.

I store things in a central library folder because project1 and project2 might both use LibraryA, for example. I have seen folks organize their projects differently though- making a Project1 folder, keeping the project code in there, and also keeping a libraries/dependencies folder inside of that for that project's dependencies. Sadly, this is not what I have been doing.

I know Github would be the best way to ultimately save, backup, track, and host my projects, but I've never used it and am just looking for some guidance on how to structure things and some resources on how to best get started.

My current folder structure looks like this:
Actual Arduino Sketches: My documents/Arduino Projects/[project name]/[project code .ino]
Libraries: My documents/Arduino Projects/Libraries

I use VScode with the Arduino plugin. I know VScode has some Git features too.

I know Git is the actual code repository system, and places like Github are hosting platforms for Git projects.

I'm hoping for some kind of "pack and go" experience. For example, I use Solidworks all the time. Different 3D models from all kinds of different folders end up producing one assembly of many models. I can use a feature called "pack and go" which saves everything to one new folder and links all the codependent files appropriately, so that I can send someone a single .zip of my project and it's got everything needed to open, inspect, and modify on a brand new PC.

This is what I hope to emulate. I have existing projects I need to "pack up", and I need a system I can employ for future projects that will lead to better and more organized project management for myself.

Does anyone have a good guide on getting started with better code management? Any experience using VScode's arduino plugin PLUS its Git features? I think I can manually move libraries into project folders, but how do I tell VScode where to look for those dependencies? How do I deal with having multiple local copies of LibraryA now that Project1 and Project2 both have a "lib" folder inside of them? Is there an industry standard approach to this?

As my projects are getting more complex and professional, and as I'm sharing with collaborators, the power and necessity of Git repos is becoming very clear. This extends beyond Arduino projects into other embedded systems, but I know this forum is one of the most helpful. Thanks so much for any suggestions.

This doesn't look like an Arduino question for Arduino forum.

VSCode with Platformio will put your dependencies in the .pio/libdeps folder

In terms of software development in general, it is not so common to check all the dependencies into the Git repository. Git is intended for version control of the project.

You might check in metadata about the dependencies, which could be package repository manifest files, Git submodules, Dockerfiles, etc. But the repo would get pretty crazy if you start tracking all the dependencies, most especially when it comes to the toolchain binaries. The repositories where that has been done get huge. For example, Arduino used to store the toolchains for the AVR and SAM boards and that repo is about 1 GB. They came to their senses when the Zero came out and moved all that out of the repository, but it remains forever in the history taking up space.

There are cases where the entire project, at various stages, must be kept under source control. It's a common behavior in regulated industries like medical devices. The purpose is to be able to recreate an exact version of software as it was at a particular time. That means the source, all dependencies, the build configuration, and all tools used to build must be archived.

And yes, sometimes the repos get massive.

That said, there are other reasons. I often have to share code with people I don't know and need to deal with different library versions, Arduino IDE versions and configuration, etc. It's easier if everything used to build a software release can be zipped up and sent over. Solves a lot of problems that way.

This is hard. Do you include the complete IDE and compiler toolchain as well?

git/github has "sub-modules." In theory, you can point the libraries via sub-modules at other github repositories (assuming that they're hosted on github as well.) I guess you could even link to specific versions of other repositories.

But afaik, there's no tool to assist with this. (It'd be nice to get the arduino tools to kick out all the dependencies that it figures out during a compile, but I don't think that exists, either.)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.