From 596e38e89b437ef003aacc6a9ec1a95d7ac69ce2 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Tue, 11 Dec 2018 19:42:24 +0100
Subject: [PATCH] A version for MdR

---
 src/plugins/markdown-report/.gitignore          | 10 ++++++++++
 src/plugins/markdown-report/Makefile            | 13 ++++++++++++-
 src/plugins/markdown-report/Report_markdown.mli |  3 ---
 src/plugins/markdown-report/mdr_params.ml       |  2 --
 src/plugins/markdown-report/mdr_params.mli      |  3 ---
 5 files changed, 22 insertions(+), 9 deletions(-)
 create mode 100644 src/plugins/markdown-report/.gitignore

diff --git a/src/plugins/markdown-report/.gitignore b/src/plugins/markdown-report/.gitignore
new file mode 100644
index 00000000000..b43cf1317bc
--- /dev/null
+++ b/src/plugins/markdown-report/.gitignore
@@ -0,0 +1,10 @@
+*.cm*
+META.*
+*.o
+top/
+*.check_mli_exists
+.Makefile.plugin.generated
+.depend
+.merlin
+*~
+/mdr_version.ml
diff --git a/src/plugins/markdown-report/Makefile b/src/plugins/markdown-report/Makefile
index cd82c36f341..217b85e5d94 100644
--- a/src/plugins/markdown-report/Makefile
+++ b/src/plugins/markdown-report/Makefile
@@ -2,15 +2,26 @@ ifndef FRAMAC_SHARE
   FRAMAC_SHARE:=$(shell frama-c -print-share-path)
 endif
 
+Report_markdown_VERSION:=0.1~alpha
+
 PLUGIN_NAME:=Report_markdown
+PLUGIN_GENERATED:=mdr_version.ml
 PLUGIN_CMO:=\
-  markdown sarif mdr_params parse_remarks eva_coverage sarif_gen md_gen
+  markdown sarif mdr_version mdr_params parse_remarks \
+  eva_coverage sarif_gen md_gen
 PLUGIN_NO_TEST:=true
 PLUGIN_REQUIRES:=ppx_deriving ppx_deriving_yojson yojson
+PLUGIN_VERSION:=$(Report_markdown_VERSION)
 PLUGIN_DISTRIB_EXTERNAL:=share/acsl.xml
 
 include $(FRAMAC_SHARE)/Makefile.dynamic
 
+$(Report_markdown_DIR)/mdr_version.ml: $(Report_markdown_DIR)/Makefile
+	$(PRINT_MAKING) $@
+	$(RM) $@
+	$(ECHO) "let version = \"$(Report_markdown_VERSION)\"" > $@
+	$(CHMOD_RO) $@
+
 $(Report_markdown_DIR)/Report_markdown.mli: \
   $(Report_markdown_DIR)/mdr_params.mli \
   $(Report_markdown_DIR)/markdown.mli \
diff --git a/src/plugins/markdown-report/Report_markdown.mli b/src/plugins/markdown-report/Report_markdown.mli
index 0c632a33971..f76e4200aa3 100644
--- a/src/plugins/markdown-report/Report_markdown.mli
+++ b/src/plugins/markdown-report/Report_markdown.mli
@@ -21,9 +21,6 @@ module Title: Parameter_sig.String
 
 (** Value of [-mdr-stubs]. *)
 module Stubs: Parameter_sig.String_list
-
-(** version of mdr plugin itself *)
-val version: string
 end
 module Markdown: sig
 type align = Left | Center | Right
diff --git a/src/plugins/markdown-report/mdr_params.ml b/src/plugins/markdown-report/mdr_params.ml
index e7de9d876c3..be8ef4d1c14 100644
--- a/src/plugins/markdown-report/mdr_params.ml
+++ b/src/plugins/markdown-report/mdr_params.ml
@@ -70,5 +70,3 @@ module Stubs = String_list(
     let arg_name = "f1,...,fn"
     let help = "list of C files containing stub functions"
   end)
-
-let version = "0.1~alpha"
diff --git a/src/plugins/markdown-report/mdr_params.mli b/src/plugins/markdown-report/mdr_params.mli
index e6490396557..4affc377045 100644
--- a/src/plugins/markdown-report/mdr_params.mli
+++ b/src/plugins/markdown-report/mdr_params.mli
@@ -20,6 +20,3 @@ module Title: Parameter_sig.String
 
 (** Value of [-mdr-stubs]. *)
 module Stubs: Parameter_sig.String_list
-
-(** version of mdr plugin itself *)
-val version: string
-- 
GitLab