<commit_before>package sbt.internal.inc

import java.io.File
import java.net.URLClassLoader
import java.util.Properties
import java.util.concurrent.Callable

import sbt.internal.inc.classpath.ClasspathUtilities
import sbt.internal.librarymanagement.JsonUtil
import sbt.io.IO
import sbt.io.syntax._
import sbt.librarymanagement.{ ModuleID, UpdateOptions, Resolver, Patterns, FileRepository, DefaultMavenRepository }
import sbt.util.{ Logger, Level }
import xsbti.{ ComponentProvider, GlobalLock }

/**
 * Base class for test suites that must be able to fetch and compile the compiler bridge.
 */
abstract class BridgeProviderSpecification extends BaseIvySpecification {
  log.setLevel(Level.Warn)

  def realLocal: Resolver =
    {
      val pList = Vector(s"$${user.home}/.ivy2/local/${Resolver.localBasePattern}")
      FileRepository("local", Resolver.defaultFileConfiguration, Patterns().withIvyPatterns(pList).withArtifactPatterns(pList).withIsMavenCompatible(false))
    }
  override def resolvers: Vector[Resolver] = Vector(realLocal, DefaultMavenRepository)
  private val ivyConfiguration = mkIvyConfiguration(UpdateOptions())

  def secondaryCacheDirectory: File =
    {
      val target = file("target").getAbsoluteFile
      target / "zinc-components"
    }
  def secondaryCacheOpt: Option[File] = Some(secondaryCacheDirectory)

  def getCompilerBridge(targetDir: File, log: Logger, scalaVersion: String): File = {
    val instance = scalaInstance(scalaVersion)
    val bridgeId = compilerBridgeId(scalaVersion)
    val sourceModule = ModuleID(xsbti.ArtifactInfo.SbtOrganization, bridgeId, ComponentCompiler.incrementalVersion).withConfigurations(Some("component")).sources()

    val raw = new RawCompiler(instance, ClasspathOptionsUtil.auto, log)
    val manager = new ZincComponentManager(lock, provider(targetDir), secondaryCacheOpt, log)
    val componentCompiler = new IvyComponentCompiler(raw, manager, ivyConfiguration, fileToStore, sourceModule, log)

    val bridge = componentCompiler.apply()
    val target = targetDir / s"target-bridge-$scalaVersion.jar"
    IO.copyFile(bridge, target)<commit_msg>Switch over to using ManagedLogger<commit_after>package sbt.internal.inc

import java.io.File
import java.net.URLClassLoader
import java.util.Properties
import java.util.concurrent.Callable

import sbt.internal.inc.classpath.ClasspathUtilities
import sbt.internal.librarymanagement.JsonUtil
import sbt.io.IO
import sbt.io.syntax._
import sbt.librarymanagement.{ ModuleID, UpdateOptions, Resolver, Patterns, FileRepository, DefaultMavenRepository }
import sbt.util.{ Logger, Level }
import xsbti.{ ComponentProvider, GlobalLock }

/**
 * Base class for test suites that must be able to fetch and compile the compiler bridge.
 */
abstract class BridgeProviderSpecification extends BaseIvySpecification {
  // log.setLevel(Level.Warn)

  def realLocal: Resolver =
    {
      val pList = Vector(s"$${user.home}/.ivy2/local/${Resolver.localBasePattern}")
      FileRepository("local", Resolver.defaultFileConfiguration, Patterns().withIvyPatterns(pList).withArtifactPatterns(pList).withIsMavenCompatible(false))
    }
  override def resolvers: Vector[Resolver] = Vector(realLocal, DefaultMavenRepository)
  private val ivyConfiguration = mkIvyConfiguration(UpdateOptions())

  def secondaryCacheDirectory: File =
    {
      val target = file("target").getAbsoluteFile
      target / "zinc-components"
    }
  def secondaryCacheOpt: Option[File] = Some(secondaryCacheDirectory)

  def getCompilerBridge(targetDir: File, log: Logger, scalaVersion: String): File = {
    val instance = scalaInstance(scalaVersion)
    val bridgeId = compilerBridgeId(scalaVersion)
    val sourceModule = ModuleID(xsbti.ArtifactInfo.SbtOrganization, bridgeId, ComponentCompiler.incrementalVersion).withConfigurations(Some("component")).sources()

    val raw = new RawCompiler(instance, ClasspathOptionsUtil.auto, log)
    val manager = new ZincComponentManager(lock, provider(targetDir), secondaryCacheOpt, log)
    val componentCompiler = new IvyComponentCompiler(raw, manager, ivyConfiguration, fileToStore, sourceModule, log)

    val bridge = componentCompiler.apply()
    val target = targetDir / s"target-bridge-$scalaVersion.jar"
    IO.copyFile(bridge, target)
{'fraction_non_alphanumeric': 0.09423347398030943, 'fraction_numerical': 0.00046882325363338024, 'mean_word_length': 5.504573170731708, 'pattern_counts': {'":': 0, '<': 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': '6277464', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1180, 'n_words': 277}