From ad9116a3324e9499de08d8f26a40ead37de3351b Mon Sep 17 00:00:00 2001
From: Julien Girard <julien.girard2@cea.fr>
Date: Fri, 21 Jul 2023 18:41:01 +0200
Subject: [PATCH] [opam] Simplified opam packaging.

Just provide a single opam package for CAISAR.
---
 Makefile                 |  4 +--
 caisar-ir.opam           | 38 ---------------------
 caisar-nnet.opam         | 36 --------------------
 caisar-onnx.opam         | 39 ---------------------
 caisar-ovo.opam          | 36 --------------------
 caisar-xgboost.opam      | 39 ---------------------
 caisar.opam              | 15 ++++-----
 dune-project             | 73 ++++------------------------------------
 lib/ir/dune              |  2 +-
 lib/nnet/dune            |  2 +-
 lib/onnx/dune            |  4 +--
 lib/ovo/dune             |  2 +-
 lib/xgboost/bin/dune     |  2 +-
 lib/xgboost/dune         |  2 +-
 lib/xgboost/example/dune |  4 +--
 src/dune                 |  2 +-
 16 files changed, 26 insertions(+), 274 deletions(-)
 delete mode 100644 caisar-ir.opam
 delete mode 100644 caisar-nnet.opam
 delete mode 100644 caisar-onnx.opam
 delete mode 100644 caisar-ovo.opam
 delete mode 100644 caisar-xgboost.opam

diff --git a/Makefile b/Makefile
index 0eb46079..2eacf944 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 all:
-	dune build --root=. @install caisar.opam caisar-nnet.opam caisar-onnx.opam caisar-ovo.opam caisar-ir.opam caisar-xgboost.opam
+	dune build --root=. @install caisar.opam
 
 all-ci:
-	dune build -j2 --root=. @install caisar.opam caisar-nnet.opam caisar-onnx.opam caisar-ovo.opam caisar-ir.opam caisar-xgboost.opam
+	dune build -j2 --root=. @install caisar.opam
 
 install:
 	dune install
