summaryrefslogtreecommitdiff
path: root/scalalib
diff options
context:
space:
mode:
authorAndres Pipicello <andres.pipicello@olx.com>2019-05-24 17:04:42 -0300
committerTobias Roeser <le.petit.fou@web.de>2019-06-28 08:37:39 +0200
commitc3474360661b2cf87b3bc7cf8446b8ea78d7927f (patch)
tree048d04542cf1b353213a7e546468bca09346b2a0 /scalalib
parentf5bbf16878002dcf7836ab1e596f9dd8eff8999f (diff)
downloadmill-c3474360661b2cf87b3bc7cf8446b8ea78d7927f.tar.gz
mill-c3474360661b2cf87b3bc7cf8446b8ea78d7927f.tar.bz2
mill-c3474360661b2cf87b3bc7cf8446b8ea78d7927f.zip
Fixes 'file name too long' error
Diffstat (limited to 'scalalib')
-rwxr-xr-xscalalib/src/GenIdeaImpl.scala24
1 files changed, 4 insertions, 20 deletions
diff --git a/scalalib/src/GenIdeaImpl.scala b/scalalib/src/GenIdeaImpl.scala
index e483f287..2db28327 100755
--- a/scalalib/src/GenIdeaImpl.scala
+++ b/scalalib/src/GenIdeaImpl.scala
@@ -172,31 +172,15 @@ object GenIdeaImpl {
val librariesProperties = resolved.flatMap(x => x.libraryClasspath.map(_ -> x.compilerClasspath)).toMap
- val commonPrefix =
- if (allResolved.isEmpty) 0
- else {
- val minResolvedLength = allResolved.map(_.segmentCount).min
- allResolved.map(_.segments.take(minResolvedLength).toList)
- .transpose
- .takeWhile(_.distinct.length == 1)
- .length
- }
-
- // only resort to full long path names if the jar name is a duplicate
val pathShortLibNameDuplicate = allResolved
.distinct
- .map{p => p.last -> p}
- .groupBy(_._1)
+ .groupBy(_.last)
.filter(_._2.size > 1)
- .keySet
+ .mapValues(_.zipWithIndex)
+ .flatMap(y => y._2.map(x => x._1 -> s"${y._1} (${x._2})"))
val pathToLibName = allResolved
- .map{p =>
- if (pathShortLibNameDuplicate(p.last))
- (p, p.segments.drop(commonPrefix).mkString("_"))
- else
- (p, p.last)
- }
+ .map(p => p -> pathShortLibNameDuplicate.getOrElse(p, p.last))
.toMap
sealed trait ResolvedLibrary { def path : os.Path }