mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 14:36:09 +02:00
implemented message blocks for package compilation
git-svn-id: trunk@4486 -
This commit is contained in:
parent
b49deecff8
commit
2a4806460e
30
ide/main.pp
30
ide/main.pp
@ -5548,23 +5548,24 @@ begin
|
||||
Result:=DoSaveForBuild;
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// compile required packages
|
||||
Result:=PkgBoss.DoCompileProjectDependencies(Project1,[pcfDoNotSaveEditorFiles]);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// get main source filename
|
||||
if not Project1.IsVirtual then
|
||||
DefaultFilename:=''
|
||||
else
|
||||
DefaultFilename:=GetTestUnitFilename(Project1.MainUnitInfo);
|
||||
|
||||
// clear old error lines
|
||||
SourceNotebook.ClearErrorLines;
|
||||
|
||||
// show messages
|
||||
MessagesView.Clear;
|
||||
MessagesView.BeginBlock;
|
||||
try
|
||||
// compile required packages
|
||||
Result:=PkgBoss.DoCompileProjectDependencies(Project1,
|
||||
[pcfDoNotSaveEditorFiles]);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// get main source filename
|
||||
if not Project1.IsVirtual then
|
||||
DefaultFilename:=''
|
||||
else
|
||||
DefaultFilename:=GetTestUnitFilename(Project1.MainUnitInfo);
|
||||
|
||||
// clear old error lines
|
||||
SourceNotebook.ClearErrorLines;
|
||||
|
||||
DoArrangeSourceEditorAndMessageView(false);
|
||||
|
||||
// warn ambigious files
|
||||
@ -9413,6 +9414,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.637 2003/08/15 16:19:53 mattias
|
||||
implemented message blocks for package compilation
|
||||
|
||||
Revision 1.636 2003/08/15 16:10:12 mattias
|
||||
implemented message blocks
|
||||
|
||||
|
@ -212,6 +212,7 @@ end;
|
||||
|
||||
procedure TMessagesView.BeginBlock;
|
||||
begin
|
||||
Clear;
|
||||
inc(fBlockCount);
|
||||
end;
|
||||
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
IDEProcs, ProjectDefs, InputHistory, IDEDefs, Project, ComponentReg,
|
||||
UComponentManMain, PackageEditor, AddToPackageDlg, PackageDefs, PackageLinks,
|
||||
PackageSystem, OpenInstalledPkgDlg, PkgGraphExplorer, BrokenDependenciesDlg,
|
||||
CompilerOptions, ExtToolDialog, ExtToolEditDlg, EditDefineTree,
|
||||
CompilerOptions, ExtToolDialog, ExtToolEditDlg, EditDefineTree, MsgView,
|
||||
BuildLazDialog, DefineTemplates, LazConf, ProjectInspector, ComponentPalette,
|
||||
UnitEditor, AddFileToAPackageDlg, LazarusPackageIntf, PublishProjectDlg,
|
||||
BasePkgManager, MainBar;
|
||||
@ -1960,84 +1960,89 @@ begin
|
||||
|
||||
// auto increase version
|
||||
// ToDo
|
||||
|
||||
Result:=DoPreparePackageOutputDirectory(APackage);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// create package main source file
|
||||
Result:=DoSavePackageMainSource(APackage,Flags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// check ambigious units
|
||||
Result:=CheckAmbigiousPackageUnits(APackage);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// run compilation tool 'Before'
|
||||
Result:=MainIDE.DoExecuteCompilationTool(
|
||||
APackage.CompilerOptions.ExecuteBefore,
|
||||
APackage.Directory,'Executing command before');
|
||||
if Result<>mrOk then exit;
|
||||
MessagesView.BeginBlock;
|
||||
try
|
||||
Result:=DoPreparePackageOutputDirectory(APackage);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// create external tool to run the compiler
|
||||
writeln('TPkgManager.DoCompilePackage Compiler="',CompilerFilename,'"');
|
||||
writeln('TPkgManager.DoCompilePackage Params="',CompilerParams,'"');
|
||||
writeln('TPkgManager.DoCompilePackage WorkingDir="',APackage.Directory,'"');
|
||||
// create package main source file
|
||||
Result:=DoSavePackageMainSource(APackage,Flags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
if not APackage.CompilerOptions.SkipCompiler then begin
|
||||
// check compiler filename
|
||||
try
|
||||
CheckIfFileIsExecutable(CompilerFilename);
|
||||
except
|
||||
on e: Exception do begin
|
||||
Result:=MessageDlg(lisPkgManginvalidCompilerFilename,
|
||||
Format(lisPkgMangTheCompilerFileForPackageIsNotAValidExecutable, [
|
||||
APackage.IDAsString, #13, E.Message]),
|
||||
mtError,[mbCancel,mbAbort],0);
|
||||
exit;
|
||||
// check ambigious units
|
||||
Result:=CheckAmbigiousPackageUnits(APackage);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// run compilation tool 'Before'
|
||||
Result:=MainIDE.DoExecuteCompilationTool(
|
||||
APackage.CompilerOptions.ExecuteBefore,
|
||||
APackage.Directory,'Executing command before');
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// create external tool to run the compiler
|
||||
writeln('TPkgManager.DoCompilePackage Compiler="',CompilerFilename,'"');
|
||||
writeln('TPkgManager.DoCompilePackage Params="',CompilerParams,'"');
|
||||
writeln('TPkgManager.DoCompilePackage WorkingDir="',APackage.Directory,'"');
|
||||
|
||||
if not APackage.CompilerOptions.SkipCompiler then begin
|
||||
// check compiler filename
|
||||
try
|
||||
CheckIfFileIsExecutable(CompilerFilename);
|
||||
except
|
||||
on e: Exception do begin
|
||||
Result:=MessageDlg(lisPkgManginvalidCompilerFilename,
|
||||
Format(lisPkgMangTheCompilerFileForPackageIsNotAValidExecutable, [
|
||||
APackage.IDAsString, #13, E.Message]),
|
||||
mtError,[mbCancel,mbAbort],0);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// change compiler parameters for compiling clean
|
||||
EffektiveCompilerParams:=CompilerParams;
|
||||
if pcfCleanCompile in Flags then begin
|
||||
if EffektiveCompilerParams<>'' then
|
||||
EffektiveCompilerParams:='-B '+EffektiveCompilerParams
|
||||
else
|
||||
EffektiveCompilerParams:='-B';
|
||||
end;
|
||||
|
||||
PkgCompileTool:=TExternalToolOptions.Create;
|
||||
try
|
||||
PkgCompileTool.Title:='Compiling package '+APackage.IDAsString;
|
||||
PkgCompileTool.ScanOutputForFPCMessages:=true;
|
||||
PkgCompileTool.ScanOutputForMakeMessages:=true;
|
||||
PkgCompileTool.WorkingDirectory:=APackage.Directory;
|
||||
PkgCompileTool.Filename:=CompilerFilename;
|
||||
PkgCompileTool.CmdLineParams:=EffektiveCompilerParams;
|
||||
|
||||
// clear old errors
|
||||
SourceNotebook.ClearErrorLines;
|
||||
|
||||
// compile package
|
||||
Result:=EnvironmentOptions.ExternalTools.Run(PkgCompileTool,
|
||||
MainIDE.MacroList);
|
||||
if Result<>mrOk then exit;
|
||||
// compilation succeded -> write state file
|
||||
Result:=DoSavePackageCompiledState(APackage,
|
||||
CompilerFilename,CompilerParams);
|
||||
if Result<>mrOk then exit;
|
||||
finally
|
||||
// clean up
|
||||
PkgCompileTool.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
// change compiler parameters for compiling clean
|
||||
EffektiveCompilerParams:=CompilerParams;
|
||||
if pcfCleanCompile in Flags then begin
|
||||
if EffektiveCompilerParams<>'' then
|
||||
EffektiveCompilerParams:='-B '+EffektiveCompilerParams
|
||||
else
|
||||
EffektiveCompilerParams:='-B';
|
||||
end;
|
||||
|
||||
PkgCompileTool:=TExternalToolOptions.Create;
|
||||
try
|
||||
PkgCompileTool.Title:='Compiling package '+APackage.IDAsString;
|
||||
PkgCompileTool.ScanOutputForFPCMessages:=true;
|
||||
PkgCompileTool.ScanOutputForMakeMessages:=true;
|
||||
PkgCompileTool.WorkingDirectory:=APackage.Directory;
|
||||
PkgCompileTool.Filename:=CompilerFilename;
|
||||
PkgCompileTool.CmdLineParams:=EffektiveCompilerParams;
|
||||
|
||||
// clear old errors
|
||||
SourceNotebook.ClearErrorLines;
|
||||
|
||||
// compile package
|
||||
Result:=EnvironmentOptions.ExternalTools.Run(PkgCompileTool,
|
||||
MainIDE.MacroList);
|
||||
if Result<>mrOk then exit;
|
||||
// compilation succeded -> write state file
|
||||
Result:=DoSavePackageCompiledState(APackage,
|
||||
CompilerFilename,CompilerParams);
|
||||
if Result<>mrOk then exit;
|
||||
finally
|
||||
// clean up
|
||||
PkgCompileTool.Free;
|
||||
end;
|
||||
// run compilation tool 'After'
|
||||
Result:=MainIDE.DoExecuteCompilationTool(
|
||||
APackage.CompilerOptions.ExecuteAfter,
|
||||
APackage.Directory,'Executing command after');
|
||||
if Result<>mrOk then exit;
|
||||
finally
|
||||
MessagesView.EndBlock;
|
||||
end;
|
||||
|
||||
// run compilation tool 'After'
|
||||
Result:=MainIDE.DoExecuteCompilationTool(
|
||||
APackage.CompilerOptions.ExecuteAfter,
|
||||
APackage.Directory,'Executing command after');
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
finally
|
||||
if not (pcfDoNotSaveEditorFiles in Flags) then begin
|
||||
// check for changed files on disk
|
||||
|
Loading…
Reference in New Issue
Block a user