Commit cc55f9be by Vincent Celier Committed by Arnaud Charlet

prj-conf.adb (Get_Or_Create_Configuration_File): Do not attempt to find a…

prj-conf.adb (Get_Or_Create_Configuration_File): Do not attempt to find a configuration project file when...

2014-01-23  Vincent Celier  <celier@adacore.com>

	* prj-conf.adb (Get_Or_Create_Configuration_File): Do not attempt
	to find a configuration project file when Config_File_Name is
	No_Configuration_File.
	* prj-conf.ads (No_Configuration_File): New constant String.
	* prj-pars.adb (Parse): Call Get_Or_Create_Configuration_File
	with Config_File_Name set to No_Configuration_File, so that
	no existing configuration project file will be used, and the
	configuration project will be only created in memory when
	Add_Default_GNAT_Naming_Scheme is called.
	* projects.texi: Minor reformatting.

From-SVN: r206985
parent 225a0c5c
2014-01-23 Vincent Celier <celier@adacore.com> 2014-01-23 Vincent Celier <celier@adacore.com>
* prj-conf.adb (Get_Or_Create_Configuration_File): Do not attempt
to find a configuration project file when Config_File_Name is
No_Configuration_File.
* prj-conf.ads (No_Configuration_File): New constant String.
* prj-pars.adb (Parse): Call Get_Or_Create_Configuration_File
with Config_File_Name set to No_Configuration_File, so that
no existing configuration project file will be used, and the
configuration project will be only created in memory when
Add_Default_GNAT_Naming_Scheme is called.
* projects.texi: Minor reformatting.
2014-01-23 Vincent Celier <celier@adacore.com>
* prj-conf.adb (Get_Or_Create_Configuration_File): Never parse * prj-conf.adb (Get_Or_Create_Configuration_File): Never parse
a config project file if On_Load_Config is not null. a config project file if On_Load_Config is not null.
* prj-pars.adb: Minor comment changes. * prj-pars.adb: Minor comment changes.
......
...@@ -1372,19 +1372,27 @@ package body Prj.Conf is ...@@ -1372,19 +1372,27 @@ package body Prj.Conf is
Get_Project_Target; Get_Project_Target;
Check_Builder_Switches; Check_Builder_Switches;
if Conf_File_Name'Length > 0 then -- Do not attempt to find a configuration project file when
Config_File_Path := Locate_Config_File (Conf_File_Name.all); -- Config_File_Name is No_Configuration_File.
if Config_File_Name = No_Configuration_File then
Config_File_Path := null;
else else
Config_File_Path := Locate_Config_File (Default_File_Name); if Conf_File_Name'Length > 0 then
end if; Config_File_Path := Locate_Config_File (Conf_File_Name.all);
else
Config_File_Path := Locate_Config_File (Default_File_Name);
end if;
if Config_File_Path = null then if Config_File_Path = null then
if not Allow_Automatic_Generation if not Allow_Automatic_Generation
and then Conf_File_Name'Length > 0 and then Conf_File_Name'Length > 0
then then
Raise_Invalid_Config Raise_Invalid_Config
("could not locate main configuration project " ("could not locate main configuration project "
& Conf_File_Name.all); & Conf_File_Name.all);
end if;
end if; end if;
end if; end if;
...@@ -1415,22 +1423,18 @@ package body Prj.Conf is ...@@ -1415,22 +1423,18 @@ package body Prj.Conf is
and then On_Load_Config = null and then On_Load_Config = null
then then
Write_Line Write_Line
("warning: --RTS is taken into account only in auto-configuration"); ("warning: " &
"--RTS is taken into account only in auto-configuration");
end if; end if;
-- Parse the configuration file -- Parse the configuration file
if Verbose_Mode if Verbose_Mode and then Config_File_Path /= null then
and then Config_File_Path /= null
and then On_Load_Config = null
then
Write_Str ("Checking configuration "); Write_Str ("Checking configuration ");
Write_Line (Config_File_Path.all); Write_Line (Config_File_Path.all);
end if; end if;
-- Add comment for On_Load_Config test ??? if Config_File_Path /= null then
if Config_File_Path /= null and then On_Load_Config = null then
Prj.Part.Parse Prj.Part.Parse
(In_Tree => Project_Node_Tree, (In_Tree => Project_Node_Tree,
Project => Config_Project_Node, Project => Config_Project_Node,
......
...@@ -40,6 +40,12 @@ package Prj.Conf is ...@@ -40,6 +40,12 @@ package Prj.Conf is
-- is set to Empty_Node when this procedure is called. You can then decide -- is set to Empty_Node when this procedure is called. You can then decide
-- to create a new config file if you need. -- to create a new config file if you need.
No_Configuration_File : constant String := "/";
-- When specified as a parameter Config_File_Name in the procedures below,
-- no existing configuration project file is parsed. This is used by
-- gnatmake, gnatclean and the GNAT driver to avoid parsing an existing
-- default configuration project file.
procedure Parse_Project_And_Apply_Config procedure Parse_Project_And_Apply_Config
(Main_Project : out Prj.Project_Id; (Main_Project : out Prj.Project_Id;
User_Project_Node : out Prj.Tree.Project_Node_Id; User_Project_Node : out Prj.Tree.Project_Node_Id;
...@@ -68,6 +74,10 @@ package Prj.Conf is ...@@ -68,6 +74,10 @@ package Prj.Conf is
-- happened while parsing the project itself (i.e. creating the tree), -- happened while parsing the project itself (i.e. creating the tree),
-- User_Project_Node is also set to Empty_Node. -- User_Project_Node is also set to Empty_Node.
-- --
-- If Config_File_Name is No_Configuration_File, then no configuration
-- project file is parsed. Normally, in this case On_Load_Config is not
-- null, and it is used to create a configuration project file in memory.
--
-- Autoconf_Specified indicates whether the user has specified --autoconf. -- Autoconf_Specified indicates whether the user has specified --autoconf.
-- If this is the case, the config file might be (re)generated, as -- If this is the case, the config file might be (re)generated, as
-- appropriate, to match languages and target if the one specified doesn't -- appropriate, to match languages and target if the one specified doesn't
......
...@@ -86,7 +86,7 @@ package body Prj.Pars is ...@@ -86,7 +86,7 @@ package body Prj.Pars is
Process_Project_And_Apply_Config Process_Project_And_Apply_Config
(Main_Project => The_Project, (Main_Project => The_Project,
User_Project_Node => Project_Node, User_Project_Node => Project_Node,
Config_File_Name => "", Config_File_Name => No_Configuration_File,
Autoconf_Specified => False, Autoconf_Specified => False,
Project_Tree => In_Tree, Project_Tree => In_Tree,
Project_Node_Tree => Project_Node_Tree, Project_Node_Tree => Project_Node_Tree,
......
...@@ -4384,11 +4384,11 @@ Index is a language name. Indicates the kind of the language, either file based ...@@ -4384,11 +4384,11 @@ Index is a language name. Indicates the kind of the language, either file based
or unit based. Only authorized case-insensitive values are "unit_based" and or unit based. Only authorized case-insensitive values are "unit_based" and
"file_based" (the default). "file_based" (the default).
@item @b{Dependency_Kind}: : single, indexed, case-insensitive index @item @b{Dependency_Kind}: single, indexed, case-insensitive index
Index is a language name. Indicates how the dependencies are handled for the Index is a language name. Indicates how the dependencies are handled for the
language. Only authorized case-insensitive values are "makefile", "ali_file", language. Only authorized case-insensitive values are "makefile", "ali_file",
"ali_closure" or "none" (the default. "ali_closure" or "none" (the default).
@item @b{Required_Switches}: list, indexed, case-insensitive index @item @b{Required_Switches}: list, indexed, case-insensitive index
......
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