use of sbt.internal.inc.AnalyzingCompiler in project gradle by gradle.
the class ZincScalaCompilerFactory method getCompiler.
static ZincScalaCompiler getCompiler(CacheRepository cacheRepository, HashedClasspath hashedScalaClasspath) {
ScalaInstance scalaInstance;
try {
scalaInstance = getScalaInstance(hashedScalaClasspath);
} catch (Exception e) {
throw new RuntimeException("Failed create instance of the scala compiler", e);
}
String zincVersion = ZincCompilerUtil.class.getPackage().getImplementationVersion();
String scalaVersion = scalaInstance.actualVersion();
String javaVersion = Jvm.current().getJavaVersion().getMajorVersion();
String zincCacheKey = String.format("zinc-%s_%s_%s", zincVersion, scalaVersion, javaVersion);
String zincCacheName = String.format("%s compiler cache", zincCacheKey);
final PersistentCache zincCache = cacheRepository.cache(zincCacheKey).withDisplayName(zincCacheName).withLockOptions(mode(FileLockManager.LockMode.OnDemand)).open();
File compilerBridgeJar;
if (isScala3(scalaVersion)) {
compilerBridgeJar = findFile("scala3-sbt-bridge", hashedScalaClasspath.getClasspath());
} else {
File compilerBridgeSourceJar = findFile("compiler-bridge", hashedScalaClasspath.getClasspath());
compilerBridgeJar = getBridgeJar(zincCache, scalaInstance, compilerBridgeSourceJar, sbt.util.Logger.xlog2Log(new SbtLoggerAdapter()));
}
ScalaCompiler scalaCompiler = new AnalyzingCompiler(scalaInstance, ZincUtil.constantBridgeProvider(scalaInstance, compilerBridgeJar), ClasspathOptionsUtil.manual(), k -> scala.runtime.BoxedUnit.UNIT, Option.apply(COMPILER_CLASSLOADER_CACHE));
return new ZincScalaCompiler(scalaInstance, scalaCompiler, new AnalysisStoreProvider());
}
Aggregations