@@ -10,14 +10,21 @@ final class MiMaLib(cp: Seq[File], log: Logging = ConsoleLogging) {
10
10
private val classpath = ClassPath .of(cp.flatMap(ClassPath .fromJarOrDir(_)) :+ ClassPath .base)
11
11
12
12
private def createPackage (dirOrJar : File ): PackageInfo = {
13
- val cp = ClassPath .fromJarOrDir(dirOrJar).getOrElse(sys.error(s " not a directory or jar file: $dirOrJar" ))
14
- val defs = new Definitions (ClassPath .of(List (cp, classpath)))
15
- val pkg = new DefinitionsTargetPackageInfo (defs.root)
16
- for (pkgName <- cp.packages(ClassPath .RootPackage )) {
17
- pkg.packages(pkgName) = new ConcretePackageInfo (pkg, cp, pkgName, defs)
13
+ ClassPath .fromJarOrDir(dirOrJar).fold(createEmptyPackage(dirOrJar)) { cp =>
14
+ val defs = new Definitions (ClassPath .of(List (cp, classpath)))
15
+ val pkg = new DefinitionsTargetPackageInfo (defs.root)
16
+ for (pkgName <- cp.packages(ClassPath .RootPackage )) {
17
+ pkg.packages(pkgName) = new ConcretePackageInfo (pkg, cp, pkgName, defs)
18
+ }
19
+ log.debug(s " adding packages from $dirOrJar: ${pkg.packages.keys.mkString(" , " )}" )
20
+ pkg
18
21
}
19
- log.debug(s " adding packages from $dirOrJar: ${pkg.packages.keys.mkString(" , " )}" )
20
- pkg
22
+ }
23
+
24
+ private def createEmptyPackage (missingDirOrJar : File ): PackageInfo = {
25
+ log.debug(s " not a directory or jar file: $missingDirOrJar. This is normal for POM-only modules. Proceeding with empty set of packages. " )
26
+ val defs = new Definitions (ClassPath .base)
27
+ new DefinitionsTargetPackageInfo (defs.root)
21
28
}
22
29
23
30
private def traversePackages (oldpkg : PackageInfo , newpkg : PackageInfo , excludeAnnots : List [AnnotInfo ]): List [Problem ] = {
0 commit comments