是否有任何简单的自动化方法可以找出与 Delphi 项目关联的所有源文件?
我喜欢在发布版本时备份项目的源代码集。我使用 GExperts 项目备份,它似乎将项目管理器中的所有文件收集到 ZIP 文件中。您还可以将任意文件添加到此文件集中,但我始终意识到我不一定获得所有文件。除非我专门仔细检查使用条款并将我拥有的所有单元添加到项目中,否则我永远无法确定是否存储了重新创建可安装/可执行文件所需的所有文件。
我考虑过滚动一个应用程序来遍历一个项目,跟踪所有使用的单元并查看所有搜索路径,看看是否有可用于该单元的源文件,并构建一个文件列表来备份,但是嘿 - 也许有人已经完成了这项工作?
I like to backup up the source code set for a project when I release a version. I use GExperts project backups, which seems to gather up all the files in the project manager into the ZIP file. You can also add arbitrary files to this file set, but I'm always conscious of the fact that I haven't necessarily got all the files. Unless I specifically go though the uses clauses and add all the units I have sources for to the project, I'll never be sure of storing all the files necessary to recreate the installable/executable.
I've thought about rolling an app to traverse a project, following all the units used and looking down all the search paths and seeing if there is a source file available for that unit, and building a list of files to back up that way, but hey - maybe someone has already done the work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您应该(强烈推荐)研究一下版本控制。
例如
SVN
(subversion)、CVS
这将允许您控制所有源代码的修订。它将允许您添加或删除源文件、回滚合并以及与管理项目源相关的所有其他好东西。
这有一天将为您节省$%#。
You should (highly recommend) look into Version Control.
e.g.
SVN
(subversion),CVS
This will allow you to control revisions of all of your source. It will allow you to add or remove source files, roll back merge and all other nice things related to managing project sources.
This WILL save your a$%# one day.
您可以用两种方式解释您的问题:
第一个是确保您可以构建系统,第二个是允许您清理未使用的文件。
对于两者来说,包含单独构建系统的版本控制系统是最佳选择。
然后,对于每组新的更改,您可以使用以下步骤来确保这两个条件都成立:
大多数版本控制系统都有很好的方法来生成开发或构建系统上的文件与版本控制系统中的文件之间的差异(通常针对您在版本控制系统中添加/删除/更新文件的每个历史点进行细粒度处理) )。
您想要一个单独的构建系统(或两个单独的开发系统)的原因是您希望它们是独立的:您使用一个用于开发,另一个用于检查构建是否仍然正常。
这是第一步,将来您可能希望将其扩展到持续集成系统(运行单元测试,自动创建产品设置等等)。
——杰罗恩
You can interpret your question in two ways:
The first is to make sure you can build the system at all, the second to allow you to clean up unused files.
For both, a version control system including a separate build system is the way to go.
You then - for each new set of changes - can use these steps to assure that both conditions hold:
Most version control systems have good ways of generating a difference between the files on your development or build system against the files in the version control system (usually fine grained for each historic point in time you added/removed/updated files in your version control system).
The reason you want a separate build system (or two separate development systems) is that you want them to be independent: you use one for developing, and the other for checking if the build is still OK.
This is the first step that in the future you might want to extend this into a continuous integration system (that runs unit tests, automatically creates product setups and much more).
--jeroen
我不确定您是否在询问版本控制或如何确保您已获得所有文件。
我偶尔运行的一个有用的实用程序是一个程序,它可以为我的 dcu 输出文件夹中的所有文件创建一个 DirList。将扩展名从 .dcu 更改为 .pas 为我提供了所有源代码文件的列表。
当然,它会错过 .inc 文件和其他非 .pas 文件,但也许这种思路在某种程度上对您有帮助?
该实用程序对我的价值在于,第二个内务管理实用程序会列出我的源代码树中没有相应 .dcu 文件的所有 .pas 文件。这(在完全编译所有程序之后)通常会显示一些不再使用的“垃圾”.pas 文件。
I'm not sure if you're asking about version control or how to be sure you've got all the files.
One useful utility I run occasionally is a program that makes a DirList of all of the files in my dcu output folder. Changing the extensions from .dcu to .pas gives me a list of all of the source code files.
Of course it misses .inc files and other non-.pas files, but perhaps this line of thinking would be helpful to you in some way?
The value of this utility to me is that a second housekeeping utility program then makes a list of all .pas files in my source tree that do not have corresponding .dcu files. This (after a full compile of all programs) generally reveals some "junk" .pas files that are no longer in use.
为了获取编译成可执行文件的所有单元的列表,您可以让编译器生成一个 MAP 文件。该文件将包含所有使用的单位的条目。
For getting a list of all units compiled into an executable, you could let the compiler generate a MAP file. This file will contain entries for all the units used.