将 SVN 与 Delphi Visual Component 包结合使用的最佳实践?
由于希望能够重现使用第 3 方可视化组件包的项目的给定版本,SVN 中包含哪些内容以及实现/构建 SVN 存储库的最佳方法是什么?
对于非可视组件,规则似乎很简单,可以确保不依赖外部存储库 - “不允许 svn-externals 引用任何外部存储库”。我有一个我控制的共享存储库,这是唯一允许的“svn-externals”引用。这使得在不同 SVN 项目中实现和共享这些类型的运行时项目与源代码变得容易。此内部共享存储库的任何引用均由“svn-externals”使用特定修订号进行。
可视化包似乎与轻松进行版本控制背道而驰,因为它们可能必须在每次修订时重新安装。如何最好地创建一个 SVN 项目,以便稍后能够以特定修订号重新创建......有推荐的解决方案吗?
以前我们并不担心第三方组件,因为它们不经常更改,而且我们从来没有真正好的解决方案。我想知道其他人是否已经找到了处理这个问题的最佳方法,因为我正在进行春季大扫除/内部重组,并且希望做得比以前“更好”。
从技术上讲,RTL/VCL 源代码也应该位于 SVN 存储库中(如果发布了 Delphi 修补程序/服务包)。
我的解决方案可能是创建一个具有特定版本的 Delphi 环境和所有可视控件的虚拟机安装。当我们添加/更新可视化控件,或使用修补程序/服务包更新 Delphi 时,我们将创建新版本的虚拟机。然后,我们将此 VM 修订版的映像存储在某个地方的架子上。这就是你所做的吗?在这种情况下,Delphi 激活/许可是否有效(或完全有效)?
谢谢,
达里安
With the desire to be able to reproduce a given revision of a project that is utilizing 3rd party visual component packages, what goes in SVN and what's the best way to implement/structure the SVN repos?
For non-visual components, the rule seems simple to ensure no reliance on outside repos - "no svn-externals reference to any outside repo allowed". I have a shared repo that I control, which is the only 'svn-externals' reference allowed. This makes it easy to implement and share these types of runtime itemss with sourcecode in different SVN projects. Any reference this internal shared repo is by 'svn-externals' using a specific revision number.
Visual packages seem to go counter to being able to be version controlled easily as they may have to be reinstalled at each revision. How to best create a SVN project which is able to be recreated later at a specific revision number...is there a recommended solution?
Previously we didn't worry about 3rd party components as they don't change often and we never had a real good solution. I was wondering if others have figure out the best way to handle this problem as I'm doing a spring cleaning/internal reorganization and wanted to do it 'better' than before.
Technically, the RTL/VCL source should also be in the SVN repo as well (if there's a Delphi hotfix/service pack released.)
My solution will likely be to create a virtual machine with a particular release of the Delphi environment with all visual controls installed. As we add/update visual controls, or update Delphi with hotfixes/service packs then we create a new version of the virtual machine. We then store an image of this VM revision on a shelf somewhere. Is this what you do? Does the Delphi activation/licensing work well (or at all) in this scenario?
Thanks,
Darian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以为您的项目准备“启动 IDE”(也可能是“构建”)脚本,并随着项目在存储库中的发展而维护它们。
无论您决定将组件保留在单独的存储库中并使用外部组件,还是将它们包含在具有可能分支的单个存储库中,您还应该为每个组件构建以及为特定 Delphi 版本准备的每个分支包含已编译的 bpl 文件。
您绝对应该尝试保持大多数(如果不是全部)路径的相对路径,在最坏的情况下使用环境变量指向您的根项目目录。
启动 IDE 脚本允许您在单个 Windows 安装上单独配置每个项目和 Delphi 版本环境。
它应该包含您的项目和 Delphi 所需的注册表项:
然后您可以准备批处理文件:
其中
${DelphiRegKey}
是HKEY_CURRENT_USER\Software\Borland(或较新版本中的 CodeGear)\ProjectRegKey< /代码>。
基本上,当您从注册表中转储当前的工作配置、将其从不必要的键中删除、将路径更改为相对路径,然后进行调整以使其适用于您的项目时,会更容易。
在这种配置中,在具有不同组件集(和/或可能使用不同的 Delphi 版本)的项目及其分支之间进行切换只需检出存储库并运行脚本即可。
You can prepare "start IDE" (and possibly "build") scripts for your projects and maintain them as project evolves in repository.
Regardless of your decision about keeping components in separate repositories and using externals, or including them in a single repository with possible branching, you should also include compiled bpl files for every component build and for every branch prepared for a specific Delphi version.
You should definitely try to keep most (if not all) of paths relative, in a worst case use environment variables to point to your root project dir.
Start IDE script allows you to keep each project and Delphi version environment spearately configured on a single Windows installation.
It should include necessary registry keys for your project and Delphi:
You can then prepare batch file:
Where
${DelphiRegKey}
isHKEY_CURRENT_USER\Software\Borland(or CodeGear in newer versions)\ProjectRegKey
.Basically it is easier when you will dump your current working configuration from registry, strip it from unnecessary keys, change paths to relative and then adapt to make it work with your project.
In such configuration, switching between projects and their branches which have different sets of components (and/or possibly using different Delphi version) is a matter of checking out a repository only and running the script.
对我们来说幸运的是,我们不必担心修补程序/服务包;我们仍在使用 Delphi 5。:D
您考虑影响是完全正确的修补程序/服务包。不仅 RTL/VCL 可能受到影响,编译器本身也可能发生轻微变化。还要注意,按照同样的思路运行,即使当您升级 Delphi 版本时,您也需要使用正确的版本进行构建。诚然,这要容易一些,因为您可以同时运行不同的 Delphi 版本。
然而,我要建议的是,这可能不值得付出太多努力。 请记住,在旧版本上工作总是比在当前版本上工作更昂贵。
提示:我还建议构建过程自动将构建输出复制到另一台计算机,或者至少复制到不同的硬盘驱动器。
如果您的构建脚本也保存在源代码管理中,则这种情况会隐式发生。
您还可以考虑驱动器映像,而不是使用 VM 选项来保留旧配置。
自动构建脚本失败是正常的,因为所需的配置不可用。这会提醒您手动设置。
第三方软件包
我们去了在这里多一点努力。我们的主要动机之一是我们使用了大约 8 个第三方软件包。因此,做一些事情来标准化它本身是有意义的。我们还认为运行 8 个安装程序是 PITA,因此我们设计了一种简单的方法来从源代码管理手动安装所有必需的软件包。
关键注意事项
我们创建了以下文件夹结构:
因此,配置新环境非常容易:
编辑:Darian 担心切换设计包版本时可能会出现错误。然而,这种方法避免了此类问题。
Fortunately for us, we don't have to worry about a hotfix/service pack; we're still on Delphi 5. :D
You are quite right to consider the impact of hotfixes/service packs. It's not only RTL/VCL that could be affected, but the compiler itself could have been slightly changed. Note also that running on the same line of thought, even when you upgrade Delphi versions, you need to build using the correct version. Admittedly this is a little easier because you can run different Delphi versions alongside each other.
However, I'm going to advise that it's probably not worth going to too much effort. Remember, working on old versions is always more expensive than working on the current version.
TIP: I would also suggest that the build process automtically copy build output to a different machine, or at least a different hard-drive.
If your build scripts are also kept in source control, this happens implicitly.
Instead of a VM option to keep your old configuration, you can also consider drive-imaging.
It's okay for an automatic build script to fail because the desired configuration isn't available. This will remind you to set it up manually.
Third Party Packages
We went to a little bit more effort here. One of our main motivations though was the fact that we use about 8 third party packages. So doing something to standardise this in itslef made sense. We also decided running 8 installation programs was a PITA, so we devised an easy way to manually install all required packages from source-control.
Key Considerations
We created the following folder structure:
As a result of this it's quite easy to configure a new environment:
Edit: Darian was concerned about the possibility of errors when switching switching versions of Design Packages. However, this approach avoids those kinds of problems.
我通常在 SVN 中构建我的存储库,如下所示:
在根文件夹(主干)中,我有一个项目组(.groupproj,或旧 delphi 上的 .bpg),其中包含我的所有组件。 (所有组件.groupproj)。
在新机器上安装意味着打开该软件包并安装设计时组件。这对 2010 年之前的所有 Delphi 版本来说都是一种拖累,但 2010 和 XE 有一个可爱的功能,因此您可以一眼看出哪些组件是设计时组件。
有时,我也会通过制作 build.bat 文件和 regcomponents.bat 文件来省去手动安装这些组件的麻烦。 regcomponents 只是运行 regedit ,并在 build.bat 构建了它们以及其他所有内容之后导入注册所有这些组件所需的密钥。
当您从一个 Delphi 版本升级到另一个版本时,拥有批处理文件和 reg 文件以及小组项目来帮助您肯定是件好事。特别是如果您必须进行大量打开项目/包并将它们保存为 MyComponent3.dpk 而不是 MyComponent2.dpk,或者将包扩展名从 150 更新到 160,或者您的包执行的任何操作。
I usually structure my repository in SVN like this:
I have, right in the root folder (trunk) a project group (.groupproj, or .bpg on old delphi) that contains all my components. (allcomponents.groupproj).
Installing on a new machine, means opening that package, and installing the designtime components. That's a drag on all versions of Delphi older than 2010, but 2010 and XE have a lovely feature so you can see at a glance, which components are designtime components.
I also, sometimes, will save myself the trouble of installing those components by hand, by making a build.bat file, and a regcomponents.bat file. The regcomponents just runs regedit , and imports the keys needed to register all those components, after build.bat has built them, and everything else.
When you move up from one delphi version to another, it's sure good to have both a batch and reg file, and a group project, to help you. Especially if you have to go through and do a lot of opening of project/packages and saving them as MyComponent3.dpk instead of MyComponent2.dpk, or updating the package extension from 150 to 160, or whatever your packages do.