with MLib.Tgt;
with Opt; use Opt;
with Output; use Output;
+with Prj.Env;
with Prj.Err;
with Prj.Part;
with Prj.PP;
Count : Natural;
Result : Argument_List_Access;
+ Check_Default : Boolean;
+
begin
Prj_Iter := Project_Tree.Projects;
while Prj_Iter /= null loop
or else Variable.Default
then
-- Languages is not declared. If it is not an extending
- -- project, check for Default_Language
+ -- project, or if it extends a project with no Languages,
+ -- check for Default_Language.
+
+ Check_Default := Prj_Iter.Project.Extends = No_Project;
+
+ if not Check_Default then
+ Variable :=
+ Value_Of
+ (Name_Languages,
+ Prj_Iter.Project.Extends.Decl.Attributes,
+ Project_Tree);
+ Check_Default :=
+ Variable /= Nil_Variable_Value
+ and then Variable.Values = Nil_String;
+ end if;
- if Prj_Iter.Project.Extends = No_Project then
+ if Check_Default then
Variable :=
Value_Of
(Name_Default_Language,
Language_Htable.Set (Lang, Lang);
else
- -- If no language is declared, default to Ada
+ -- If no default language is declared, default to Ada
Language_Htable.Set (Name_Ada, Name_Ada);
end if;
Args : Argument_List (1 .. 5);
Arg_Last : Positive;
+ Obj_Dir_Exists : Boolean := True;
+
begin
-- Check if the object directory exists. If Setup_Projects is True
-- (-p) and directory does not exist, attempt to create it.
Prj.Err.Error_Msg
(Flags,
"?object directory " & Obj_Dir & " does not exist");
+ Obj_Dir_Exists := False;
when Silent =>
null;
end case;
-- If no config file was specified, set the auto.cgpr one
if Config_File_Name = "" then
- Args (3) := new String'
- (Obj_Dir & Directory_Separator & Auto_Cgpr);
+ if Obj_Dir_Exists then
+ Args (3) :=
+ new String'(Obj_Dir & Directory_Separator & Auto_Cgpr);
+
+ else
+ declare
+ Path_FD : File_Descriptor;
+ Path_Name : Path_Name_Type;
+
+ begin
+ Prj.Env.Create_Temp_File
+ (In_Tree => Project_Tree,
+ Path_FD => Path_FD,
+ Path_Name => Path_Name,
+ File_Use => "configuration file");
+
+ if Path_FD /= Invalid_FD then
+ Args (3) := new String'(Get_Name_String (Path_Name));
+ GNAT.OS_Lib.Close (Path_FD);
+
+ else
+ -- We'll have an error message later on
+
+ Args (3) :=
+ new String'
+ (Obj_Dir & Directory_Separator & Auto_Cgpr);
+ end if;
+ end;
+ end if;
else
Args (3) := new String'(Config_File_Name);
end if;
Index : String := "";
Pkg : Project_Node_Id := Empty_Node)
is
- Attr : Project_Node_Id;
- Val : Name_Id := No_Name;
+ Attr : Project_Node_Id;
+ pragma Unreferenced (Attr);
+
+ Expr : Name_Id := No_Name;
+ Val : Name_Id := No_Name;
Parent : Project_Node_Id := Config_File;
begin
if Index /= "" then
Parent := Pkg;
end if;
+ Name_Len := Value'Length;
+ Name_Buffer (1 .. Name_Len) := Value;
+ Expr := Name_Find;
+
Attr := Create_Attribute
(Tree => Project_Tree,
Prj_Or_Pkg => Parent,
Name => Name,
Index_Name => Val,
- Kind => Prj.Single);
-
- Name_Len := Value'Length;
- Name_Buffer (1 .. Name_Len) := Value;
- Val := Name_Find;
-
- Set_Expression_Of
- (Attr, Project_Tree,
- Enclose_In_Expression
- (Create_Literal_String (Val, Project_Tree),
- Project_Tree));
+ Kind => Prj.Single,
+ Value => Create_Literal_String (Expr, Project_Tree));
end Create_Attribute;
+ -- Local variables
+
Name : Name_Id;
Naming : Project_Node_Id;