Skip to content

Commit

Permalink
chore: dune file cleanups (#2761)
Browse files Browse the repository at this point in the history
* Use `project_root` where the location points to the source tree

* No need for `safe-string` nor wrapping
  • Loading branch information
Leonidas-from-XIV authored Dec 10, 2024
1 parent 9e48abd commit 6b18aba
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 49 deletions.
44 changes: 22 additions & 22 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
(rule
(target main.css)
(deps
%{workspace_root}/tool/tailwind/tailwindcss
(:config %{workspace_root}/tailwind.config.js)
(:input %{workspace_root}/src/ocamlorg_frontend/css/styles.css)
(source_tree %{workspace_root}/src/ocamlorg_frontend))
%{project_root}/tool/tailwind/tailwindcss
(:config %{project_root}/tailwind.config.js)
(:input %{project_root}/src/ocamlorg_frontend/css/styles.css)
(source_tree %{project_root}/src/ocamlorg_frontend))
(action
(chdir
%{workspace_root}
%{project_root}
(run
%{workspace_root}/tool/tailwind/tailwindcss
%{project_root}/tool/tailwind/tailwindcss
-m
-c
%{config}
Expand All @@ -25,12 +25,12 @@
(rule
(target planet.xml)
(deps
(source_tree %{workspace_root}/data/planet)
(source_tree %{workspace_root}/data/planet-local-blogs)
(:gen_feed %{workspace_root}/tool/ood-gen/bin/feed.exe))
(source_tree %{project_root}/data/planet)
(source_tree %{project_root}/data/planet-local-blogs)
(:gen_feed %{project_root}/tool/ood-gen/bin/feed.exe))
(action
(chdir
%{workspace_root}
%{project_root}
(with-stdout-to
%{target}
(run %{gen_feed} planet))))))
Expand All @@ -40,11 +40,11 @@
(rule
(target news.xml)
(deps
(source_tree %{workspace_root}/data/news)
(:gen_feed %{workspace_root}/tool/ood-gen/bin/feed.exe))
(source_tree %{project_root}/data/news)
(:gen_feed %{project_root}/tool/ood-gen/bin/feed.exe))
(action
(chdir
%{workspace_root}
%{project_root}
(with-stdout-to
%{target}
(run %{gen_feed} news))))))
Expand All @@ -54,11 +54,11 @@
(rule
(target changelog.xml)
(deps
(source_tree %{workspace_root}/data/changelog)
(:gen_feed %{workspace_root}/tool/ood-gen/bin/feed.exe))
(source_tree %{project_root}/data/changelog)
(:gen_feed %{project_root}/tool/ood-gen/bin/feed.exe))
(action
(chdir
%{workspace_root}
%{project_root}
(with-stdout-to
%{target}
(run %{gen_feed} changelog))))))
Expand All @@ -68,11 +68,11 @@
(rule
(target events.xml)
(deps
(source_tree %{workspace_root}/data/events)
(:gen_feed %{workspace_root}/tool/ood-gen/bin/feed.exe))
(source_tree %{project_root}/data/events)
(:gen_feed %{project_root}/tool/ood-gen/bin/feed.exe))
(action
(chdir
%{workspace_root}
%{project_root}
(with-stdout-to
%{target}
(run %{gen_feed} events))))))
Expand All @@ -82,11 +82,11 @@
(rule
(target jobs.xml)
(deps
(:gen_feed %{workspace_root}/tool/ood-gen/bin/feed.exe)
%{workspace_root}/data/jobs.yml)
(:gen_feed %{project_root}/tool/ood-gen/bin/feed.exe)
%{project_root}/data/jobs.yml)
(action
(chdir
%{workspace_root}
%{project_root}
(with-stdout-to
%{target}
(run %{gen_feed} job))))))
Expand Down
6 changes: 3 additions & 3 deletions playground/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(mode
(promote (until-clean)))
(deps
(:js %{workspace_root}/src/main.bc.js))
(:js %{project_root}/src/main.bc.js))
(action
(run
esbuild
Expand All @@ -23,7 +23,7 @@
(mode
(promote (until-clean)))
(deps
(:js %{workspace_root}/src/worker.js)
(:js %{project_root}/src/worker.js)
stdlib)
(action
(run jsoo_minify %{js} -o %{targets})))
Expand All @@ -32,7 +32,7 @@
(mode
(promote (until-clean)))
(deps
(:js %{workspace_root}/src/merlin_worker.bc.js))
(:js %{project_root}/src/merlin_worker.bc.js))
(action
(run jsoo_minify %{js} -o %{targets})))
(rule
Expand Down
32 changes: 13 additions & 19 deletions src/ocamlorg_static/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,33 @@
(rule
(target asset.ml)
(deps
%{workspace_root}/asset/css/main.css
%{workspace_root}/asset/changelog.xml
%{workspace_root}/asset/events.xml
%{workspace_root}/asset/jobs.xml
%{workspace_root}/asset/news.xml
%{workspace_root}/asset/planet.xml
(source_tree %{workspace_root}/asset))
%{project_root}/asset/css/main.css
%{project_root}/asset/changelog.xml
%{project_root}/asset/events.xml
%{project_root}/asset/jobs.xml
%{project_root}/asset/news.xml
%{project_root}/asset/planet.xml
(source_tree %{project_root}/asset))
(action
(with-stdout-to
%{null}
(run %{bin:ocaml-crunch} -m plain %{workspace_root}/asset -o %{target}))))
(run %{bin:ocaml-crunch} -m plain %{project_root}/asset -o %{target}))))

(rule
(target media.ml)
(deps
(source_tree %{workspace_root}/data/media))
(source_tree %{project_root}/data/media))
(action
(with-stdout-to
%{null}
(run
%{bin:ocaml-crunch}
-m
plain
%{workspace_root}/data/media
-o
%{target}))))
(run %{bin:ocaml-crunch} -m plain %{project_root}/data/media -o %{target}))))

(rule
(target playground_digests.ml)
(deps
%{workspace_root}/tool/static-file-digest/main.exe
(source_tree %{workspace_root}/playground/asset))
%{project_root}/tool/static-file-digest/main.exe
(source_tree %{project_root}/playground/asset))
(action
(with-stdout-to
%{null}
(run %{deps} %{workspace_root}/playground/asset/ -s -o %{target}))))
(run %{deps} %{project_root}/playground/asset/ -s -o %{target}))))
4 changes: 2 additions & 2 deletions src/ocamlorg_web/bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

(rule
(alias run)
(deps main.exe %{workspace_root}/asset/css/main.css)
(deps main.exe %{project_root}/asset/css/main.css)
(action
(chdir
%{workspace_root}
%{project_root}
(run %{bin:server}))))
4 changes: 1 addition & 3 deletions tool/static-file-digest/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(library
(name digest_map)
(wrapped false)
(modules digest_map)
(flags :standard -safe-string))
(modules digest_map))

(executable
(name main)
Expand Down

0 comments on commit 6b18aba

Please sign in to comment.