From 2a4806460e5ddfca6b49480b0497a6f65d1ca624 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 15 Aug 2003 16:19:53 +0000 Subject: [PATCH] implemented message blocks for package compilation git-svn-id: trunk@4486 - --- ide/main.pp | 30 ++++---- ide/msgview.pp | 1 + packager/pkgmanager.pas | 147 +++++++++++++++++++++------------------- 3 files changed, 94 insertions(+), 84 deletions(-) diff --git a/ide/main.pp b/ide/main.pp index 886665ac86..1c3a35920b 100644 --- a/ide/main.pp +++ b/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 diff --git a/ide/msgview.pp b/ide/msgview.pp index 145a616caf..1fa0c24df9 100644 --- a/ide/msgview.pp +++ b/ide/msgview.pp @@ -212,6 +212,7 @@ end; procedure TMessagesView.BeginBlock; begin + Clear; inc(fBlockCount); end; diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas index 6e7a6e1ccc..5f2d1245ed 100644 --- a/packager/pkgmanager.pas +++ b/packager/pkgmanager.pas @@ -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