mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 12:49:21 +02:00
MG: fixed TestProject
git-svn-id: trunk@363 -
This commit is contained in:
parent
82db53ce16
commit
57014a2ff7
@ -599,7 +599,7 @@ end;
|
|||||||
|
|
||||||
function TCodeBuffer.SaveToFile(const AFilename: string): boolean;
|
function TCodeBuffer.SaveToFile(const AFilename: string): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=inherited SaveToFile(Filename);
|
Result:=inherited SaveToFile(AFilename);
|
||||||
writeln('TCodeBuffer.SaveToFile ',Filename,' -> ',AFilename,' ',Result);
|
writeln('TCodeBuffer.SaveToFile ',Filename,' -> ',AFilename,' ',Result);
|
||||||
if CompareFilenames(AFilename,Filename)=0 then begin
|
if CompareFilenames(AFilename,Filename)=0 then begin
|
||||||
if FIsDeleted then FIsDeleted:=not Result;
|
if FIsDeleted then FIsDeleted:=not Result;
|
||||||
|
@ -154,8 +154,11 @@ begin
|
|||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if AProject.MainUnit<0 then exit;
|
if AProject.MainUnit<0 then exit;
|
||||||
OldCurDir:=GetCurrentDir;
|
OldCurDir:=GetCurrentDir;
|
||||||
ProjectFilename:=AProject.Units[AProject.MainUnit].Filename;
|
if AProject.Units[AProject.MainUnit].IsVirtual then
|
||||||
if ProjectFilename='' then ProjectFilename:=DefaultFilename;
|
ProjectFilename:=DefaultFilename
|
||||||
|
else
|
||||||
|
ProjectFilename:=AProject.Units[AProject.MainUnit].Filename;
|
||||||
|
if ProjectFilename='' then exit;
|
||||||
ProjectDir:=ExtractFilePath(ProjectFilename);
|
ProjectDir:=ExtractFilePath(ProjectFilename);
|
||||||
if not SetCurrentDir(ProjectDir) then exit;
|
if not SetCurrentDir(ProjectDir) then exit;
|
||||||
try
|
try
|
||||||
@ -322,6 +325,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.15 2001/10/23 09:13:50 lazarus
|
||||||
|
MG: fixed TestProject
|
||||||
|
|
||||||
Revision 1.14 2001/07/08 22:33:56 lazarus
|
Revision 1.14 2001/07/08 22:33:56 lazarus
|
||||||
MG: added rapid testing project
|
MG: added rapid testing project
|
||||||
|
|
||||||
|
70
ide/main.pp
70
ide/main.pp
@ -1993,9 +1993,10 @@ CheckHeap(IntToStr(GetMem_Cnt));
|
|||||||
end;
|
end;
|
||||||
GetUnitWithPageIndex(PageIndex,ActiveSrcEdit,ActiveUnitInfo);
|
GetUnitWithPageIndex(PageIndex,ActiveSrcEdit,ActiveUnitInfo);
|
||||||
if ActiveUnitInfo=nil then exit;
|
if ActiveUnitInfo=nil then exit;
|
||||||
|
|
||||||
if (not SaveToTestDir) and (Project.MainUnit>=0)
|
if (not SaveToTestDir) and (Project.MainUnit>=0)
|
||||||
and (Project.Units[Project.MainUnit]=ActiveUnitInfo)
|
and (Project.Units[Project.MainUnit]=ActiveUnitInfo)
|
||||||
and (ActiveUnitInfo.Source.IsVirtual) then begin
|
and (ActiveUnitInfo.IsVirtual) then begin
|
||||||
Result:=DoSaveProject(false,SaveToTestDir);
|
Result:=DoSaveProject(false,SaveToTestDir);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -2009,14 +2010,13 @@ CheckHeap(IntToStr(GetMem_Cnt));
|
|||||||
ActiveSrcEdit.UpdateCodeBuffer;
|
ActiveSrcEdit.UpdateCodeBuffer;
|
||||||
ActiveUnitInfo.Modified:=true;
|
ActiveUnitInfo.Modified:=true;
|
||||||
end;
|
end;
|
||||||
if (not SaveToTestDir) and (ActiveUnitInfo.Source.IsVirtual) then
|
|
||||||
SaveAs:=true;
|
|
||||||
if (not SaveToTestDir) and (not ActiveUnitInfo.Modified) and (not SaveAs) then
|
if (not SaveToTestDir) and (not ActiveUnitInfo.Modified) and (not SaveAs) then
|
||||||
begin
|
begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
if (not SaveToTestDir) and (ActiveUnitInfo.IsVirtual) then
|
||||||
|
SaveAs:=true;
|
||||||
|
|
||||||
if ActiveUnitInfo.HasResources then begin
|
if ActiveUnitInfo.HasResources then begin
|
||||||
LinkIndex:=-1;
|
LinkIndex:=-1;
|
||||||
@ -2193,6 +2193,7 @@ writeln('TMainIDE.DoSaveEditorUnit F ',ResourceCode.Modified);
|
|||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
// ToDo: calculate a better resource filename
|
// ToDo: calculate a better resource filename
|
||||||
|
writeln('>>>>>>>>>>>>> ',TestFilename,' ',ChangeFileExt(TestFilename,ResourceFileExt));
|
||||||
Result:=DoSaveCodeBufferToFile(ResourceCode,
|
Result:=DoSaveCodeBufferToFile(ResourceCode,
|
||||||
ChangeFileExt(TestFilename,ResourceFileExt),false);
|
ChangeFileExt(TestFilename,ResourceFileExt),false);
|
||||||
if not Result=mrOk then exit;
|
if not Result=mrOk then exit;
|
||||||
@ -2540,13 +2541,15 @@ writeln('[TMainIDE.DoOpenMainUnit] A');
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
// MainUnit not loaded -> create source editor
|
// MainUnit not loaded -> create source editor
|
||||||
NewPageName:=ExtractFileName(MainUnitInfo.Filename);
|
if MainUnitInfo.Source.IsVirtual then
|
||||||
Ext:=uppercase(ExtractFileExt(MainUnitInfo.Filename));
|
NewPageName:=CodeToolBoss.GetSourceName(MainUnitInfo.Source)
|
||||||
if (Ext='.PAS') or (Ext='.PP') then
|
else begin
|
||||||
NewPageName:=copy(NewPageName,1,length(NewPageName)-length(Ext));
|
NewPageName:=ExtractFileName(MainUnitInfo.Filename);
|
||||||
|
Ext:=uppercase(ExtractFileExt(MainUnitInfo.Filename));
|
||||||
|
if (Ext='.PAS') or (Ext='.PP') then
|
||||||
|
NewPageName:=copy(NewPageName,1,length(NewPageName)-length(Ext));
|
||||||
|
end;
|
||||||
//writeln('TMainIDE.DoOpenMainUnit B ',NewPageName,' ',MainUnitInfo.Source.SourceLength);
|
//writeln('TMainIDE.DoOpenMainUnit B ',NewPageName,' ',MainUnitInfo.Source.SourceLength);
|
||||||
if NewpageName='' then
|
|
||||||
NewPageName:=CodeToolBoss.GetSourceName(MainUnitInfo.Source);
|
|
||||||
if NewPageName='' then
|
if NewPageName='' then
|
||||||
NewPageName:='mainunit';
|
NewPageName:='mainunit';
|
||||||
//writeln('TMainIDE.DoOpenMainUnit C ',NewPageName);
|
//writeln('TMainIDE.DoOpenMainUnit C ',NewPageName);
|
||||||
@ -2854,18 +2857,20 @@ writeln('TMainIDE.DoSaveProject A SaveAs=',SaveAs,' SaveToTestDir=',SaveToTestDi
|
|||||||
Result:=Project.WriteProject;
|
Result:=Project.WriteProject;
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
end;
|
end;
|
||||||
// save source
|
// save main source
|
||||||
if MainUnitInfo<>nil then begin
|
if MainUnitInfo<>nil then begin
|
||||||
if MainUnitInfo.Loaded then begin
|
if MainUnitInfo.Loaded then begin
|
||||||
|
// shown in source editor
|
||||||
Result:=DoSaveEditorUnit(MainUnitInfo.EditorIndex,false,SaveToTestDir);
|
Result:=DoSaveEditorUnit(MainUnitInfo.EditorIndex,false,SaveToTestDir);
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
end else begin
|
end else begin
|
||||||
|
// not shown in source editor, but code internally loaded
|
||||||
if not SaveToTestDir then begin
|
if not SaveToTestDir then begin
|
||||||
Result:=DoSaveCodeBufferToFile(MainUnitInfo.Source,
|
Result:=DoSaveCodeBufferToFile(MainUnitInfo.Source,
|
||||||
MainUnitInfo.Filename,true);
|
MainUnitInfo.Filename,true);
|
||||||
end else begin
|
end else begin
|
||||||
Result:=DoSaveCodeBufferToFile(MainUnitInfo.Source,
|
Result:=DoSaveCodeBufferToFile(MainUnitInfo.Source,
|
||||||
GetTestProjectFilename,false);
|
GetTestUnitFilename(MainUnitInfo),false);
|
||||||
end;
|
end;
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
end;
|
end;
|
||||||
@ -2881,7 +2886,7 @@ writeln('TMainIDE.DoSaveProject A SaveAs=',SaveAs,' SaveToTestDir=',SaveToTestDi
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// save editor files
|
// save editor files
|
||||||
if (SourceNoteBook.Notebook<>nil) then begin
|
if (SourceNoteBook.Notebook<>nil) and (not SaveToTestDir) then begin
|
||||||
for i:=0 to SourceNoteBook.Notebook.Pages.Count-1 do begin
|
for i:=0 to SourceNoteBook.Notebook.Pages.Count-1 do begin
|
||||||
if (Project.MainUnit<0)
|
if (Project.MainUnit<0)
|
||||||
or (Project.Units[Project.MainUnit].EditorIndex<>i) then begin
|
or (Project.Units[Project.MainUnit].EditorIndex<>i) then begin
|
||||||
@ -3186,6 +3191,10 @@ begin
|
|||||||
Result:=mrAbort;
|
Result:=mrAbort;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
if Project=nil then Begin
|
||||||
|
MessageDlg('Create a project first!',mterror,[mbok],0);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
try
|
try
|
||||||
if not (Project.ProjectType in [ptProgram, ptApplication, ptCustomProgram])
|
if not (Project.ProjectType in [ptProgram, ptApplication, ptCustomProgram])
|
||||||
then exit;
|
then exit;
|
||||||
@ -3197,13 +3206,8 @@ begin
|
|||||||
if Project.ProjectFile<>'' then
|
if Project.ProjectFile<>'' then
|
||||||
DefaultFilename:=''
|
DefaultFilename:=''
|
||||||
else
|
else
|
||||||
DefaultFilename:=GetTestProjectFilename;
|
DefaultFilename:=GetTestUnitFilename(Project.Units[Project.MainUnit]);
|
||||||
|
|
||||||
Assert(False, 'Trace:Build Project Clicked');
|
|
||||||
if Project=nil then Begin
|
|
||||||
MessageDlg('Create a project first!',mterror,[mbok],0);
|
|
||||||
Exit;
|
|
||||||
end;
|
|
||||||
ActiveSrcEdit:=SourceNotebook.GetActiveSE;
|
ActiveSrcEdit:=SourceNotebook.GetActiveSE;
|
||||||
if ActiveSrcEdit<>nil then ActiveSrcEdit.ErrorLine:=-1;
|
if ActiveSrcEdit<>nil then ActiveSrcEdit.ErrorLine:=-1;
|
||||||
|
|
||||||
@ -3262,8 +3266,10 @@ writeln('[TMainIDE.DoRunProject] A');
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
MainUnitInfo:=Project.Units[Project.MainUnit];
|
MainUnitInfo:=Project.Units[Project.MainUnit];
|
||||||
ProgramFilename:=ChangeFileExt(MainUnitInfo.Filename,Project.TargetFileExt);
|
if MainUnitInfo.IsVirtual then
|
||||||
if MainUnitInfo.IsVirtual then ProgramFilename:=GetTestProjectFilename;
|
ProgramFilename:=GetTestProjectFilename
|
||||||
|
else
|
||||||
|
ProgramFilename:=ChangeFileExt(MainUnitInfo.Filename,Project.TargetFileExt);
|
||||||
|
|
||||||
if not FileExists(ProgramFilename) then begin
|
if not FileExists(ProgramFilename) then begin
|
||||||
AText:='No program file "'+ProgramFilename+'" found!';
|
AText:='No program file "'+ProgramFilename+'" found!';
|
||||||
@ -3386,6 +3392,14 @@ begin
|
|||||||
case EnvironmentOptions.DebuggerType of
|
case EnvironmentOptions.DebuggerType of
|
||||||
dtGnuDebugger:
|
dtGnuDebugger:
|
||||||
begin
|
begin
|
||||||
|
MessageDlg('Sorry, not implemented yet',
|
||||||
|
'The GNU debugger support is not yet implemented.'#13
|
||||||
|
+'The IDE can already handle the abstract debugger'#13
|
||||||
|
+'(see directory debugger), so that anyone can write a unit for their'#13
|
||||||
|
+'favourite debugger.'#13
|
||||||
|
+'Please set the debugger in the environment options to none to'#13
|
||||||
|
+'just start the program without debugging.',mtInformation,[mbOk],0);
|
||||||
|
exit;
|
||||||
{ ToDo: GnuDebugger
|
{ ToDo: GnuDebugger
|
||||||
if (TheDebugger<>nil) and (not (TheDebugger is TGnuDebugger)) then begin
|
if (TheDebugger<>nil) and (not (TheDebugger is TGnuDebugger)) then begin
|
||||||
TheDebugger.Free;
|
TheDebugger.Free;
|
||||||
@ -3554,15 +3568,15 @@ function TMainIDE.DoSaveCodeBufferToFile(ABuffer: TCodeBuffer;
|
|||||||
var
|
var
|
||||||
ACaption,AText:string;
|
ACaption,AText:string;
|
||||||
begin
|
begin
|
||||||
Result:=DoBackupFile(ABuffer.Filename,IsPartOfProject);
|
Result:=DoBackupFile(AFilename,IsPartOfProject);
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
repeat
|
repeat
|
||||||
if ABuffer.SaveToFile(ABuffer.Filename) then begin
|
if ABuffer.SaveToFile(AFilename) then begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
end else begin
|
end else begin
|
||||||
ACaption:='Write Error';
|
ACaption:='Write Error';
|
||||||
AText:='Unable to write to file "'+ABuffer.Filename+'"!';
|
AText:='Unable to write to file "'+AFilename+'"!';
|
||||||
Result:=MessageDlg(ACaption,AText,mterror,[mbabort, mbretry, mbignore],0);
|
Result:=MessageDlg(ACaption,AText,mtError,[mbAbort, mbRetry, mbIgnore],0);
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
if Result=mrIgnore then Result:=mrOk;
|
if Result=mrIgnore then Result:=mrOk;
|
||||||
end;
|
end;
|
||||||
@ -3948,7 +3962,8 @@ var TestDir: string;
|
|||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
if (Project.MainUnit<0) then exit;
|
if (Project.MainUnit<0) then exit;
|
||||||
Result:=ExtractFilename(Project.Units[Project.MainUnit].Source.Filename);
|
Result:=lowercase(
|
||||||
|
CodeToolBoss.GetSourceName(Project.Units[Project.MainUnit].Source));
|
||||||
if (Result='') then exit;
|
if (Result='') then exit;
|
||||||
TestDir:=EnvironmentOptions.TestBuildDirectory;
|
TestDir:=EnvironmentOptions.TestBuildDirectory;
|
||||||
if (TestDir='') then exit;
|
if (TestDir='') then exit;
|
||||||
@ -4333,6 +4348,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.126 2001/10/23 09:13:51 lazarus
|
||||||
|
MG: fixed TestProject
|
||||||
|
|
||||||
Revision 1.125 2001/10/18 13:34:03 lazarus
|
Revision 1.125 2001/10/18 13:34:03 lazarus
|
||||||
MG: keys for debugging
|
MG: keys for debugging
|
||||||
|
|
||||||
|
@ -880,7 +880,7 @@ begin
|
|||||||
case fProjectType of
|
case fProjectType of
|
||||||
ptProgram, ptApplication, ptCustomProgram:
|
ptProgram, ptApplication, ptCustomProgram:
|
||||||
begin
|
begin
|
||||||
NewPrgBuf:=CodeToolBoss.CreateFile('program.pas');
|
NewPrgBuf:=CodeToolBoss.CreateFile('project1.pas');
|
||||||
PrgUnitInfo:=TUnitInfo.Create(NewPrgBuf);
|
PrgUnitInfo:=TUnitInfo.Create(NewPrgBuf);
|
||||||
PrgUnitInfo.IsPartOfProject:=true;
|
PrgUnitInfo.IsPartOfProject:=true;
|
||||||
PrgUnitInfo.SyntaxHighlighter:=
|
PrgUnitInfo.SyntaxHighlighter:=
|
||||||
@ -1470,6 +1470,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.32 2001/10/23 09:13:52 lazarus
|
||||||
|
MG: fixed TestProject
|
||||||
|
|
||||||
Revision 1.31 2001/10/18 13:01:31 lazarus
|
Revision 1.31 2001/10/18 13:01:31 lazarus
|
||||||
MG: fixed speedbuttons numglyphs>1 and started IDE debugging
|
MG: fixed speedbuttons numglyphs>1 and started IDE debugging
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user