Commit 6c9a4567 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add checking function for ASN.1 file presence

parent 690de90d
...@@ -151,6 +151,7 @@ package body TASTE.AADL_Parser is ...@@ -151,6 +151,7 @@ package body TASTE.AADL_Parser is
if Result.Configuration.Data_View.all'Length > 0 then if Result.Configuration.Data_View.all'Length > 0 then
begin begin
Result.Data_View := Parse_Data_View (Dataview_root); Result.Data_View := Parse_Data_View (Dataview_root);
Result.Data_View.Check_Files;
exception exception
when Constraint_Error => when Constraint_Error =>
raise Data_View_Error with "Update your data view!"; raise Data_View_Error with "Update your data view!";
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
-- Interface View parser -- Interface View parser
with Locations, with Ada.Directories,
Locations,
Ocarina.Instances.Queries, Ocarina.Instances.Queries,
Ocarina.Analyzer, Ocarina.Analyzer,
Ocarina.Backends.Properties, Ocarina.Backends.Properties,
...@@ -119,6 +120,25 @@ package body TASTE.Data_View is ...@@ -119,6 +120,25 @@ package body TASTE.Data_View is
return Data_AST : constant Taste_Data_View := (ASN1_Files => Files); return Data_AST : constant Taste_Data_View := (ASN1_Files => Files);
end Parse_Data_View; end Parse_Data_View;
-- Function checking the actual file presence of the ASN.1 models that
-- are referenced in the input file DataView.aadl. Raise an exception
-- if any file is missing.
procedure Check_Files (DV : Taste_Data_View) is
Success : Boolean := True;
begin
for Each of DV.ASN1_Files loop
if not Ada.Directories.Exists (To_String (Each.Path)) then
Put_Error ("File not found: " & To_String (Each.Path));
Success := False;
end if;
end loop;
if not Success then
raise Data_View_Error with
"ASN.1 files missing (wrong path in DataView.aadl). "
& "Run taste-update-data-view [list of ASN.1 files]";
end if;
end Check_Files;
procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type) is procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type) is
begin begin
for Each of DV.ASN1_Files loop for Each of DV.ASN1_Files loop
......
...@@ -58,7 +58,9 @@ package TASTE.Data_View is ...@@ -58,7 +58,9 @@ package TASTE.Data_View is
end record; end record;
function Parse_Data_View (Dataview_Root : Node_Id) return Taste_Data_View function Parse_Data_View (Dataview_Root : Node_Id) return Taste_Data_View
with Pre => Dataview_Root /= No_Node; with Pre => Dataview_Root /= No_Node;
procedure Check_Files (DV : Taste_Data_View);
procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type); procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type);
......
package TASTE.Parser_Version is package TASTE.Parser_Version is
Parser_Release : constant String := Parser_Release : constant String :=
"c7a88bb ; Commit Date: Mon Mar 12 21:34:55 2018 "; "690de90 ; Commit Date: Mon Mar 12 21:50:07 2018 ";
Ocarina_Version : constant String := Ocarina_Version : constant String :=
"Ocarina 2017.x (Working Copy from rc50d394)"; "Ocarina 2017.x (Working Copy from r61c0f39)";
end TASTE.Parser_Version; end TASTE.Parser_Version;
\ No newline at end of file
...@@ -2,11 +2,11 @@ AADL_PARSER=../../aadl_parser ...@@ -2,11 +2,11 @@ AADL_PARSER=../../aadl_parser
all: test-parse all: test-parse
test-parse: test-parse: clean
$(AADL_PARSER) -o output -i InterfaceView.aadl -d DataView.aadl ../common/TASTE_IV_Properties.aadl $(AADL_PARSER) -o output -i InterfaceView.aadl -d DataView.aadl ../common/TASTE_IV_Properties.aadl
clean: clean:
rm -rf obj $(exec) *~ rm -rf output
.PHONY: clean test-parse .PHONY: clean test-parse
Supports Markdown
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