カスタム プロジェクト タイプのスケルトンを作成するための OpenTools ウィザードを作成しました。それは機能し、プロジェクトとユニットは適切に作成されます。しかし、.dpk または .dpk ファイルの requires 句を編集するにはどうすればよいですか?
を呼び出すとModuleServices.CreateModule(MyIOTAProjectCreatorInterface)
、.dproj ファイルのみが返されます。
私のVCL コンポーネント インストーラー(XE 以降、これは Delphi IDE の一部です) では、次のようにします。
procedure TCompInstallWizard.AddReferenceFiles(InstallProject: IOTAProject;
const FileNames: array of string);
var
ReferenceFile: string;
begin
WriteDebugMessage('AddReferenceFiles');
for ReferenceFile in FileNames do
if not ContainsFile(InstallProject, ReferenceFile) then
InstallProject.AddFile(ReferenceFile, False);
end;
function の助けを借りてIOTAProject.AddFile(FileName, IsUnitOrForm)
。私はそれを次のように呼んでいることに注意してください:
if FPersonality = ppCppBuilder then
AddReferenceFiles(InstallProject,
['rtl.bpi', 'designide.bpi', 'vcl.bpi', 'vclactnband.bpi',
'vclx.bpi', 'xmlrtl.bpi'])
else
AddReferenceFiles(InstallProject,
['rtl.dcp', 'designide.dcp', 'vcl.dcp', 'vclactnband.dcp',
'vclx.dcp', 'xmlrtl.dcp']);
ドキュメントが言うことに注意してください:
{ Call this function to add an arbitrary file to the project. NOTE: some
files have special meaning to different projects. For example: adding
VCL60.DCP will cause a new entry in a package project's "requires" list
while it will be a raw file to any other project type. Set IsUnitOrForm
to true for files that are considered items that the project would
process directly or indirectly (ie. .pas, .cpp, .rc, etc..) or can be
opened in the code editor. For all others, including binary files
(.res, .bpi, .dcp, etc..) set this to False. }
procedure AddFile(const AFileName: string; IsUnitOrForm: Boolean);
これは、a を追加する'bla.dcp'
と自動的にセクションに配置され、ファイルrequires
を追加するとセクションに配置されることを意味します。見つけるのにしばらく時間がかかりました。'bla.pas'
contains