From 0d2c28a7efb35437767b02aad2285e259779bdbf Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 12 May 2017 21:32:02 -0400 Subject: [PATCH 01/19] jbuilderify opam file --- opam | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/opam b/opam index 5bd3e3b..49c0b5b 100644 --- a/opam +++ b/opam @@ -12,12 +12,11 @@ doc: "https://reasonml.github.io/ReasonNativeProject/" bug-reports: "https://github.com/reasonml/ReasonNativeProject/issues" dev-repo: "git://github.com/reasonml/ReasonNativeProject.git" tags: [ "reason" "example" ] -substs: [ "pkg/META" ] build: [ - [make "build"] + ["jbuilder" "build" "-p" name "-j" jobs] ] depends: [ - "topkg" {>= "0.8.1" & < "0.9"} + "jbuilder" {build} "reason" {= "1.13.3"} ] available: [ ocaml-version >= "4.02" & ocaml-version < "4.05" ] From 054f77bf7d359b9934b78d5f4927e57ad0c98cea Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 12 May 2017 21:52:36 -0400 Subject: [PATCH 02/19] Remove old build files and make opam name reason compatible --- .merlin | 6 ------ _tags | 1 - pkg/META.in | 7 ------- pkg/build.ml | 17 ----------------- opam => react-native-project.opam | 0 5 files changed, 31 deletions(-) delete mode 100644 .merlin delete mode 100644 _tags delete mode 100644 pkg/META.in delete mode 100644 pkg/build.ml rename opam => react-native-project.opam (100%) diff --git a/.merlin b/.merlin deleted file mode 100644 index 7893d97..0000000 --- a/.merlin +++ /dev/null @@ -1,6 +0,0 @@ -# This is a Merlin configuration file that enables your editor integration -# https://github.com/ocaml/merlin/wiki/project-configuration - -PKG topkg reason # the OPAM packages -B ./_build/src # built artifacts location -S ./src # source location diff --git a/_tags b/_tags deleted file mode 100644 index 3a10ef5..0000000 --- a/_tags +++ /dev/null @@ -1 +0,0 @@ -: -traverse diff --git a/pkg/META.in b/pkg/META.in deleted file mode 100644 index f9d0e0e..0000000 --- a/pkg/META.in +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2015-present, Facebook, Inc. All rights reserved. - -version = "%{version}%" -description = "ReasonNativeProject: Example project for Reason" - -archive(byte) = "ReasonNativeProject.cma" -archive(native) = "ReasonNativeProject.cmxa" diff --git a/pkg/build.ml b/pkg/build.ml deleted file mode 100644 index 1188890..0000000 --- a/pkg/build.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* http://erratique.ch/software/topkg/doc/Topkg.html#basics *) - -open Topkg - -let () = - let cmd c os files = - let ocamlbuild = Conf.tool "rebuild" os in - OS.Cmd.run @@ Cmd.(ocamlbuild % "-use-ocamlfind" - %% (v "-I" % "src") - %% of_list files) - in - let build = Pkg.build ~cmd () in - Pkg.describe "ReasonNativeProject" ~build ~change_logs:[] ~licenses:[] ~readmes:[] (fun c -> - Ok [ - Pkg.lib "pkg/META"; - Pkg.bin ~auto:true ~dst:"test" "src/test"; - ]) diff --git a/opam b/react-native-project.opam similarity index 100% rename from opam rename to react-native-project.opam From ebdc7c7ecfcbf7427adcab859dec0ebf8694bd25 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 12 May 2017 21:52:52 -0400 Subject: [PATCH 03/19] update gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 213ffe7..f0c113d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,5 @@ _build/** *.byte *.install pkg/META - +.merlin /node_modules/ From 010b0865aac9f3db1d6cfed6842382333f38f034 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 12 May 2017 21:53:03 -0400 Subject: [PATCH 04/19] Update makefile to use jbuilder --- Makefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 3f2310c..5c79735 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,8 @@ -# topkg (https://github.com/dbuenzli/topkg) is a small native packager for your lib -# http://erratique.ch/software/topkg/doc/Topkg.html#basics build: - cp pkg/META.in pkg/META - ocamlbuild -package topkg pkg/build.native - ./build.native build + jbuilder build + +test: + jbuilder runtest # some boilerplate to publish a new version to GitHub release: @@ -14,6 +13,6 @@ release: git push "git@github.com:reasonml/ReasonNativeProject.git" tag $(version) clean: - ocamlbuild -clean + rm -rf _build -.PHONY: build release +.PHONY: build release test From 3481c923d8515e1e722b253a03723abc5accf4c3 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 12 May 2017 21:53:12 -0400 Subject: [PATCH 05/19] jbuild file --- src/jbuild | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/jbuild diff --git a/src/jbuild b/src/jbuild new file mode 100644 index 0000000..7859994 --- /dev/null +++ b/src/jbuild @@ -0,0 +1,5 @@ +(jbuild_version 1) + +(executable + ((name test) + (public_name react_native_project))) From 5a2726eff66d3d3ba2aaf6171f250695270f3e6c Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 12 May 2017 22:48:42 -0400 Subject: [PATCH 06/19] s/react/reason/ --- react-native-project.opam => reason-native-project.opam | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename react-native-project.opam => reason-native-project.opam (100%) diff --git a/react-native-project.opam b/reason-native-project.opam similarity index 100% rename from react-native-project.opam rename to reason-native-project.opam From a0625fa8badc56e0082157dc6893dfecd51bc4cd Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 12 May 2017 23:58:12 -0400 Subject: [PATCH 07/19] Show 4 uses of jbuilder * Using external dep * Internal library * Library for opam export * Binary --- internal-lib/jbuild | 7 +++++++ internal-lib/m1.ml | 3 +++ internal-lib/m2.re | 2 ++ reason-native-lib.opam | 22 ++++++++++++++++++++++ reason-native-lib/jbuild | 6 ++++++ reason-native-lib/m1.re | 2 ++ reason-native-project.opam | 1 + reason-native-project/jbuild | 7 +++++++ {src => reason-native-project}/test.re | 2 ++ src/jbuild | 5 ----- 10 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 internal-lib/jbuild create mode 100644 internal-lib/m1.ml create mode 100644 internal-lib/m2.re create mode 100644 reason-native-lib.opam create mode 100644 reason-native-lib/jbuild create mode 100644 reason-native-lib/m1.re create mode 100644 reason-native-project/jbuild rename {src => reason-native-project}/test.re (68%) delete mode 100644 src/jbuild diff --git a/internal-lib/jbuild b/internal-lib/jbuild new file mode 100644 index 0000000..eb783fa --- /dev/null +++ b/internal-lib/jbuild @@ -0,0 +1,7 @@ +(jbuild_version 1) + +;; why is this lib internal? +;; because it doesn't have a public_name +(library + ((name internal_lib) + (libraries (re)))) \ No newline at end of file diff --git a/internal-lib/m1.ml b/internal-lib/m1.ml new file mode 100644 index 0000000..6163447 --- /dev/null +++ b/internal-lib/m1.ml @@ -0,0 +1,3 @@ + +(* we can have ocaml as well as reason sources *) +let opt = Re.opt diff --git a/internal-lib/m2.re b/internal-lib/m2.re new file mode 100644 index 0000000..fa87917 --- /dev/null +++ b/internal-lib/m2.re @@ -0,0 +1,2 @@ + +let y = "testing" \ No newline at end of file diff --git a/reason-native-lib.opam b/reason-native-lib.opam new file mode 100644 index 0000000..49c0b5b --- /dev/null +++ b/reason-native-lib.opam @@ -0,0 +1,22 @@ +opam-version: "1.2" +name: "ReasonNativeProject" +version: "0.0.1" +maintainer: "Jordan Walke " +authors: [ + "Jordan Walke " + "Maxwell Bernstein " +] +license: "BSD" +homepage: "https://github.com/reasonml/ReasonNativeProject" +doc: "https://reasonml.github.io/ReasonNativeProject/" +bug-reports: "https://github.com/reasonml/ReasonNativeProject/issues" +dev-repo: "git://github.com/reasonml/ReasonNativeProject.git" +tags: [ "reason" "example" ] +build: [ + ["jbuilder" "build" "-p" name "-j" jobs] +] +depends: [ + "jbuilder" {build} + "reason" {= "1.13.3"} +] +available: [ ocaml-version >= "4.02" & ocaml-version < "4.05" ] diff --git a/reason-native-lib/jbuild b/reason-native-lib/jbuild new file mode 100644 index 0000000..ba515fc --- /dev/null +++ b/reason-native-lib/jbuild @@ -0,0 +1,6 @@ +(jbuild_version 1) + +(library + ((name reason_native_lib) + (public_name reason-native-lib) + (libraries (re)))) \ No newline at end of file diff --git a/reason-native-lib/m1.re b/reason-native-lib/m1.re new file mode 100644 index 0000000..0c929c3 --- /dev/null +++ b/reason-native-lib/m1.re @@ -0,0 +1,2 @@ + +let answer = 42; \ No newline at end of file diff --git a/reason-native-project.opam b/reason-native-project.opam index 49c0b5b..3971206 100644 --- a/reason-native-project.opam +++ b/reason-native-project.opam @@ -17,6 +17,7 @@ build: [ ] depends: [ "jbuilder" {build} + "reason-native-lib" "reason" {= "1.13.3"} ] available: [ ocaml-version >= "4.02" & ocaml-version < "4.05" ] diff --git a/reason-native-project/jbuild b/reason-native-project/jbuild new file mode 100644 index 0000000..b127433 --- /dev/null +++ b/reason-native-project/jbuild @@ -0,0 +1,7 @@ +(jbuild_version 1) + +(executable + ((libraries (internal_lib reason-native-lib)) + (package reason-native-project) + (name test) + (public_name react_native_project))) diff --git a/src/test.re b/reason-native-project/test.re similarity index 68% rename from src/test.re rename to reason-native-project/test.re index f6f03c9..6bff471 100644 --- a/src/test.re +++ b/reason-native-project/test.re @@ -7,3 +7,5 @@ print_string msg; print_newline (); print_string "!!!!!!\n"; +let a = Reason_native_lib.M1.answer; +Printf.printf "Answer: %d\n" a \ No newline at end of file diff --git a/src/jbuild b/src/jbuild deleted file mode 100644 index 7859994..0000000 --- a/src/jbuild +++ /dev/null @@ -1,5 +0,0 @@ -(jbuild_version 1) - -(executable - ((name test) - (public_name react_native_project))) From 40bd8f9d8fc175caa498393699371b0e909a6eba Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sat, 13 May 2017 00:41:06 -0400 Subject: [PATCH 08/19] stick to 1 opam project --- reason-native-lib.opam | 22 ---------------------- reason-native-lib/jbuild | 2 +- reason-native-project/jbuild | 3 +-- 3 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 reason-native-lib.opam diff --git a/reason-native-lib.opam b/reason-native-lib.opam deleted file mode 100644 index 49c0b5b..0000000 --- a/reason-native-lib.opam +++ /dev/null @@ -1,22 +0,0 @@ -opam-version: "1.2" -name: "ReasonNativeProject" -version: "0.0.1" -maintainer: "Jordan Walke " -authors: [ - "Jordan Walke " - "Maxwell Bernstein " -] -license: "BSD" -homepage: "https://github.com/reasonml/ReasonNativeProject" -doc: "https://reasonml.github.io/ReasonNativeProject/" -bug-reports: "https://github.com/reasonml/ReasonNativeProject/issues" -dev-repo: "git://github.com/reasonml/ReasonNativeProject.git" -tags: [ "reason" "example" ] -build: [ - ["jbuilder" "build" "-p" name "-j" jobs] -] -depends: [ - "jbuilder" {build} - "reason" {= "1.13.3"} -] -available: [ ocaml-version >= "4.02" & ocaml-version < "4.05" ] diff --git a/reason-native-lib/jbuild b/reason-native-lib/jbuild index ba515fc..8126ccd 100644 --- a/reason-native-lib/jbuild +++ b/reason-native-lib/jbuild @@ -2,5 +2,5 @@ (library ((name reason_native_lib) - (public_name reason-native-lib) + (public_name reason-native-project) (libraries (re)))) \ No newline at end of file diff --git a/reason-native-project/jbuild b/reason-native-project/jbuild index b127433..79cf7a1 100644 --- a/reason-native-project/jbuild +++ b/reason-native-project/jbuild @@ -1,7 +1,6 @@ (jbuild_version 1) (executable - ((libraries (internal_lib reason-native-lib)) - (package reason-native-project) + ((libraries (internal_lib reason-native-project)) (name test) (public_name react_native_project))) From 17b40a4978d76fe7ba5b393053f49106cfaa4af6 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sat, 13 May 2017 00:41:14 -0400 Subject: [PATCH 09/19] improve clean target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5c79735..938f923 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,6 @@ release: git push "git@github.com:reasonml/ReasonNativeProject.git" tag $(version) clean: - rm -rf _build + rm -rf _build *.install .PHONY: build release test From 55f1fdd746c4906e0b51f724e38a5f1ceb006ab5 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 12 Jun 2017 20:30:22 -0600 Subject: [PATCH 10/19] move things around, add docs --- Makefile | 3 +++ internal-lib/m2.re | 2 -- {internal-lib => internal_lib}/jbuild | 0 {internal-lib => internal_lib}/m1.ml | 2 ++ internal_lib/m2.re | 8 ++++++++ reason-native-project/jbuild | 6 ------ {reason-native-lib => reason_native_lib}/jbuild | 1 + {reason-native-lib => reason_native_lib}/m1.re | 0 reason_native_project/jbuild | 8 ++++++++ {reason-native-project => reason_native_project}/test.re | 1 + 10 files changed, 23 insertions(+), 8 deletions(-) delete mode 100644 internal-lib/m2.re rename {internal-lib => internal_lib}/jbuild (100%) rename {internal-lib => internal_lib}/m1.ml (76%) create mode 100644 internal_lib/m2.re delete mode 100644 reason-native-project/jbuild rename {reason-native-lib => reason_native_lib}/jbuild (64%) rename {reason-native-lib => reason_native_lib}/m1.re (100%) create mode 100644 reason_native_project/jbuild rename {reason-native-project => reason_native_project}/test.re (86%) diff --git a/Makefile b/Makefile index 938f923..06f8077 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ build: jbuilder build +run: build + ./_build/install/default/bin/react_native_project + test: jbuilder runtest diff --git a/internal-lib/m2.re b/internal-lib/m2.re deleted file mode 100644 index fa87917..0000000 --- a/internal-lib/m2.re +++ /dev/null @@ -1,2 +0,0 @@ - -let y = "testing" \ No newline at end of file diff --git a/internal-lib/jbuild b/internal_lib/jbuild similarity index 100% rename from internal-lib/jbuild rename to internal_lib/jbuild diff --git a/internal-lib/m1.ml b/internal_lib/m1.ml similarity index 76% rename from internal-lib/m1.ml rename to internal_lib/m1.ml index 6163447..3e171c6 100644 --- a/internal-lib/m1.ml +++ b/internal_lib/m1.ml @@ -1,3 +1,5 @@ (* we can have ocaml as well as reason sources *) let opt = Re.opt + +let format = "OCaml" \ No newline at end of file diff --git a/internal_lib/m2.re b/internal_lib/m2.re new file mode 100644 index 0000000..799aeda --- /dev/null +++ b/internal_lib/m2.re @@ -0,0 +1,8 @@ + +let y = "testing"; + +/* Getting a value from another file within this directory */ +let z = "value from " ^ (M1.format); + +/* Getting a value from a library (specified in ./jbuild) */ +let rx = Re.str "hello"; \ No newline at end of file diff --git a/reason-native-project/jbuild b/reason-native-project/jbuild deleted file mode 100644 index 79cf7a1..0000000 --- a/reason-native-project/jbuild +++ /dev/null @@ -1,6 +0,0 @@ -(jbuild_version 1) - -(executable - ((libraries (internal_lib reason-native-project)) - (name test) - (public_name react_native_project))) diff --git a/reason-native-lib/jbuild b/reason_native_lib/jbuild similarity index 64% rename from reason-native-lib/jbuild rename to reason_native_lib/jbuild index 8126ccd..477638e 100644 --- a/reason-native-lib/jbuild +++ b/reason_native_lib/jbuild @@ -2,5 +2,6 @@ (library ((name reason_native_lib) + ; this will be exported & installable as a library via OPAM (public_name reason-native-project) (libraries (re)))) \ No newline at end of file diff --git a/reason-native-lib/m1.re b/reason_native_lib/m1.re similarity index 100% rename from reason-native-lib/m1.re rename to reason_native_lib/m1.re diff --git a/reason_native_project/jbuild b/reason_native_project/jbuild new file mode 100644 index 0000000..4136b71 --- /dev/null +++ b/reason_native_project/jbuild @@ -0,0 +1,8 @@ +(jbuild_version 1) + +(executable + ((name test) + ; This will be installable as a global binary via opam + (public_name react_native_project) + ; and it depends on 2 local libraries + (libraries (internal_lib reason-native-project)))) diff --git a/reason-native-project/test.re b/reason_native_project/test.re similarity index 86% rename from reason-native-project/test.re rename to reason_native_project/test.re index 6bff471..d0e2d7d 100644 --- a/reason-native-project/test.re +++ b/reason_native_project/test.re @@ -6,6 +6,7 @@ let msg = "Hello Reason!"; print_string msg; print_newline (); print_string "!!!!!!\n"; +print_endline Internal_lib.M2.z; let a = Reason_native_lib.M1.answer; Printf.printf "Answer: %d\n" a \ No newline at end of file From ca541c5cc8841f3cb3c7c940973e257d7a439ec7 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 12 Jun 2017 20:45:42 -0600 Subject: [PATCH 11/19] fix opam and stuff --- reason-native-project.opam | 3 +-- test-with-version.sh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/reason-native-project.opam b/reason-native-project.opam index 3971206..f82f56f 100644 --- a/reason-native-project.opam +++ b/reason-native-project.opam @@ -17,7 +17,6 @@ build: [ ] depends: [ "jbuilder" {build} - "reason-native-lib" - "reason" {= "1.13.3"} + "reason" {= "2.0.0"} ] available: [ ocaml-version >= "4.02" & ocaml-version < "4.05" ] diff --git a/test-with-version.sh b/test-with-version.sh index 077975f..7cd62bd 100755 --- a/test-with-version.sh +++ b/test-with-version.sh @@ -9,6 +9,5 @@ opam switch "${OCAML_VERSION}" eval `opam config env` opam update opam pin add -y ReasonNativeProject . -make -./test.native +make run git diff --exit-code From 85dbb296bac911348b9d809894288283b89e268e Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 12 Jun 2017 20:53:37 -0600 Subject: [PATCH 12/19] fix opam --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index de5a771..f2296aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ before_install: - eval `opam config env` - opam update before_script: - - opam pin add -y ReasonNativeProject . + - opam pin add -y reason-native-project . script: - ./test-with-version.sh "$OCAML_VERSION" - git diff --exit-code From ced967063517b9ec11d2b65ce53939cb5f85df30 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 12 Jun 2017 21:56:25 -0600 Subject: [PATCH 13/19] renames --- Makefile | 2 +- reason_native_lib/jbuild | 2 +- reason-native-project.opam => reason_native_project.opam | 0 reason_native_project/jbuild | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) rename reason-native-project.opam => reason_native_project.opam (100%) diff --git a/Makefile b/Makefile index 06f8077..4e6af4b 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ build: jbuilder build run: build - ./_build/install/default/bin/react_native_project + ./_build/install/default/bin/reason_native_project test: jbuilder runtest diff --git a/reason_native_lib/jbuild b/reason_native_lib/jbuild index 477638e..1adbd17 100644 --- a/reason_native_lib/jbuild +++ b/reason_native_lib/jbuild @@ -3,5 +3,5 @@ (library ((name reason_native_lib) ; this will be exported & installable as a library via OPAM - (public_name reason-native-project) + (public_name reason_native_project) (libraries (re)))) \ No newline at end of file diff --git a/reason-native-project.opam b/reason_native_project.opam similarity index 100% rename from reason-native-project.opam rename to reason_native_project.opam diff --git a/reason_native_project/jbuild b/reason_native_project/jbuild index 4136b71..c3cf434 100644 --- a/reason_native_project/jbuild +++ b/reason_native_project/jbuild @@ -3,6 +3,6 @@ (executable ((name test) ; This will be installable as a global binary via opam - (public_name react_native_project) + (public_name reason_native_project) ; and it depends on 2 local libraries - (libraries (internal_lib reason-native-project)))) + (libraries (internal_lib reason_native_project)))) From 9018b3dec3dd160e73a398c43f101ddbc22c17f7 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 12 Jun 2017 22:14:43 -0600 Subject: [PATCH 14/19] move things more --- {reason_native_project => bin}/jbuild | 4 ++-- {reason_native_project => bin}/test.re | 4 ++-- {internal_lib => internal}/jbuild | 4 +++- {internal_lib => internal}/m1.ml | 0 {internal_lib => internal}/m2.re | 0 {reason_native_lib => lib}/jbuild | 2 +- {reason_native_lib => lib}/m1.re | 0 7 files changed, 8 insertions(+), 6 deletions(-) rename {reason_native_project => bin}/jbuild (52%) rename {reason_native_project => bin}/test.re (71%) rename {internal_lib => internal}/jbuild (55%) rename {internal_lib => internal}/m1.ml (100%) rename {internal_lib => internal}/m2.re (100%) rename {reason_native_lib => lib}/jbuild (84%) rename {reason_native_lib => lib}/m1.re (100%) diff --git a/reason_native_project/jbuild b/bin/jbuild similarity index 52% rename from reason_native_project/jbuild rename to bin/jbuild index c3cf434..479dffe 100644 --- a/reason_native_project/jbuild +++ b/bin/jbuild @@ -2,7 +2,7 @@ (executable ((name test) - ; This will be installable as a global binary via opam + ; This will be installable as a global binary (public_name reason_native_project) ; and it depends on 2 local libraries - (libraries (internal_lib reason_native_project)))) + (libraries (lib internal)))) diff --git a/reason_native_project/test.re b/bin/test.re similarity index 71% rename from reason_native_project/test.re rename to bin/test.re index d0e2d7d..99d0282 100644 --- a/reason_native_project/test.re +++ b/bin/test.re @@ -6,7 +6,7 @@ let msg = "Hello Reason!"; print_string msg; print_newline (); print_string "!!!!!!\n"; -print_endline Internal_lib.M2.z; +print_endline Internal.M2.z; -let a = Reason_native_lib.M1.answer; +let a = Lib.M1.answer; Printf.printf "Answer: %d\n" a \ No newline at end of file diff --git a/internal_lib/jbuild b/internal/jbuild similarity index 55% rename from internal_lib/jbuild rename to internal/jbuild index eb783fa..ffeca5f 100644 --- a/internal_lib/jbuild +++ b/internal/jbuild @@ -2,6 +2,8 @@ ;; why is this lib internal? ;; because it doesn't have a public_name +;; so it won't be exposed to opam as an +;; installable/distributable library (library - ((name internal_lib) + ((name internal) (libraries (re)))) \ No newline at end of file diff --git a/internal_lib/m1.ml b/internal/m1.ml similarity index 100% rename from internal_lib/m1.ml rename to internal/m1.ml diff --git a/internal_lib/m2.re b/internal/m2.re similarity index 100% rename from internal_lib/m2.re rename to internal/m2.re diff --git a/reason_native_lib/jbuild b/lib/jbuild similarity index 84% rename from reason_native_lib/jbuild rename to lib/jbuild index 1adbd17..608e030 100644 --- a/reason_native_lib/jbuild +++ b/lib/jbuild @@ -1,7 +1,7 @@ (jbuild_version 1) (library - ((name reason_native_lib) + ((name lib) ; this will be exported & installable as a library via OPAM (public_name reason_native_project) (libraries (re)))) \ No newline at end of file diff --git a/reason_native_lib/m1.re b/lib/m1.re similarity index 100% rename from reason_native_lib/m1.re rename to lib/m1.re From f4c81de55dae89d418462cdf12f806110ddb053c Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 12 Jun 2017 22:21:23 -0600 Subject: [PATCH 15/19] more renamings --- Makefile | 2 +- reason_native_project.opam => ReasonNativeProject.opam | 0 bin/jbuild | 2 +- bin/test.re | 4 ++-- internal/GoodValues.re | 6 ++++++ internal/{m1.ml => Something.ml} | 0 internal/m2.re | 8 -------- lib/{m1.re => LifeTheUniverseAndEverything.re} | 0 lib/jbuild | 2 +- 9 files changed, 11 insertions(+), 13 deletions(-) rename reason_native_project.opam => ReasonNativeProject.opam (100%) create mode 100644 internal/GoodValues.re rename internal/{m1.ml => Something.ml} (100%) delete mode 100644 internal/m2.re rename lib/{m1.re => LifeTheUniverseAndEverything.re} (100%) diff --git a/Makefile b/Makefile index 4e6af4b..4db0a36 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ build: jbuilder build run: build - ./_build/install/default/bin/reason_native_project + ./_build/install/default/bin/reason-native-bin test: jbuilder runtest diff --git a/reason_native_project.opam b/ReasonNativeProject.opam similarity index 100% rename from reason_native_project.opam rename to ReasonNativeProject.opam diff --git a/bin/jbuild b/bin/jbuild index 479dffe..26496b0 100644 --- a/bin/jbuild +++ b/bin/jbuild @@ -3,6 +3,6 @@ (executable ((name test) ; This will be installable as a global binary - (public_name reason_native_project) + (public_name reason-native-bin) ; and it depends on 2 local libraries (libraries (lib internal)))) diff --git a/bin/test.re b/bin/test.re index 99d0282..42c2340 100644 --- a/bin/test.re +++ b/bin/test.re @@ -6,7 +6,7 @@ let msg = "Hello Reason!"; print_string msg; print_newline (); print_string "!!!!!!\n"; -print_endline Internal.M2.z; +print_endline Internal.GoodValues.message; -let a = Lib.M1.answer; +let a = Lib.LifeTheUniverseAndEverything.answer; Printf.printf "Answer: %d\n" a \ No newline at end of file diff --git a/internal/GoodValues.re b/internal/GoodValues.re new file mode 100644 index 0000000..1b6893a --- /dev/null +++ b/internal/GoodValues.re @@ -0,0 +1,6 @@ + +/* Getting a value from another module within this directory */ +let message = "value from " ^ (Something.format); + +/* Getting a value from an external library (specified in jbuild) */ +let rx = Re.str "hello"; \ No newline at end of file diff --git a/internal/m1.ml b/internal/Something.ml similarity index 100% rename from internal/m1.ml rename to internal/Something.ml diff --git a/internal/m2.re b/internal/m2.re deleted file mode 100644 index 799aeda..0000000 --- a/internal/m2.re +++ /dev/null @@ -1,8 +0,0 @@ - -let y = "testing"; - -/* Getting a value from another file within this directory */ -let z = "value from " ^ (M1.format); - -/* Getting a value from a library (specified in ./jbuild) */ -let rx = Re.str "hello"; \ No newline at end of file diff --git a/lib/m1.re b/lib/LifeTheUniverseAndEverything.re similarity index 100% rename from lib/m1.re rename to lib/LifeTheUniverseAndEverything.re diff --git a/lib/jbuild b/lib/jbuild index 608e030..f7bca70 100644 --- a/lib/jbuild +++ b/lib/jbuild @@ -3,5 +3,5 @@ (library ((name lib) ; this will be exported & installable as a library via OPAM - (public_name reason_native_project) + (public_name ReasonNativeProject) (libraries (re)))) \ No newline at end of file From b067c6671ff54cc9a5cb3174cfa5f2a765b08adb Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 12 Jun 2017 22:35:10 -0600 Subject: [PATCH 16/19] add sub library --- lib/LifeTheUniverseAndEverything.re | 3 ++- lib/jbuild | 2 +- lib/sub/Nested.re | 2 ++ lib/sub/jbuild | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 lib/sub/Nested.re create mode 100644 lib/sub/jbuild diff --git a/lib/LifeTheUniverseAndEverything.re b/lib/LifeTheUniverseAndEverything.re index 0c929c3..d912447 100644 --- a/lib/LifeTheUniverseAndEverything.re +++ b/lib/LifeTheUniverseAndEverything.re @@ -1,2 +1,3 @@ -let answer = 42; \ No newline at end of file +let answer = 42; +let nested = Sub.Nested.value; \ No newline at end of file diff --git a/lib/jbuild b/lib/jbuild index f7bca70..c3e81a8 100644 --- a/lib/jbuild +++ b/lib/jbuild @@ -4,4 +4,4 @@ ((name lib) ; this will be exported & installable as a library via OPAM (public_name ReasonNativeProject) - (libraries (re)))) \ No newline at end of file + (libraries (re sub)))) \ No newline at end of file diff --git a/lib/sub/Nested.re b/lib/sub/Nested.re new file mode 100644 index 0000000..787d95d --- /dev/null +++ b/lib/sub/Nested.re @@ -0,0 +1,2 @@ + +let value = 34; \ No newline at end of file diff --git a/lib/sub/jbuild b/lib/sub/jbuild new file mode 100644 index 0000000..f40ec04 --- /dev/null +++ b/lib/sub/jbuild @@ -0,0 +1,4 @@ +(jbuild_version 1) + +(library + ((name sub))) From 0078970837e818111f124caa0e86e95c02358c15 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 12 Jun 2017 23:28:13 -0600 Subject: [PATCH 17/19] add test directory --- internal/Something.ml | 4 +++- tests/jbuild | 10 ++++++++++ tests/test.re | 13 +++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/jbuild create mode 100644 tests/test.re diff --git a/internal/Something.ml b/internal/Something.ml index 3e171c6..44ef0ac 100644 --- a/internal/Something.ml +++ b/internal/Something.ml @@ -2,4 +2,6 @@ (* we can have ocaml as well as reason sources *) let opt = Re.opt -let format = "OCaml" \ No newline at end of file +let format = "OCaml" + +let calculate x = x * 2 \ No newline at end of file diff --git a/tests/jbuild b/tests/jbuild new file mode 100644 index 0000000..ad047b1 --- /dev/null +++ b/tests/jbuild @@ -0,0 +1,10 @@ +(jbuild_version 1) + +(executable + ((name test) + (libraries (internal)))) + +(alias + ((name runtest) + (deps (test.exe)) + (action (run ${<})))) diff --git a/tests/test.re b/tests/test.re new file mode 100644 index 0000000..6fbaf75 --- /dev/null +++ b/tests/test.re @@ -0,0 +1,13 @@ + +let res = Internal.Something.calculate 4; +let main () => { + if (Internal.Something.calculate 4 != 8) { + print_endline "Test failure!!"; + exit 1; + } else { + print_endline "Tests passed"; + exit 0; + } +}; + +main(); \ No newline at end of file From 8f1a48ee270afbc44ddafcfe8e5f866118e72da5 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Tue, 13 Jun 2017 09:04:18 -0600 Subject: [PATCH 18/19] fix travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f2296aa..b7c42ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,9 @@ before_install: - eval `opam config env` - opam update before_script: - - opam pin add -y reason-native-project . + - opam pin add -y ReasonNativeProject . script: - - ./test-with-version.sh "$OCAML_VERSION" + - make run - git diff --exit-code env: - OCAML_VERSION=4.02.3 From 42e771eff72f6c094d9c3290eb1cf0841dc8585d Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Tue, 13 Jun 2017 10:27:43 -0600 Subject: [PATCH 19/19] add re dep --- .travis.yml | 1 + test-with-version.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b7c42ae..e6dc974 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ before_install: - opam switch "$OCAML_VERSION" - eval `opam config env` - opam update + - opam install -y re before_script: - opam pin add -y ReasonNativeProject . script: diff --git a/test-with-version.sh b/test-with-version.sh index 7cd62bd..e6fcef8 100755 --- a/test-with-version.sh +++ b/test-with-version.sh @@ -8,6 +8,7 @@ make clean opam switch "${OCAML_VERSION}" eval `opam config env` opam update +opam install -y re opam pin add -y ReasonNativeProject . make run git diff --exit-code