mirror of
https://git.sr.ht/~bryan_bennett/flake_env
synced 2025-12-17 07:01:23 +01:00
Remove dependency on Janestreet Core
Core doubles the closure size and adds 8mb to the binary size for dubious benefit. This adds FileUtils to do the file interaction bits that aren't in the stdlib and removes Core in preference to the bundled Stdlib. Tests are passing, but I want to investigate the nix build before I commit to this approach
This commit is contained in:
parent
3f5f7a602d
commit
5c01142933
11 changed files with 184 additions and 232 deletions
|
|
@ -1,6 +1,3 @@
|
|||
open Core;
|
||||
module Unix = Core_unix;
|
||||
|
||||
module Util = Flake_env__util;
|
||||
|
||||
type t = {
|
||||
|
|
@ -33,7 +30,7 @@ let compare = (a, b) => {
|
|||
|
||||
let extract_version_number = cmd => {
|
||||
switch (Util.run_process(cmd, ["--version"])) {
|
||||
| (Ok (), stdout) when String.length(stdout) > 0 =>
|
||||
| (WEXITED(0), stdout) when String.length(stdout) > 0 =>
|
||||
switch (Re.exec(semver_re, stdout)) {
|
||||
| exception Stdlib.Not_found =>
|
||||
Error(
|
||||
|
|
@ -66,9 +63,14 @@ let is_new_enough = (cur, needed) => {
|
|||
};
|
||||
|
||||
let in_direnv = () =>
|
||||
/* direnv sets `$direnv` to the executable's full path
|
||||
If it is empty - we're running tests (ocaml's stdlib doesn't offer unsetenv...)
|
||||
If it isn't found, we're running outside direnv
|
||||
*/
|
||||
switch (Sys.getenv("direnv")) {
|
||||
| Some(_) => true
|
||||
| None => false
|
||||
| exception Not_found => false
|
||||
| "" => false
|
||||
| _ => true
|
||||
};
|
||||
|
||||
let preflight_versions = () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue