-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from szeiger/scala-2.12
Scala 2.12 support
- Loading branch information
Showing
15 changed files
with
141 additions
and
70 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
40 changes: 40 additions & 0 deletions
40
core/src/main/scala-2.10/com/typesafe/tools/mima/core/package.scala
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,40 @@ | ||
package com.typesafe.tools.mima | ||
|
||
import scala.tools.nsc.io.AbstractFile | ||
import scala.tools.nsc.util.{ClassPath, DirectoryClassPath, JavaClassPath} | ||
|
||
package object core { | ||
type ProblemFilter = (Problem) => Boolean | ||
type CompilerClassPath = scala.tools.nsc.util.ClassPath[AbstractFile] | ||
|
||
def resolveClassPath(): CompilerClassPath = | ||
new PathResolver(Config.settings).mimaResult | ||
|
||
def definitionsPackageInfo(defs: Definitions): ConcretePackageInfo = | ||
new ConcretePackageInfo(null, | ||
new JavaClassPath( | ||
if (defs.lib.isDefined) Vector(defs.lib.get, defs.classPath) | ||
else Vector(defs.classPath), DefaultJavaContext), | ||
"", | ||
defs) | ||
|
||
def asClassPathString(cp: CompilerClassPath): String = cp.asClasspathString | ||
|
||
def classFilesFrom(cp: CompilerClassPath, pkg: String): IndexedSeq[AbstractFile] = | ||
cp.classes flatMap (_.binary) | ||
|
||
def packagesFrom(cp: CompilerClassPath, owner: ConcretePackageInfo): Seq[(String, PackageInfo)] = | ||
(cp.packages map (cp => cp.name -> new ConcretePackageInfo(owner, cp, owner.pkg + "." + cp.name, owner.defs))) | ||
|
||
def definitionsTargetPackages(pkg: PackageInfo, cp: CompilerClassPath, defs: Definitions): Seq[(String, PackageInfo)] = | ||
cp.packages.map(p => p.name -> new ConcretePackageInfo(pkg, p, p.name, defs)) | ||
|
||
def baseClassPath(cpString: String): CompilerClassPath = | ||
new JavaClassPath(ClassPath.DefaultJavaContext.classesInPath(cpString).toIndexedSeq, ClassPath.DefaultJavaContext) | ||
|
||
def reporterClassPath(classpath: String): CompilerClassPath = | ||
new JavaClassPath(DefaultJavaContext.classesInPath(classpath).toIndexedSeq, DefaultJavaContext) | ||
|
||
def dirClassPath(dir: AbstractFile): CompilerClassPath = | ||
new DirectoryClassPath(dir, DefaultJavaContext) | ||
} |
44 changes: 44 additions & 0 deletions
44
core/src/main/scala-2.12/com/typesafe/tools/mima/core/package.scala
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,44 @@ | ||
package com.typesafe.tools.mima | ||
|
||
import scala.tools.nsc.util.ClassPath | ||
import scala.tools.nsc.classpath.{AggregateClassPath, ClassPathFactory} | ||
import scala.tools.nsc.io.AbstractFile | ||
import scala.tools.util.PathResolver | ||
import scala.tools.nsc.mima.ClassPathAccessors | ||
|
||
package object core { | ||
type ProblemFilter = (Problem) => Boolean | ||
type CompilerClassPath = ClassPath | ||
|
||
def resolveClassPath(): CompilerClassPath = | ||
AggregateClassPath.createAggregate(new PathResolver(Config.settings).containers: _*) | ||
|
||
def definitionsPackageInfo(defs: Definitions): ConcretePackageInfo = { | ||
val elems = defs.lib.toList :+ defs.classPath | ||
new ConcretePackageInfo( | ||
null, | ||
AggregateClassPath.createAggregate(elems: _*), | ||
ClassPath.RootPackage, | ||
defs) | ||
} | ||
|
||
def asClassPathString(cp: CompilerClassPath): String = cp.asClassPathString | ||
|
||
def classFilesFrom(cp: CompilerClassPath, pkg: String): IndexedSeq[AbstractFile] = | ||
cp.classesIn(pkg).flatMap(_.binary).toIndexedSeq | ||
|
||
def packagesFrom(cp: CompilerClassPath, owner: ConcretePackageInfo): Seq[(String, PackageInfo)] = | ||
(cp.packagesIn(owner.pkg) map (p => p.name -> new ConcretePackageInfo(owner, cp, owner.pkg + p.name, owner.defs))) | ||
|
||
def definitionsTargetPackages(pkg: PackageInfo, cp: CompilerClassPath, defs: Definitions): Seq[(String, PackageInfo)] = | ||
cp.packagesIn(ClassPath.RootPackage).map(p => p.name -> new ConcretePackageInfo(pkg, cp, p.name, defs)) | ||
|
||
def baseClassPath(cpString: String): CompilerClassPath = | ||
AggregateClassPath.createAggregate(new ClassPathFactory(Config.settings).classesInPath(cpString): _*) | ||
|
||
def reporterClassPath(classpath: String): CompilerClassPath = AggregateClassPath.createAggregate( | ||
new ClassPathFactory(Config.settings).classesInPath(classpath): _*) | ||
|
||
def dirClassPath(dir: AbstractFile): CompilerClassPath = | ||
ClassPathFactory.newClassPath(dir, Config.settings) | ||
} |
13 changes: 13 additions & 0 deletions
13
core/src/main/scala-2.12/scala/tools/nsc/mima/package.scala
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,13 @@ | ||
package scala.tools.nsc | ||
|
||
import scala.tools.nsc.util.ClassPath | ||
|
||
/** | ||
* Some extension methods to allow accessing private[nsc] members of ClassPath. | ||
*/ | ||
package object mima { | ||
implicit class ClassPathAccessors(val cp: ClassPath) extends AnyVal { | ||
def classesIn(pkg: String) = cp.classes(pkg) | ||
def packagesIn(pkg: String) = cp.packages(pkg) | ||
} | ||
} |
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
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
5 changes: 0 additions & 5 deletions
5
core/src/main/scala/com/typesafe/tools/mima/core/package.scala
This file was deleted.
Oops, something went wrong.
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
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