适用于手机应用程序的最佳版本控制系统?

时间:2022-05-20 06:29:09

I'm developing a mobile phone application that targets a lot of mobile devices based on the capabilities they offer. There would be a base feature set which all phones are expected to support and then there would be additional features that would depend on specific set of phones.

我正在开发一种基于其提供的功能针对许多移动设备的移动电话应用程序。将有一个基本功能集,所有手机都应该支持,然后会有一些额外的功能,这取决于特定的手机组。

How do I manage such a code base in terms of a version control system?

如何根据版本控制系统管理这样的代码库?

I have experience with CVS and VSS but both don't quite fit into my needs for this kind of an application. The last thing I would want to do is branch the code for each of these device sets.

我有CVS和VSS的经验,但两者都不太适合我对这种应用程序的需求。我想做的最后一件事是为每个设备集分支代码。

Let me make this a bit more clear with the help of an example. Lets say I'm developing a J2ME application using MIDP 2.0. This is the base feature set that I would expect all phones supporting MIDP 2.0 to have. On top of this I would extend this application for specific sets of phones using their SDK's. For eg. Nokia S40, Nokia S60, Sony Ericsson, Blackberry etc. All these provide additional functionalities which lets you build more on top of your base application and most of the times these would affect your whole code base from UI to core logic.

在示例的帮助下,让我更清楚一点。假设我正在使用MIDP 2.0开发J2ME应用程序。这是我希望所有支持MIDP 2.0的手机都具备的基本功能集。除此之外,我会使用他们的SDK为特定的手机套件扩展此应用程序。例如。诺基亚S40,诺基亚S60,索尼爱立信,黑莓等所有这些都提供了额外的功能,使您可以在基础应用程序之上构建更多功能,并且大多数时候这些功能会影响从UI到核心逻辑的整个代码库。

One way to achieve this is to use a combination of a build system with preprocessor flags and trying to separate the differences enough to not have too many dependencies. This can get quite complicated at times. I am wondering if there is an easier way to handle this using a smart source control system....

实现此目的的一种方法是使用构建系统与预处理程序标志的组合,并尝试将差异分离到足以不具有太多依赖项。这有时会变得非常复杂。我想知道是否有一种更简单的方法来处理这个使用智能源控制系统....

5 个解决方案

#1


I would look at Subversion's svn:externals.

我会看看Subversion的svn:externals。

With svn 1.5 you can use relative references for directories, and svn 1.6 supports file-based externals.

使用svn 1.5,您可以使用目录的相对引用,svn 1.6支持基于文件的外部。

For example a structure like,

例如,像,

  • /Phone1/Base
  • /Phone1/Feature1
  • /Phone1/Feature2
  • /Phone2/Base
  • /Phone2/Feature1
  • /Phone2/Feature3

Would be easily acheived using svn:externals.

使用svn:externals很容易实现。

In Subversion, your repository structure is very flexible, here is one way (of many) you could lay that out:

在Subversion中,您的存储库结构非常灵活,这是您可以解决的一种方式(很多):

  • trunk/Features/Base
  • trunk/Features/Feature1
  • trunk/Features/Feature2
  • trunk/Features/Feature2
  • trunk/Phones/Phone1 (with svn:externals to Base, Feature1, ...)
  • trunk / Phones / Phone1(svn:externals to Base,Feature1,...)

  • trunk/Phones/Phone2 (with svn:externals to Base, Feature3, ...)
  • trunk / Phones / Phone2(svn:externals to Base,Feature3,...)

One hint though: Make sure that you use a specific Subversion revision for each external reference, it may not seem important when starting out, but 6 months down the track it will :)

但有一个提示:确保为每个外部引用使用特定的Subversion修订版,它在启动时可能看起来不重要,但是在轨道上它将会有6个月:)

#2


I like Subversion for projects which don't have a lot of developers on it. From your problem statement, to me it sounds like you should be able to acheive what you want with a good build system. So I don't think the source control itself would make much a difference. But I may be misunderstanding your problem.

对于那些没有很多开发人员的项目,我喜欢Subversion。从你的问题陈述到我,听起来你应该能够用一个好的构建系统来实现你想要的东西。所以我不认为源代码控制本身会产生很大的影响。但我可能会误解你的问题。

Sayed Ibrahim Hashimi

Sayed Ibrahim Hashimi

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

我的书:Microsoft Build Engine内部:使用MSBuild和Team Foundation Build

#3


I don't think VCS will solve your problem.

我认为VCS不会解决您的问题。

Your best bet maybe to abstract out the phone specific functionality as much as possible and/or go with a plugin type model.

您最好的选择可能是尽可能抽象出手机特定功能和/或使用插件类型模型。

I've only had experience with Subversion, CVS, Starteam, and VSS. Branches are a pain no matter what... especially if you have multiple active branches. You won't get around doing constant merges , branch comparisons, and trying to track if you've made a change to all branches.

我只有Subversion,CVS,Starteam和VSS的经验。无论如何,分支都是痛苦的......特别是如果你有多个活动分支。您不会绕过不断的合并,分支比较,并试图跟踪您是否对所有分支进行了更改。

#4


If you organize your code into some core modules and some phone-specific modules which depend on the core modules then it doesn't really matter which VCS you use. I would recommend a decentralized VCS anyway (Mercurial, Bazaar, Git).

如果将代码组织到某些核心模块和某些依赖于核心模块的特定于电话的模块中,那么使用哪个VCS并不重要。无论如何我会推荐一个分散的VCS(Mercurial,Bazaar,Git)。

You could consider describing how do you want to achieve what you want (different app versions with different feature sets) to get a more reasonable advice

您可以考虑描述如何实现您想要的(具有不同功能集的不同应用程序版本)以获得更合理的建议

#5


If you use Perforce, you can use different mappings between the depot and your workspaces and do something like:

如果使用Perforce,则可以在软件仓库和工作区之间使用不同的映射,并执行以下操作:

depot/
  common/
  platform1/
    someportedfile
  platform2/
    someportedfile

and have it mapped in your workspace to:

并将它映射到您的工作区中:

platform1/
  someportedfile
  common/
platform2/
  somtportedfile
  common/

#1


I would look at Subversion's svn:externals.

我会看看Subversion的svn:externals。

With svn 1.5 you can use relative references for directories, and svn 1.6 supports file-based externals.

使用svn 1.5,您可以使用目录的相对引用,svn 1.6支持基于文件的外部。

For example a structure like,

例如,像,

  • /Phone1/Base
  • /Phone1/Feature1
  • /Phone1/Feature2
  • /Phone2/Base
  • /Phone2/Feature1
  • /Phone2/Feature3

Would be easily acheived using svn:externals.

使用svn:externals很容易实现。

In Subversion, your repository structure is very flexible, here is one way (of many) you could lay that out:

在Subversion中,您的存储库结构非常灵活,这是您可以解决的一种方式(很多):

  • trunk/Features/Base
  • trunk/Features/Feature1
  • trunk/Features/Feature2
  • trunk/Features/Feature2
  • trunk/Phones/Phone1 (with svn:externals to Base, Feature1, ...)
  • trunk / Phones / Phone1(svn:externals to Base,Feature1,...)

  • trunk/Phones/Phone2 (with svn:externals to Base, Feature3, ...)
  • trunk / Phones / Phone2(svn:externals to Base,Feature3,...)

One hint though: Make sure that you use a specific Subversion revision for each external reference, it may not seem important when starting out, but 6 months down the track it will :)

但有一个提示:确保为每个外部引用使用特定的Subversion修订版,它在启动时可能看起来不重要,但是在轨道上它将会有6个月:)

#2


I like Subversion for projects which don't have a lot of developers on it. From your problem statement, to me it sounds like you should be able to acheive what you want with a good build system. So I don't think the source control itself would make much a difference. But I may be misunderstanding your problem.

对于那些没有很多开发人员的项目,我喜欢Subversion。从你的问题陈述到我,听起来你应该能够用一个好的构建系统来实现你想要的东西。所以我不认为源代码控制本身会产生很大的影响。但我可能会误解你的问题。

Sayed Ibrahim Hashimi

Sayed Ibrahim Hashimi

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

我的书:Microsoft Build Engine内部:使用MSBuild和Team Foundation Build

#3


I don't think VCS will solve your problem.

我认为VCS不会解决您的问题。

Your best bet maybe to abstract out the phone specific functionality as much as possible and/or go with a plugin type model.

您最好的选择可能是尽可能抽象出手机特定功能和/或使用插件类型模型。

I've only had experience with Subversion, CVS, Starteam, and VSS. Branches are a pain no matter what... especially if you have multiple active branches. You won't get around doing constant merges , branch comparisons, and trying to track if you've made a change to all branches.

我只有Subversion,CVS,Starteam和VSS的经验。无论如何,分支都是痛苦的......特别是如果你有多个活动分支。您不会绕过不断的合并,分支比较,并试图跟踪您是否对所有分支进行了更改。

#4


If you organize your code into some core modules and some phone-specific modules which depend on the core modules then it doesn't really matter which VCS you use. I would recommend a decentralized VCS anyway (Mercurial, Bazaar, Git).

如果将代码组织到某些核心模块和某些依赖于核心模块的特定于电话的模块中,那么使用哪个VCS并不重要。无论如何我会推荐一个分散的VCS(Mercurial,Bazaar,Git)。

You could consider describing how do you want to achieve what you want (different app versions with different feature sets) to get a more reasonable advice

您可以考虑描述如何实现您想要的(具有不同功能集的不同应用程序版本)以获得更合理的建议

#5


If you use Perforce, you can use different mappings between the depot and your workspaces and do something like:

如果使用Perforce,则可以在软件仓库和工作区之间使用不同的映射,并执行以下操作:

depot/
  common/
  platform1/
    someportedfile
  platform2/
    someportedfile

and have it mapped in your workspace to:

并将它映射到您的工作区中:

platform1/
  someportedfile
  common/
platform2/
  somtportedfile
  common/