1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| const
C_Command_Call = 'call "%s\rsvars.bat"';
C_Command_Compile = 'msbuild %s /target:Build /p:config=Release';
C_Path_U_Abstract = 'U_Abstract\';
var
sPath : String;
sInitial : String;
rProject, rObj : TDll_Project;
sText, sParam, sAbsolute : string;
srIniFile : TSearchRec;
i , j : Integer;
SL : TStringList;
begin
sAbsolute := ExpandFileName(C_Path_U_Abstract);
if ParamStr(1) = '' then
begin
SL := TStringList.Create;
try
if FindFirst(sAbsolute + '*.ini', faAnyFile, srIniFile) = 0 Then
begin
repeat
SL.Add(srIniFile.Name);
WriteLn(srIniFile.Name);
until FindNext(srIniFile) <> 0;
end;
j := 0;
while j < SL.Count do
begin
//WriteLn(SL[j]);
rObj := TDll_Project.Create(sAbsolute + SL[j]);
sInitial := '';
sPath := '';
rProject := TDll_Project(rObj);
sInitial := SysUtils.GetEnvironmentVariable('Path');
for i := 1 to Get_TokenCount(sInitial,';') do
begin
if ContainsStr(Get_Token(sInitial,i,';'),'CodeGear') or ContainsStr(Get_Token(sInitial,i,';'),'Embarcadero') then
sPath:= Get_Token(sInitial,i,';');
end;
Enable_XML_Generation(replaceStr(rObj.sPath_DPR,'.dpr','.dproj'));
Execute(ExpandFileName('U_Abstract\Compiler.bat'),'"'+sPath+'\rsvars.bat" "'+replaceStr(rProject.sPath_DPR,'.dpr','.dproj')+'"',ExtractFileDir(rProject.sPath_DPR),True,True);
rProject.Analyze;
try
WriteLn('Writing a backup of the existing files');
CopyFile(PWideChar(rProject.sPath_DPR),PWideChar(rProject.sPath_DPR+'.bak'),false);
CopyFile(PWideChar(rProject.sPath_U_Abstract),PWideChar(rProject.sPath_U_Abstract+'.bak'),false);
Write_U_Abstract_Dpr(rProject,nil);
Write_U_Abstract(rProject,nil);
except
on E: Exception do
begin
Writeln(E.Classname, ': ', E.Message);
raise;
end;
end;
inc(j);
end;
finally
SL.Free;
end;
end
else
[...] |
Partager