Browse Source

Start experimenting Core_extended dependency removing

This is an experiment to try to remove Core_extended dependency, replacing it by
a mix of Textutils and dropped code (maybe reimplemented in the future, see
drawback 1)

Expected benefits:
 - Faster to compile for the user, you don't need to install the big
   Core_extended package. (Textutils is already a Core_extended dependency)
 - Smaller binaries (oclaunch.native dropped by ~40%, test.native by 35%,
   compressed stripped binaries of oclaunch.native by more than 25% (using a
   script in an other branch,
   6e37624497aed6c1e1f9a8248338bc6288fd5167:0install.sh)). The command used was
   of this flavor: `du -s ./dist/*`

Drawbacks:
 - In this code, the colored messages functions have been removed, replaced by
   an exception for the tests. We can imagine reimplement it with a copy of a
   source file of Core_extended, color_print.ml. We would copy it and use it
   as-is. Licence is compatible, with proper credits. The problem is that such
   copy-pasting is a bad practice, both in term of library update and code
   factoring. Another idea would be to use a specific library for this.
 - Some other Core_extended function maybe useful in the future. However, this
   issue is quite easy to address, since we can get it back, revert changes
   introduced by this commit (and some further if necessary).

Modified files:
 - Oasis, and oasis-generated files, to actually remove Core_extended

 - Some code using Core_extended: Messages.ml, for colors
 - List_rc.ml, to print the list, replaced by Textutils. (No code modified)
Leo 9 years ago
parent
commit
46a45235f2
5 changed files with 15 additions and 40 deletions
  1. 2 2
      INSTALL.md
  2. 2 2
      _oasis
  3. 5 5
      _tags
  4. 4 4
      setup.ml
  5. 2 27
      src/messages.ml

+ 2 - 2
INSTALL.md

@@ -1,5 +1,5 @@
 <!--- OASIS_START --->
 <!--- OASIS_START --->
-<!--- DO NOT EDIT (digest: 641d2e4362cb9e2f3469b89eff9de495) --->
+<!--- DO NOT EDIT (digest: caa10816c3c9689f846b03a0fa379434) --->
 
 
 This is the INSTALL file for the OcLaunch distribution.
 This is the INSTALL file for the OcLaunch distribution.
 
 
@@ -14,7 +14,7 @@ In order to compile this package, you will need:
 * ocaml for all, test tests
 * ocaml for all, test tests
 * findlib
 * findlib
 * core
 * core
-* core_extended
+* textutils
 * atdgen
 * atdgen
 * alcotest for executable run_test
 * alcotest for executable run_test
 * oUnit for executable run_test
 * oUnit for executable run_test

+ 2 - 2
_oasis

@@ -28,7 +28,7 @@ PreBuildCommand: echo "Atdgen executed"
 Executable oclaunch
 Executable oclaunch
   Path:       src
   Path:       src
   MainIs:     oclaunch.ml
   MainIs:     oclaunch.ml
-  BuildDepends: core, core_extended, atdgen, threads
+  BuildDepends: core, textutils, atdgen, threads
   CompiledObject: best
   CompiledObject: best
 
 
 Executable "run_test"
 Executable "run_test"
@@ -37,7 +37,7 @@ Executable "run_test"
   Build$: flag(tests)
   Build$: flag(tests)
   CompiledObject: best
   CompiledObject: best
   Install: false
   Install: false
-  BuildDepends: alcotest, oUnit, core, threads, core_extended, atdgen
+  BuildDepends: alcotest, oUnit, core, threads, textutils, atdgen
 
 
 Test "tests"
 Test "tests"
   Run$: flag(tests)
   Run$: flag(tests)

+ 5 - 5
_tags

@@ -1,5 +1,5 @@
 # OASIS_START
 # OASIS_START
-# DO NOT EDIT (digest: d2586eecbf711619953a777ca84195da)
+# DO NOT EDIT (digest: e9ef8e895a62f6d302c93293b9e2d7af)
 # Ignore VCS directories, you can use the same kind of rule outside
 # Ignore VCS directories, you can use the same kind of rule outside
 # OASIS_START/STOP if you want to exclude directories that contains
 # OASIS_START/STOP if you want to exclude directories that contains
 # useless stuff for the build process
 # useless stuff for the build process
@@ -17,25 +17,25 @@ true: annot, bin_annot
 # Executable oclaunch
 # Executable oclaunch
 <src/oclaunch.{native,byte}>: pkg_atdgen
 <src/oclaunch.{native,byte}>: pkg_atdgen
 <src/oclaunch.{native,byte}>: pkg_core
 <src/oclaunch.{native,byte}>: pkg_core
-<src/oclaunch.{native,byte}>: pkg_core_extended
+<src/oclaunch.{native,byte}>: pkg_textutils
 <src/oclaunch.{native,byte}>: pkg_threads
 <src/oclaunch.{native,byte}>: pkg_threads
 # Executable run_test
 # Executable run_test
 <src/test/test.{native,byte}>: pkg_alcotest
 <src/test/test.{native,byte}>: pkg_alcotest
 <src/test/test.{native,byte}>: pkg_atdgen
 <src/test/test.{native,byte}>: pkg_atdgen
 <src/test/test.{native,byte}>: pkg_core
 <src/test/test.{native,byte}>: pkg_core
-<src/test/test.{native,byte}>: pkg_core_extended
 <src/test/test.{native,byte}>: pkg_oUnit
 <src/test/test.{native,byte}>: pkg_oUnit
