-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package bloop.internal | ||
|
||
import java.io.File | ||
import java.util.Optional | ||
|
||
import xsbti.compile.{ | ||
ClassFileManager, | ||
ClassFileManagerUtil, | ||
DefaultExternalHooks, | ||
IncOptions, | ||
WrappedClassFileManager | ||
} | ||
|
||
object Ecosystem { | ||
def supportDotty(incOptions: IncOptions): IncOptions = { | ||
val tastyFileManager = new ClassFileManager { | ||
private[this] val inherited = ClassFileManagerUtil.getDefaultClassFileManager(incOptions) | ||
|
||
def delete(classes: Array[File]): Unit = { | ||
val tastySuffixes = List(".tasty", ".hasTasty") | ||
inherited.delete(classes flatMap { classFile => | ||
if (classFile.getPath endsWith ".class") { | ||
val prefix = classFile.getAbsolutePath.stripSuffix(".class") | ||
tastySuffixes.map(suffix => new File(prefix + suffix)).filter(_.exists) | ||
} else Nil | ||
}) | ||
} | ||
|
||
def generated(classes: Array[File]): Unit = {} | ||
def complete(success: Boolean): Unit = {} | ||
} | ||
val inheritedHooks = incOptions.externalHooks | ||
val externalClassFileManager: Optional[ClassFileManager] = Option( | ||
inheritedHooks.getExternalClassFileManager.orElse(null)) match { | ||
case Some(prevManager) => | ||
Optional.of(WrappedClassFileManager.of(prevManager, Optional.of(tastyFileManager))) | ||
case None => | ||
Optional.of(tastyFileManager) | ||
} | ||
|
||
val newExternalHooks = | ||
new DefaultExternalHooks(inheritedHooks.getExternalLookup, externalClassFileManager) | ||
incOptions.withExternalHooks(newExternalHooks) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters