<commit_before>import nake

const
  DefaultOptions = "--verbosity:0 --hint[XDeclaredButNotUsed]:off"
  MainDeps =
    @["types", "objects", "scripting", "querying", "verbs", "builtins", "persist"]
  Exes = {
    "main": MainDeps,
    "test": MainDeps
  }


task defaultTask, "builds everything":
  for info in Exes:
    let (exe, deps) = info
    runTask(exe)


proc simpleBuild(name: string, deps: seq[string]) =
  task name, "builds " & name:
    let sourceFile = name & ".nim"
    var refresh = false
    for dep in deps:
      let depName = dep & ".nim"
      refresh = refresh or name.needsRefresh(depName)

    refresh = refresh or name.needsRefresh(sourceFile)

    if refresh:
      if direShell(nimExe, DefaultOptions, "c", name):
        echo "success building " & name
    else:
      echo name & " is up to date"

task "clean", "removes executables":
  for info in Exes:
    let (exe, deps) = info
    echo "removing " & exe
    removeFile(exe)

  echo "removing nimcache"
  removeDir("nimcache")

task "tests", "run tests":
  runTask("test")
  direShell("./test")


for info in Exes:
  let (exe, deps) = info
  simpleBuild(exe, deps)
<commit_msg>Add setup and setupmin tasks<commit_after>import nake

const
  DefaultOptions = "--verbosity:0 --hint[XDeclaredButNotUsed]:off"
  MainDeps =
    @["types", "objects", "scripting", "querying", "verbs", "builtins", "persist"]
  Exes = {
    "main": MainDeps,
    "test": MainDeps,
    "setupmin": MainDeps
  }


task defaultTask, "builds everything":
  for info in Exes:
    let (exe, deps) = info
    runTask(exe)

proc simpleBuild(name: string, deps: seq[string]) =
  task name, "builds " & name:
    let sourceFile = name & ".nim"
    var refresh = false
    for dep in deps:
      let depName = dep & ".nim"
      refresh = refresh or name.needsRefresh(depName)

    refresh = refresh or name.needsRefresh(sourceFile)

    if refresh:
      if direShell(nimExe, DefaultOptions, "c", name):
        echo "success building " & name
    else:
      echo name & " is up to date"

task "clean", "removes executables":
  for info in Exes:
    let (exe, deps) = info
    echo "removing " & exe
    removeFile(exe)

  echo "removing nimcache"
  removeDir("nimcache")

task "tests", "run tests":
  runTask("test")
  direShell("./test")

task "setup", "sets up a minimal world":
  runTask("setupmin")
  stdout.write "setting up a minimal world to use (worlds/min)... "
  direShell("./setupmin")
  echo "done!"
  echo "use this world by running \"main\" (nake main && ./main)"


for info in Exes:
  let (exe, deps) = info
  simpleBuild(exe, deps)

{'fraction_non_alphanumeric': 0.13554100885637274, 'fraction_numerical': 0.0007701193685021178, 'mean_word_length': 3.1903225806451614, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1618829', 'n_tokens_mistral': 913, 'n_tokens_neox': 892, 'n_words': 272}