4

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?

4

2 に答える 2

2

これには「外部」を使用できます。外部リポジトリを使用すると、特定のリポジトリ内に個別のリポジトリを含めることができます。したがって、デバイス固有のリポジ​​トリ内に、共通の「JS/HTML」リポジトリを含めることができます。

誰かが共有リポジトリで新しいバージョンをコミットするたびに、その変更がすぐに他のリポジトリに伝播することを意味するため、実際にはこのアプローチから離れました。これにより、これらの依存関係の管理で問題が発生する可能性があります。そのため、ビルドスクリプトを使用して、ビルドプロセスの一部として共有リポジトリから特定のバージョンをチェックアウトします。

于 2012-08-29T08:59:53.213 に答える
2

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).

于 2012-08-29T09:02:37.347 に答える