From 0d2c28a7efb35437767b02aad2285e259779bdbf Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 12 May 2017 21:32:02 -0400 Subject: [PATCH 1/9] 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 2/9] 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 3/9] 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 4/9] 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 5/9] 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 6/9] 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 7/9] 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 8/9] 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 9/9] 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