Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't packageLibraryMappings for multiple versions of the same library #110

Open
unkarjedy opened this issue Jul 15, 2021 · 1 comment
Open

Comments

@unkarjedy
Copy link
Member

unkarjedy commented Jul 15, 2021

  1. open Scala Plugin project
  2. go to runtimeDependencies project definition
  3. in packageLibraryMappings add
        Dependencies.scala3SbtBridge_300 -> Some("lib/jps/scala3-sbt-bridge-3.0.0.jar"),
        Dependencies.scala3SbtBridge_302 -> Some("lib/jps/scala3-sbt-bridge-3.0.2.jar"),
  val scala3SbtBridge_300 = "org.scala-lang" % "scala3-sbt-bridge" % "3.0.0"
  val scala3SbtBridge_302 = "org.scala-lang" % "scala3-sbt-bridge" % "3.0.2-RC1-bin-SNAPSHOT"

(I have a locally-published version of scala3-sbt-bridge 3.0.2, published from dotty repository)

val runtime: Seq[ModuleID] = Seq(
    sbtLaunch,
    compilerBridgeSources_2_10,
    compilerBridgeSources_2_11,
    compilerBridgeSources_2_13,
    scala3SbtBridge_300,
    scala3SbtBridge_302,
  )
  1. reimport the project, see that scala-plugin-for-ultimate\.idea\artifacts\scalaUltimate.xml only contains item for one artifact:
<element id="archive" name="scala3-sbt-bridge-3.0.2.jar">
<element id="extracted-dir" path="...\.ivy2\local\org.scala-lang\scala3-sbt-bridge\3.0.2-RC1-bin-SNAPSHOT\jars\scala3-sbt-bridge.jar" path-in-jar="/" />
</element>

so packaged Scala plugin will contain only one jar

@unkarjedy
Copy link
Member Author

unkarjedy commented Jul 15, 2021

I tracked down the bug to org.jetbrains.sbtidea.packaging.structure.sbtImpl.SbtPackageProjectData.cp:
it contains deduplicated entries, which only contains single version of scala3-sbt-bridge library.
Looks like it comes from sbt behaviour: it evicts libraries in managedClasspath which is passed to SbtPackageProjectData.cp

I stopped my investigation, cause I am already too far from my original task.
For now, I use a hack: create a new runtimeDependencies2 project with it's own mapping for 3.0.2 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant