Ejemplo n.º 1
0
    public static void geng(Taskman tm, string[] args)
    {
        tm.Mkdir($"{BHL_ROOT}/tmp");

        tm.Copy($"{BHL_ROOT}/bhl.g", $"{BHL_ROOT}/tmp/bhl.g");
        tm.Copy($"{BHL_ROOT}/util/g4sharp", $"{BHL_ROOT}/tmp/g4sharp");

        tm.Shell("sh", $"-c 'cd {BHL_ROOT}/tmp && sh g4sharp bhl.g && cp bhl*.cs ../src/g/' ");
    }
Ejemplo n.º 2
0
    public static void MCSBuild(Taskman tm, string[] srcs, string result, string opts = "", string binary = "mcs")
    {
        var files = new List <string>();

        foreach (var s in srcs)
        {
            files.AddRange(tm.Glob(s));
        }

        foreach (var f in files)
        {
            if (!File.Exists(f))
            {
                throw new Exception($"Bad file {f}");
            }
        }

        var refs = new List <string>();

        for (int i = files.Count; i-- > 0;)
        {
            if (files[i].EndsWith(".dll"))
            {
                refs.Add(files[i]);
                files.RemoveAt(i);
            }
        }

        if (files.Count == 0)
        {
            throw new Exception("No files");
        }

        string args = (refs.Count > 0 ? " -r:" + String.Join(" -r:", refs.Select(r => tm.CLIPath(r))) : "") + $" {opts} -out:{tm.CLIPath(result)} " + String.Join(" ", files.Select(f => tm.CLIPath(f)));
        string cmd  = binary + " " + args;

        uint   cmd_hash      = Hash.CRC32(cmd);
        string cmd_hash_file = $"{BHL_ROOT}/build/" + Hash.CRC32(result) + ".mhash";

        if (!File.Exists(cmd_hash_file) || File.ReadAllText(cmd_hash_file) != cmd_hash.ToString())
        {
            tm.Write(cmd_hash_file, cmd_hash.ToString());
        }

        files.Add(cmd_hash_file);

        if (tm.NeedToRegen(result, files) || tm.NeedToRegen(result, refs))
        {
            tm.Shell(binary, args);
        }
    }
Ejemplo n.º 3
0
    public static void MonoRun(Taskman tm, string exe, string[] args = null, string opts = "")
    {
        var mono_args = $"{opts} {exe} " + String.Join(" ", args);

        tm.Shell("mono", mono_args);
    }