From 3a730fa23b1dee7db4971525ebb51251d58f2f22 Mon Sep 17 00:00:00 2001 From: juha Date: Sun, 9 Feb 2014 15:49:03 +0000 Subject: [PATCH] LazBuild: make changes required by the earlier refactoring. git-svn-id: trunk@43979 - --- ide/lazbuild.lpr | 98 ++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 53 deletions(-) diff --git a/ide/lazbuild.lpr b/ide/lazbuild.lpr index 8e6775326f..c7c15d4cbe 100644 --- a/ide/lazbuild.lpr +++ b/ide/lazbuild.lpr @@ -513,12 +513,10 @@ var CurResult: TModalResult; BuildLazProfiles: TBuildLazarusProfiles; CurProf: TBuildLazarusProfile; - PkgOptions: String; - InheritedOptionStrings: TInheritedCompOptsStrings; - TargetDir: String; + InhOptStrs: TInheritedCompOptsStrings; + Builder: TLazarusBuilder; + TargetDir, s: String; i: Integer; - s: String; - ProfileChanged: boolean; begin Result:=false; if not Init then exit; @@ -587,62 +585,56 @@ begin exit; end; - // clean - ProfileChanged:=false; - if BuildLazProfiles.Current.IdeBuildMode=bmCleanAllBuild then begin - CurResult:=MakeLazarus(BuildLazProfiles.Current, - EnvironmentOptions.ExternalTools,GlobalMacroList, - '',EnvironmentOptions.GetParsedCompilerFilename, - EnvironmentOptions.GetParsedMakeFilename, - Flags+[blfDontBuild], - ProfileChanged); + Builder:=TLazarusBuilder.Create(BuildLazProfiles.Current); + try + Builder.ExtTools:=EnvironmentOptions.ExternalTools; + Builder.PkgOptions:=''; + // clean + if BuildLazProfiles.Current.IdeBuildMode=bmCleanAllBuild then begin + CurResult:=Builder.MakeLazarus(Flags+[blfDontBuild]); + if CurResult<>mrOk then begin + if ConsoleVerbosity>=-1 then + DebugLn('TLazBuildApplication.BuildLazarusIDE: Clean all failed.'); + exit; + end; + end; + + // save configs for 'make' + CurResult:=PackageGraph.SaveAutoInstallConfig; if CurResult<>mrOk then begin if ConsoleVerbosity>=-1 then - DebugLn('TLazBuildApplication.BuildLazarusIDE: Clean all failed.'); + DebugLn('TLazBuildApplication.BuildLazarusIDE: failed saving IDE make config files.'); exit; end; - end; - // save configs for 'make' - CurResult:=PackageGraph.SaveAutoInstallConfig; - if CurResult<>mrOk then begin - if ConsoleVerbosity>=-1 then - DebugLn('TLazBuildApplication.BuildLazarusIDE: failed saving IDE make config files.'); - exit; - end; + // compile auto install static packages + if not CompileAutoInstallPackages(BuildLazProfiles.Current.IdeBuildMode<>bmBuild) + then begin + if ConsoleVerbosity>=-1 then + DebugLn('TLazBuildApplication.BuildLazarusIDE: Compile AutoInstall Packages failed.'); + exit; + end; - // compile auto install static packages - if not CompileAutoInstallPackages(BuildLazProfiles.Current.IdeBuildMode<>bmBuild) - then begin - if ConsoleVerbosity>=-1 then - DebugLn('TLazBuildApplication.BuildLazarusIDE: Compile AutoInstall Packages failed.'); - exit; - end; - - // create inherited compiler options - PkgOptions:=PackageGraph.GetIDEInstallPackageOptions( - PackageGraph.FirstAutoInstallDependency,InheritedOptionStrings{%H-}); + // create inherited compiler options + Builder.PkgOptions:=PackageGraph.GetIDEInstallPackageOptions(InhOptStrs{%H-}); - // save - CurResult:=SaveIDEMakeOptions(BuildLazProfiles.Current,GlobalMacroList, - PkgOptions,Flags+[blfBackupOldExe]); - if CurResult<>mrOk then begin - if ConsoleVerbosity>=-1 then - DebugLn('TLazBuildApplication.BuildLazarusIDE: failed saving idemake.cfg'); - exit; - end; + // save + CurResult:=Builder.SaveIDEMakeOptions(Flags+[blfBackupOldExe]); + if CurResult<>mrOk then begin + if ConsoleVerbosity>=-1 then + DebugLn('TLazBuildApplication.BuildLazarusIDE: failed saving idemake.cfg'); + exit; + end; - // compile IDE - CurResult:=MakeLazarus(BuildLazProfiles.Current, - EnvironmentOptions.ExternalTools,GlobalMacroList, - PkgOptions,EnvironmentOptions.GetParsedCompilerFilename, - EnvironmentOptions.GetParsedMakeFilename, - Flags+[blfUseMakeIDECfg,blfOnlyIDE], - ProfileChanged); - if CurResult<>mrOk then begin - if ConsoleVerbosity>=-1 then - DebugLn('TLazBuildApplication.BuildLazarusIDE: Building IDE failed.'); - exit; + // compile IDE + CurResult:=Builder.MakeLazarus(Flags+[blfUseMakeIDECfg,blfOnlyIDE]); + if CurResult<>mrOk then begin + if ConsoleVerbosity>=-1 then + DebugLn('TLazBuildApplication.BuildLazarusIDE: Building IDE failed.'); + exit; + end; + finally + Builder.Free; end; Result:=true;