@@ -143,10 +143,13 @@ package Build_Configurations is
143143 -- Remove target named Target_Name from registry
144144
145145 function Get_Target_From_Name
146- (Registry : Build_Config_Registry_Access;
147- Name : String) return Target_Access;
146+ (Registry : Build_Config_Registry_Access;
147+ Name : String;
148+ Resolve_Alias : Boolean := True) return Target_Access;
148149 -- Get the target corresponding to Name in the Registry; return null if
149150 -- no such target was found.
151+ -- If the target refered by Name is an alias on another target, the
152+ -- aliased target is returned instead if Resolve_Alias is set to True.
150153
151154 procedure Duplicate_Target
152155 (Registry : Build_Config_Registry_Access;
@@ -327,6 +330,9 @@ package Build_Configurations is
327330
328331 Project_Switches : Unbounded_String;
329332 -- Project switches relevant for this target, if any.
333+
334+ Aliased_Target_Name : Unbounded_String;
335+ -- The name of the target being aliased, if any.
330336 end record ;
331337
332338 function Get_Properties (Target : Target_Access) return Target_Properties;
@@ -447,6 +453,21 @@ package Build_Configurations is
447453 (Target : Target_Access; Launch_Mode : Launch_Mode_Type);
448454 -- Change Launch_Mode value
449455
456+ procedure Set_As_Alias
457+ (Target : not null Target_Access;
458+ Aliased_Target : Target_Access := null );
459+ -- Set the given target as an alias for Aliased_Target.
460+ -- Aliases are used to temporarily replace a build target
461+ -- (e.g: "Build All") by another one (e.g: "My Custom Build All").
462+ --
463+ -- This can be used by plugins to execute their own custom build targets
464+ -- while the user interacts with the default GNAT Studio build targets,
465+ -- either via the UI or through the GPS.BuildTarget Python API.
466+ -- In the example given above, clicking on the "Build All" toolbar button
467+ -- will actually execute "My Custom Build All" instead.
468+ --
469+ -- Giving a null aliased target will unset any existing alias.
470+
450471 function Apply_Mode_Args
451472 (Target : access Target_Type;
452473 Mode : String;
0 commit comments