diff mbox

[Ada] Always get an existing declared object/exec directory

Message ID 20111212114947.GA4409@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Dec. 12, 2011, 11:49 a.m. UTC
If an object and/or exec directory exists and is declared in a project
with no source, it was not taken into account. This patch correct this.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-12  Vincent Celier  <celier@adacore.com>

	* prj-nmsc.adb (Get_Directories): For a non extending project,
	always get a declared object and/or exec directory if it already
	exists, even when there are no sources, but do not create them.
diff mbox

Patch

Index: prj-nmsc.adb
===================================================================
--- prj-nmsc.adb	(revision 182223)
+++ prj-nmsc.adb	(working copy)
@@ -5284,8 +5284,24 @@ 
                "Object_Dir cannot be empty",
                Object_Dir.Location, Project);
 
-         elsif not No_Sources then
+         elsif Setup_Projects and then
+               No_Sources and then
+               Project.Extends = No_Project
+         then
+            --  Do not create an object directory for a non extending project
+            --  with no sources.
 
+            Locate_Directory
+              (Project,
+               File_Name_Type (Object_Dir.Value),
+               Path             => Project.Object_Directory,
+               Dir_Exists       => Dir_Exists,
+               Data             => Data,
+               Location         => Object_Dir.Location,
+               Must_Exist       => False,
+               Externally_Built => Project.Externally_Built);
+
+         else
             --  We check that the specified object directory does exist.
             --  However, even when it doesn't exist, we set it to a default
             --  value. This is for the benefit of tools that recover from
@@ -5355,8 +5371,23 @@ 
                "Exec_Dir cannot be empty",
                Exec_Dir.Location, Project);
 
-         elsif not No_Sources then
+         elsif Setup_Projects and then
+               No_Sources and then
+               Project.Extends = No_Project
+         then
+            --  Do not create an exec directory for a non extending project
+            --  with no sources.
 
+            Locate_Directory
+              (Project,
+               File_Name_Type (Exec_Dir.Value),
+               Path             => Project.Exec_Directory,
+               Dir_Exists       => Dir_Exists,
+               Data             => Data,
+               Location         => Exec_Dir.Location,
+               Externally_Built => Project.Externally_Built);
+
+         else
             --  We check that the specified exec directory does exist
 
             Locate_Directory