diff --git a/caisar-ir.opam b/caisar-ir.opam
deleted file mode 100644
index 1fc076f2..00000000
--- a/caisar-ir.opam
+++ /dev/null
@@ -1,38 +0,0 @@
-# This file is generated by dune, edit dune-project instead
-opam-version: "2.0"
-version: "0.2"
-synopsis: "CAISAR's intermediate representation"
-maintainer: [
-  "LAISER team, Software Safety and Security Laboratory, CEA-List"
-]
-authors: ["LAISER team, Software Safety and Security Laboratory, CEA-List"]
-license: "LGPL-2.1-only"
-homepage: "https://git.frama-c.com/pub/caisar"
-doc: "https://git.frama-c.com/pub/caisar"
-bug-reports: "https://git.frama-c.com/pub/caisar/issues"
-depends: [
-  "dune" {>= "2.9"}
-  "ocaml" {>= "4.13"}
-  "base" {>= "v0.14.0"}
-  "ocamlgraph" {>= "1.8.8"}
-  "ppx_inline_test" {>= "0.12.0"}
-  "ppx_deriving" {>= "4.4.1"}
-  "odoc" {with-doc}
-]
-build: [
-  ["dune" "subst"] {dev}
-  [
-    "dune"
-    "build"
-    "-p"
-    name
-    "-j"
-    jobs
-    "--promote-install-files=false"
-    "@install"
-    "@runtest" {with-test}
-    "@doc" {with-doc}
-  ]
-  ["dune" "install" "-p" name "--create-install-files" name]
-]
-dev-repo: "git+https://git.frama-c.com/pub/caisar.git"
diff --git a/caisar-nnet.opam b/caisar-nnet.opam
deleted file mode 100644
index bdbceb34..00000000
--- a/caisar-nnet.opam
+++ /dev/null
@@ -1,36 +0,0 @@
-# This file is generated by dune, edit dune-project instead
-opam-version: "2.0"
-version: "0.2"
-synopsis: "NNet parser for CAISAR"
-maintainer: [
-  "LAISER team, Software Safety and Security Laboratory, CEA-List"
-]
-authors: ["LAISER team, Software Safety and Security Laboratory, CEA-List"]
-license: "LGPL-2.1-only"
-homepage: "https://git.frama-c.com/pub/caisar"
-doc: "https://git.frama-c.com/pub/caisar"
-bug-reports: "https://git.frama-c.com/pub/caisar/issues"
-depends: [
-  "dune" {>= "2.9"}
-  "ocaml" {>= "4.13"}
-  "base" {>= "v0.14.0"}
-  "csv" {>= "2.4"}
-  "odoc" {with-doc}
-]
-build: [
-  ["dune" "subst"] {dev}
-  [
-    "dune"
-    "build"
-    "-p"
-    name
-    "-j"
-    jobs
-    "--promote-install-files=false"
-    "@install"
-    "@runtest" {with-test}
-    "@doc" {with-doc}
-  ]
-  ["dune" "install" "-p" name "--create-install-files" name]
-]
-dev-repo: "git+https://git.frama-c.com/pub/caisar.git"
diff --git a/caisar-onnx.opam b/caisar-onnx.opam
deleted file mode 100644
index 986cbfd6..00000000
--- a/caisar-onnx.opam
+++ /dev/null
@@ -1,39 +0,0 @@
-# This file is generated by dune, edit dune-project instead
-opam-version: "2.0"
-version: "0.2"
-synopsis: "ONNX parser for CAISAR"
-maintainer: [
-  "LAISER team, Software Safety and Security Laboratory, CEA-List"
-]
-authors: ["LAISER team, Software Safety and Security Laboratory, CEA-List"]
-license: "LGPL-2.1-only"
-homepage: "https://git.frama-c.com/pub/caisar"
-doc: "https://git.frama-c.com/pub/caisar"
-bug-reports: "https://git.frama-c.com/pub/caisar/issues"
-depends: [
-  "dune" {>= "2.9"}
-  "ocaml" {>= "4.13"}
-  "base" {>= "v0.14.0"}
-  "stdio" {>= "v0.14.0"}
-  "ocaml-protoc-plugin" {>= "4.2.0"}
-  "ocplib-endian" {>= "1.0"}
-  "caisar-ir" {= version}
-  "odoc" {with-doc}
-]
-build: [
-  ["dune" "subst"] {dev}
-  [
-    "dune"
-    "build"
-    "-p"
-    name
-    "-j"
-    jobs
-    "--promote-install-files=false"
-    "@install"
-    "@runtest" {with-test}
-    "@doc" {with-doc}
-  ]
-  ["dune" "install" "-p" name "--create-install-files" name]
-]
-dev-repo: "git+https://git.frama-c.com/pub/caisar.git"
diff --git a/caisar-ovo.opam b/caisar-ovo.opam
deleted file mode 100644
index 3ed5ce41..00000000
--- a/caisar-ovo.opam
+++ /dev/null
@@ -1,36 +0,0 @@
-# This file is generated by dune, edit dune-project instead
-opam-version: "2.0"
-version: "0.2"
-synopsis: "OVO parser for CAISAR"
-maintainer: [
-  "LAISER team, Software Safety and Security Laboratory, CEA-List"
-]
-authors: ["LAISER team, Software Safety and Security Laboratory, CEA-List"]
-license: "LGPL-2.1-only"
-homepage: "https://git.frama-c.com/pub/caisar"
-doc: "https://git.frama-c.com/pub/caisar"
-bug-reports: "https://git.frama-c.com/pub/caisar/issues"
-depends: [
-  "dune" {>= "2.9"}
-  "ocaml" {>= "4.13"}
-  "base" {>= "v0.14.0"}
-  "csv" {>= "2.4"}
-  "odoc" {with-doc}
-]
-build: [
-  ["dune" "subst"] {dev}
-  [
-    "dune"
-    "build"
-    "-p"
-    name
-    "-j"
-    jobs
-    "--promote-install-files=false"
-    "@install"
-    "@runtest" {with-test}
-    "@doc" {with-doc}
-  ]
-  ["dune" "install" "-p" name "--create-install-files" name]
-]
-dev-repo: "git+https://git.frama-c.com/pub/caisar.git"
diff --git a/caisar-xgboost.opam b/caisar-xgboost.opam
deleted file mode 100644
index 5d4be334..00000000
--- a/caisar-xgboost.opam
+++ /dev/null
@@ -1,39 +0,0 @@
-# This file is generated by dune, edit dune-project instead
-opam-version: "2.0"
-version: "0.2"
-synopsis: "XGBOOST parser for CAISAR"
-maintainer: [
-  "LAISER team, Software Safety and Security Laboratory, CEA-List"
-]
-authors: ["LAISER team, Software Safety and Security Laboratory, CEA-List"]
-license: "LGPL-2.1-only"
-homepage: "https://git.frama-c.com/pub/caisar"
-doc: "https://git.frama-c.com/pub/caisar"
-bug-reports: "https://git.frama-c.com/pub/caisar/issues"
-depends: [
-  "dune" {>= "2.9"}
-  "ocaml" {>= "4.13"}
-  "base" {>= "v0.14.0"}
-  "ocamlgraph" {>= "1.8.8"}
-  "ppx_deriving" {>= "4.4.1"}
-  "ppx_deriving_yojson" {>= "3.6.1"}
-  "csv" {>= "2.4"}
-  "odoc" {with-doc}
-]
-build: [
-  ["dune" "subst"] {dev}
-  [
-    "dune"
-    "build"
-    "-p"
-    name
-    "-j"
-    jobs
-    "--promote-install-files=false"
-    "@install"
-    "@runtest" {with-test}
-    "@doc" {with-doc}
-  ]
-  ["dune" "install" "-p" name "--create-install-files" name]
-]
-dev-repo: "git+https://git.frama-c.com/pub/caisar.git"
diff --git a/caisar.opam b/caisar.opam
index 7ddfba04..98018a4e 100644
--- a/caisar.opam
+++ b/caisar.opam
@@ -12,7 +12,7 @@ homepage: "https://git.frama-c.com/pub/caisar"
 doc: "https://git.frama-c.com/pub/caisar"
 bug-reports: "https://git.frama-c.com/pub/caisar/issues"
 depends: [
-  "dune" {>= "2.9"}
+  "dune" {>= "3.8"}
   "ocaml" {>= "4.13"}
   "dune-site" {>= "2.9.0"}
   "piqi" {>= "0.7.6"}
@@ -24,20 +24,19 @@ depends: [
   "cmdliner" {>= "1.1.1"}
   "fmt" {>= "0.8.9"}
   "logs" {>= "0.7.0"}
-  "ppx_deriving" {>= "5.1"}
   "yojson" {>= "1.7.0"}
   "menhirLib" {>= "20210310"}
-  "ppx_deriving_yojson" {>= "3.6.1"}
   "csv" {>= "2.4"}
   "why3" {>= "1.6.0"}
   "re" {>= "1.10.4"}
   "fpath" {>= "0.7.3"}
   "yaml" {>= "3.1.0"}
-  "caisar-nnet" {= version}
-  "caisar-ovo" {= version}
-  "caisar-onnx" {= version}
-  "caisar-ir" {= version}
-  "caisar-xgboost" {= version}
+  "ocaml-protoc-plugin" {>= "4.2.0"}
+  "stdio" {>= "v0.14.0"}
+  "ocamlgraph" {>= "1.8.8"}
+  "ppx_deriving" {>= "5.1"}
+  "ppx_inline_test" {>= "0.12.0"}
+  "ppx_deriving_yojson" {>= "3.6.1"}
   "odoc" {with-doc}
 ]
 build: [
diff --git a/dune-project b/dune-project
index 65550953..1c4f8609 100644
--- a/dune-project
+++ b/dune-project
@@ -1,4 +1,4 @@
-(lang dune 2.9)
+(lang dune 3.8)
 (name caisar)
 (version 0.2)
 
@@ -17,64 +17,6 @@
 (homepage https://git.frama-c.com/pub/caisar)
 (documentation https://git.frama-c.com/pub/caisar)
 
-(package
-  (name caisar-nnet)
-  (synopsis "NNet parser for CAISAR")
-  (depends
-   (ocaml (>= 4.13))
-   (base (>= v0.14.0))
-   (csv (>= 2.4))
-  )
-)
-
-(package
-  (name caisar-ovo)
-  (synopsis "OVO parser for CAISAR")
-  (depends
-   (ocaml (>= 4.13))
-   (base (>= v0.14.0))
-   (csv (>= 2.4))
-  )
-)
-
-(package
-  (name caisar-onnx)
-  (synopsis "ONNX parser for CAISAR")
-  (depends
-   (ocaml (>= 4.13))
-   (base (>= v0.14.0))
-   (stdio (>= v0.14.0))
-   (ocaml-protoc-plugin (>= 4.2.0))
-   (ocplib-endian (>= 1.0))
-   (caisar-ir (= :version))
-  )
-)
-
-(package
-  (name caisar-xgboost)
-  (synopsis "XGBOOST parser for CAISAR")
-  (depends
-   (ocaml (>= 4.13))
-   (base (>= v0.14.0))
-   (ocamlgraph (>= 1.8.8))
-   (ppx_deriving (>= 4.4.1))
-   (ppx_deriving_yojson (>= 3.6.1))
-   (csv (>= 2.4))
-  )
-)
-
-(package
-  (name caisar-ir)
-  (synopsis "CAISAR's intermediate representation")
-  (depends
-   (ocaml (>= 4.13))
-   (base (>= v0.14.0))
-   (ocamlgraph (>= 1.8.8))
-   (ppx_inline_test (>= 0.12.0))
-   (ppx_deriving (>= 4.4.1))
-  )
-)
-
 (package
   (name caisar)
   (synopsis "A platform for characterizing the safety and robustness of artificial intelligence based software")
@@ -90,20 +32,19 @@
    (cmdliner (>= 1.1.1))
    (fmt (>= 0.8.9))
    (logs (>= 0.7.0))
-   (ppx_deriving (>= 5.1))
    (yojson (>= 1.7.0))
    (menhirLib (>= 20210310))
-   (ppx_deriving_yojson (>= 3.6.1))
    (csv (>= 2.4))
    (why3 (>= 1.6.0))
    (re (>= 1.10.4))
    (fpath (>= 0.7.3))
    (yaml (>= 3.1.0))
-   (caisar-nnet (= :version))
-   (caisar-ovo (= :version))
-   (caisar-onnx (= :version))
-   (caisar-ir (= :version))
-   (caisar-xgboost (= :version))
+   (ocaml-protoc-plugin (>= 4.2.0))
+   (stdio (>= v0.14.0))
+   (ocamlgraph (>= 1.8.8))
+   (ppx_deriving (>= 5.1))
+   (ppx_inline_test (>= 0.12.0))
+   (ppx_deriving_yojson (>= 3.6.1))
   )
   (sites
    (share stdlib)
diff --git a/lib/ir/dune b/lib/ir/dune
index bacd51c9..812eda8a 100644
--- a/lib/ir/dune
+++ b/lib/ir/dune
@@ -1,6 +1,6 @@
 (library
  (name ir)
- (public_name caisar-ir)
+ (public_name caisar.ir)
  (preprocess
   (pps
    ppx_inline_test
diff --git a/lib/nnet/dune b/lib/nnet/dune
index 6674a9ec..052c7e99 100644
--- a/lib/nnet/dune
+++ b/lib/nnet/dune
@@ -1,5 +1,5 @@
 (library
  (name nnet)
- (public_name caisar-nnet)
+ (public_name caisar.nnet)
  (libraries base csv)
  (synopsis "NNet parser for CAISAR"))
diff --git a/lib/onnx/dune b/lib/onnx/dune
index 9d5fdba2..88dea6fe 100644
--- a/lib/onnx/dune
+++ b/lib/onnx/dune
@@ -1,7 +1,7 @@
 (library
  (name onnx)
- (public_name caisar-onnx)
- (libraries base stdio ocaml-protoc-plugin ocplib-endian caisar-ir)
+ (public_name caisar.onnx)
+ (libraries base stdio ocaml-protoc-plugin ocplib-endian caisar.ir)
  (synopsis "ONNX parser for CAISAR"))
 
 (rule
diff --git a/lib/ovo/dune b/lib/ovo/dune
index 65525220..e54243a3 100644
--- a/lib/ovo/dune
+++ b/lib/ovo/dune
@@ -1,5 +1,5 @@
 (library
  (name ovo)
- (public_name caisar-ovo)
+ (public_name caisar.ovo)
  (libraries base csv)
  (synopsis "OVO parser for CAISAR"))
diff --git a/lib/xgboost/bin/dune b/lib/xgboost/bin/dune
index cef68131..625381cd 100644
--- a/lib/xgboost/bin/dune
+++ b/lib/xgboost/bin/dune
@@ -1,4 +1,4 @@
 (executable
  (name parse_xgboost)
- (libraries yojson caisar-xgboost csv)
+ (libraries yojson caisar.xgboost csv)
 )
diff --git a/lib/xgboost/dune b/lib/xgboost/dune
index 5fa6353d..9a07b01e 100644
--- a/lib/xgboost/dune
+++ b/lib/xgboost/dune
@@ -1,5 +1,5 @@
 (library
- (public_name caisar-xgboost)
+ (public_name caisar.xgboost)
  (name caisar_xgboost)
  (preprocess
   (pps ppx_deriving.show ppx_deriving_yojson))
diff --git a/lib/xgboost/example/dune b/lib/xgboost/example/dune
index 7c048738..32b6e2dd 100644
--- a/lib/xgboost/example/dune
+++ b/lib/xgboost/example/dune
@@ -1,9 +1,9 @@
 (cram
  (deps model-0.json agaricus.test.svm ../bin/parse_xgboost.exe)
  (applies_to logistic)
- (package caisar-xgboost))
+ (package caisar))
 
 (cram
  (deps california.json california.csv ../bin/parse_xgboost.exe)
  (applies_to california)
- (package caisar-xgboost))
+ (package caisar))
diff --git a/src/dune b/src/dune
index 38b0ce7b..013aad1a 100644
--- a/src/dune
+++ b/src/dune
@@ -24,7 +24,7 @@
   yaml.unix
   fpath
   zarith
-  caisar-xgboost)
+  caisar.xgboost)
  (preprocess
   (pps
    ppx_deriving_yojson
-- 
GitLab