Reputation: 5522
I am creating a phonegap app which will be supported by
Android
Windows phone
iOS
BlackBerry
So far, main development happen on Android and all JS/HTML are copied to other platforms. Moving on, we have to keep different repositories for all the platforms for easier maintenance.
The obvious way I can think of is to create a folder for each platform and maintain the code there. But in that case, if we are modifying any www (JS/HTML/CSS/Images) contents, we will need to manually copy to all the repos.
Is there a better way to handle common files, or copying same file to 4 locations is the only way out?
Upvotes: 4
Views: 880
Reputation: 49562
A possible solution would be to split your code into the following folders/repositories:
And then create a small script that can create a valid project out of these files by doing the following steps:
common
folder to a target
foldertarget
folder (and overwrite existing files)So you have to change platform independent only in one location and still have the change to add platform specific code (or overwrite common code for a specific platform).
Upvotes: 2
Reputation: 29629
You can use "Externals" for this. An external repository allows you to include a separate repository within a given repo - so within your device-specific repositories, you can include the common "JS/HTML" repository.
We have actually stepped away from this approach, because it does mean that every time someone commits a new version in the shared repo, that change immediately propagates to the other repositories. This can cause problems managing those dependencies - so we use a build script to check out a specific version from the shared repo as part of the build process.
Upvotes: 2