├── .gitattributes ├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── ReasonNativeProject.opam ├── bin ├── jbuild └── test.re ├── circle.yml ├── dune-project ├── esy.lock ├── internal ├── GoodValues.re ├── Something.ml └── jbuild ├── jbuild-ignore ├── lib ├── LifeTheUniverseAndEverything.re ├── dune └── sub │ ├── Nested.re │ └── sub.opam ├── package.json ├── test-with-version.sh └── tests ├── jbuild └── test.re /.gitattributes: -------------------------------------------------------------------------------- 1 | docs/highlightJs/** binary 2 | docs/support/** binary 3 | docs/templates/** binary 4 | docs/theme-white/** binary 5 | docs/test/** binary 6 | docs/flatdoc.js binary 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | _build/** 3 | *~ 4 | *.cmi 5 | *.exe 6 | *.cmo 7 | *.cmx 8 | *.cma 9 | *.cmxa 10 | *.cmxs 11 | *.a 12 | *.o 13 | *.annot 14 | *.run 15 | *.opt 16 | *.native 17 | *.byte 18 | *.install 19 | pkg/META 20 | .merlin 21 | /node_modules/ 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode7.3 3 | before_install: 4 | - brew update 5 | - brew install opam 6 | - opam init 7 | - opam switch "$OCAML_VERSION" 8 | - eval `opam config env` 9 | - opam update 10 | - opam install -y re 11 | before_script: 12 | - opam pin add -y ReasonNativeProject . 13 | script: 14 | - make run 15 | - git diff --exit-code 16 | env: 17 | - OCAML_VERSION=4.02.3 18 | - OCAML_VERSION=4.03.0 19 | - OCAML_VERSION=4.04.0 20 | notifications: 21 | email: 22 | - yunxing@fb.com 23 | - reason@cloudwalk.me 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 reasonml 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | jbuilder build 3 | 4 | run: build 5 | ./_build/install/default/bin/reason-native-bin 6 | 7 | test: 8 | jbuilder runtest 9 | 10 | # some boilerplate to publish a new version to GitHub 11 | release: 12 | git add package.json opam 13 | git commit -m "Version $(version)" 14 | git tag -a $(version) -m "Version $(version)." 15 | git push "git@github.com:reasonml/ReasonNativeProject.git" 16 | git push "git@github.com:reasonml/ReasonNativeProject.git" tag $(version) 17 | 18 | clean: 19 | rm -rf _build *.install 20 | 21 | .PHONY: build release test 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # !DEPRECATED! Use [hello-reason](https://github.com/esy-ocaml/hello-reason) instead 2 | 3 | Original README below: 4 | 5 | # ReasonNativeProject 6 | 7 | 8 | [`Reason`](http://reasonml.github.io/) project for native compilation: 9 | 10 | [More info on the workflow](https://reasonml.github.io/guide/native). 11 | 12 | [![Build Status](https://travis-ci.org/reasonml/ReasonNativeProject.svg?branch=master)](https://travis-ci.org/reasonml/ReasonNativeProject) 13 | 14 | ## Develop With OPAM 15 | 16 | **Build**: 17 | 18 | Clone the repo and run these commands from within the project: 19 | 20 | ```sh 21 | opam update # get the latest opam packages data. Skip this optionally 22 | # opam will read into the `opam` file and add the other dependencies 23 | opam install reason 24 | opam install merlin 25 | opam install re 26 | make build # build/rebuild your files 27 | ``` 28 | 29 | **Run**: 30 | 31 | ```sh 32 | ./_build/install/default/bin/reason-native-bin 33 | ``` 34 | 35 | **Develop**: 36 | - Make sure you have `merlin` globally installed (via opam, *not* 37 | `reason-cli`!) 38 | - [See the ReasonML 39 | docs](https://reasonml.github.io/docs/en/editor-plugins.html) about setting 40 | up your editor. Just remember to *not* install `reason-cli` when using 41 | `opam`. 42 | 43 | 44 | 45 | ## Preliminary Esy Support 46 | You may alternatively use [`esy`](http://esy.sh/) to build and develop this 47 | project. (`esy` is like "npm for native"). This is preferable for people who 48 | want to build native Reason projects using existing opam packages, but with a 49 | more familiar and sandboxed workflow. This is experimental and not stable yet. 50 | Please report any issues to [the esy repo](https://github.com/esy/esy). 51 | 52 | **Build**: 53 | 54 | ```sh 55 | npm install -g esy@latest 56 | esy install 57 | esy build 58 | ``` 59 | 60 | **Run**: 61 | 62 | Use `esy x` ("esy execute") command to run the binary. 63 | 64 | ```sh 65 | esy x reason-native-bin 66 | ``` 67 | 68 | **Develop**: 69 | 70 | - [See the ReasonML 71 | docs](https://reasonml.github.io/docs/en/editor-plugins.html) about setting 72 | up your editor. 73 | - Start your editor from the root of this project via `esy vim` or `esy atom` 74 | etc. (Note VSCode has special `esy` support so that you don't need to start 75 | it this way from the command line). 76 | - Add dependencies by adding entries to the `package.json`, running `esy 77 | install` then `esy build`. 78 | 79 | 80 | ## Developing Your Project 81 | The entrypoint of this project is the `./bin/test.re` file. Make a simple 82 | change to it and then rerun the build. 83 | 84 | `ReasonNativeProject` is meant to be the starting point of your own project. You'll 85 | want to make use of existing libraries in your app, so browse the growing set 86 | of `opam` packages in the [opam repository](http://opam.ocaml.org/packages/). 87 | 88 | 89 | ## Troubleshooting 90 | 91 | In general, if something goes wrong, try upgrading your install of the project 92 | by running `opam upgrade ReasonNativeProject`, or if it failed to install and you 93 | later fixed it, `opam install ReasonNativeProject`. 94 | -------------------------------------------------------------------------------- /ReasonNativeProject.opam: -------------------------------------------------------------------------------- 1 | opam-version: "1.2" 2 | name: "ReasonNativeProject" 3 | version: "0.0.1" 4 | maintainer: "Jordan Walke " 5 | authors: [ 6 | "Jordan Walke " 7 | "Maxwell Bernstein " 8 | ] 9 | license: "BSD" 10 | homepage: "https://github.com/reasonml/ReasonNativeProject" 11 | doc: "https://reasonml.github.io/ReasonNativeProject/" 12 | bug-reports: "https://github.com/reasonml/ReasonNativeProject/issues" 13 | dev-repo: "git://github.com/reasonml/ReasonNativeProject.git" 14 | tags: [ "reason" "example" ] 15 | build: [ 16 | ["jbuilder" "build" "-p" name "-j" jobs] 17 | ] 18 | depends: [ 19 | "jbuilder" {build} 20 | "reason" {= "3.0.4"} 21 | "re" 22 | ] 23 | available: [ ocaml-version >= "4.02" & ocaml-version < "4.05" ] 24 | -------------------------------------------------------------------------------- /bin/jbuild: -------------------------------------------------------------------------------- 1 | (jbuild_version 1) 2 | 3 | (executable 4 | ((name test) 5 | ; This will be installable as a global binary 6 | (public_name reason-native-bin) 7 | ; and it depends on 2 local libraries 8 | (libraries (lib internal)))) 9 | -------------------------------------------------------------------------------- /bin/test.re: -------------------------------------------------------------------------------- 1 | /** 2 | * Welcome to Reason. 3 | */ 4 | print_string("!!!!!!\n"); 5 | 6 | let msg = "Hello Reason!"; 7 | 8 | print_string(msg); 9 | 10 | print_newline(); 11 | 12 | print_string("!!!!!!\n"); 13 | 14 | print_endline(Internal.GoodValues.message); 15 | 16 | let a = Lib.LifeTheUniverseAndEverything.answer; 17 | 18 | Printf.printf("Answer: %d\n", a); 19 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | override: 3 | - sudo add-apt-repository -y ppa:avsm/ppa 4 | - sudo apt-get update -y 5 | - sudo apt-get install -y ocaml ocaml-native-compilers opam 6 | - opam init --auto-setup --dot-profile=~/.bashrc # Modify dotfiles 7 | - opam switch --no-switch 4.02.3 # Download and compile all the versions 8 | - opam switch --no-switch 4.03.0 9 | - opam switch --no-switch 4.04.0 10 | 11 | test: 12 | override: 13 | - ./test-with-version.sh 4.02.3 14 | - ./test-with-version.sh 4.03.0 15 | - ./test-with-version.sh 4.04.0 16 | -------------------------------------------------------------------------------- /dune-project: -------------------------------------------------------------------------------- 1 | (lang dune 1.1) 2 | -------------------------------------------------------------------------------- /esy.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@esy-ocaml/esy-installer@^0.0.0": 6 | version "0.0.0" 7 | resolved "https://registry.yarnpkg.com/@esy-ocaml/esy-installer/-/esy-installer-0.0.0.tgz#6b0e2bd4ee43531ac74793fe55cfcc3aca197a66" 8 | 9 | "@esy-ocaml/merlin@3.0.5003": 10 | version "3.0.5003" 11 | resolved "https://registry.yarnpkg.com/@esy-ocaml/merlin/-/merlin-3.0.5003.tgz#4b3d68a7ddef3051f1b05fdb5b2f69d5791034d3" 12 | dependencies: 13 | "@esy-ocaml/esy-installer" "^0.0.0" 14 | "@esy-ocaml/substs" "^0.0.1" 15 | "@opam/ocamlfind" " >= 1.5.2" 16 | "@opam/yojson" "*" 17 | peerDependencies: 18 | ocaml " >= 4.2.1 < 4.7.0" 19 | 20 | "@esy-ocaml/reason@^3.0.0": 21 | version "3.1.0" 22 | resolved "https://registry.yarnpkg.com/@esy-ocaml/reason/-/reason-3.1.0.tgz#9e77f50622c9268ef4a7cb079ca5150fc2d9140f" 23 | dependencies: 24 | "@esy-ocaml/esy-installer" "^0.0.0" 25 | "@esy-ocaml/substs" "^0.0.1" 26 | "@opam/jbuilder" "*" 27 | "@opam/menhir" " >= 20170418.0.0 <= 20171013.0.0" 28 | "@opam/merlin-extend" " >= 0.3.0" 29 | "@opam/ocaml-migrate-parsetree" "*" 30 | "@opam/ocamlfind" "" 31 | "@opam/result" "*" 32 | 33 | "@esy-ocaml/substs@^0.0.1": 34 | version "0.0.1" 35 | resolved "https://registry.yarnpkg.com/@esy-ocaml/substs/-/substs-0.0.1.tgz#59ebdbbaedcda123fc7ed8fb2b302b7d819e9a46" 36 | 37 | "@opam/base-bytes@*": 38 | version "0.0.0-base" 39 | uid bacd2a20f40952db4c545687d27548ab 40 | resolved "@opam/base-bytes@0.0.0-base-bacd2a20f40952db4c545687d27548ab.tgz" 41 | dependencies: 42 | "@esy-ocaml/esy-installer" "^0.0.0" 43 | "@esy-ocaml/substs" "^0.0.1" 44 | "@opam/ocamlfind" " >= 1.5.3" 45 | peerDependencies: 46 | ocaml " >= 4.2.0" 47 | 48 | "@opam/base-unix@*": 49 | version "0.0.0-base" 50 | uid "04bc004c59f2edca849d38ea6891bb7f" 51 | resolved "@opam/base-unix@0.0.0-base-04bc004c59f2edca849d38ea6891bb7f.tgz" 52 | dependencies: 53 | "@esy-ocaml/esy-installer" "^0.0.0" 54 | "@esy-ocaml/substs" "^0.0.1" 55 | peerDependencies: 56 | ocaml "*" 57 | 58 | "@opam/biniou@ >= 1.2.0": 59 | version "1.2.0" 60 | uid af4880e80be63bbb3043fb7184882eb8 61 | resolved "@opam/biniou@1.2.0-af4880e80be63bbb3043fb7184882eb8.tgz" 62 | dependencies: 63 | "@esy-ocaml/esy-installer" "^0.0.0" 64 | "@esy-ocaml/substs" "^0.0.1" 65 | "@opam/conf-which" "*" 66 | "@opam/easy-format" "*" 67 | "@opam/jbuilder" " >= 1.0.0-beta7" 68 | peerDependencies: 69 | ocaml " >= 4.2.3000" 70 | 71 | "@opam/conf-m4@*": 72 | version "1.0.0" 73 | uid "97f0966b2e2652d02c0d9125781c31df" 74 | resolved "@opam/conf-m4@1.0.0-97f0966b2e2652d02c0d9125781c31df.tgz" 75 | dependencies: 76 | "@esy-ocaml/esy-installer" "^0.0.0" 77 | "@esy-ocaml/substs" "^0.0.1" 78 | peerDependencies: 79 | ocaml "*" 80 | 81 | "@opam/conf-which@*": 82 | version "1.0.0" 83 | uid b7770c8a3ebbb7f8a80c925753375bb8 84 | resolved "@opam/conf-which@1.0.0-b7770c8a3ebbb7f8a80c925753375bb8.tgz" 85 | dependencies: 86 | "@esy-ocaml/esy-installer" "^0.0.0" 87 | "@esy-ocaml/substs" "^0.0.1" 88 | peerDependencies: 89 | ocaml "*" 90 | 91 | "@opam/cppo@*": 92 | version "1.6.4" 93 | uid "0caf37d16727e17fbcd4e9b41a467f91" 94 | resolved "@opam/cppo@1.6.4-0caf37d16727e17fbcd4e9b41a467f91.tgz" 95 | dependencies: 96 | "@esy-ocaml/esy-installer" "^0.0.0" 97 | "@esy-ocaml/substs" "^0.0.1" 98 | "@opam/base-bytes" "*" 99 | "@opam/base-unix" "*" 100 | "@opam/jbuilder" " >= 1.0.0-beta17" 101 | peerDependencies: 102 | ocaml "*" 103 | 104 | "@opam/easy-format@*": 105 | version "1.3.1" 106 | uid "0c2f9b085eba4175086013e7ef48ba05" 107 | resolved "@opam/easy-format@1.3.1-0c2f9b085eba4175086013e7ef48ba05.tgz" 108 | dependencies: 109 | "@esy-ocaml/esy-installer" "^0.0.0" 110 | "@esy-ocaml/substs" "^0.0.1" 111 | "@opam/jbuilder" "*" 112 | peerDependencies: 113 | ocaml " >= 4.2.3000" 114 | 115 | "@opam/jbuilder@ >= 1.0.0-beta10", "@opam/jbuilder@ >= 1.0.0-beta11", "@opam/jbuilder@ >= 1.0.0-beta17", "@opam/jbuilder@ >= 1.0.0-beta7", "@opam/jbuilder@*": 116 | version "1.0.0-beta18" 117 | uid "281d8c71c86a42346d78ad4090b8b945" 118 | resolved "@opam/jbuilder@1.0.0-beta18-281d8c71c86a42346d78ad4090b8b945.tgz" 119 | dependencies: 120 | "@esy-ocaml/esy-installer" "^0.0.0" 121 | "@esy-ocaml/substs" "^0.0.1" 122 | "@opam/ocamlfind" "*" 123 | peerDependencies: 124 | ocaml " >= 4.2.3000" 125 | 126 | "@opam/menhir@ >= 20170418.0.0 <= 20171013.0.0": 127 | version "20171013.0.0" 128 | uid "358990f51123ce9d3629e66b9ead67ee" 129 | resolved "@opam/menhir@20171013.0.0-358990f51123ce9d3629e66b9ead67ee.tgz" 130 | dependencies: 131 | "@esy-ocaml/esy-installer" "^0.0.0" 132 | "@esy-ocaml/substs" "^0.0.1" 133 | "@opam/ocamlbuild" "*" 134 | "@opam/ocamlfind" "*" 135 | peerDependencies: 136 | ocaml " >= 4.2.0" 137 | 138 | "@opam/merlin-extend@ >= 0.3.0": 139 | version "0.3.0" 140 | uid d688ddc39d2c47f4c3083de2fa51bf7e 141 | resolved "@opam/merlin-extend@0.3.0-d688ddc39d2c47f4c3083de2fa51bf7e.tgz" 142 | dependencies: 143 | "@esy-ocaml/esy-installer" "^0.0.0" 144 | "@esy-ocaml/substs" "^0.0.1" 145 | "@opam/cppo" "*" 146 | "@opam/ocamlfind" "*" 147 | peerDependencies: 148 | ocaml " >= 4.2.3000" 149 | 150 | "@opam/ocaml-migrate-parsetree@*": 151 | version "1.0.7" 152 | uid "8dd63da93ee2ed29313f5b50471c94ae" 153 | resolved "@opam/ocaml-migrate-parsetree@1.0.7-8dd63da93ee2ed29313f5b50471c94ae.tgz" 154 | dependencies: 155 | "@esy-ocaml/esy-installer" "^0.0.0" 156 | "@esy-ocaml/substs" "^0.0.1" 157 | "@opam/jbuilder" " >= 1.0.0-beta10" 158 | "@opam/ocamlfind" "*" 159 | "@opam/result" "*" 160 | peerDependencies: 161 | ocaml " >= 4.2.0" 162 | 163 | "@opam/ocamlbuild@*": 164 | version "0.12.0" 165 | uid "4d2353d6f9d4e9f658ffea64707c152a" 166 | resolved "@opam/ocamlbuild@0.12.0-4d2353d6f9d4e9f658ffea64707c152a.tgz" 167 | dependencies: 168 | "@esy-ocaml/esy-installer" "^0.0.0" 169 | "@esy-ocaml/substs" "^0.0.1" 170 | peerDependencies: 171 | ocaml " >= 4.3.0" 172 | 173 | "@opam/ocamlfind@", "@opam/ocamlfind@ >= 1.5.2", "@opam/ocamlfind@ >= 1.5.3", "@opam/ocamlfind@*": 174 | version "1.7.3--1" 175 | uid "2e5446e160cfd1aae7944b2f7add39b7" 176 | resolved "@opam/ocamlfind@1.7.3--1-2e5446e160cfd1aae7944b2f7add39b7.tgz" 177 | dependencies: 178 | "@esy-ocaml/esy-installer" "^0.0.0" 179 | "@esy-ocaml/substs" "^0.0.1" 180 | "@opam/conf-m4" "*" 181 | peerDependencies: 182 | ocaml " >= 3.12.0" 183 | 184 | "@opam/re@*": 185 | version "1.7.2" 186 | uid "3d51cbd58d4882081ab0bbad4ed9e83e" 187 | resolved "@opam/re@1.7.2-3d51cbd58d4882081ab0bbad4ed9e83e.tgz" 188 | dependencies: 189 | "@esy-ocaml/esy-installer" "^0.0.0" 190 | "@esy-ocaml/substs" "^0.0.1" 191 | "@opam/base-bytes" "*" 192 | "@opam/jbuilder" "*" 193 | peerDependencies: 194 | ocaml " >= 4.2.3000" 195 | 196 | "@opam/result@*": 197 | version "1.3.0" 198 | uid "9a01d033485a02ccc143441a46adeb53" 199 | resolved "@opam/result@1.3.0-9a01d033485a02ccc143441a46adeb53.tgz" 200 | dependencies: 201 | "@esy-ocaml/esy-installer" "^0.0.0" 202 | "@esy-ocaml/substs" "^0.0.1" 203 | "@opam/jbuilder" " >= 1.0.0-beta11" 204 | peerDependencies: 205 | ocaml "*" 206 | 207 | "@opam/yojson@*": 208 | version "1.4.1" 209 | uid "1d23ddc5148ccb2ca2e11f0a854d35dd" 210 | resolved "@opam/yojson@1.4.1-1d23ddc5148ccb2ca2e11f0a854d35dd.tgz" 211 | dependencies: 212 | "@esy-ocaml/esy-installer" "^0.0.0" 213 | "@esy-ocaml/substs" "^0.0.1" 214 | "@opam/biniou" " >= 1.2.0" 215 | "@opam/cppo" "*" 216 | "@opam/easy-format" "*" 217 | "@opam/jbuilder" "*" 218 | peerDependencies: 219 | ocaml " >= 4.2.3000" 220 | 221 | ocaml@~4.6.0: 222 | version "4.6.1" 223 | resolved "https://registry.yarnpkg.com/ocaml/-/ocaml-4.6.1.tgz#8babea2c41a9f734313b4fc1841ec0963c9d7a07" 224 | 225 | refmterr@^3.0.4: 226 | version "3.0.7" 227 | resolved "https://registry.yarnpkg.com/refmterr/-/refmterr-3.0.7.tgz#5573f34fb86fb0ead532553b871c5a7c7c5db7e3" 228 | dependencies: 229 | "@esy-ocaml/reason" "^3.0.0" 230 | "@opam/jbuilder" "*" 231 | "@opam/re" "*" 232 | peerDependencies: 233 | ocaml " >= 4.2.0 < 4.7.0" 234 | -------------------------------------------------------------------------------- /internal/GoodValues.re: -------------------------------------------------------------------------------- 1 | /* Getting a value from another module within this directory */ 2 | let message = "value from " ++ Something.format; 3 | 4 | /* Getting a value from an external library (specified in jbuild) */ 5 | let rx = Re.str("hello"); 6 | -------------------------------------------------------------------------------- /internal/Something.ml: -------------------------------------------------------------------------------- 1 | 2 | (* we can have ocaml as well as reason sources *) 3 | let opt = Re.opt 4 | 5 | let format = "OCaml" 6 | 7 | let calculate x = x * 2 -------------------------------------------------------------------------------- /internal/jbuild: -------------------------------------------------------------------------------- 1 | (jbuild_version 1) 2 | 3 | ;; why is this lib internal? 4 | ;; because it doesn't have a public_name 5 | ;; so it won't be exposed to opam as an 6 | ;; installable/distributable library 7 | (library 8 | ((name internal) 9 | (libraries (re)))) -------------------------------------------------------------------------------- /jbuild-ignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /lib/LifeTheUniverseAndEverything.re: -------------------------------------------------------------------------------- 1 | 2 | let answer = 42; 3 | let nested = Nested.value; 4 | -------------------------------------------------------------------------------- /lib/dune: -------------------------------------------------------------------------------- 1 | 2 | (library 3 | (name lib) 4 | ; this will be exported & installable as a library via OPAM 5 | (public_name ReasonNativeProject) 6 | (libraries re)) 7 | 8 | (include_subdirs unqualified) 9 | -------------------------------------------------------------------------------- /lib/sub/Nested.re: -------------------------------------------------------------------------------- 1 | 2 | let value = 34; -------------------------------------------------------------------------------- /lib/sub/sub.opam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reasonml/ReasonNativeProject/ae6eea83f9f9d1beab4fe3ac686a50bbdc33474c/lib/sub/sub.opam -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reason-native-project", 3 | "version": "0.0.1", 4 | "description": "Reason native project", 5 | "NOTE": "This package.json is just a duplication of the opam file. It's here so that you can try building this project with 'esy'.", 6 | "NOTE2": " 'esy' is not yet ready for widespread use, but including this package.json so that you can use esy instead of opam.", 7 | "license": "MIT", 8 | "esy": { 9 | "build": [ 10 | ["refmterr", "jbuilder", "build"] 11 | ], 12 | "install": [ 13 | "esy-installer" 14 | ], 15 | "buildsInSource": "_build" 16 | }, 17 | "dependencies": { 18 | "@esy-ocaml/esy-installer": "^0.0.0", 19 | "@opam/jbuilder": "*", 20 | "@esy-ocaml/reason": "^3.0.0", 21 | "@opam/re": "*", 22 | "refmterr": "^3.0.4" 23 | }, 24 | "peerDependencies": { 25 | "ocaml": "~4.6.0" 26 | }, 27 | "devDependencies": { 28 | "@esy-ocaml/merlin": "3.0.5003", 29 | "ocaml": "~4.6.0" 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /test-with-version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | export OCAML_VERSION="${1}" 6 | 7 | make clean 8 | opam switch "${OCAML_VERSION}" 9 | eval `opam config env` 10 | opam update 11 | opam install -y re 12 | opam pin add -y ReasonNativeProject . 13 | make run 14 | git diff --exit-code 15 | -------------------------------------------------------------------------------- /tests/jbuild: -------------------------------------------------------------------------------- 1 | (jbuild_version 1) 2 | 3 | (executable 4 | ((name test) 5 | (libraries (internal)))) 6 | 7 | (alias 8 | ((name runtest) 9 | (deps (test.exe)) 10 | (action (run ${<})))) 11 | -------------------------------------------------------------------------------- /tests/test.re: -------------------------------------------------------------------------------- 1 | 2 | let res = Internal.Something.calculate 4; 3 | let main () => { 4 | if (Internal.Something.calculate 4 != 8) { 5 | print_endline "Test failure!!"; 6 | exit 1; 7 | } else { 8 | print_endline "Tests passed"; 9 | exit 0; 10 | } 11 | }; 12 | 13 | main(); --------------------------------------------------------------------------------