是否有一个Delphi库可以返回项目的所有有效的源路径? [英] Is there a Delphi library which returns all effective source paths for a project?

查看:151
本文介绍了是否有一个Delphi库可以返回项目的所有有效的源路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于静态代码分析工具,必须知道给定的Delphi项目的所有有效源路径,这些项目是在项目级别和全局IDE配置中定义的。



<有没有可以收集这种项目信息的Delphi库?



据我所知,Delphi IDE的注册表设置可以在不同的地方,以支持多种配置。但是对于IDE注册表位置和项目文件的给定组合,应该可以收集源路径。



编辑:另一个解决方案是使用--depends开关。这将导致dcc32.exe写入具有项目的所有dcu文件名(和所有依赖项)的.d文件,包括路径名。但是,文件列表包括已经编译的单元,所以它不是原始问题的正确解决方案。

解决方案

找到另一个解决方案:



如果我启动RAD Studio命令提示符并运行

  msbuild / t:在项目目录中重建

,msbuild将显示完整的命令行调用dcc32,包括所有路径设置。将构建日志重定向到文件(或用自制版本替换dcc32.exe,只捕获参数)和解析输出似乎比解析dproj文件要容易得多。



另一个优点是可以用于自动化构建/持续集成。


For static code analysis tools, it is necessary to know all effective source paths for a given Delphi project, which are defined on project level and in the global IDE configuration.

Is there a Delphi library which can collect this kind of project information?

As far as I know, the registry settings for the Delphi IDE can be in different places, to support multiple configurations. But for a given combination of the IDE registry location and a project file, it should be possible to collect the source paths.

Edit: Another solution is to use the --depends switch. This will cause dcc32.exe to write a ".d" file with all dcu file names of the project (and all dependencies), including the path names. However, the file list includes units which are compiled already, so it is not a correct solution for the original problem.

解决方案

Just found another solution:

if I launch the RAD Studio command prompt and run

msbuild /t:Rebuild

in the project directory, msbuild will show the full command line to invoke dcc32, including all path settings. Redirecting the build log to a file (or replacing dcc32.exe with a self made version which only captures the parameters) and parsing the output seems to be a lot easier than to parse dproj files.

Another advantage is that it can be used in automated builds / continuous integration.

这篇关于是否有一个Delphi库可以返回项目的所有有效的源路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