mirror of https://github.com/sbt/sbt.git
Merge pull request #7755 from adpi2/2.x-lm-coursier-shading
[2.x] Exclude Scala libraries from lm-coursier-shaded
This commit is contained in:
commit
242bd18d30
65
build.sbt
65
build.sbt
|
|
@ -1447,35 +1447,6 @@ lazy val lmCoursierSettings: Seq[Setting[_]] = Def.settings(
|
|||
),
|
||||
)
|
||||
|
||||
lazy val lmCoursierDependencies = Def.settings(
|
||||
libraryDependencies ++= Seq(
|
||||
coursier,
|
||||
coursierSbtMavenRepo,
|
||||
"io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier" % jniUtilsVersion,
|
||||
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixVersion % Provided,
|
||||
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
|
||||
),
|
||||
excludeDependencies ++= Seq(
|
||||
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13"),
|
||||
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13")
|
||||
),
|
||||
)
|
||||
|
||||
def dataclassGen(data: Reference) = Def.taskDyn {
|
||||
val root = (ThisBuild / baseDirectory).value.toURI.toString
|
||||
val from = (data / Compile / sourceDirectory).value
|
||||
val to = (Compile / sourceManaged).value
|
||||
val outFrom = from.toURI.toString.stripSuffix("/").stripPrefix(root)
|
||||
val outTo = to.toURI.toString.stripSuffix("/").stripPrefix(root)
|
||||
val _ = (data / Compile / compile).value
|
||||
Def.task {
|
||||
val _ = (data / Compile / scalafix)
|
||||
.toTask(s" --rules GenerateDataClass --out-from=$outFrom --out-to=$outTo")
|
||||
.value
|
||||
(to ** "*.scala").get
|
||||
}
|
||||
}
|
||||
|
||||
lazy val lmCoursierDefinitions = project
|
||||
.in(file("lm-coursier/definitions"))
|
||||
.disablePlugins(MimaPlugin)
|
||||
|
|
@ -1493,6 +1464,20 @@ lazy val lmCoursierDefinitions = project
|
|||
)
|
||||
.dependsOn(lmIvy % "provided")
|
||||
|
||||
lazy val lmCoursierDependencies = Def.settings(
|
||||
libraryDependencies ++= Seq(
|
||||
coursier,
|
||||
coursierSbtMavenRepo,
|
||||
"io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier" % jniUtilsVersion,
|
||||
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixVersion % Provided,
|
||||
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
|
||||
),
|
||||
excludeDependencies ++= Seq(
|
||||
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13"),
|
||||
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13")
|
||||
),
|
||||
)
|
||||
|
||||
lazy val lmCoursier = project
|
||||
.in(file("lm-coursier"))
|
||||
.settings(
|
||||
|
|
@ -1500,7 +1485,7 @@ lazy val lmCoursier = project
|
|||
Mima.settings,
|
||||
Mima.lmCoursierFilters,
|
||||
lmCoursierDependencies,
|
||||
Compile / sourceGenerators += dataclassGen(lmCoursierDefinitions).taskValue,
|
||||
Compile / sourceGenerators += Utils.dataclassGen(lmCoursierDefinitions).taskValue,
|
||||
)
|
||||
.dependsOn(
|
||||
// We depend on lmIvy rather than just lmCore to handle the ModuleDescriptor
|
||||
|
|
@ -1518,23 +1503,13 @@ lazy val lmCoursierShaded = project
|
|||
Mima.lmCoursierShadedFilters,
|
||||
Compile / sources := (lmCoursier / Compile / sources).value,
|
||||
lmCoursierDependencies,
|
||||
autoScalaLibrary := false,
|
||||
libraryDependencies ++= Seq(
|
||||
scala3Library % Provided,
|
||||
),
|
||||
assembly / assemblyOption ~= { _.withIncludeScala(false) },
|
||||
conflictWarning := ConflictWarning.disable,
|
||||
Utils.noPublish,
|
||||
// shadedModules ++= Set(
|
||||
// "io.get-coursier" %% "coursier",
|
||||
// "io.get-coursier" %% "coursier-sbt-maven-repository",
|
||||
// "io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier"
|
||||
// ),
|
||||
// validNamespaces += "lmcoursier",
|
||||
// validEntries ++= Set(
|
||||
// // FIXME Ideally, we should just strip those from the resulting JAR…
|
||||
// "README", // from google-collections via plexus-archiver (see below)
|
||||
// // from plexus-util via plexus-archiver (see below)
|
||||
// "licenses/extreme.indiana.edu.license.TXT",
|
||||
// "licenses/javolution.license.TXT",
|
||||
// "licenses/thoughtworks.TXT",
|
||||
// "licenses/",
|
||||
// ),
|
||||
assemblyShadeRules := {
|
||||
val namespacesToShade = Seq(
|
||||
"coursier",
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ object Dependencies {
|
|||
"com.eed3si9n.remoteapis.shaded" % "shaded-remoteapis-java" % "2.3.0-M1-52317e00d8d4c37fa778c628485d220fb68a8d08"
|
||||
|
||||
val scalaCompiler = "org.scala-lang" %% "scala3-compiler" % scala3
|
||||
val scala3Library = "org.scala-lang" %% "scala3-library" % scala3
|
||||
|
||||
val scalaXml = Def.setting(
|
||||
if (scalaBinaryVersion.value == "3") {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import scala.util.control.NonFatal
|
||||
import sbt._
|
||||
import Keys._
|
||||
import scalafix.sbt.ScalafixPlugin.autoImport.scalafix
|
||||
|
||||
import sbt.internal.inc.Analysis
|
||||
|
||||
|
|
@ -165,6 +166,21 @@ object Utils {
|
|||
sourceGenerators += Def.task(Seq(generateKeywords.value)).taskValue
|
||||
)
|
||||
)
|
||||
|
||||
def dataclassGen(data: Reference) = Def.taskDyn {
|
||||
val root = (ThisBuild / baseDirectory).value.toURI.toString
|
||||
val from = (data / Compile / sourceDirectory).value
|
||||
val to = (Compile / sourceManaged).value
|
||||
val outFrom = from.toURI.toString.stripSuffix("/").stripPrefix(root)
|
||||
val outTo = to.toURI.toString.stripSuffix("/").stripPrefix(root)
|
||||
val _ = (data / Compile / compile).value
|
||||
Def.task {
|
||||
val _ = (data / Compile / scalafix)
|
||||
.toTask(s" --rules GenerateDataClass --out-from=$outFrom --out-to=$outTo")
|
||||
.value
|
||||
(to ** "*.scala").get
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Licensed {
|
||||
|
|
|
|||
Loading…
Reference in New Issue