Skip to content

Commit

Permalink
generate *-dune.inc (#370)
Browse files Browse the repository at this point in the history
* generate dune.inc in unit_test of lib_gen

* generate dune.inc in with_js/compile-tests

* generate dune.inc in with_js/apidir-tests

* generate dune.inc in apidir-typescript-tests

* reset dune-gen

* update ci

* remove commnented out lines from dune

* fix by review

* generate dune.inc

---------

Co-authored-by: Haochen M. Kotoi-Xie <[email protected]>
  • Loading branch information
kxc-wraikny and haochenx authored Sep 7, 2023
1 parent 4473b02 commit ccbe680
Show file tree
Hide file tree
Showing 41 changed files with 2,615 additions and 1,957 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ jobs:
run: |
GITHUB_STATUS_SHA="${{ github.event.pull_request.head.sha }}"
GITHUB_STATUS_SHA="${GITHUB_STATUS_SHA:=$GITHUB_SHA}"
git add src/
git add tooling/
git add with_js/
git add example/
git diff --cached --exit-code && ( \
curl --request POST \
Expand Down
2 changes: 1 addition & 1 deletion example/for_dev/generator/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(executables
(names duneinc_generator openapi_listing_generator)
(libraries
kxclib fmt
kxclib fmt dune_file_parts
bindoj_test_common_typedesc_examples
bindoj_test_common_apidir_examples)
(flags :standard))
173 changes: 0 additions & 173 deletions example/for_dev/generator/dune_file_parts.ml

This file was deleted.

23 changes: 10 additions & 13 deletions example/for_dev/generator/duneinc_generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,16 @@ AnchorZ Inc. to satisfy its needs in its product development workflow.
*)
open Kxclib

open struct
[@@@warning "-32"]

let (&) f a = f a
let (&.) f a = f [a]
end

let lib_gen_generator_dep = "%{workspace_root}/src/lib_gen/unit_test/gen/gen.exe"
let lib_gen_ts_generator_dep = "%{workspace_root}/src/lib_gen_ts/unit_test/gen/gen.exe"
let json_examples_generator_dep = "%{workspace_root}/with_js/compile-tests/json/gen.exe"
let json_schema_generator_dep = "%{workspace_root}/with_js/compile-tests/schema/gen.exe"
let json_examples_generator_dep = "%{workspace_root}/with_js/compile-tests/generator/gen_json.exe"
let json_schema_generator_dep = "%{workspace_root}/with_js/compile-tests/generator/gen_schema.exe"

let chop_suffix_exn suffix = String.(chop_suffix suffix &> Option.get)

module Dparts = Dune_file_parts
include Dparts.Fcomb.Ops

module Dcomb = struct
[@@@warning "-32"]

Expand Down Expand Up @@ -93,13 +88,14 @@ let () =
named "schema_gen" (atomic json_schema_generator_dep);
atomic "%{workspace_root}/with_js/node_modules"
]);
Action.(vpbox ~lead:"action" &.
Action.(mk_progn &
let single gen f =
with_stdout_to_piped (`expr (fmt f)) [
run (sprintf "%%{%s}" gen) [fmt f];
run_prettier' ~compact:true (fmt f);
] in
progn [
]
in
[
single "ts_gen" "%s_gen.ts";
single "json_gen" "%s_examples.json";
single "schema_gen" "%s_schema.json";
Expand Down Expand Up @@ -135,7 +131,8 @@ let () =
(subdir "typedesc_examples/lib_gen" [
Library.mk []
~name:("dev_example_" ^ chop_suffix_exn "-dune.inc" target_name ^ "-lib_gen"
|> mangle_library_name)
|> mangle_library_name
|> str)
~modules':[list ~sep:sp string]
~libraries:[
"bindoj.base";
Expand Down
Loading

0 comments on commit ccbe680

Please sign in to comment.