Skip to content

Commit

Permalink
Share manifests (#740)
Browse files Browse the repository at this point in the history
One frequent reason that `libribasim` and `ribasim_cli` builds break is
because we add a dependency to the core, and we forget to resolve the
Manifests of `libribasim` and `ribasim_cli`. (e.g. #484).

This adds an entry like `manifest = "../Manifest.toml"` to the `core`,
`libribasim` and `ribasim_cli` Project.toml, which all point to the new
`root` Manifest. With this they still have their own Project, but a
shared Manifest. This option exists to make it easier to work with
multiple related projects in one monorepo.

~~As a follow-up we could consider also doing~~ We also do this for the
remaining two projects, `docs` and `create_binaries`. `create_binaries`
doesn't depend on Ribasim, so there is not as much benefit. `docs` does,
currently not via Project.toml, but via adding it to the LOAD_PATH. It
would be cleaner to also use a shared Manifest there. One thing to check
if the unmaintained docs dependencies don't hold back Ribasim
dependencies, see #621 (EDIT: they don't).

~~This is on top of #738, but could be separated out if needed.~~

Also simplifies the docs, and has a not-directly-related commit
8403bef that runs CompatHelper for all
projects, not just core.

For reference, the root project is populated like this: `dev ./core
./docs build/create_binaries build/libribasim build/ribasim_cli`.
  • Loading branch information
visr committed Nov 13, 2023
1 parent 6194502 commit 47aa680
Show file tree
Hide file tree
Showing 20 changed files with 231 additions and 3,179 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/core_compat_helper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ jobs:
- name: "Run CompatHelper"
run: |
import CompatHelper
CompatHelper.main(; subdirs=["core"])
CompatHelper.main(; subdirs=[
"core",
"docs",
"build/create_binaries",
"build/libribasim",
"build/ribasim_cli"
])
shell: julia --color=yes {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"[julia]": {
"editor.formatOnSave": true
},
"julia.environmentPath": "core",
"notebook.formatOnSave.enabled": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
Expand Down
226 changes: 164 additions & 62 deletions core/Manifest.toml → Manifest.toml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name = "root"
authors = ["Deltares and contributors <[email protected]>"]
description = "Meta-project used to share the Manifest of Ribasim and its dependents"

[deps]
Ribasim = "aac5e3d9-0b8f-4d4f-8241-b1a7a9632635"
create_binaries = "3cfb6a46-05f0-43df-bb16-bf763deb14b4"
docs = "8daea9ca-fc6c-4731-aa85-717fa0b706bc"
libribasim = "f319f290-633d-4573-adfe-d6d5548b6388"
ribasim_cli = "e45c999e-e944-4589-a8e6-7d0b7a60140a"
225 changes: 0 additions & 225 deletions build/create_binaries/Manifest.toml

This file was deleted.

7 changes: 7 additions & 0 deletions build/create_binaries/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
name = "create_binaries"
uuid = "3cfb6a46-05f0-43df-bb16-bf763deb14b4"
authors = ["Deltares and contributors <[email protected]>"]
description = "Build Ribasim binaries with PackageCompiler"
manifest = "../../Manifest.toml"
version = "0.1.0"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Expand Down
4 changes: 2 additions & 2 deletions build/create_binaries/add_metadata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function add_metadata(project_dir, license_file, output_dir, git_repo)
)
# the Manifest.toml always gives the exact version of Ribasim that was built
cp(
normpath(project_dir, "Manifest.toml"),
normpath(git_repo, "Manifest.toml"),
normpath(output_dir, "share/julia/Manifest.toml");
force = true,
)
Expand All @@ -35,7 +35,7 @@ function add_metadata(project_dir, license_file, output_dir, git_repo)
open(normpath(output_dir, "README.md"), "a") do io
# since the exact Ribasim version may be hard to find in the Manifest.toml file
# we can also extract that information, and add it to the README.md
manifest = TOML.parsefile(normpath(project_dir, "Manifest.toml"))
manifest = TOML.parsefile(normpath(git_repo, "Manifest.toml"))
if !haskey(manifest, "manifest_format")
error("Manifest.toml is in the old format, run Pkg.upgrade_manifest()")
end
Expand Down
4 changes: 4 additions & 0 deletions build/create_binaries/src/create_binaries.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__precompile__(false)

# This is not really a package, but needs to be set up like one so we can run
# `dev build/create_binaries` from the root project.
Loading

0 comments on commit 47aa680

Please sign in to comment.