mirror of https://github.com/briot/gnatbdd
Add support for specifying the name of the driver for gnatbdd
This commit is contained in:
parent
de179bcbdd
commit
8e1fee43a9
|
@ -481,6 +481,7 @@ package body Gnatbdd.Codegen is
|
||||||
Extension : Filesystem_String := ".ads";
|
Extension : Filesystem_String := ".ads";
|
||||||
Object_Dir : GNATCOLL.VFS.Virtual_File;
|
Object_Dir : GNATCOLL.VFS.Virtual_File;
|
||||||
Tree : GNATCOLL.Projects.Project_Tree;
|
Tree : GNATCOLL.Projects.Project_Tree;
|
||||||
|
Driver : String;
|
||||||
Extra_Steps_Dirs : GNATCOLL.VFS.File_Array_Access)
|
Extra_Steps_Dirs : GNATCOLL.VFS.File_Array_Access)
|
||||||
is
|
is
|
||||||
Files : File_Array_Access;
|
Files : File_Array_Access;
|
||||||
|
@ -520,7 +521,8 @@ package body Gnatbdd.Codegen is
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
Create (F, Out_File,
|
Create (F, Out_File,
|
||||||
Create_From_Dir (Object_Dir, "driver.adb").Display_Full_Name);
|
Create_From_Dir
|
||||||
|
(Object_Dir, +Driver & ".adb").Display_Full_Name);
|
||||||
Put_Line (F, "-- Automatically generated");
|
Put_Line (F, "-- Automatically generated");
|
||||||
Put_Line (F, "with BDD; use BDD;");
|
Put_Line (F, "with BDD; use BDD;");
|
||||||
Put_Line (F, "with BDD.Main; use BDD.Main;");
|
Put_Line (F, "with BDD.Main; use BDD.Main;");
|
||||||
|
@ -528,7 +530,7 @@ package body Gnatbdd.Codegen is
|
||||||
Put_Line (F, "with BDD.Runner; use BDD.Runner;");
|
Put_Line (F, "with BDD.Runner; use BDD.Runner;");
|
||||||
Put_Line (F, "with GNAT.Regpat; use GNAT.Regpat;");
|
Put_Line (F, "with GNAT.Regpat; use GNAT.Regpat;");
|
||||||
Put_Line (F, To_String (Data.Withs));
|
Put_Line (F, To_String (Data.Withs));
|
||||||
Put_Line (F, "procedure Driver is");
|
Put_Line (F, "procedure " & Driver & " is");
|
||||||
New_Line (F);
|
New_Line (F);
|
||||||
Put_Line (F, To_String (Data.Regexps));
|
Put_Line (F, To_String (Data.Regexps));
|
||||||
Put_Line (F, " procedure Run_Steps");
|
Put_Line (F, " procedure Run_Steps");
|
||||||
|
@ -559,18 +561,19 @@ package body Gnatbdd.Codegen is
|
||||||
Put_Line
|
Put_Line
|
||||||
(F, " Runner.Add_Step_Runner (Run_Steps'Unrestricted_Access);");
|
(F, " Runner.Add_Step_Runner (Run_Steps'Unrestricted_Access);");
|
||||||
Put_Line (F, " BDD.Main.Main (Runner);");
|
Put_Line (F, " BDD.Main.Main (Runner);");
|
||||||
Put_Line (F, "end Driver;");
|
Put_Line (F, "end " & Driver & ";");
|
||||||
Close (F);
|
Close (F);
|
||||||
|
|
||||||
Create (F, Out_File,
|
Create (F, Out_File,
|
||||||
Create_From_Dir (Object_Dir, "driver.gpr").Display_Full_Name);
|
Create_From_Dir
|
||||||
|
(Object_Dir, +Driver & ".gpr").Display_Full_Name);
|
||||||
Put_Line (F, "with ""gnatcoll"";");
|
Put_Line (F, "with ""gnatcoll"";");
|
||||||
Put_Line (F, "with ""gnatbdd"";");
|
Put_Line (F, "with ""gnatbdd"";");
|
||||||
Put_Line (F, "with """
|
Put_Line (F, "with """
|
||||||
& Tree.Root_Project.Project_Path.Display_Full_Name
|
& Tree.Root_Project.Project_Path.Display_Full_Name
|
||||||
& """;");
|
& """;");
|
||||||
Put_Line (F, "project Driver is");
|
Put_Line (F, "project " & Driver & " is");
|
||||||
Put_Line (F, " for Main use (""driver.adb"");");
|
Put_Line (F, " for Main use (""" & Driver & ".adb"");");
|
||||||
Put (F, " for Source_Dirs use ("".""");
|
Put (F, " for Source_Dirs use ("".""");
|
||||||
|
|
||||||
if Extra_Steps_Dirs /= null then
|
if Extra_Steps_Dirs /= null then
|
||||||
|
@ -589,7 +592,7 @@ package body Gnatbdd.Codegen is
|
||||||
Put_Line (F, " package Compiler is");
|
Put_Line (F, " package Compiler is");
|
||||||
Put_Line (F, " for Switches (""Ada"") use (""-g"");");
|
Put_Line (F, " for Switches (""Ada"") use (""-g"");");
|
||||||
Put_Line (F, " end Compiler;");
|
Put_Line (F, " end Compiler;");
|
||||||
Put_Line (F, "end Driver;");
|
Put_Line (F, "end " & Driver & ";");
|
||||||
Close (F);
|
Close (F);
|
||||||
end Discover_Steps;
|
end Discover_Steps;
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ package Gnatbdd.Codegen is
|
||||||
Extension : Filesystem_String := ".ads";
|
Extension : Filesystem_String := ".ads";
|
||||||
Object_Dir : GNATCOLL.VFS.Virtual_File;
|
Object_Dir : GNATCOLL.VFS.Virtual_File;
|
||||||
Tree : GNATCOLL.Projects.Project_Tree;
|
Tree : GNATCOLL.Projects.Project_Tree;
|
||||||
|
Driver : String;
|
||||||
Extra_Steps_Dirs : GNATCOLL.VFS.File_Array_Access);
|
Extra_Steps_Dirs : GNATCOLL.VFS.File_Array_Access);
|
||||||
-- Parse all specs in the project's source directories or in
|
-- Parse all specs in the project's source directories or in
|
||||||
-- Extra_Steps_Dirs, to find the definition of steps.
|
-- Extra_Steps_Dirs, to find the definition of steps.
|
||||||
|
|
|
@ -79,6 +79,7 @@ begin
|
||||||
Extension => +Ads_Extension,
|
Extension => +Ads_Extension,
|
||||||
Object_Dir => Tree.Root_Project.Object_Dir,
|
Object_Dir => Tree.Root_Project.Object_Dir,
|
||||||
Tree => Tree,
|
Tree => Tree,
|
||||||
|
Driver => Setup.Driver.all,
|
||||||
Extra_Steps_Dirs => Setup.Steps_Dirs);
|
Extra_Steps_Dirs => Setup.Steps_Dirs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,12 @@ package body Gnatbdd.Support is
|
||||||
Long_Switch => "--steps=",
|
Long_Switch => "--steps=",
|
||||||
Argument => "DIR",
|
Argument => "DIR",
|
||||||
Help => "Specify a directory to search for step definitions");
|
Help => "Specify a directory to search for step definitions");
|
||||||
|
|
||||||
|
Define_Switch
|
||||||
|
(Config,
|
||||||
|
Long_Switch => "--driver=",
|
||||||
|
Argument => "NAME",
|
||||||
|
Help => "Name of the generated driver");
|
||||||
end Setup_Command_Line_Switches;
|
end Setup_Command_Line_Switches;
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
|
@ -105,6 +111,10 @@ package body Gnatbdd.Support is
|
||||||
Error ("Project file not found");
|
Error ("Project file not found");
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
elsif Switch = "--driver" then
|
||||||
|
Free (Result.Driver);
|
||||||
|
Result.Driver := new String'(Parameter);
|
||||||
end if;
|
end if;
|
||||||
end On_Switch;
|
end On_Switch;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ package Gnatbdd.Support is
|
||||||
type Configuration is record
|
type Configuration is record
|
||||||
Project_Name : GNATCOLL.VFS.Virtual_File;
|
Project_Name : GNATCOLL.VFS.Virtual_File;
|
||||||
Steps_Dirs : GNATCOLL.VFS.File_Array_Access;
|
Steps_Dirs : GNATCOLL.VFS.File_Array_Access;
|
||||||
|
Driver : GNAT.Strings.String_Access := new String'("driver");
|
||||||
end record;
|
end record;
|
||||||
-- Various configurations from the command line
|
-- Various configurations from the command line
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue