Skip to content

Commit

Permalink
Extract configuration to goblint_config dune library
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Dec 6, 2023
1 parent 1ac6baf commit 54d7fdf
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
run: npm install -g ajv-cli

- name: Migrate schema # https://github.com/ajv-validator/ajv-cli/issues/199
run: ajv migrate -s src/common/util/options.schema.json
run: ajv migrate -s src/config/options.schema.json

- name: Validate conf
run: ajv validate -s src/common/util/options.schema.json -d "conf/**/*.json"
run: ajv validate -s src/config/options.schema.json -d "conf/**/*.json"

- name: Validate incremental tests
run: ajv validate -s src/common/util/options.schema.json -d "tests/incremental/*/*.json"
run: ajv validate -s src/config/options.schema.json -d "tests/incremental/*/*.json"
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ build:
- pip install json-schema-for-humans
post_build:
- mkdir _readthedocs/html/jsfh/
- generate-schema-doc --config-file jsfh.yml src/common/util/options.schema.json _readthedocs/html/jsfh/
- generate-schema-doc --config-file jsfh.yml src/config/options.schema.json _readthedocs/html/jsfh/
2 changes: 1 addition & 1 deletion docs/user-guide/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In `.vscode/settings.json` add the following:
"/conf/*.json",
"/tests/incremental/*/*.json"
],
"url": "/src/common/util/options.schema.json"
"url": "/src/config/options.schema.json"
}
]
}
Expand Down
8 changes: 0 additions & 8 deletions src/common/common.mld
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ AnalysisState
ControlSpecC
}

{2 Configuration}
{!modules:
GobConfig
AfterConfig
JsonSchema
Options
}


{1 Domains}
{!modules:
Expand Down
9 changes: 2 additions & 7 deletions src/common/dune
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,18 @@
batteries.unthreaded
zarith
goblint_std
goblint_config
goblint_tracing
goblint-cil
fpath
yojson
json-data-encoding
cpu
goblint_timing
goblint_build_info
goblint.sites
qcheck-core.runner)
(flags :standard -open Goblint_std)
(preprocess
(pps
ppx_deriving.std
ppx_deriving_hash
ppx_deriving_yojson
ppx_blob))
(preprocessor_deps (file util/options.schema.json)))
ppx_deriving_yojson)))

(documentation)
File renamed without changes.
14 changes: 14 additions & 0 deletions src/config/config.mld
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{0 Library goblint.config}
This library is unwrapped and provides the following top-level modules.
For better context, see {!Goblint_lib} which also documents these modules.


{1 Framework}

{2 Configuration}
{!modules:
GobConfig
AfterConfig
JsonSchema
Options
}
23 changes: 23 additions & 0 deletions src/config/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(include_subdirs unqualified)

(library
(name goblint_config)
(public_name goblint.config)
(wrapped false) ; TODO: wrap
(libraries
batteries.unthreaded
goblint_std
goblint_tracing
fpath
yojson
json-data-encoding
cpu
goblint.sites
qcheck-core.runner)
(flags :standard -open Goblint_std)
(preprocess
(pps
ppx_blob))
(preprocessor_deps (file options.schema.json)))

(documentation)
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/common/util/options.ml → src/config/options.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(** [src/common/util/options.schema.json] low-level access. *)
(** [src/config/options.schema.json] low-level access. *)

open Json_schema

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(name goblint_lib)
(public_name goblint.lib)
(modules :standard \ goblint privPrecCompare apronPrecCompare messagesCompare)
(libraries goblint.sites goblint.build-info goblint-cil.all-features batteries.unthreaded qcheck-core.runner sha json-data-encoding jsonrpc cpu arg-complete fpath yaml yaml.unix uuidm goblint_timing catapult goblint_backtrace fileutils goblint_std goblint_common goblint_domain goblint_tracing
(libraries goblint.sites goblint.build-info goblint-cil.all-features batteries.unthreaded qcheck-core.runner sha json-data-encoding jsonrpc cpu arg-complete fpath yaml yaml.unix uuidm goblint_timing catapult goblint_backtrace fileutils goblint_std goblint_config goblint_common goblint_domain goblint_tracing
; Conditionally compile based on whether apron optional dependency is installed or not.
; Alternative dependencies seem like the only way to optionally depend on optional dependencies.
; See: https://dune.readthedocs.io/en/stable/concepts.html#alternative-dependencies.
Expand Down
2 changes: 1 addition & 1 deletion src/goblint_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module VarQuery = VarQuery
(** {2 Configuration}
Runtime configuration is represented as JSON.
Options are specified and documented by the JSON schema [src/common/util/options.schema.json]. *)
Options are specified and documented by the JSON schema [src/config/options.schema.json]. *)

module GobConfig = GobConfig
module AfterConfig = AfterConfig
Expand Down
3 changes: 3 additions & 0 deletions src/index.mld
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ The following libraries make up Goblint's main codebase.
{!modules:Goblint_lib}
This library currently contains the majority of Goblint and is in the process of being split into smaller libraries.

{2 Library goblint.config}
This {{!page-config}unwrapped library} contains various configuration modules extracted from {!Goblint_lib}.

{2 Library goblint.common}
This {{!page-common}unwrapped library} contains various common modules extracted from {!Goblint_lib}.

Expand Down

0 comments on commit 54d7fdf

Please sign in to comment.