From a6b75564e71b1cfba291fdf28bddb6f93f6b9371 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 23 Nov 2018 18:53:45 -0800 Subject: [PATCH 01/17] Initial Windows fixes --- src/analyze/BuildSystem.re | 32 ++++++++++++++-------- src/analyze/State.re | 2 -- src/analyze_example_tests/ExamplesTests.re | 12 ++++---- util/Infix.re | 2 +- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/analyze/BuildSystem.re b/src/analyze/BuildSystem.re index e9b82ff8..5755736a 100644 --- a/src/analyze/BuildSystem.re +++ b/src/analyze/BuildSystem.re @@ -1,4 +1,3 @@ - type target = | Js | Bytecode @@ -130,10 +129,21 @@ let detect = (rootPath, bsconfig) => { let getEsyCompiledBase = (root) => { let env = Unix.environment()->Array.to_list; - switch(Utils.getEnvVar(~env, "cur__original_root"), Utils.getEnvVar(~env, "cur__target_dir")) { - | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(projectRoot, targetDir)) - | (_, _) => - switch (Commands.execResult("esy command-env --json")) { + let correctSlashesOnWindows = (p) => { + if (Sys.win32) { + let slashRegex = Str.regexp("/"); + Str.global_replace(slashRegex, "\\\\", p); + } else { + p + } + }; + + let prevCwd = Unix.getcwd(); + Unix.chdir(root); + let res = Commands.execResult("esy command-env --json") + Unix.chdir(prevCwd); + + switch (res) { | Ok(commandEnv) => switch (Json.parse(commandEnv)) { | exception (Failure(message)) => @@ -149,14 +159,13 @@ let getEsyCompiledBase = (root) => { Json.get("cur__original_root", json) |?> Json.string, Json.get("cur__target_dir", json) |?> Json.string, ) { - | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(projectRoot, targetDir)) + | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(correctSlashesOnWindows(projectRoot), correctSlashesOnWindows(targetDir))) | _ => Error("Couldn't find Esy target directory (missing json entries)") } ) } | err => err } - } }; let getCompiledBase = (root, buildSystem) => { @@ -219,7 +228,7 @@ let getStdlib = (base, buildSystem) => { switch (Utils.getEnvVar(~env, "OCAMLLIB")) { | Some(esy_ocamllib) => Ok([esy_ocamllib]) | None => - let%try_wrap esy_ocamllib = getLine("esy -q sh -- -c 'echo $OCAMLLIB'", ~pwd=base); + let%try_wrap esy_ocamllib = getLine("esy b echo $OCAMLLIB", ~pwd=base); [esy_ocamllib]; }; | Dune(Opam(switchPrefix)) => @@ -234,10 +243,11 @@ let isRunningInEsyNamedSandbox = () => { }; let getExecutableInEsyPath = (exeName, ~pwd) => { + let whichCommand = Sys.win32 ? "where" : "which" if (isRunningInEsyNamedSandbox()) { - getLine("which " ++ exeName, ~pwd) + getLine(whichCommand ++ " " ++ exeName, ~pwd) } else { - getLine("esy which " ++ exeName, ~pwd) + getLine("esy " ++ whichCommand ++ " " ++ exeName, ~pwd) } }; @@ -302,4 +312,4 @@ let inferPackageManager = (projectRoot) => { Log.log("Detected `esy` dependency manager for local use"); Ok(Esy) }; -}; \ No newline at end of file +}; diff --git a/src/analyze/State.re b/src/analyze/State.re index b80d28df..8aaa349f 100644 --- a/src/analyze/State.re +++ b/src/analyze/State.re @@ -361,8 +361,6 @@ let newJbuilderPackage = (~reportDiagnostics, state, rootPath) => { ); }); - - /* print_endline("Getting things"); */ let (otherDirectories, otherFiles) = source |> List.filter(s => s != "." && s != "" && s.[0] != '/') |> optMap(name => { let otherPath = rootPath /+ name; let res = { diff --git a/src/analyze_example_tests/ExamplesTests.re b/src/analyze_example_tests/ExamplesTests.re index 7280bbf4..e0f2f5a4 100644 --- a/src/analyze_example_tests/ExamplesTests.re +++ b/src/analyze_example_tests/ExamplesTests.re @@ -32,12 +32,12 @@ let checkExampleProject = (rootPath, sourcePaths) => { }; let projects = [ - ("example-project", ["src"], "npm install"), - ("example-es6-imports", ["src"], "npm install"), - ("example-react", ["src", "__tests__"], "npm install"), - ("name_with_underscore", ["src"], "npm install"), - ("bs-3.1.5", ["src"], "npm install"), - /* ("example-esy-dune-project", ["lib", "bin"], "esy"), */ + /* ("example-project", ["src"], "npm install"), */ + /* ("example-es6-imports", ["src"], "npm install"), */ + /* ("example-react", ["src", "__tests__"], "npm install"), */ + /* ("name_with_underscore", ["src"], "npm install"), */ + /* ("bs-3.1.5", ["src"], "npm install"), */ + ("example-esy-dune-project", ["lib", "bin"], "esy"), ]; diff --git a/util/Infix.re b/util/Infix.re index 14e64d8b..1107bd7c 100644 --- a/util/Infix.re +++ b/util/Infix.re @@ -34,7 +34,7 @@ let logIfAbsent = (message, x) => switch x { }; let maybeConcat = (a, b) => { - if (b != "" && b.[0] == '/') { + if (b != "" && (b.[0] == '/' || b.[1] == ':')) { b } else { fileConcat(a, b) From 3564e77b71384a71977ca931e52f8df8cdbf3298 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 23 Nov 2018 18:54:29 -0800 Subject: [PATCH 02/17] Enable all tests --- src/analyze_example_tests/ExamplesTests.re | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/analyze_example_tests/ExamplesTests.re b/src/analyze_example_tests/ExamplesTests.re index e0f2f5a4..d3cbc6ca 100644 --- a/src/analyze_example_tests/ExamplesTests.re +++ b/src/analyze_example_tests/ExamplesTests.re @@ -32,11 +32,11 @@ let checkExampleProject = (rootPath, sourcePaths) => { }; let projects = [ - /* ("example-project", ["src"], "npm install"), */ - /* ("example-es6-imports", ["src"], "npm install"), */ - /* ("example-react", ["src", "__tests__"], "npm install"), */ - /* ("name_with_underscore", ["src"], "npm install"), */ - /* ("bs-3.1.5", ["src"], "npm install"), */ + ("example-project", ["src"], "npm install"), + ("example-es6-imports", ["src"], "npm install"), + ("example-react", ["src", "__tests__"], "npm install"), + ("name_with_underscore", ["src"], "npm install"), + ("bs-3.1.5", ["src"], "npm install"), ("example-esy-dune-project", ["lib", "bin"], "esy"), ]; @@ -83,4 +83,4 @@ if (failures == []) { | `FileFail(uri, message) => print_endline("- Failed to get compilation info for " ++ uri ++ " : " ++ message) }); exit(10) -} \ No newline at end of file +} From f5afe2917ab80798d3d20f683be669ce2fec2513 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 23 Nov 2018 18:55:43 -0800 Subject: [PATCH 03/17] Revert changes to State.re --- src/analyze/State.re | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/analyze/State.re b/src/analyze/State.re index 8aaa349f..b80d28df 100644 --- a/src/analyze/State.re +++ b/src/analyze/State.re @@ -361,6 +361,8 @@ let newJbuilderPackage = (~reportDiagnostics, state, rootPath) => { ); }); + + /* print_endline("Getting things"); */ let (otherDirectories, otherFiles) = source |> List.filter(s => s != "." && s != "" && s.[0] != '/') |> optMap(name => { let otherPath = rootPath /+ name; let res = { From 1558a42e0a7ffe27a39db30d129f19e0c80e4aaa Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 23 Nov 2018 18:56:43 -0800 Subject: [PATCH 04/17] Fix up whitespace --- src/analyze/BuildSystem.re | 55 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/analyze/BuildSystem.re b/src/analyze/BuildSystem.re index 5755736a..3003e703 100644 --- a/src/analyze/BuildSystem.re +++ b/src/analyze/BuildSystem.re @@ -1,3 +1,4 @@ + type target = | Js | Bytecode @@ -138,34 +139,34 @@ let getEsyCompiledBase = (root) => { } }; - let prevCwd = Unix.getcwd(); - Unix.chdir(root); - let res = Commands.execResult("esy command-env --json") - Unix.chdir(prevCwd); - - switch (res) { - | Ok(commandEnv) => - switch (Json.parse(commandEnv)) { - | exception (Failure(message)) => - Log.log("Json response"); - Log.log(commandEnv); - Error("Couldn't find Esy target directory (invalid json response: parse fail): " ++ message); - | exception exn => - Log.log(commandEnv); - Error("Couldn't find Esy target directory (invalid json response) " ++ Printexc.to_string(exn)); - | json => - Json.Infix.( - switch ( - Json.get("cur__original_root", json) |?> Json.string, - Json.get("cur__target_dir", json) |?> Json.string, - ) { - | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(correctSlashesOnWindows(projectRoot), correctSlashesOnWindows(targetDir))) - | _ => Error("Couldn't find Esy target directory (missing json entries)") - } - ) - } - | err => err + let prevCwd = Unix.getcwd(); + Unix.chdir(root); + let res = Commands.execResult("esy command-env --json") + Unix.chdir(prevCwd); + + switch (res) { + | Ok(commandEnv) => + switch (Json.parse(commandEnv)) { + | exception (Failure(message)) => + Log.log("Json response"); + Log.log(commandEnv); + Error("Couldn't find Esy target directory (invalid json response: parse fail): " ++ message); + | exception exn => + Log.log(commandEnv); + Error("Couldn't find Esy target directory (invalid json response) " ++ Printexc.to_string(exn)); + | json => + Json.Infix.( + switch ( + Json.get("cur__original_root", json) |?> Json.string, + Json.get("cur__target_dir", json) |?> Json.string, + ) { + | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(correctSlashesOnWindows(projectRoot), correctSlashesOnWindows(targetDir))) + | _ => Error("Couldn't find Esy target directory (missing json entries)") + } + ) } + | err => err + } }; let getCompiledBase = (root, buildSystem) => { From 20c99e1d9f16d63eadaa51a2ab5f0d17955c5956 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 26 Nov 2018 13:51:05 -0800 Subject: [PATCH 05/17] Upgrade esy for Windows --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index e20b8892..cb95d32e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ cache: install: # The x64 is required as a workaround for esy/esy#412 - ps: Install-Product node 8 x64 - - npm install -g esy@0.3.4 + - npm install -g esy@0.4.3 # Retry is necessary due to esy/esy#413 and esy/esy#414 - appveyor-retry esy install From 0bed757184f9ced4c1fed4ee6eed164a936bbb31 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 26 Nov 2018 14:08:54 -0800 Subject: [PATCH 06/17] Factor out 'withCwd' logic --- util/Commands.re | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/util/Commands.re b/util/Commands.re index 80f7dd2a..2b43eff5 100644 --- a/util/Commands.re +++ b/util/Commands.re @@ -2,18 +2,8 @@ let shellEscape = path => Filename.quote(path); -let execFull = (~input=?, ~pwd=?, ~env=Unix.environment(), cmd) => { - let cmd = - if (Sys.os_type == "Win32") { - Printf.sprintf("\"%s\"", cmd) - } else { - cmd - } - let env = switch pwd { - | None => env - | Some(pwd) => Array.map(item => String.length(item) > 4 && String.sub(item, 0, 4) == "PWD=" ? "PWD=" ++ pwd : item, env) - }; - let prevCwd = switch pwd { +let withCwd = (~cwd, f) => { + let prevCwd = switch cwd { | None => None | Some(pwd) => let prevCwd = Unix.getcwd(); @@ -24,11 +14,32 @@ let execFull = (~input=?, ~pwd=?, ~env=Unix.environment(), cmd) => { Some(prevCwd) } } - let (cmd_out, cmd_in, cmd_err) = Unix.open_process_full(cmd, env); + + let ret = f(); + switch prevCwd { | None => () | Some(prevCwd) => Unix.chdir(prevCwd) }; + + ret; +}; + +let execFull = (~input=?, ~pwd=?, ~env=Unix.environment(), cmd) => { + let cmd = + if (Sys.os_type == "Win32") { + Printf.sprintf("\"%s\"", cmd) + } else { + cmd + } + let env = switch pwd { + | None => env + | Some(pwd) => Array.map(item => String.length(item) > 4 && String.sub(item, 0, 4) == "PWD=" ? "PWD=" ++ pwd : item, env) + }; + + let (cmd_out, cmd_in, cmd_err) = withCwd(~cwd=pwd, () => { + Unix.open_process_full(cmd, env); + }) switch input { | None => () @@ -104,8 +115,8 @@ let execOption = cmd => { } }; -let execResult = cmd => { - let (lines, success) = execSync(cmd); +let execResult = (~cwd=?, cmd) => { + let (lines, success) = withCwd(~cwd, () => execSync(cmd)); if (success) { RResult.Ok(String.concat("\n", lines)) } else { @@ -138,4 +149,4 @@ let execWithInput = (cmd, input) => { } { | End_of_file => ([], false) } -}; \ No newline at end of file +}; From 0dfbb3569371af17c601d2ce3f87d644926142e4 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 26 Nov 2018 14:24:01 -0800 Subject: [PATCH 07/17] Fix getting '$OCAMLLIB' on Windows --- src/analyze/BuildSystem.re | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/analyze/BuildSystem.re b/src/analyze/BuildSystem.re index 3003e703..9e755d11 100644 --- a/src/analyze/BuildSystem.re +++ b/src/analyze/BuildSystem.re @@ -139,10 +139,7 @@ let getEsyCompiledBase = (root) => { } }; - let prevCwd = Unix.getcwd(); - Unix.chdir(root); - let res = Commands.execResult("esy command-env --json") - Unix.chdir(prevCwd); + let res = Commands.execResult(~cwd=root, "esy command-env --json") switch (res) { | Ok(commandEnv) => @@ -229,7 +226,8 @@ let getStdlib = (base, buildSystem) => { switch (Utils.getEnvVar(~env, "OCAMLLIB")) { | Some(esy_ocamllib) => Ok([esy_ocamllib]) | None => - let%try_wrap esy_ocamllib = getLine("esy b echo $OCAMLLIB", ~pwd=base); + let echoCommand = Filename.quote("echo $OCAMLLIB"); + let%try_wrap esy_ocamllib = getLine("esy -q sh -- -c " ++ echoCommand, ~pwd=base); [esy_ocamllib]; }; | Dune(Opam(switchPrefix)) => From 6e017420c70358dbff98d7fe8a0b07da436d2511 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 26 Nov 2018 15:35:41 -0800 Subject: [PATCH 08/17] Fix robustness of path checking --- util/Infix.re | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/Infix.re b/util/Infix.re index 1107bd7c..1ff5c4c9 100644 --- a/util/Infix.re +++ b/util/Infix.re @@ -34,11 +34,11 @@ let logIfAbsent = (message, x) => switch x { }; let maybeConcat = (a, b) => { - if (b != "" && (b.[0] == '/' || b.[1] == ':')) { + if (b != "" && (b.[0] == '/' || (String.length(b) > 2 && b.[1] == ':'))) { b } else { fileConcat(a, b) } }; -let (/+) = fileConcat; \ No newline at end of file +let (/+) = fileConcat; From 20db56fe68f39ce5fe290bd3330b7117ffc6e8b3 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 26 Nov 2018 15:36:55 -0800 Subject: [PATCH 09/17] Fix off-by-one issue --- util/Infix.re | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/Infix.re b/util/Infix.re index 1ff5c4c9..273a4fe0 100644 --- a/util/Infix.re +++ b/util/Infix.re @@ -34,7 +34,7 @@ let logIfAbsent = (message, x) => switch x { }; let maybeConcat = (a, b) => { - if (b != "" && (b.[0] == '/' || (String.length(b) > 2 && b.[1] == ':'))) { + if (b != "" && (b.[0] == '/' || (String.length(b) > 1 && b.[1] == ':'))) { b } else { fileConcat(a, b) From de1495ba29d0c11d16b373e1e4fd42906c960071 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Wed, 28 Nov 2018 19:06:36 -0800 Subject: [PATCH 10/17] Revert removal of environment detection --- src/analyze/BuildSystem.re | 48 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/analyze/BuildSystem.re b/src/analyze/BuildSystem.re index 9e755d11..946bdfd0 100644 --- a/src/analyze/BuildSystem.re +++ b/src/analyze/BuildSystem.re @@ -139,30 +139,32 @@ let getEsyCompiledBase = (root) => { } }; - let res = Commands.execResult(~cwd=root, "esy command-env --json") - - switch (res) { - | Ok(commandEnv) => - switch (Json.parse(commandEnv)) { - | exception (Failure(message)) => - Log.log("Json response"); - Log.log(commandEnv); - Error("Couldn't find Esy target directory (invalid json response: parse fail): " ++ message); - | exception exn => - Log.log(commandEnv); - Error("Couldn't find Esy target directory (invalid json response) " ++ Printexc.to_string(exn)); - | json => - Json.Infix.( - switch ( - Json.get("cur__original_root", json) |?> Json.string, - Json.get("cur__target_dir", json) |?> Json.string, - ) { - | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(correctSlashesOnWindows(projectRoot), correctSlashesOnWindows(targetDir))) - | _ => Error("Couldn't find Esy target directory (missing json entries)") - } - ) + switch(Utils.getEnvVar(~env, "cur__original_root"), Utils.getEnvVar(~env, "cur__target_dir")) { + | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(correctSlashesOnWindows(projectRoot), correctSlashesOnWindows(targetDir))) + | (_, _) => + switch (Commands.execResult("esy command-env --json")) { + | Ok(commandEnv) => + switch (Json.parse(commandEnv)) { + | exception (Failure(message)) => + Log.log("Json response"); + Log.log(commandEnv); + Error("Couldn't find Esy target directory (invalid json response: parse fail): " ++ message); + | exception exn => + Log.log(commandEnv); + Error("Couldn't find Esy target directory (invalid json response) " ++ Printexc.to_string(exn)); + | json => + Json.Infix.( + switch ( + Json.get("cur__original_root", json) |?> Json.string, + Json.get("cur__target_dir", json) |?> Json.string, + ) { + | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(correctSlashesOnWindows(projectRoot), correctSlashesOnWindows(targetDir))) + | _ => Error("Couldn't find Esy target directory (missing json entries)") + } + ) + } + | err => err } - | err => err } }; From 78042af7b66959274afe9953abcacd206cf3f979 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Wed, 28 Nov 2018 19:39:22 -0800 Subject: [PATCH 11/17] Fix esy execution path when detecting using command-env --- src/analyze/BuildSystem.re | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analyze/BuildSystem.re b/src/analyze/BuildSystem.re index 946bdfd0..e90283fd 100644 --- a/src/analyze/BuildSystem.re +++ b/src/analyze/BuildSystem.re @@ -142,7 +142,7 @@ let getEsyCompiledBase = (root) => { switch(Utils.getEnvVar(~env, "cur__original_root"), Utils.getEnvVar(~env, "cur__target_dir")) { | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(correctSlashesOnWindows(projectRoot), correctSlashesOnWindows(targetDir))) | (_, _) => - switch (Commands.execResult("esy command-env --json")) { + switch (Commands.execResult(~cwd=root, "esy command-env --json")) { | Ok(commandEnv) => switch (Json.parse(commandEnv)) { | exception (Failure(message)) => From 11179c4c612411a7d9ceabcb61b92a89b6b6990c Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Thu, 29 Nov 2018 18:00:41 -0800 Subject: [PATCH 12/17] Run tests directly from executable --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cb95d32e..cdc76bcf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,7 +28,8 @@ build_script: - esy build # Validate binary - _esy\default\build\default\bin\Bin.exe --help - - esy dune exec ExamplesTests + # Run tests + - _esy\default\build\default\bin\ExamplesTests.exe artifacts: - path: _esy\default\build\default\bin\Bin.exe From 99e661a8dc1206e72063b0de37d980e0494b5f40 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Thu, 29 Nov 2018 18:36:21 -0800 Subject: [PATCH 13/17] Check path for ExamplesTests --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index cdc76bcf..e9b13dfb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,6 +29,7 @@ build_script: # Validate binary - _esy\default\build\default\bin\Bin.exe --help # Run tests + - esy x which ExamplesTests.exe - _esy\default\build\default\bin\ExamplesTests.exe artifacts: From 7afcadd405472762989f3307973054f6b65d407b Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 30 Nov 2018 18:35:50 -0800 Subject: [PATCH 14/17] Move files to predictable structure; run tests directly --- appveyor.yml | 5 +++-- package.json | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e9b13dfb..c7552208 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,10 +27,11 @@ install: build_script: - esy build # Validate binary - - _esy\default\build\default\bin\Bin.exe --help + - esy x which Bin.exe + - _build\default\bin\Bin.exe --help # Run tests - esy x which ExamplesTests.exe - - _esy\default\build\default\bin\ExamplesTests.exe + - _build\install\default\bin\ExamplesTests.exe artifacts: - path: _esy\default\build\default\bin\Bin.exe diff --git a/package.json b/package.json index eeeeb13a..99677ca6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "author": "Jared Forsyth", "license": "ISC", "esy": { - "build": "dune build -p #{self.name}" + "build": "dune build -p #{self.name}", + "buildsInSource": "_build" }, "dependencies": { "@opam/dune": "*", From 3fa909b41c0a9247fa7b362abcc435a4a7fc932c Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 25 Mar 2019 06:55:32 -0600 Subject: [PATCH 15/17] add windows conditional --- util/Infix.re | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/Infix.re b/util/Infix.re index 273a4fe0..5cef6bc8 100644 --- a/util/Infix.re +++ b/util/Infix.re @@ -34,7 +34,7 @@ let logIfAbsent = (message, x) => switch x { }; let maybeConcat = (a, b) => { - if (b != "" && (b.[0] == '/' || (String.length(b) > 1 && b.[1] == ':'))) { + if (b != "" && (b.[0] == '/' || (Sys.os_type == "Win32" && String.length(b) > 1 && b.[1] == ':'))) { b } else { fileConcat(a, b) From 341243654077f0387b9128cab0db53ae9529bd96 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 25 Mar 2019 13:50:20 -0600 Subject: [PATCH 16/17] fix --- src/analyze/BuildSystem.re | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analyze/BuildSystem.re b/src/analyze/BuildSystem.re index 33d7a6f2..0ca096bf 100644 --- a/src/analyze/BuildSystem.re +++ b/src/analyze/BuildSystem.re @@ -164,7 +164,7 @@ let getEsyCompiledBase = () => { switch(Utils.getEnvVar(~env, "cur__original_root"), Utils.getEnvVar(~env, "cur__target_dir")) { | (Some(projectRoot), Some(targetDir)) => Ok(Files.relpath(correctSlashesOnWindows(projectRoot), correctSlashesOnWindows(targetDir))) | (_, _) => - switch (Commands.execResult(~cwd=root, "esy command-env --json")) { + switch (Commands.execResult("esy command-env --json")) { | Ok(commandEnv) => switch (Json.parse(commandEnv)) { | exception (Failure(message)) => From c3fe600428415f093f04c6387605ec3dcd7aa09e Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 25 Mar 2019 15:00:57 -0600 Subject: [PATCH 17/17] lol --- src/analyze/BuildSystem.re | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analyze/BuildSystem.re b/src/analyze/BuildSystem.re index 0ca096bf..5851504c 100644 --- a/src/analyze/BuildSystem.re +++ b/src/analyze/BuildSystem.re @@ -253,7 +253,7 @@ let getStdlib = (base, buildSystem) => { let echoCommand = Filename.quote("echo $OCAMLLIB"); let commandPrefix = v < "0.5.6" ? "esy -q sh -- -c " : "esy -q sh -c "; - let%try_wrap esy_ocamllib = getLine(command ++ echoCommand, ~pwd=base); + let%try_wrap esy_ocamllib = getLine(commandPrefix ++ echoCommand, ~pwd=base); [esy_ocamllib]; }; | Dune(Opam(switchPrefix)) =>