Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE: Compiling Eliom with the new compiler #459

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
89b2b30
Remove is_global from the API.
Drup Jul 27, 2016
8d23f9d
Don't emit set_global in the ppx.
Drup Aug 1, 2016
11dc82a
Big renaming
Drup Aug 1, 2016
b5d9ee7
Remove set_global from the camlp4 syntax extension.
Drup Aug 1, 2016
5128db7
Start working on the ocamlbuild plugin.
Drup Aug 1, 2016
e905cdb
More modifications to the build system.
Drup Sep 22, 2016
73944b4
Progress on the build system front.
Drup Sep 23, 2016
04d89e6
Implement copy rules properly and remove old stuff.
Drup Sep 28, 2016
b82e0f8
Fix the family of I tags.
Drup Sep 29, 2016
7e31fab
be a lot more liberal in what is included where.
Drup Sep 29, 2016
8701cd0
Remove the useless functor for the ocamlbuild plugins.
Drup Dec 8, 2016
26f04ed
Remove the ppx and the camlp4 syntax extension.
Drup Dec 8, 2016
af90858
Move eliommod_parameters to the main dir.
Drup Dec 15, 2016
8343aaa
Add [@client] paremeters and avoid dep to the minimal runtime.
Drup Dec 15, 2016
4bf9171
Add a special hook to build the runtime before any .eliom file.
Drup Jan 1, 2017
529df50
Small cleanup of build stuff.
Drup Jan 1, 2017
87d7a90
Add new rules for .client/server.cmi files alone.
Drup Jan 1, 2017
91249d0
Replace some .ml files by eliom files.
Drup Jan 1, 2017
5b01a27
Remove some unused sideness annotations.
Drup Jan 1, 2017
d8f1663
TEMP: Comment out eliom_shared.
Drup Jan 1, 2017
6d85f0c
Add missing bit of runtime.
Drup Jan 1, 2017
db76e44
TEMP: Comment out to_and_of
Drup Jan 1, 2017
30f458c
fixup! Remove some unused sideness annotations.
Drup Jan 1, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ opam install --verbose eliom
do_build_doc () {
make wikidoc
cp -Rf doc/manual-wiki/*.wiki ${MANUAL_SRC_DIR}
mkdir -p ${API_DIR}/server ${API_DIR}/client ${API_DIR}/ocamlbuild ${API_DIR}/ppx
mkdir -p ${API_DIR}/server ${API_DIR}/client ${API_DIR}/ocamlbuild $
cp -Rf _build/src/lib/server/api.wikidocdir/*.wiki ${API_DIR}/server/
cp -Rf _build/src/lib/client/api.wikidocdir/*.wiki ${API_DIR}/client/
cp -Rf _build/src/ocamlbuild/api.wikidocdir/*.wiki ${API_DIR}/ocamlbuild/
cp -Rf _build/src/ppx/api.wikidocdir/*.wiki ${API_DIR}/ppx/
cp -Rf doc/index.wiki ${API_DIR}/
}

Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ $(BUILDER): $(wildcard build/*.ml)
builder: $(BUILDER)
### Doc
.PHONY: doc wikidoc doc man alldoc
DOCS_DIR=src/lib/client src/lib/server src/ocamlbuild src/ppx
DOCS_DIR=src/lib/client src/lib/server src/ocamlbuild
DOCS_HTML=$(addsuffix /api.docdir/index.html,$(DOCS_DIR))
DOCS_WIKI=$(addsuffix /api.wikidocdir/index.wiki,$(DOCS_DIR))
DOCS_MAN= src/lib/client/api.mandocdir/man.3oc \
src/lib/server/api.mandocdir/man.3os \
src/ocamlbuild/api.mandocdir/man.3o \
src/ppx/api.mandocdir/man.3o
src/ocamlbuild/api.mandocdir/man.3o
doc: $(BUILDER)
$(BUILDER) $(DOCS_HTML)
wikidoc: $(BUILDER)
Expand Down
51 changes: 7 additions & 44 deletions build/build.ml
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
open Ocamlbuild_plugin
module Pack = Ocamlbuild_pack

module Conf = struct
let server_dir = "server"
let client_dir = "client"
let type_dir = "type_dir"
end

module Intern = struct

let with_eliom_ppx = Some begin function
| `Client -> "src/ppx/ppx_eliom_client_ex.native"
| `Server -> "src/ppx/ppx_eliom_server_ex.native"
end

let with_package = function
| "eliom.ppx.type" -> "pkg_ppx_eliom_types"
| "eliom.ppx.client"
| "eliom.ppx.server"
| "eliom.syntax.predef"
| "eliom.client"
| "eliom.server" -> (* do noting in this case *) "pkg_dummy"
| _ -> assert false
end

module Eliom_plugin = Ocamlbuild_eliom.MakeIntern(Intern)(Conf)

let _ = dispatch (fun x ->
Eliom_plugin.dispatcher x;
let runtime =
expand_module ["src/lib"] "Eliom_runtime"
["server.cmo"; "server.cmi" ; "client.cmo"; "client.cmi"]
in
Ocamlbuild_eliom.dispatcher ~runtime x;
match x with
| After_rules ->
Doc.init ();
Expand All @@ -36,24 +15,6 @@ let _ = dispatch (fun x ->
rule (Printf.sprintf "%s -> %s" source dest) ~dep:source ~prod:dest
(fun env _ -> Cmd (S [A"ln"; A"-f";P (env source); P (env dest)])) in

(* add I pflag *)
pflag [ "ocaml"; "compile"] "I" (fun x -> S[A"-I"; A x]);
pflag [ "ocaml"; "infer_interface"] "I" (fun x -> S[A"-I"; A x]);
pflag [ "ocaml"; "doc"] "I" (fun x -> S[A"-I"; A x]);

(* add syntax extension *)
let add_syntax name path =
let bytes_dep = Findlib.(link_flags_byte [query "bytes"]) in
(* hack : not dep when "compile" to avoid the extension syntax to be link with binaries *)
(* the dep with ocamldep make sure the extension syntax is compiled before *)
flag ["ocaml";"compile";"pkg_"^name] (S [A "-ppx" ;P (path ^ name ^ "_ex.native") ]);
flag_and_dep ["ocaml";"ocamldep";"pkg_"^name] (S [A "-ppx" ;P (path ^ name ^ "_ex.native") ]);
flag_and_dep ["ocaml";"infer_interface";"pkg_"^name] (S [A "-ppx" ;P (path ^ name ^ "_ex.native") ]);
flag_and_dep ["doc";"pkg_"^name] (S [A "-ppx" ;P (path ^ name ^ "_ex.native") ]) in

add_syntax "ppx_eliom_utils" "src/ppx/";
add_syntax "ppx_eliom_types" "src/ppx/";

(* link executable aliases *)
let link_exec f t =
link (Printf.sprintf "src/tools/%s.byte" f) (Printf.sprintf "src/tools/%s.byte" t);
Expand All @@ -67,5 +28,7 @@ let _ =
Options.make_links:=false;
Options.plugin := false;
Options.use_ocamlfind := true;
Pack.Log.classic_display := true;
Pack.Log.level := 3;
Ocamlbuild_unix_plugin.setup ();
Ocamlbuild_pack.Main.main ()
1 change: 0 additions & 1 deletion opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ depends: [
"ocamlfind"
"deriving" {>= "0.6"}
"ppx_deriving"
"ppx_tools" {>= "0.99.3"}
"js_of_ocaml" {>= "2.8.2"}
"tyxml" {>= "4.0.0"}
"calendar"
Expand Down
62 changes: 0 additions & 62 deletions pkg/META
Original file line number Diff line number Diff line change
Expand Up @@ -60,68 +60,6 @@ package "client" (
linkopts(javascript) += "+js_of_ocaml/classlist.js"
)

package "syntax" (
directory = "syntax"
package "common" (
description = "Syntax extension: spliting client and server code (base)"
version = "[distributed with Eliom]"
requires = "camlp4, bytes"
requires(preprocessor, syntax, pkg_type_conv) = "type_conv"
archive(syntax, preprocessor) = "pa_eliom_seed.cmo"
)

package "client" (
description = "Syntax extension: spliting client and server code (client side)"
version = "[distributed with Eliom]"
requires(syntax, preprocessor) = "eliom.syntax.common"
requires(syntax, toploop) = "eliom.syntax.common"
archive(syntax, preprocessor) = "pa_eliom_client_client.cmo"
archive(syntax, toploop) = "pa_eliom_client_client.cmo"
)

package "server" (
description = "Syntax extension: spliting client and server code (server side)"
version = "[distributed with Eliom]"
requires(syntax, preprocessor) = "eliom.syntax.common"
requires(syntax, toploop) = "eliom.syntax.common"
archive(syntax, preprocessor) = "pa_eliom_client_server.cmo"
archive(syntax, toploop) = "pa_eliom_client_server.cmo"
)

package "type" (
description = "Syntax extension: spliting client and server code (type inference)"
version = "[distributed with Eliom]"
requires(syntax, preprocessor) = "eliom.syntax.common"
archive(syntax, preprocessor) = "pa_eliom_type_filter.cmo"
)

package "predef" (
description = "Syntax extension: predefined commonly use syntaxes"
version = "[distributed with Eliom]"

requires(syntax, preprocessor) = "js_of_ocaml.syntax,js_of_ocaml.deriving.syntax,lwt.syntax,tyxml.syntax"
requires(syntax, toploop) = "js_of_ocaml.syntax,js_of_ocaml.deriving.syntax,lwt.syntax,tyxml.syntax"
archive(syntax, preprocessor) = "-ignore dummy"
)

)

package "ppx" (
directory = "ppx"
package "server" (
description = "Ppx syntax extension: server side"
ppx = "ppx_eliom_server"
)
package "client" (
description = "Ppx syntax extension: client side"
ppx = "ppx_eliom_client"
)
package "type" (
description = "Ppx syntax extension: type inference"
ppx = "ppx_eliom_types"
)
)


package "templates" (
directory = "templates"
Expand Down
28 changes: 1 addition & 27 deletions pkg/build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ let except = function
| _ -> true
(* END *)

let exts_syntax = List.filter except [".cmo";".cmx";".cma";".cmxa";".cmxs";".a"]
let exts_modlib = List.filter except Exts.module_library
let exts_lib = List.filter except Exts.library

Expand All @@ -25,15 +24,7 @@ let _ =

list_to_file "src/ocamlbuild/ocamlbuild.mllib" ocamlbuild_mllib;
list_to_file "src/ocamlbuild/ocamlbuild.mldylib" ocamlbuild_mllib;
list_to_file "src/ocamlbuild/api.odocl" ocamlbuild_api;

list_to_file "src/ppx/ppx.mllib" ppx_mllib;
list_to_file "src/ppx/ppx.mldylib" ppx_mllib;
list_to_file "src/ppx/api.odocl" ppx_api;

list_to_file "src/ppx/ppx.mllib" ppx_mllib;
list_to_file "src/ppx/ppx.mldylib" ppx_mllib;
list_to_file "src/ppx/api.odocl" ppx_api
list_to_file "src/ocamlbuild/api.odocl" ocamlbuild_api

let spf = Printf.sprintf

Expand Down Expand Up @@ -62,7 +53,6 @@ let () =
Pkg.man ~cond:with_man3 ~dst:"man3/%.3oc" ~target:"src/lib/client/api.mandocdir/man.3oc" "src/lib/client/api.mandocdir/%.3oc";
Pkg.man ~cond:with_man3 ~dst:"man3/%.3os" ~target:"src/lib/server/api.mandocdir/man.3os" "src/lib/server/api.mandocdir/%.3os";
Pkg.man ~cond:with_man3 ~dst:"man3/%.3o" ~target:"src/ocamlbuild/api.mandocdir/man.3o" "src/ocamlbuild/api.mandocdir/%.3o";
Pkg.man ~cond:with_man3 ~dst:"man3/%.3o" ~target:"src/ppx/api.mandocdir/man.3o" "src/ppx/api.mandocdir/%.3o";

(* TOOLS *)
Pkg.bin ~auto:true "src/tools/eliomc";
Expand All @@ -75,24 +65,8 @@ let () =
Pkg.bin ~auto:true ~dst:"eliom-distillery" "src/tools/distillery";
Pkg.bin ~auto:true "src/ocamlbuild/eliombuild";

(* SYNTAXES *)
Pkg.lib ~exts:exts_syntax ~dst:"syntax/pa_eliom_seed" "src/syntax/pa_eliom_seed";
Pkg.lib ~exts:exts_syntax ~dst:"syntax/pa_eliom_client_client" "src/syntax/pa_eliom_client_client";
Pkg.lib ~exts:exts_syntax ~dst:"syntax/pa_eliom_client_server" "src/syntax/pa_eliom_client_server";
Pkg.lib ~exts:exts_syntax ~dst:"syntax/pa_eliom_type_filter" "src/syntax/pa_eliom_type_filter";

Pkg.lib ~exts:exts_modlib ~dst:"ocamlbuild/ocamlbuild_eliom" "src/ocamlbuild/ocamlbuild_eliom";

(* PPX *)
Pkg.lib ~exts:Exts.module_library ~dst:"ppx/ppx_eliom" "src/ppx/ppx_eliom";
Pkg.lib ~exts:Exts.module_library ~dst:"ppx/ppx_eliom_client" "src/ppx/ppx_eliom_client";
Pkg.lib ~exts:Exts.module_library ~dst:"ppx/ppx_eliom_type" "src/ppx/ppx_eliom_type";
Pkg.lib ~exts:Exts.module_library ~dst:"ppx/ppx_eliom_server" "src/ppx/ppx_eliom_server";

Pkg.bin ~auto:true ~dst:"ppx_eliom_client" "src/ppx/ppx_eliom_client_ex" ;
Pkg.bin ~auto:true ~dst:"ppx_eliom_server" "src/ppx/ppx_eliom_server_ex" ;
Pkg.bin ~auto:true ~dst:"ppx_eliom_types" "src/ppx/ppx_eliom_types_ex"

] @ (
(* CLIENT LIBS *)
Pkg.lib ~dst:"client/client" ~exts:[".cma"] "src/lib/client/client" ::
Expand Down
32 changes: 10 additions & 22 deletions pkg/filelist.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ let server = {
"eliom_parameter_sigs";
"eliom_registration_sigs";
"eliom_service_sigs";
"eliom_shared_sigs";
(* "eliom_shared_sigs"; *)
];
interface = [
"eliom_bus";
"eliom_client_value";
"eliom_syntax";
"eliom_runtime";
"eliom_client";
"eliom_comet";
"eliom_common";
Expand All @@ -29,8 +29,8 @@ let server = {
"eliom_notif";
"eliom_parameter";
"eliom_react";
"eliom_shared";
"eliom_cscache";
(* "eliom_shared"; *)
(* "eliom_cscache"; *)
"eliom_reference";
"eliom_registration";
"eliom_request_info";
Expand All @@ -44,7 +44,7 @@ let server = {
internal = [
"eliom_comet_base";
"eliom_common_base";
"eliom_runtime";
"eliom_serial";
"eliom_content_";
"eliom_content_core";
"eliom_cookies_base";
Expand All @@ -57,7 +57,7 @@ let server = {
"eliom_service_base";
"eliom_route";
"eliom_route_base";
"eliom_shared_content";
(* "eliom_shared_content"; *)
"eliom_types_base";
"eliommod";
"eliommod_cli";
Expand All @@ -81,7 +81,7 @@ let client = {
"eliom_parameter_sigs";
"eliom_registration_sigs";
"eliom_service_sigs";
"eliom_shared_sigs";
(* "eliom_shared_sigs"; *)
];
interface = [
"eliom_bus";
Expand All @@ -96,8 +96,8 @@ let client = {
"eliom_lib";
"eliom_parameter";
"eliom_react";
"eliom_shared";
"eliom_cscache";
(* "eliom_shared"; *)
(* "eliom_cscache"; *)
"eliom_registration";
"eliom_service";
"eliom_tools";
Expand All @@ -121,7 +121,7 @@ let client = {
"eliom_service_base";
"eliom_route";
"eliom_route_base";
"eliom_shared_content";
(* "eliom_shared_content"; *)
"eliom_types_base";
"eliommod_cookies";
"eliommod_dom";
Expand All @@ -146,12 +146,6 @@ let ocamlbuild = {

}

let ppx = {
interface_only = [];
interface = [ "ppx_eliom" ; "ppx_eliom_client" ; "ppx_eliom_type" ; "ppx_eliom_server" ];
internal = [ "ppx_eliom_utils" ];
}


let (-.-) name ext = name ^ "." ^ ext
let exts el sl =
Expand Down Expand Up @@ -198,12 +192,6 @@ let ocamlbuild_extra =
exts ["cmx"] (ocamlbuild.interface @ ocamlbuild.internal)
let ocamlbuild_api = ocamlbuild.interface_only @ ocamlbuild.interface

let ppx_mllib = ppx.interface @ ppx.internal
let ppx_extra =
exts ["cmi"] ppx.interface @
exts ["cmx"] (ppx.interface @ ppx.internal)
let ppx_api = ppx.interface


let templates_dir = "pkg/distillery"
let templates = Array.to_list (Sys.readdir templates_dir)
Expand Down
Loading