So I have this dilemma I'm trying to solve. I am an indie game developer working on 6-7 client projects at any given time with the Unity game engine. The problem I'm experiencing is keeping my shared-code synced between the projects - my current solution is very "manual" and time consuming (and error prone when I forget to update everything). I started looking into SVN externals as a solution, but there's one problem. The Unity game engine uses *.meta files to maintain data for how the files in question are used within each game.
As a quick example - here is a sample folder structure:
Project 1:
- ROOT
- ROOT/Assets
- ROOT/Assets/SharedCode
- ROOT/Assets/SharedCode/SharedScript.cs
- ROOT/Assets/SharedCode/SharedScript.meta
Project 2:
- ROOT
- ROOT/Assets
- ROOT/Assets/SharedCode
- ROOT/Assets/SharedCode/SharedScript.cs
- ROOT/Assets/SharedCode/SharedScript.meta
The obvious/immediate solution is to just make my "SharedCode" folder an SVN external. The issue that arises is that the SharedScript.cs file should be identical on both projects, but the SharedScript.meta file is project specific and auto-generated by the game engine (so I can't say, store all my meta files in a single folder somewhere external to the "SharedCode" folder).
There are hundreds of these files, so I'd love a solution that doesn't involve treating each "shared" file as an SVN external unto itself.
My current ugly solution is to keep the whole project tree in SVN - and I have a sub-folder that is a GIT repo which ignores the .meta files. It's pretty ugly though, and I frequently commit/update the main project and forget to commit/push/pull the git "library" project.
Any suggestions would be greatly appreciated!
Why not make your "SharedCode" folder an SVN external - but without the "SharedScript.meta" file (and any other files that are project specific/auto-generated).
Now have the SharedCode.csproj point to a non-existent file, "$(SolutionDir)/<(blah)/SharedScript.meta". You can simply hand-edit the csproj to do this. Note that all your solutions MUST now generate this meta file to this relative path.
Now when you add this csproj to the solution of your choice you'll need to set up the project dependencies so that "SharedScript.meta" file is generated before your "SharedCode" project is built. Now there shouldn't be any issues.
Hope that helps!