Kamal
Kamal

Reputation: 5522

SVN Repository for common code -phonegap

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

Answers (2)

micha
micha

Reputation: 49562

A possible solution would be to split your code into the following folders/repositories:

  • common - contains all platform independent files
  • android - contains android specific files
  • windows - contains windows specific files
  • ios - contains ios specific files
  • blackberry - contains blackberry specific files

And then create a small script that can create a valid project out of these files by doing the following steps:

  • copy all files of the common folder to a target folder
  • copy the files of a platform folder (e.g. android) to the target folder (and overwrite existing files)
  • package the target folder to an application package and deploy in on a device

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

Neville Kuyt
Neville Kuyt

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

Related Questions