From e6e1297dc0d95d0465d47f6a7b3a9d366da002b9 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 20 Nov 2015 16:28:04 +0000 Subject: [PATCH] project groups: compile project group git-svn-id: trunk@50448 - --- components/projectgroups/projectgroup.pp | 34 +++++++++++++------ .../projectgroups/projectgroupeditor.lfm | 2 ++ .../projectgroups/projectgroupeditor.pas | 6 ++-- components/projectgroups/projectgroupintf.pp | 7 ++-- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/components/projectgroups/projectgroup.pp b/components/projectgroups/projectgroup.pp index 8cc3fe9c33..4ebd2ee2a6 100644 --- a/components/projectgroups/projectgroup.pp +++ b/components/projectgroups/projectgroup.pp @@ -1,8 +1,6 @@ { ToDo: - save/restore Active target - - Build file - - build modes of project as nodes with checkboxes - run external tool - update files when project/package changes in IDE - update dependencies when changed in IDE @@ -54,11 +52,11 @@ type function PerformNextTarget(AAction: TPGTargetAction): TPGActionResult; procedure ActiveChanged(Sender: TPGCompileTarget); override; public + destructor Destroy; override; procedure LoadTarget(Recursively: boolean); virtual; procedure LoadGroupSettings(XMLConfig: TXMLConfig; aPath: string); procedure SaveGroupSettings(XMLConfig: TXMLConfig; aPath: string); procedure UnLoadTarget; virtual; - destructor Destroy; override; procedure Modified; override; end; @@ -754,7 +752,6 @@ begin Target:=TIDECompileTarget(AddTarget(TargetFileName)); if pgloLoadRecursively in Options then Target.LoadTarget(true); - // ToDo: load buildmode flags end else if (pgloRemoveInvalid in Options) then begin @@ -1373,19 +1370,34 @@ end; function TIDECompileTarget.ProjectGroupAction(AAction: TPGTargetAction ): TPGActionResult; +var + i: Integer; + aTarget: TIDECompileTarget; begin Result:=arFailed; case AAction of - taOpen: ProjectGroupManager.LoadProjectGroup(FileName,[]); + taOpen: + ProjectGroupManager.LoadProjectGroup(FileName,[]); taSettings: ; taCompile, - taCompileClean, + taCompileClean: + begin + for i:=0 to ProjectGroup.TargetCount-1 do begin + aTarget:=TIDECompileTarget(ProjectGroup.Targets[i]); + if AAction in aTarget.AllowedActions then + if aTarget.PerformAction(AAction)<>arOk then + exit; + end; + end; taCompileFromHere: begin - // todo: compile all targets - if AAction=taCompileFromHere then - Result:=PerformNextTarget(taCompileFromHere); + if ProjectGroupAction(taCompile)<>arOK then + exit; + Result:=arOK; + aTarget:=TIDECompileTarget(GetNext(true)); + if aTarget=nil then exit; + Result:=aTarget.PerformAction(taCompileFromHere); end; end; end; @@ -1460,7 +1472,7 @@ function TIDECompileTarget.PerformNextTarget(AAction: TPGTargetAction var aTarget: TIDECompileTarget; begin - aTarget:=TIDECompileTarget(GetNext); + aTarget:=TIDECompileTarget(GetNext(false)); while (aTarget<>nil) do begin if AAction in aTarget.AllowedActions then @@ -1468,7 +1480,7 @@ begin Result:=aTarget.PerformAction(AAction); exit; end; - aTarget:=TIDECompileTarget(aTarget.GetNext); + aTarget:=TIDECompileTarget(aTarget.GetNext(false)); end; Result:=arOK; end; diff --git a/components/projectgroups/projectgroupeditor.lfm b/components/projectgroups/projectgroupeditor.lfm index 0b27a2a15a..7f24993f3e 100644 --- a/components/projectgroups/projectgroupeditor.lfm +++ b/components/projectgroups/projectgroupeditor.lfm @@ -34,6 +34,7 @@ object ProjectGroupEditorForm: TProjectGroupEditorForm Left = 37 Top = 2 Action = AProjectGroupAddNew + Visible = False end object TBDelete: TToolButton Left = 150 @@ -79,6 +80,7 @@ object ProjectGroupEditorForm: TProjectGroupEditorForm Left = 377 Top = 2 Action = ATargetActivate + Visible = False end end object TVPG: TTreeView diff --git a/components/projectgroups/projectgroupeditor.pas b/components/projectgroups/projectgroupeditor.pas index 4640944146..5f854fb25f 100644 --- a/components/projectgroups/projectgroupeditor.pas +++ b/components/projectgroups/projectgroupeditor.pas @@ -1,10 +1,11 @@ { Todo: - - new button: call new item dialog - activate project when project is opened - deactivate project when project is closed - show active build mode - compile a single build mode + - Is Activate needed? + - Is New button needed? } unit ProjectGroupEditor; @@ -293,7 +294,7 @@ procedure TProjectGroupEditorForm.ClearEventCallBacks(AProjectGroup: TProjectGro Var PG: TIDEProjectGroup; begin - debugln(['TProjectGroupEditorForm.ClearEventCallBacks ']); + //debugln(['TProjectGroupEditorForm.ClearEventCallBacks ']); PG:=AProjectGroup as TIDEProjectGroup; PG.RemoveAllHandlersOfObject(Self); PG.OnFileNameChange:=Nil; @@ -1293,7 +1294,6 @@ begin CreateSubNode(FileNodes[False],ntFile,T,T.Files[i]); // dependencies ShowDependencies(AParent,T,DepNodes); - // TODO: Build mode info Not available ? finally TVPG.EndUpdate; end; diff --git a/components/projectgroups/projectgroupintf.pp b/components/projectgroups/projectgroupintf.pp index 44f76d95ac..3117771cbd 100644 --- a/components/projectgroups/projectgroupintf.pp +++ b/components/projectgroups/projectgroupintf.pp @@ -98,7 +98,7 @@ Type procedure DeActivate; function GetOwnerProjectGroup: TProjectGroup; function GetRootProjectGroup: TProjectGroup; - function GetNext: TPGCompileTarget; + function GetNext(SkipChildren: boolean): TPGCompileTarget; function IndexOfBuildMode(aName: string): integer; function FindBuildMode(aName: string): TPGBuildMode; procedure Modified; virtual; abstract; @@ -545,14 +545,15 @@ begin Result:=aTarget.ProjectGroup; end; -function TPGCompileTarget.GetNext: TPGCompileTarget; +function TPGCompileTarget.GetNext(SkipChildren: boolean): TPGCompileTarget; var aTarget: TPGCompileTarget; PG: TProjectGroup; i: Integer; begin // check first child - if (ProjectGroup<>nil) and (ProjectGroup.TargetCount>0) then begin + if (not SkipChildren) and (ProjectGroup<>nil) and (ProjectGroup.TargetCount>0) + then begin Result:=ProjectGroup.Targets[0]; exit(Result); end;