+<src/test/test.{native,byte}>: pkg_textutils
 <src/test/test.{native,byte}>: pkg_threads
 <src/test/test.{native,byte}>: pkg_threads
 <src/*.ml{,i,y}>: pkg_alcotest
 <src/*.ml{,i,y}>: pkg_alcotest
 <src/*.ml{,i,y}>: pkg_atdgen
 <src/*.ml{,i,y}>: pkg_atdgen
 <src/*.ml{,i,y}>: pkg_core
 <src/*.ml{,i,y}>: pkg_core
-<src/*.ml{,i,y}>: pkg_core_extended
 <src/*.ml{,i,y}>: pkg_oUnit
 <src/*.ml{,i,y}>: pkg_oUnit
+<src/*.ml{,i,y}>: pkg_textutils
 <src/*.ml{,i,y}>: pkg_threads
 <src/*.ml{,i,y}>: pkg_threads
 <src/test/*.ml{,i,y}>: pkg_alcotest
 <src/test/*.ml{,i,y}>: pkg_alcotest
 <src/test/*.ml{,i,y}>: pkg_atdgen
 <src/test/*.ml{,i,y}>: pkg_atdgen
 <src/test/*.ml{,i,y}>: pkg_core
 <src/test/*.ml{,i,y}>: pkg_core
-<src/test/*.ml{,i,y}>: pkg_core_extended
 <src/test/*.ml{,i,y}>: pkg_oUnit
 <src/test/*.ml{,i,y}>: pkg_oUnit
+<src/test/*.ml{,i,y}>: pkg_textutils
 <src/test/*.ml{,i,y}>: pkg_threads
 <src/test/*.ml{,i,y}>: pkg_threads
 # OASIS_STOP
 # OASIS_STOP

+ 4 - 4
setup.ml

@@ -1,7 +1,7 @@
 (* setup.ml generated for the first time by OASIS v0.4.5 *)
 (* setup.ml generated for the first time by OASIS v0.4.5 *)
 
 
 (* OASIS_START *)
 (* OASIS_START *)
-(* DO NOT EDIT (digest: e91b030c955ca4285ff7faa765505e6d) *)
+(* DO NOT EDIT (digest: 295e7c9a49c18130f10cb53d140e828c) *)
 (*
 (*
    Regenerated by OASIS v0.4.5
    Regenerated by OASIS v0.4.5
    Visit http://oasis.forge.ocamlcore.org for more information and
    Visit http://oasis.forge.ocamlcore.org for more information and
@@ -6927,7 +6927,7 @@ let setup_t =
                       bs_build_depends =
                       bs_build_depends =
                         [
                         [
                            FindlibPackage ("core", None);
                            FindlibPackage ("core", None);
-                           FindlibPackage ("core_extended", None);
+                           FindlibPackage ("textutils", None);
                            FindlibPackage ("atdgen", None);
                            FindlibPackage ("atdgen", None);
                            FindlibPackage ("threads", None)
                            FindlibPackage ("threads", None)
                         ];
                         ];
@@ -6964,7 +6964,7 @@ let setup_t =
                            FindlibPackage ("oUnit", None);
                            FindlibPackage ("oUnit", None);
                            FindlibPackage ("core", None);
                            FindlibPackage ("core", None);
                            FindlibPackage ("threads", None);
                            FindlibPackage ("threads", None);
-                           FindlibPackage ("core_extended", None);
+                           FindlibPackage ("textutils", None);
                            FindlibPackage ("atdgen", None)
                            FindlibPackage ("atdgen", None)
                         ];
                         ];
                       bs_build_tools =
                       bs_build_tools =
@@ -7019,7 +7019,7 @@ let setup_t =
        };
        };
      oasis_fn = Some "_oasis";
      oasis_fn = Some "_oasis";
      oasis_version = "0.4.5";
      oasis_version = "0.4.5";
-     oasis_digest = Some "].1\244rq\174\023\156{h\176\194y\234s";
+     oasis_digest = Some "\193L\223w\146K\213\144r\003%\242A\214\131>";
      oasis_exec = None;
      oasis_exec = None;
      oasis_setup_args = [];
      oasis_setup_args = [];
      setup_update = false
      setup_update = false

+ 2 - 27
src/messages.ml

@@ -71,29 +71,7 @@ type style =
 
 
 (* General function to print things *)
 (* General function to print things *)
 let print ~color ~style message =
 let print ~color ~style message =
-    let open Core_extended in
-    match !Const.no_color with
-    | true -> printf "%s" message
-    | false -> begin (* Use colors *)
-        (* Log that we used colored messages *)
-        log_already ();
-        (* This code create proper escapement to display text with bold/color... *)
-        color |>
-        (function
-            | Green -> Color_print.color ~color:`Green message
-            | Red -> Color_print.color ~color:`Red message
-            | Yellow -> Color_print.color ~color:`Yellow message
-            | White -> Color_print.color ~color:`White message
-            | Plum -> Color_print.color ~color:`Plum message
-            | Cyan -> Color_print.color ~color:`Cyan message
-        ) |> (* Finaly print escaped string *)
-        (fun colored_msg ->
-            match style with
-            | Bold -> Color_print.boldprintf "%s" colored_msg
-            | Underline -> Color_print.underlineprintf "%s" colored_msg
-            | Normal -> printf "%s" colored_msg
-        )
-    end
+  failwith "Not implemented"
 ;;
 ;;
 
 
 (* Behave in a conform way to verbosity
 (* Behave in a conform way to verbosity
@@ -184,8 +162,5 @@ let tips message =
 
 
 (* Reset printing, to avoid color problem on some terminal (Konsole), the  *)
 (* Reset printing, to avoid color problem on some terminal (Konsole), the  *)
 let reset () =
 let reset () =
-    match !already with
-    | true -> debug "Reseted colors";
-        Core_extended.Color_print.normal "" |> printf "%s\n"
-    | false -> debug "Not resetted"; ()
+  failwith "Not implemented"
 ;;
 ;;