Added an example

This commit is contained in:
Jeremie Dimino 2017-03-21 14:28:23 +00:00
parent 799d51be30
commit 35db749e29
9 changed files with 60 additions and 1 deletions

View File

@ -15,7 +15,7 @@ let gen_example example =
(deps ((files_recursively_in %s)))
(action
(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

View File

@ -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

View File

@ -0,0 +1,9 @@
(jbuild_version 1)
(executables
((names (main))
(libraries (hello_world))))
(install
((section bin)
(files ((main.exe as hello_world)))))

View File

@ -0,0 +1 @@
let () = print_endline Hello_world.message

View File

@ -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"]
]

View File

@ -0,0 +1 @@
let message = "Hello, world!"

View File

@ -0,0 +1,5 @@
(jbuild_version 1)
(library
((name hello_world)
(public_name hello_world)))

View File

@ -0,0 +1 @@
Hello, world!

View File

@ -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}))))