将 SVN 与 Delphi Visual Component 包结合使用的最佳实践?

发布于 2024-10-25 12:08:33 字数 724 浏览 0 评论 0原文

由于希望能够重现使用第 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

盗琴音 2024-11-01 12:08:33

您可以为您的项目准备“启动 IDE”(也可能是“构建”)脚本,并随着项目在存储库中的发展而维护它们。

无论您决定将组件保留在单独的存储库中并使用外部组件,还是将它们包含在具有可能分支的单个存储库中,您还应该为每个组件构建以及为特定 Delphi 版本准备的每个分支包含已编译的 bpl 文件。

您绝对应该尝试保持大多数(如果不是全部)路径的相对路径,在最坏的情况下使用环境变量指向您的根项目目录。

启动 IDE 脚本允许您在单个 Windows 安装上单独配置每个项目和 Delphi 版本环境。

它应该包含您的项目和 Delphi 所需的注册表项:

Windows Registry Editor Version 5.00

[-${DelphiRegKey}\Disabled Packages]
[-${DelphiRegKey}\Known Packages]
[-${DelphiRegKey}\Library]

[${DelphiRegKey}\Known Packages]
"$(BDS)\\Bin\\dclstd${CompilerVersion}.bpl"="Borland Standard Components"
"$(BDS)\\Bin\\dclie${CompilerVersion}.bpl"="Internet Explorer Components"
"$(BDS)\\Bin\\dcldb${CompilerVersion}.bpl"="Borland Database Components"
(...)
"${CustomComponentPack}"="Custom Components"

[${DelphiRegKey}\Library]
"Search Path"="${YourLibrarySourceFolder1};${YourLibrarySourceFolder2}"
(...)

然后您可以准备批处理文件:

regedit /s project.reg
%DelphiPath%\bin\bds -rProjectRegKey Project.dpr

其中 ${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:

Windows Registry Editor Version 5.00

[-${DelphiRegKey}\Disabled Packages]
[-${DelphiRegKey}\Known Packages]
[-${DelphiRegKey}\Library]

[${DelphiRegKey}\Known Packages]
"$(BDS)\\Bin\\dclstd${CompilerVersion}.bpl"="Borland Standard Components"
"$(BDS)\\Bin\\dclie${CompilerVersion}.bpl"="Internet Explorer Components"
"$(BDS)\\Bin\\dcldb${CompilerVersion}.bpl"="Borland Database Components"
(...)
"${CustomComponentPack}"="Custom Components"

[${DelphiRegKey}\Library]
"Search Path"="${YourLibrarySourceFolder1};${YourLibrarySourceFolder2}"
(...)

You can then prepare batch file:

regedit /s project.reg
%DelphiPath%\bin\bds -rProjectRegKey Project.dpr

Where ${DelphiRegKey} is HKEY_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.

我恋#小黄人 2024-11-01 12:08:33

对我们来说幸运的是,我们不必担心修补程序/服务包;我们仍在使用 Delphi 5。:D

叹息,曾经有一段时间,整个应用程序(设置和所有)都存在于单个目录中 - 这使得这不再是问题。但是,世界已经发生了变化,我们的应用程序的各个部分分散在各处:

  • 注册表
  • Windows\系统
  • 程序文件
  • 有时甚至是“应用程序数据”或“本地设置”中的用户文件夹

您考虑影响是完全正确的修补程序/服务包。不仅 RTL/VCL 可能受到影响,编译器本身也可能发生轻微变化。还要注意,按照同样的思路运行,即使当您升级 Delphi 版本时,您也需要使用正确的版本进行构建。诚然,这要容易一些,因为您可以同时运行不同的 Delphi 版本。

然而,我要建议的是,这可能不值得付出太多努力。 请记住,在旧版本上工作总是比在当前版本上工作更昂贵。

  • 理想情况下,您希望所有开发人员都在主分支代码上,您希望最大限度地减少补丁- 在旧版本上工作。
  • 因此,请努力让大多数用户尽可能保持最新版本。
  • 诚然,这并不总是可能的。
  • 无论如何,您都不会想在没有先进行一些测试的情况下跳转到“新版本”。
  • 某些敏捷流程确实会让这变得更容易。
  • 通过使用单独的构建机器或虚拟机,您已经拥有一定程度的控制权。
  • 提示:我还建议构建过程自动将构建输出复制到另一台计算机,或者至少复制到不同的硬盘驱动器。
  • 一旦您对服务包感到满意,您就可以计划何时想要将其滚动到您的构建机器上。
  • 记录构建配置更改的标签非常重要。 (以防万一。)
  • 如果您的构建脚本也保存在源代码管理中,则这种情况会隐式发生。
  • 当您推出修补程序/服务包时,应积极阻止对旧版本的修复。
  • 当然,它们可能无法消除,但如果它足够罕见,那么甚至手动重新配置也是可行的。
  • 您还可以考虑驱动器映像,而不是使用 VM 选项来保留旧配置。
  • 要节省 VMWare LabManager 的费用,请寻找命令行驱动的 VM Player。
  • 您可能必须保留 2 台“活动”机器/虚拟机,但永远不需要更多。
  • 自动构建脚本失败是正常的,因为所需的配置不可用。这会提醒您手动设置。
  • 请记住,使用旧版本总是比使用当前版本更昂贵。

第三方软件包

我们去了在这里多一点努力。我们的主要动机之一是我们使用了大约 8 个第三方软件包。因此,做一些事情来标准化它本身是有意义的。我们还认为运行 8 个安装程序是 PITA,因此我们设计了一种简单的方法来从源代码管理手动安装所有必需的软件包。

关键注意事项

  • 只要对象和/或源文件可访问,构建环境就不需要安装任何包。
  • 如果开发人员能够相当轻松地确保他们在必要时使用相同版本的第三方库进行构建,这将会有所帮助。
  • 但是,开发环境通常必须将软件包安装到 IDE 中。
    • 这有时会导致源兼容性问题。
    • 例如,写入 IDE 维护文件的新属性。
    • 这当然让我们回到了第二点。
  • 由于第三方软件包很少更新,因此它们被放置在稍微不同的源代码控制区域中。
  • 但是,NB 仍必须通过相对路径引用。

我们创建了以下文件夹结构:

...\ThirdParty\_DesignTimePackages //The actual package files only are copied here
...\ThirdParty\_RunTimePackages //As above, for any packages "required" by those above
...\ThirdParty\Suite1
...\ThirdParty\Suite2
...\ThirdParty\Suite3

因此,配置新环境非常容易:

  • 获取所有第三方文件的最新版本。
  • 将 _DesignTimePackages 和 _RunTimePackages 添加到 Windows 路径
  • 打开 Delphi
  • 选择安装组件
  • 从 _DesignTimePackages 中选择所有包。
  • 完毕!

编辑:Darian 担心切换设计包版本时可能会出现错误。然而,这种方法避免了此类问题。

  • 通过将 _DesignTimePackages 和 _RunTimePackages 添加到 Windows 路径,Delphi 将始终在同一位置找到所需的包。
  • 因此,您不太可能遇到不兼容版本的“包噩梦”。
  • 当然,如果您做了一些愚蠢的事情,例如重建一些软件包并签入新版本,则无论您采用哪种方法,都可能会出现问题。

Fortunately for us, we don't have to worry about a hotfix/service pack; we're still on Delphi 5. :D

Sigh, there was a time when an entire application (settings and all) would exist within a single directory - making this a non-issue. But, the world has moved on, and we have various parts of an application scattered all over the place:

  • registry
  • Windows\System
  • Program Files
  • Sometimes even User folders in "Application Data" or "Local Settings"

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.

  • Ideally you want all your dev to be be on main branch code, you want to minimise patch-work on older versions.
  • So strive to keep the majority of your users on the latest version as much as possible.
  • Admittedly this isn't always possible.
  • You wouldn't want to jump over to the 'new version' without some testing first in any case.
  • Certain agile processes do tend to make this easier.
  • By using a separate build machine or VM, you already have a measure of control.
  • TIP: I would also suggest that the build process automtically copy build output to a different machine, or at least a different hard-drive.
  • Once you're satisfied with the service pack, you can plan when you want to roll it to your build machine.
  • It is extremely important to keep record of the label at which the build configuration changed. (Just in case.)
  • If your build scripts are also kept in source control, this happens implicitly.
  • When you've rolled out the hotfix/service pack, fixes to older versions should be actively discouraged.
  • Of course, they probably can't be eliminated, but if it's rare enough, then even manual reconfiguration could be feasible.
  • Instead of a VM option to keep your old configuration, you can also consider drive-imaging.
  • To save on the $$$ of VMWare LabManager, look for a command-line driven VM Player.
  • You might have to keep 2 "live" machines/VMs, but should never need more than that.
  • 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.
  • Remember, working on old versions is always more expensive than working on the current version.

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

  • The build environment doesn't need any packages installed, provided the object and/or source files are accessible.
  • It would help if developers could fairly easily ensure they're building with the same version of third party libraries when necessary.
  • However, dev environments usually must install packages into the IDE.
    • This can sometimes cause problems with source compatibility.
    • For example new properties that get written to IDE maintained files.
    • Which of course brings us back to the second point.
  • Since Third Party packages are infrequently updated, they are placed within a slightly different area of source-control.
  • But, NB must still be referenced via relative paths.

We created the following folder structure:

...\ThirdParty\_DesignTimePackages //The actual package files only are copied here
...\ThirdParty\_RunTimePackages //As above, for any packages "required" by those above
...\ThirdParty\Suite1
...\ThirdParty\Suite2
...\ThirdParty\Suite3

As a result of this it's quite easy to configure a new environment:

  • Get latest version of all ThirdParty files.
  • Add _DesignTimePackages and _RunTimePackages to Windows Path
  • Open Delphi
  • Select Install Components
  • Select all packages from _DesignTimePackages.
  • Done!

Edit: Darian was concerned about the possibility of errors when switching switching versions of Design Packages. However, this approach avoids those kinds of problems.

  • By adding _DesignTimePackages and _RunTimePackages to the Windows Path, Delphi will always find required packages in the same place.
  • As a result, you're less likely to encounter the 'package nightmare' of incompatible versions.
  • Of course, if you do something silly like rebuild some of your packages and check-in the new version, you can expect problems - no matter what approach you follow.
抹茶夏天i‖ 2024-11-01 12:08:33

我通常在 SVN 中构建我的存储库,如下所示:

/trunk/app1
/trunk/comp/thirdparty1
/trunk/comp/thirdparty2
/trunk/comp/thirdparty3...

在根文件夹(主干)中,我有一个项目组(.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:

/trunk/app1
/trunk/comp/thirdparty1
/trunk/comp/thirdparty2
/trunk/comp/thirdparty3...

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文