Merge pull request #522 from adpi2/2.x-merge-main

[2.x] Merge main
This commit is contained in:
adpi2 2024-10-08 15:50:24 +02:00 committed by GitHub
commit 740f4b8e60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 50 additions and 15 deletions

View File

@ -16,7 +16,7 @@ inThisBuild(List(
)
),
semanticdbEnabled := true,
semanticdbVersion := "4.8.14",
semanticdbVersion := "4.9.8",
scalafixDependencies += "net.hamnaberg" %% "dataclass-scalafix" % dataclassScalafixV,
version := "2.0.0-alpha8-SNAPSHOT",
scalaVersion := scala3,
@ -43,7 +43,7 @@ ThisBuild / assemblyMergeStrategy := {
oldStrategy(x)
}
val coursierVersion0 = "2.1.9"
val coursierVersion0 = "2.1.13"
val lmVersion = "1.3.4"
val lm2_13Version = "1.5.0-M3"
val lm3Version = "2.0.0-M1"
@ -143,7 +143,7 @@ lazy val `lm-coursier` = project
// IvySbt#Module (seems DependencyResolutionInterface.moduleDescriptor
// is ignored).
lmIvy.value,
"org.scalatest" %% "scalatest" % "3.2.18" % Test,
"org.scalatest" %% "scalatest" % "3.2.19" % Test
),
excludeDependencies ++= excludedDependencies,
Test / exportedProducts := {
@ -222,7 +222,7 @@ lazy val `lm-coursier-shaded` = project
"io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier" % jniUtilsVersion,
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixV % Provided,
lmIvy.value % Provided,
"org.scalatest" %% "scalatest" % "3.2.18" % Test,
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
),
excludeDependencies ++= excludedDependencies,
conflictWarning := ConflictWarning.disable,
@ -236,7 +236,7 @@ lazy val `sbt-coursier-shared` = project
.settings(
plugin,
generatePropertyFile,
libraryDependencies += "com.lihaoyi" %% "utest" % "0.8.3" % Test,
libraryDependencies += "com.lihaoyi" %% "utest" % "0.8.4" % Test,
testFrameworks += new TestFramework("utest.runner.Framework")
)

View File

@ -4,15 +4,16 @@ import java.io.File
import java.net.URL
import java.util.GregorianCalendar
import java.util.concurrent.ConcurrentHashMap
import coursier.cache.CacheUrl
import coursier.{Attributes, Dependency, Module, Project, Resolution}
import coursier.core.{Classifier, Configuration, Extension, Publication, Type}
import coursier.core.{Classifier, Configuration, Extension, Info, Publication, Type}
import coursier.maven.MavenAttributes
import coursier.util.Artifact
import sbt.librarymanagement.{Artifact => _, Configuration => _, _}
import sbt.util.Logger
import scala.annotation.tailrec
private[internal] object SbtUpdateReport {
private def caching[K, V](f: K => V): K => V = {
@ -226,6 +227,26 @@ private[internal] object SbtUpdateReport {
)
}
/**
* Assemble the project info, resolving inherited fields. Only implements resolving
* the fields that are relevant for moduleReport
*
* @see https://maven.apache.org/pom.html#Inheritance
* @see https://maven.apache.org/ref/3-LATEST/maven-model-builder/index.html#Inheritance_Assembly
*/
def assemble(project: Project): Project = {
@tailrec
def licenseInfo(project: Project): Seq[Info.License] = {
if (project.info.licenseInfo.nonEmpty || project.parent.isEmpty)
project.info.licenseInfo
else
licenseInfo(lookupProject(project.parent.get).get)
}
project.withInfo(
project.info.withLicenseInfo(licenseInfo(project))
)
}
val m = Dependency(thisModule._1, "")
val directReverseDependencies = res.rootDependencies.toSet.map(clean).map(_.withVersion(""))
.map(
@ -252,6 +273,7 @@ private[internal] object SbtUpdateReport {
groupedDepArtifacts.toVector.map {
case (dep, artifacts) =>
val proj = lookupProject(dep.moduleVersion).get
val assembledProject = assemble(proj)
// FIXME Likely flaky...
val dependees = reverseDependencies
@ -280,7 +302,7 @@ private[internal] object SbtUpdateReport {
moduleReport((
dep,
dependees,
proj,
assembledProject,
filesOpt,
classLoaders,
))

View File

@ -235,4 +235,17 @@ final class ResolutionSpec extends AnyPropSpec with Matchers {
assert(resolution.isRight)
}
property("resolve licenses from parent poms") {
val dependencies =
Vector(("org.apache.commons" % "commons-compress" % "1.26.2"))
val coursierModule = module(lmEngine, stubModule, dependencies, Some("2.12.4"))
val resolution =
lmEngine.update(coursierModule, UpdateConfiguration(), UnresolvedWarningConfiguration(), log)
assert(resolution.isRight)
val componentConfig = resolution.right.get.configurations.find(_.configuration == Compile.toConfigRef).get
val compress = componentConfig.modules.find(_.module.name == "commons-compress").get
compress.licenses should have size 1
}
}

View File

@ -9,9 +9,9 @@ import com.jsuereth.sbtpgp._
object Settings {
def scala212 = "2.12.17"
def scala213 = "2.13.10"
def scala3 = "3.3.1"
def scala212 = "2.12.20"
def scala213 = "2.13.15"
def scala3 = "3.3.4"
def targetSbtVersion = "1.2.8"

View File

@ -1 +1 @@
sbt.version=1.9.7
sbt.version=1.10.2

View File

@ -1,9 +1,9 @@
semanticdbEnabled := false
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.6.1")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")
// addSbtPlugin("io.get-coursier" % "sbt-shading" % "2.1.5")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.0.0-RC1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.13.0")
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value