-- For a non-library project, add the object
-- directory, if it is not a virtual project, and if
- -- there are Ada sources or if the project is an
- -- extending project. If there are no Ada sources,
+ -- there are Ada sources in the project or one of the
+ -- projects it extends. If there are no Ada sources,
-- adding the object directory could disrupt the order
-- of the object dirs in the path.
- elsif not Data.Virtual
- and then There_Are_Ada_Sources (In_Tree, Project)
- then
- Add_To_Object_Path
- (Data.Object_Directory.Name, In_Tree);
+ elsif not Data.Virtual then
+ declare
+ Add_Object_Dir : Boolean := False;
+ Prj : Project_Id := Project;
+
+ begin
+ while not Add_Object_Dir
+ and then Prj /= No_Project
+ loop
+ if In_Tree.Projects.Table
+ (Prj).Ada_Sources /= Nil_String
+ then
+ Add_Object_Dir := True;
+
+ else
+ Prj :=
+ In_Tree.Projects.Table (Prj).Extends;
+ end if;
+ end loop;
+
+ if Add_Object_Dir then
+ Add_To_Object_Path
+ (Data.Object_Directory.Name, In_Tree);
+ end if;
+ end;
end if;
end if;
end if;
-- does not (because it is already extended), but other projects that it
-- imports may need to be virtually extended.
+ type Extension_Origin is (None, Extending_Simple, Extending_All);
+ -- Type of parameter From_Extended for procedures Parse_Single_Project and
+ -- Post_Parse_Context_Clause. Extending_All means that we are parsing the
+ -- tree rooted at an extending all project.
+
+ procedure Parse_Single_Project
+ (In_Tree : Project_Node_Tree_Ref;
+ Project : out Project_Node_Id;
+ Extends_All : out Boolean;
+ Path_Name : String;
+ Extended : Boolean;
+ From_Extended : Extension_Origin;
+ In_Limited : Boolean;
+ Packages_To_Check : String_List_Access;
+ Depth : Natural;
+ Current_Dir : String);
+ -- Parse a project file.
+ -- Recursive procedure: it calls itself for imported and extended
+ -- projects. When From_Extended is not None, if the project has already
+ -- been parsed and is an extended project A, return the ultimate
+ -- (not extended) project that extends A. When In_Limited is True,
+ -- the importing path includes at least one "limited with".
+ -- When parsing configuration projects, do not allow a depth > 1.
+
procedure Pre_Parse_Context_Clause
(In_Tree : Project_Node_Tree_Ref;
Context_Clause : out With_Id);
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- Current_Directory is used for optimization purposes only, avoiding extra
-- system calls.
- type Extension_Origin is (None, Extending_Simple, Extending_All);
- -- Type of parameter From_Extended for procedures Parse_Single_Project and
- -- Post_Parse_Context_Clause. Extending_All means that we are parsing the
- -- tree rooted at an extending all project.
-
- procedure Parse_Single_Project
- (In_Tree : Project_Node_Tree_Ref;
- Project : out Project_Node_Id;
- Extends_All : out Boolean;
- Path_Name : String;
- Extended : Boolean;
- From_Extended : Extension_Origin;
- In_Limited : Boolean;
- Packages_To_Check : String_List_Access;
- Depth : Natural;
- Current_Dir : String);
- -- Parse a project file.
- -- Recursive procedure: it calls itself for imported and extended
- -- projects. When From_Extended is not None, if the project has already
- -- been parsed and is an extended project A, return the ultimate
- -- (not extended) project that extends A. When In_Limited is True,
- -- the importing path includes at least one "limited with".
- -- When parsing configuration projects, do not allow a depth > 1.
-
end Prj.Part;
Objects_Path_File_Without_Libs => No_Path,
Config_File_Name => No_Path,
Config_File_Temp => False,
- Linker_Name => No_File,
- Linker_Path => No_Path,
- Minimum_Linker_Options => No_Name_List,
Config_Checked => False,
Checked => False,
Seen => False,
return Extend_Name (Source_File_Name, Switches_Dependency_Suffix);
end Switches_Name;
- ---------------------------
- -- There_Are_Ada_Sources --
- ---------------------------
-
- function There_Are_Ada_Sources
- (In_Tree : Project_Tree_Ref;
- Project : Project_Id) return Boolean
- is
- Prj : Project_Id;
-
- begin
- Prj := Project;
- while Prj /= No_Project loop
- if In_Tree.Projects.Table (Prj).Ada_Sources /= Nil_String then
- return True;
- end if;
-
- Prj := In_Tree.Projects.Table (Prj).Extends;
- end loop;
-
- return False;
- end There_Are_Ada_Sources;
-
-----------
-- Value --
-----------
-- use this field directly outside of the project manager, use
-- Prj.Env.Ada_Include_Path instead.
- -------------
- -- Linking --
- -------------
-
- Linker_Name : File_Name_Type := No_File;
- -- Value of attribute Language_Processing'Linker in the project file
-
- Linker_Path : Path_Name_Type := No_Path;
- -- Path of linker when attribute Language_Processing'Linker is specified
-
- Minimum_Linker_Options : Name_List_Index := No_Name_List;
- -- List of options specified in attribute
- -- Language_Processing'Minimum_Linker_Options.
-
-------------------
-- Miscellaneous --
-------------------
-- Return True when Language_Name (which must be lower case) is one of the
-- languages used for the project.
- function There_Are_Ada_Sources
- (In_Tree : Project_Tree_Ref;
- Project : Project_Id) return Boolean;
- -- ??? needs comment
- -- ??? Name sounds strange, suggested replacement: Ada_Sources_Present
-
Project_Error : exception;
-- Raised by some subprograms in Prj.Attr