简体   繁体   English

在编译[OTA]之前将dcu文件添加到项目

[英]Add a dcu file to a project before compiling [OTA]

I'd like to add a dcu file to a project before compiling it. 我想在编译之前将dcu文件添加到项目中。 I'm trying to use the OTA to this. 我正在尝试使用OTA。 In IOTAProject I have the option to add a file ( AddFile() ), but when I try to add a dcu it doesn't allow me, and I must set the file as the first file in my project. 在IOTAProject中我可以选择添加一个文件( AddFile() ),但是当我尝试添加一个dcu它不允许我时,我必须将该文件设置为我项目中的第一个文件。

I'd like to simulate some thing like: 我想模拟一些事情:

------------------ Original project
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};
etc...

------------------- Before compile I intercept it and set
program Project1;

uses
  MyDCU, //Add this
  Forms,
  Unit1 in 'Unit1.pas' {Form1};
etc...

------------------ After compile remove and it came back to 
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};
etc...

The after/before compiling interception is not the problem IOTAIDENotifier give me the necessary interface to work with. 编译后的/之前的拦截不是IOTAIDENotifier为我提供必要的界面的问题。 The problem is only with the dcu file as the first file of my project. 问题是只有将dcu文件作为我项目的第一个文件。

Someone can help me? 有人可以帮帮我吗? Tks TKS

Since the OTA does not supply a CodeDom (as far as I know) the only chance how to do this is by intercepting the BeforeCompile Notification, parse the project file (The IDE version not the file system) and add it to the uses clause yourself. 由于OTA不提供CodeDom(据我所知),唯一的机会是如何拦截BeforeCompile Notification,解析项目文件(IDE版本而不是文件系统)并自己将其添加到uses子句中。 That done, stream back the modified contents to the IDE buffer. 完成后,将修改后的内容流回IDE缓冲区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM