Commit 104e4daa by Vincent Celier Committed by Arnaud Charlet

clean.adb (Check_Project): Look for Ada code in extending project, even if Ada…

clean.adb (Check_Project): Look for Ada code in extending project, even if Ada is not specified as a language.

2005-11-14  Vincent Celier  <celier@adacore.com>

	* clean.adb (Check_Project): Look for Ada code in extending project,
	even if Ada is not specified as a language.
	Use new function DLL_Prefix for DLL_Name
	(Clean_Interface_Copy_Directory): New procedure
	(Clean_Library_Directory): New procedure
	(Clean_Directory): Remove procedure, no longer used
	(Clean_Project): Do not delete any file in an externally built project

	* prj-env.adb (Set_Ada_Paths.Add.Recursive_Add): Add the object
	directory of an extending project, even when there are no Ada source
	present.
	(Ada_Objects_Path.Add): Add Library_ALI_Dir, not Library_Dir to the path
	(Set_Ada_Paths.Add.Recursive_Add): Ditto

	* mlib-prj.adb (Check_Library): For all library projects, get the
	library file timestamp.
	(Build_Library): Copy ALI files in Library_ALI_Dir, not in Library_Dir
	(Build_Library): Use new function DLL_Prefix for the DLL_Name
	(Clean): Remove procedure, no longer used
	(Ultimate_Extension_Of): New function
	(Build_Library): When cleaning the library directory, only remove an
	existing library file and any ALI file of a source of the project.
	When cleaning the interface copy directory, remove any source that
	could be a source of the project.

	* prj.ads, prj.adb (Project_Empty): Add values of new components
	Library_TS and All_Imported_Projects.
	(Project_Empty): Add values for new components of Project_Data:
	Library_ALI_Dir and Display_Library_ALI_Dir

	* prj-attr.adb: New project level attribute name Library_ALI_Dir

	* prj-nmsc.adb (Check_Library_Attributes): Take into account new
	attribute Library_ALI_Dir.
	(Check_Library_Attributes): The library directory cannot be the same as
	any source directory of the project tree.
	(Check_Stand_Alone_Library): The interface copy directory cannot be
	the same as any source directory of the project tree.

	* mlib.adb: Use Prj.Com.Fail, instead of Osint.Fail directly, to delete
	all temporary files.

From-SVN: r106967
parent f9f7e102
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1999-2005, Ada Core Technologies, Inc. -- -- Copyright (C) 1999-2005, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -34,6 +34,8 @@ with Namet; use Namet; ...@@ -34,6 +34,8 @@ with Namet; use Namet;
with MLib.Utl; use MLib.Utl; with MLib.Utl; use MLib.Utl;
with Prj.Com;
with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Directory_Operations; use GNAT.Directory_Operations;
package body MLib is package body MLib is
...@@ -67,24 +69,24 @@ package body MLib is ...@@ -67,24 +69,24 @@ package body MLib is
procedure Check_Library_Name (Name : String) is procedure Check_Library_Name (Name : String) is
begin begin
if Name'Length = 0 then if Name'Length = 0 then
Fail ("library name cannot be empty"); Prj.Com.Fail ("library name cannot be empty");
end if; end if;
if Name'Length > Max_Characters_In_Library_Name then if Name'Length > Max_Characters_In_Library_Name then
Fail ("illegal library name """, Name, """: too long"); Prj.Com.Fail ("illegal library name """, Name, """: too long");
end if; end if;
if not Is_Letter (Name (Name'First)) then if not Is_Letter (Name (Name'First)) then
Fail ("illegal library name """, Prj.Com.Fail ("illegal library name """,
Name, Name,
""": should start with a letter"); """: should start with a letter");
end if; end if;
for Index in Name'Range loop for Index in Name'Range loop
if not Is_Alphanumeric (Name (Index)) then if not Is_Alphanumeric (Name (Index)) then
Fail ("illegal library name """, Prj.Com.Fail ("illegal library name """,
Name, Name,
""": should include only letters and digits"); """: should include only letters and digits");
end if; end if;
end loop; end loop;
end Check_Library_Name; end Check_Library_Name;
...@@ -273,7 +275,7 @@ package body MLib is ...@@ -273,7 +275,7 @@ package body MLib is
end; end;
if not Success then if not Success then
Fail ("could not copy ALI files to library dir"); Prj.Com.Fail ("could not copy ALI files to library dir");
end if; end if;
end loop; end loop;
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2004 Free Software Foundation, Inc. -- -- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -55,7 +55,7 @@ package body Prj.Attr is ...@@ -55,7 +55,7 @@ package body Prj.Attr is
-- insensitive -- insensitive
-- 'c' same as 'b', with optional index -- 'c' same as 'b', with optional index
-- End is indicated by two consecutive '#'. -- End is indicated by two consecutive '#'
Initialization_Data : constant String := Initialization_Data : constant String :=
...@@ -75,6 +75,7 @@ package body Prj.Attr is ...@@ -75,6 +75,7 @@ package body Prj.Attr is
"SVlibrary_auto_init#" & "SVlibrary_auto_init#" &
"LVlibrary_options#" & "LVlibrary_options#" &
"SVlibrary_src_dir#" & "SVlibrary_src_dir#" &
"SVlibrary_ali_dir#" &
"SVlibrary_gcc#" & "SVlibrary_gcc#" &
"SVlibrary_symbol_file#" & "SVlibrary_symbol_file#" &
"SVlibrary_symbol_policy#" & "SVlibrary_symbol_policy#" &
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -48,7 +48,7 @@ package body Prj.Env is ...@@ -48,7 +48,7 @@ package body Prj.Env is
-- and ADA_OBJECTS_PATH are stored. -- and ADA_OBJECTS_PATH are stored.
Ada_Path_Length : Natural := 0; Ada_Path_Length : Natural := 0;
-- Index of the last valid character in Ada_Path_Buffer. -- Index of the last valid character in Ada_Path_Buffer
Ada_Prj_Include_File_Set : Boolean := False; Ada_Prj_Include_File_Set : Boolean := False;
Ada_Prj_Objects_File_Set : Boolean := False; Ada_Prj_Objects_File_Set : Boolean := False;
...@@ -270,9 +270,9 @@ package body Prj.Env is ...@@ -270,9 +270,9 @@ package body Prj.Env is
if Data.Library then if Data.Library then
if Data.Object_Directory = No_Name if Data.Object_Directory = No_Name
or else or else
Contains_ALI_Files (Data.Library_Dir) Contains_ALI_Files (Data.Library_ALI_Dir)
then then
Add_To_Path (Get_Name_String (Data.Library_Dir)); Add_To_Path (Get_Name_String (Data.Library_ALI_Dir));
else else
Add_To_Path (Get_Name_String (Data.Object_Directory)); Add_To_Path (Get_Name_String (Data.Object_Directory));
end if; end if;
...@@ -2121,16 +2121,17 @@ package body Prj.Env is ...@@ -2121,16 +2121,17 @@ package body Prj.Env is
and then and then
(not Including_Libraries or else not Data.Library)) (not Including_Libraries or else not Data.Library))
then then
-- For a library project, add the library directory -- For a library project, add the library ALI
-- if there is no object directory or if the library -- directory if there is no object directory or
-- directory contains ALI files; otherwise add the -- if the library ALI directory contains ALI files;
-- object directory. -- otherwise add the object directory.
if Data.Library then if Data.Library then
if Data.Object_Directory = No_Name if Data.Object_Directory = No_Name
or else Contains_ALI_Files (Data.Library_Dir) or else Contains_ALI_Files (Data.Library_ALI_Dir)
then then
Add_To_Object_Path (Data.Library_Dir, In_Tree); Add_To_Object_Path
(Data.Library_ALI_Dir, In_Tree);
else else
Add_To_Object_Path Add_To_Object_Path
(Data.Object_Directory, In_Tree); (Data.Object_Directory, In_Tree);
...@@ -2138,13 +2139,18 @@ package body Prj.Env is ...@@ -2138,13 +2139,18 @@ package body Prj.Env is
-- For a non-library project, add the object -- For a non-library project, add the object
-- directory, if it is not a virtual project, and -- directory, if it is not a virtual project, and
-- if there are Ada sources. If there are no Ada -- if there are Ada sources or if the project is an
-- sources, adding the object directory could -- extending project. if There Are No Ada sources,
-- disrupt the order of the object dirs in the path. -- adding the object directory could disrupt
-- the order of the object dirs in the path.
elsif not Data.Virtual elsif not Data.Virtual
and then In_Tree.Projects.Table and then (In_Tree.Projects.Table
(Project).Ada_Sources_Present (Project).Ada_Sources_Present
or else
(Data.Extends /= No_Project
and then
Data.Object_Directory /= No_Name))
then then
Add_To_Object_Path Add_To_Object_Path
(Data.Object_Directory, In_Tree); (Data.Object_Directory, In_Tree);
...@@ -2230,7 +2236,7 @@ package body Prj.Env is ...@@ -2230,7 +2236,7 @@ package body Prj.Env is
Add (Project); Add (Project);
end if; end if;
-- Write and close any file that has been created. -- Write and close any file that has been created
if Source_FD /= Invalid_FD then if Source_FD /= Invalid_FD then
for Index in Source_Path_Table.First .. for Index in Source_Path_Table.First ..
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -102,6 +102,8 @@ package body Prj is ...@@ -102,6 +102,8 @@ package body Prj is
Display_Library_Dir => No_Name, Display_Library_Dir => No_Name,
Library_Src_Dir => No_Name, Library_Src_Dir => No_Name,
Display_Library_Src_Dir => No_Name, Display_Library_Src_Dir => No_Name,
Library_ALI_Dir => No_Name,
Display_Library_ALI_Dir => No_Name,
Library_Name => No_Name, Library_Name => No_Name,
Library_Kind => Static, Library_Kind => Static,
Lib_Internal_Name => No_Name, Lib_Internal_Name => No_Name,
...@@ -121,6 +123,7 @@ package body Prj is ...@@ -121,6 +123,7 @@ package body Prj is
Known_Order_Of_Source_Dirs => True, Known_Order_Of_Source_Dirs => True,
Object_Directory => No_Name, Object_Directory => No_Name,
Display_Object_Dir => No_Name, Display_Object_Dir => No_Name,
Library_TS => Empty_Time_Stamp,
Exec_Directory => No_Name, Exec_Directory => No_Name,
Display_Exec_Dir => No_Name, Display_Exec_Dir => No_Name,
Extends => No_Project, Extends => No_Project,
...@@ -132,6 +135,7 @@ package body Prj is ...@@ -132,6 +135,7 @@ package body Prj is
Default_Linker_Path => No_Name, Default_Linker_Path => No_Name,
Decl => No_Declarations, Decl => No_Declarations,
Imported_Projects => Empty_Project_List, Imported_Projects => Empty_Project_List,
All_Imported_Projects => Empty_Project_List,
Ada_Include_Path => null, Ada_Include_Path => null,
Ada_Objects_Path => null, Ada_Objects_Path => null,
Include_Path_File => No_Name, Include_Path_File => No_Name,
...@@ -485,7 +489,7 @@ package body Prj is ...@@ -485,7 +489,7 @@ package body Prj is
end if; end if;
end loop; end loop;
-- If none can be found, create a new one. -- If none can be found, create a new one
if not Found then if not Found then
Element := Element :=
...@@ -526,7 +530,7 @@ package body Prj is ...@@ -526,7 +530,7 @@ package body Prj is
end if; end if;
end loop; end loop;
-- If none can be found, create a new one. -- If none can be found, create a new one
if not Found then if not Found then
Element := Element :=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment