<commit_before>package com.prezi.haskell.gradle.external

import java.io.File

import com.prezi.haskell.gradle.ApiHelper._
import com.prezi.haskell.gradle.model.Sandbox
import org.gradle.api.Action
import org.gradle.process.{ExecResult, ExecSpec}

/**
 * Executes external tools with the Gradle project's execution command
 * @param executor The `project.exec` function
 */
class HaskellTools(executor : Action[ExecSpec] => ExecResult) {
  def cabalInstall(root: File, buildDir: File, targetSandbox: Sandbox, dependencies: List[Sandbox]): Unit = {
    exec(Some(root),
      "cabal", "install"
      :: "-j"
      :: "--package-db=clear"
      :: "--package-db=global"
      :: dependencies.map(_.asPackageDbArg)
      ::: List(targetSandbox.asPackageDbArg,
               targetSandbox.asPrefixArg,
               s"--builddir=${buildDir.getAbsolutePath}")
      : _*)
  }

  def cabalTest(root: File, buildDir: File, targetSandbox: Sandbox, dependencies: List[Sandbox]): Unit = {
    exec(Some(root),
      "cabal", "configure"
        :: "--package-db=clear"
        :: "--package-db=global"
        :: dependencies.map(_.asPackageDbArg)
        ::: List(targetSandbox.asPackageDbArg,
        targetSandbox.asPrefixArg,
        s"--builddir=${buildDir.getAbsolutePath}")
        : _*)<commit_msg>Not using -j for cabal install<commit_after>package com.prezi.haskell.gradle.external

import java.io.File

import com.prezi.haskell.gradle.ApiHelper._
import com.prezi.haskell.gradle.model.Sandbox
import org.gradle.api.Action
import org.gradle.process.{ExecResult, ExecSpec}

/**
 * Executes external tools with the Gradle project's execution command
 * @param executor The `project.exec` function
 */
class HaskellTools(executor : Action[ExecSpec] => ExecResult) {
  def cabalInstall(root: File, buildDir: File, targetSandbox: Sandbox, dependencies: List[Sandbox]): Unit = {
    exec(Some(root),
      "cabal", "install"
      :: "--package-db=clear"
      :: "--package-db=global"
      :: dependencies.map(_.asPackageDbArg)
      ::: List(targetSandbox.asPackageDbArg,
               targetSandbox.asPrefixArg,
               s"--builddir=${buildDir.getAbsolutePath}")
      : _*)
  }

  def cabalTest(root: File, buildDir: File, targetSandbox: Sandbox, dependencies: List[Sandbox]): Unit = {
    exec(Some(root),
      "cabal", "configure"
        :: "--package-db=clear"
        :: "--package-db=global"
        :: dependencies.map(_.asPackageDbArg)
        ::: List(targetSandbox.asPackageDbArg,
        targetSandbox.asPrefixArg,
        s"--builddir=${buildDir.getAbsolutePath}")
        : _*)
{'fraction_non_alphanumeric': 0.14148404459823144, 'fraction_numerical': 0.0, 'mean_word_length': 3.3366666666666664, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '938438', 'n_tokens_mistral': 854, 'n_tokens_neox': 803, 'n_words': 144}