diff options
author | Andres Pipicello <andres.pipicello@olx.com> | 2019-05-23 22:43:33 -0300 |
---|---|---|
committer | Tobias Roeser <le.petit.fou@web.de> | 2019-06-28 08:37:39 +0200 |
commit | 573e99315fe22db032115b614403de80148f155a (patch) | |
tree | dcc0a556c3c1e6e67d217aad9eceab7df4e58e0c /scalalib | |
parent | 3d08f9a92210bec5b790b9f924fcec2f73f99650 (diff) | |
download | mill-573e99315fe22db032115b614403de80148f155a.tar.gz mill-573e99315fe22db032115b614403de80148f155a.tar.bz2 mill-573e99315fe22db032115b614403de80148f155a.zip |
Fixes generation of fake SBT libraries
Diffstat (limited to 'scalalib')
-rwxr-xr-x | scalalib/src/GenIdeaImpl.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scalalib/src/GenIdeaImpl.scala b/scalalib/src/GenIdeaImpl.scala index 84ec26fc..8c72f0bd 100755 --- a/scalalib/src/GenIdeaImpl.scala +++ b/scalalib/src/GenIdeaImpl.scala @@ -226,12 +226,16 @@ object GenIdeaImpl { def sbtLibraryNameFromPom(pom : os.Path) : String = { val xml = scala.xml.XML.loadFile(pom.toIO) - val groupId = (xml \ "groupId").text + val parent = xml \ "parent" val artifactId = (xml \ "artifactId").text - val version = (xml \ "version").text + val groupId = Some(xml \ "groupId").filter(_.nonEmpty).getOrElse(parent \ "groupId").text + val version = Some(xml \ "version").filter(_.nonEmpty).getOrElse(parent \ "version").text - // The scala version here is non incidental - s"SBT: $groupId:$artifactId:$version:jar" + val artifactWithScalaVersion = artifactId.substring(artifactId.length - 5) match { + case "_2.10" | "_2.11" | "_2.12" => artifactId + case _ => artifactId + "_2.12" + } + s"SBT: $groupId:$artifactWithScalaVersion:$version:jar" } def libraryName(resolvedJar: ResolvedLibrary) : String = resolvedJar match { |