support sub-directories, i.e. structure module names;
authorwenzelm
Mon Nov 05 15:04:31 2018 +0100 (6 months ago)
changeset 692396cd985a78d6e
parent 69238 d98cfb369cbd
child 69240 16ca270090b6
support sub-directories, i.e. structure module names;
src/Tools/Haskell/Build.thy
src/Tools/Haskell/haskell.ML
     1.1 --- a/src/Tools/Haskell/Build.thy	Mon Nov 05 15:00:55 2018 +0100
     1.2 +++ b/src/Tools/Haskell/Build.thy	Mon Nov 05 15:04:31 2018 +0100
     1.3 @@ -7,18 +7,17 @@
     1.4  theory Build imports Haskell
     1.5  begin
     1.6  
     1.7 -ML_command \<open>
     1.8 +ML \<open>
     1.9    Isabelle_System.with_tmp_dir "ghc" (fn dir =>
    1.10      let
    1.11 +      val _ = Haskell.install_sources dir;
    1.12        val (out, rc) =
    1.13          Isabelle_System.bash_output
    1.14           (cat_lines
    1.15             ["set -e",
    1.16              "cd " ^ File.bash_path dir,
    1.17 -            "cp " ^ File.bash_paths Haskell.source_modules ^ " .",
    1.18 -            "\"$ISABELLE_GHC\" " ^ File.bash_paths (map Path.base Haskell.source_modules)]);
    1.19 -    in if rc = 0 then writeln out else error out end
    1.20 -  )
    1.21 +            "\"$ISABELLE_GHC\" " ^ File.bash_paths Haskell.sources]);
    1.22 +    in if rc = 0 then writeln out else error out end)
    1.23  \<close>
    1.24  
    1.25  end
     2.1 --- a/src/Tools/Haskell/haskell.ML	Mon Nov 05 15:00:55 2018 +0100
     2.2 +++ b/src/Tools/Haskell/haskell.ML	Mon Nov 05 15:04:31 2018 +0100
     2.3 @@ -10,7 +10,8 @@
     2.4      Toplevel.transition -> Toplevel.transition
     2.5    val export_file_cmd: string * Input.source ->
     2.6      Toplevel.transition -> Toplevel.transition
     2.7 -  val source_modules: Path.T list
     2.8 +  val sources: Path.T list
     2.9 +  val install_sources: Path.T -> unit
    2.10  end;
    2.11  
    2.12  structure Haskell: HASKELL =
    2.13 @@ -43,15 +44,20 @@
    2.14      in () end);
    2.15  
    2.16  
    2.17 -(* source modules *)
    2.18 +(* sources *)
    2.19  
    2.20 -val source_modules =
    2.21 - [\<^file>\<open>~~/src/Tools/Haskell/Library.hs\<close>,
    2.22 -  \<^file>\<open>~~/src/Tools/Haskell/Value.hs\<close>,
    2.23 -  \<^file>\<open>~~/src/Tools/Haskell/Buffer.hs\<close>,
    2.24 -  \<^file>\<open>~~/src/Tools/Haskell/Properties.hs\<close>,
    2.25 -  \<^file>\<open>~~/src/Tools/Haskell/Markup.hs\<close>,
    2.26 -  \<^file>\<open>~~/src/Tools/Haskell/XML.hs\<close>,
    2.27 -  \<^file>\<open>~~/src/Tools/Haskell/YXML.hs\<close>];
    2.28 +val sources =
    2.29 + [\<^path>\<open>Library.hs\<close>,
    2.30 +  \<^path>\<open>Value.hs\<close>,
    2.31 +  \<^path>\<open>Buffer.hs\<close>,
    2.32 +  \<^path>\<open>Properties.hs\<close>,
    2.33 +  \<^path>\<open>Markup.hs\<close>,
    2.34 +  \<^path>\<open>XML.hs\<close>,
    2.35 +  \<^path>\<open>YXML.hs\<close>];
    2.36 +
    2.37 +val master_dir = Resources.master_directory \<^theory>;
    2.38 +
    2.39 +fun install_sources dir =
    2.40 +  sources |> List.app (fn path => Isabelle_System.copy_file_base (master_dir, path) dir);
    2.41  
    2.42  end;