Delphi 构建自动化和持续集成仅使用 MS Build 可行吗?

发布于 2024-08-22 16:40:08 字数 1013 浏览 8 评论 0原文

我正在寻求实现一个连续的单元测试运行系统,我听说过所谓的“smoketest”或“tinderbox”(一个构建服务器,它可以对给定源存储库中的所有内容进行干净的版本控制检查和完整的系统构建,或者项目),以及类似于小型团队的“持续集成”之类的东西,与德尔福。

我不愿意致力于商业“构建服务器”产品,并且希望我可以通过 delphi 中内置的 MS-Build 支持来完成很多工作。

我正在寻找资源、想法和开始的地方。我不知道如何使用 MS Build 来实现此目的。 Steve Trevethen 有一篇博客文章,对旧的 dcc32 命令行进行了一些讨论build,有些评论提到了 ms-build,它自 delphi 2007 年以来一直存在。我正在使用 Delphi 2010。我正在寻找指导、见解和经验,它们会告诉我,这是一条合理的路径,如果不,我应该走哪条路呢?

我发现您可以使用 /p:DCU_DcuOutput= 从 msbuild 命令行覆盖单元 (DCU) 和 EXE 输出目录。请注意,我查看了 DPROJ 文件中的 XML 以找出如何覆盖内容。

但是,它只执行 make,而不执行构建,并且 /t:rebuild 不起作用(编辑:是的,它确实有效。它在 DPROJ 文件上运行良好,但在 GroupProjects 上则不然。)

我希望有更多 MSBuild-with-Delphi文档在哪里? “Rad Studio 2010”产品文档中的 MS-Build 帮助显示了有关 MS-Build 的一两件事,但确实很粗略且不完整。

相关问题:

MSBuild 命令行

I am looking to implement a continuous unit test running system, something I have heard called a "smoketest" or "tinderbox", (a build server that does clean version control check-outs and full system builds of everything in a given source repository or project), and something like "continuous integration" for small teams, with Delphi.

I am loathe to commit to a commercial "build server" product and am hoping I can do a lot of this just with MS-Build support that is built into delphi.

I am looking for resources, ideas, and a place to get started. I do not know how to use MS Build for this purpose. Steve Trevethen has a blog post that leads to a little discussion on the old dcc32 command line build, and some comments mention ms-build which has been here since delphi 2007. I am using Delphi 2010. I am looking for guidance and insight, and experiences, that will tell me, is this a reasonable path to go down, and if not, what way should I go instead?

I found you can override the Unit (DCU) and EXE Output Directory from the msbuild command line with /p:DCU_DcuOutput=. Note that I looked at the XML inside my DPROJ files to figure out how to override stuff.

However, it only does a make, not a build, and /t:rebuild does not work (edit: yes it does. it works fine on DPROJ files, but not on GroupProjects.)

I wish there was more MSBuild-with-Delphi documentation out there anywhere? The MS-Build help in "Rad Studio 2010" product documentation shows one or two things about MS-Build but is really sketchy and incomplete.

Related questions:

MSBuild command lines

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

感情废物 2024-08-29 16:40:08

Delphi 2010 使用 MSBuild 作为其主要构建引擎。这意味着 IDE 和命令行执行完全相同的操作。这也意味着您可以使用命令行轻松构建现有项目。事实上,我们德尔福团队一直在做同样的事情。您不必担心编译器本身的开关 - IDE 创建的 DProj 文件将

在“开始”菜单上是一个命令行,用于将 MSBuild 与现有的 Delphi 项目一起使用。它会正确设置环境,以便您只需调用:

msbuild myproject.dproj

您还可以从命令行调用特定的构建配置,使用 IDE 通过 MSBuild 的命令行参数轻松创建所述配置。

如果您想自己创建环境,可以运行 rsvars.bat 批处理文件来进行设置。该文件可以在您的 \bin 目录中找到,并且应该可以从默认命令行访问。

该文件包含以下内容:

@SET BDS=<your BDS directory>
@SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\7.0
@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v2.0.50727
@SET FrameworkVersion=v2.0.50727
@SET FrameworkSDKDir=
@SET PATH=%FrameworkDir%;%FrameworkSDKDir%;%PATH%
@SET LANGDIR=EN

因此,如果您想创建自己的持续集成构建,您可以使用 MSBuild 轻松管理您的 Delphi 构建。

Delphi 2010 uses MSBuild as it's main build engine. That means that the IDE and the command line both do exactly the same thing. It also means that you can easily build existing projects with the command line. In fact, we on the Delphi team do this exact thing all the time. You need not worry about switches for the compiler itself -- the DProj file created by the IDE will

On the Start Menu is a command line for using MSBuild with an existing Delphi project. It sets up the environment correctly so that you can simply call:

msbuild myproject.dproj

You can also call specific build configurations from the command line, using the IDE to easily create said configurations using command line parameters for MSBuild.

If you want to create the environment yourself, you can run the rsvars.bat batch file to set things up. That file can be found in your \bin directory, and should be available from a default command line.

The file contains the following:

@SET BDS=<your BDS directory>
@SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\7.0
@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v2.0.50727
@SET FrameworkVersion=v2.0.50727
@SET FrameworkSDKDir=
@SET PATH=%FrameworkDir%;%FrameworkSDKDir%;%PATH%
@SET LANGDIR=EN

Thus, if you want to create your own continuous integration build, you can easily manage your Delphi build using MSBuild.

街角卖回忆 2024-08-29 16:40:08

dproj 和 groupproj 是 msbuild 文件,您可以查看它们的内部。其他部分信息可在msbuild安装路径(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727)中找到。在那里你会发现几个 Borland.*.targets 文件。

在 msbuild 脚本中,您可以看到以 .例如,groupfile 包含 Make、Clean 和 Build 目标,您可以使用 /t 参数指定这些目标。 dproj 文件也是如此。 dproj 文件也有一个 ReBuild 目标。它先进行清理,然后进行构建。如果您想对组文件具有相同的效果,您可以指定两个目标: /t:Clean;Build

您还会发现可以使用 /p 设置许多参数。例如,Configuration 指定配置或 DCC_Quiet 指示 dcc32 停止输出无用的空格。

因此,从命令行使用 Release 配置进行构建的命令是:

msbuild mygroup.groupproj /p:Configuration=Release /t:Build

免责声明: 我已经查看了 Delphi 2007 的 msbuild 文件。更高版本的 Delphi 可能更改了目标或参数的名称。只需查看 msbuild 脚本即可了解哪个是哪个。

The dproj and groupproj are msbuild files and you can have a look inside them. The other parts of the information are to be find in the msbuild installation path (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727). There you will find several Borland.*.targets files.

Inside the msbuild scripts you can see the different targets named with . For example the groupfile contains Make, Clean and Build targets which you can specify with the /t parameter. The same goes for the dproj files. dproj files also have a ReBuild target. It does a Clean and then a Build. If you want to have the same effect for groupfile you could specify two targets: /t:Clean;Build

You will also find lots of parameters in you can set with /p. Like for example Configuration to specify the configuration or DCC_Quiet to instruct dcc32 to stop outputting useless whitespaces.

So the doing a build with Release configuration from the command line is this command:

msbuild mygroup.groupproj /p:Configuration=Release /t:Build

disclaimer: I have looked at Delphi 2007's msbuild files. Later Delphi versions might have changed the name of the targets or parameters. Just have a look inside the msbuild scripts to find out which is which.

画骨成沙 2024-08-29 16:40:08

我不确定这是否是您所需要的,但我有 CruiseControl.NET 设置用于进行持续集成 -和 DUnit 测试 - 用于 Delphi 2009。CCNET 有一组针对 MSBuild 的特定任务,除了一些设置问题之外,它非常适合我。

如果您需要,我可以告诉您我必须做什么才能使其正常工作。

标记

I'm not sure if this is what you need, but I have CruiseControl.NET setup for doing continuous integration - and DUnit tests - for Delphi 2009. CCNET has a specific set of tasks for MSBuild, and other than a few setup issues, it works perfectly for me.

I can let you know what I had to do get ths working if you need.

Mark

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