Added an example
This commit is contained in:
parent
799d51be30
commit
35db749e29
|
@ -15,7 +15,7 @@ let gen_example example =
|
||||||
(deps ((files_recursively_in %s)))
|
(deps ((files_recursively_in %s)))
|
||||||
(action
|
(action
|
||||||
(chdir %s
|
(chdir %s
|
||||||
(run ${exe:../test/run.exe} -- ${bin:jbuilder} build -j1 --root . @install)))))
|
(run ${exe:../test/run.exe} -- ${bin:jbuilder} build -j1 --root . @install @runtest)))))
|
||||||
|}
|
|}
|
||||||
dir dir
|
dir dir
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
This project is called =hello_world=. It defines one library called
|
||||||
|
=hello_world= and one executable called =hello_world=.
|
||||||
|
|
||||||
|
The library is defined in =lib= and the executable in =bin=. It also
|
||||||
|
defines a test in =test=.
|
||||||
|
|
||||||
|
At the toplevel of the project, there is a =hello_world.opam=
|
||||||
|
file. This file is required so that =jbuilder= knows that this is the
|
||||||
|
=hello_world= project.
|
||||||
|
|
||||||
|
To build everything that is meant to be installed in this project,
|
||||||
|
type:
|
||||||
|
|
||||||
|
#+begin_src
|
||||||
|
$ jbuilder build @install
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
To run the tests, type:
|
||||||
|
|
||||||
|
#+begin_src
|
||||||
|
$ jbuilder runtest
|
||||||
|
#+end_src
|
|
@ -0,0 +1,9 @@
|
||||||
|
(jbuild_version 1)
|
||||||
|
|
||||||
|
(executables
|
||||||
|
((names (main))
|
||||||
|
(libraries (hello_world))))
|
||||||
|
|
||||||
|
(install
|
||||||
|
((section bin)
|
||||||
|
(files ((main.exe as hello_world)))))
|
|
@ -0,0 +1 @@
|
||||||
|
let () = print_endline Hello_world.message
|
|
@ -0,0 +1,11 @@
|
||||||
|
opam-version: "1.2"
|
||||||
|
version: "1.0"
|
||||||
|
maintainer: "bob@sponge.com"
|
||||||
|
authors: ["SpongeBob"]
|
||||||
|
homepage: "https://github.com/SpongeBob/hello_world"
|
||||||
|
bug-reports: "https://github.com/SpongeCob/hello_world/issues"
|
||||||
|
dev-repo: "https://github.com/SpongeBob/hello_world.git"
|
||||||
|
license: "Apache-2.0"
|
||||||
|
build: [
|
||||||
|
["jbuilder" "build" "--only" "hello_world" "--root" "." "-j" jobs "@install"]
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
let message = "Hello, world!"
|
|
@ -0,0 +1,5 @@
|
||||||
|
(jbuild_version 1)
|
||||||
|
|
||||||
|
(library
|
||||||
|
((name hello_world)
|
||||||
|
(public_name hello_world)))
|
|
@ -0,0 +1 @@
|
||||||
|
Hello, world!
|
|
@ -0,0 +1,9 @@
|
||||||
|
(jbuild_version 1)
|
||||||
|
|
||||||
|
(rule
|
||||||
|
((targets (hello_world.output))
|
||||||
|
(action (with-stdout-to ${@} (run ${bin:hello_world})))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name runtest)
|
||||||
|
(action (run diff -u ${path:hello_world.expected} ${path:hello_world.output}))))
|
Loading…
Reference in New Issue