mirror of https://github.com/sbt/sbt.git
Merge remote-tracking branch 'origin/develop' into merge-develop
This commit is contained in:
commit
2e1bed8e5a
|
|
@ -10,12 +10,15 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
java: 8
|
java: 8
|
||||||
|
distribution: zulu
|
||||||
jobtype: 1
|
jobtype: 1
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
java: 11
|
java: 11
|
||||||
|
distribution: temurin
|
||||||
jobtype: 1
|
jobtype: 1
|
||||||
- os: ubuntu-latest
|
- os: macos-latest
|
||||||
java: 17
|
java: 17
|
||||||
|
distribution: temurin
|
||||||
jobtype: 1
|
jobtype: 1
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
|
|
@ -26,11 +29,13 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup JDK
|
- name: Setup JDK
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: "${{ matrix.distribution }}"
|
||||||
java-version: "${{ matrix.java }}"
|
java-version: "${{ matrix.java }}"
|
||||||
cache: sbt
|
cache: sbt
|
||||||
|
- name: Setup sbt
|
||||||
|
uses: sbt/setup-sbt@v1
|
||||||
- name: Build and test (1)
|
- name: Build and test (1)
|
||||||
if: ${{ matrix.jobtype == 1 }}
|
if: ${{ matrix.jobtype == 1 }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,15 @@
|
||||||
*/
|
*/
|
||||||
package sbt.librarymanagement
|
package sbt.librarymanagement
|
||||||
|
|
||||||
import java.io.{ IOException, File }
|
import java.io.{ File, IOException }
|
||||||
import java.net.{ URI, URL }
|
import java.net.{ URI, URL }
|
||||||
import scala.annotation.nowarn
|
import scala.annotation.nowarn
|
||||||
import scala.xml.XML
|
import scala.xml.XML
|
||||||
import org.xml.sax.SAXParseException
|
import org.xml.sax.SAXParseException
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
|
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
import scala.util.matching.Regex
|
||||||
|
|
||||||
final class RawRepository(val resolver: AnyRef, name: String) extends Resolver(name) {
|
final class RawRepository(val resolver: AnyRef, name: String) extends Resolver(name) {
|
||||||
override def toString = "Raw(" + resolver.toString + ")"
|
override def toString = "Raw(" + resolver.toString + ")"
|
||||||
|
|
@ -400,20 +402,29 @@ private[librarymanagement] abstract class ResolverFunctions {
|
||||||
def defaultRetrievePattern =
|
def defaultRetrievePattern =
|
||||||
"[type]s/[organisation]/[module]/" + PluginPattern + "[artifact](-[revision])(-[classifier]).[ext]"
|
"[type]s/[organisation]/[module]/" + PluginPattern + "[artifact](-[revision])(-[classifier]).[ext]"
|
||||||
final val PluginPattern = "(scala_[scalaVersion]/)(sbt_[sbtVersion]/)"
|
final val PluginPattern = "(scala_[scalaVersion]/)(sbt_[sbtVersion]/)"
|
||||||
private[librarymanagement] def expandMavenSettings(str: String): String = {
|
|
||||||
|
private[librarymanagement] def expandMavenSettings(
|
||||||
|
str: String,
|
||||||
|
envVars: Map[String, String] = sys.env,
|
||||||
|
props: Map[String, String] = sys.props.toMap
|
||||||
|
): String = {
|
||||||
// Aren't regular expressions beautifully clear and concise.
|
// Aren't regular expressions beautifully clear and concise.
|
||||||
// This means "find all ${...}" blocks, with the first group of each being the text between curly brackets.
|
// This means "find all ${...}" blocks, with the first group of each being the text between curly brackets.
|
||||||
val findQuoted = "\\$\\{([^\\}]*)\\}".r
|
val findQuoted = "\\$\\{([^}]*)}".r
|
||||||
val env = "env\\.(.*)".r
|
val env = "env\\.(.*)".r
|
||||||
|
|
||||||
findQuoted.replaceAllIn(
|
findQuoted.replaceAllIn(
|
||||||
str,
|
str,
|
||||||
_.group(1) match {
|
regexMatch =>
|
||||||
case env(variable) => sys.env.getOrElse(variable, "")
|
Regex.quoteReplacement {
|
||||||
case property => sys.props.getOrElse(property, "")
|
regexMatch.group(1) match {
|
||||||
|
case env(variable) => envVars.getOrElse(variable, "")
|
||||||
|
case property => props.getOrElse(property, "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private[this] def mavenLocalDir: File = {
|
private[this] def mavenLocalDir: File = {
|
||||||
def loadHomeFromSettings(f: () => File): Option[File] =
|
def loadHomeFromSettings(f: () => File): Option[File] =
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,13 @@ object ResolverExtraTest extends BasicTestSuite {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("expandMavenSettings should preserve backslashes in environment variable values") {
|
||||||
|
val path = """C:\foo\bar\baz"""
|
||||||
|
val env = Map("SOME_PATH" -> path)
|
||||||
|
|
||||||
|
assert(Resolver.expandMavenSettings("${env.SOME_PATH}", env) == path)
|
||||||
|
}
|
||||||
|
|
||||||
// - Helper functions ----------------------------------------------------------------------------
|
// - Helper functions ----------------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
def assertExpansion(input: String, expected: String) =
|
def assertExpansion(input: String, expected: String) =
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,7 @@ object PomExtraDependencyAttributes {
|
||||||
item.getQualifiedExtraAttributes.asInstanceOf[java.util.Map[String, String]].asScala.toMap
|
item.getQualifiedExtraAttributes.asInstanceOf[java.util.Map[String, String]].asScala.toMap
|
||||||
}
|
}
|
||||||
def filterCustomExtra(item: ExtendableItem, include: Boolean): Map[String, String] =
|
def filterCustomExtra(item: ExtendableItem, include: Boolean): Map[String, String] =
|
||||||
qualifiedExtra(item).view.filterKeys { k =>
|
qualifiedExtra(item).view.filterKeys { k => qualifiedIsExtra(k) == include }.toMap
|
||||||
qualifiedIsExtra(k) == include
|
|
||||||
}.toMap
|
|
||||||
|
|
||||||
def qualifiedIsExtra(k: String): Boolean =
|
def qualifiedIsExtra(k: String): Boolean =
|
||||||
k.endsWith(ScalaVersionKey) || k.endsWith(SbtVersionKey)
|
k.endsWith(ScalaVersionKey) || k.endsWith(SbtVersionKey)
|
||||||
|
|
@ -109,17 +107,27 @@ object PomExtraDependencyAttributes {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the "extra" property values for DependencyDescriptors that can be written into a maven pom
|
* Creates the "extra" property values for DependencyDescriptors that can be written into a maven pom
|
||||||
* so we don't loose the information.
|
* so we don't lose the information.
|
||||||
* @param s
|
* @param s
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
def writeDependencyExtra(s: Seq[DependencyDescriptor]): Seq[String] =
|
def writeDependencyExtra(s: Seq[DependencyDescriptor]): Seq[String] =
|
||||||
s.flatMap { dd =>
|
s.flatMap { dd =>
|
||||||
val revId = dd.getDependencyRevisionId
|
val revId = dd.getDependencyRevisionId
|
||||||
if (filterCustomExtra(revId, include = true).isEmpty)
|
val filteredExtra = filterCustomExtra(revId, include = true)
|
||||||
|
if (filteredExtra.isEmpty)
|
||||||
Nil
|
Nil
|
||||||
else
|
else {
|
||||||
revId.encodeToString :: Nil
|
import scala.collection.JavaConverters._
|
||||||
|
val revId0 = ModuleRevisionId.newInstance(
|
||||||
|
revId.getOrganisation,
|
||||||
|
revId.getName,
|
||||||
|
revId.getBranch,
|
||||||
|
revId.getRevision,
|
||||||
|
filteredExtra.asJava
|
||||||
|
)
|
||||||
|
revId0.encodeToString :: Nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ package sbt.internal.librarymanagement
|
||||||
import sbt.librarymanagement._
|
import sbt.librarymanagement._
|
||||||
import sbt.librarymanagement.syntax._
|
import sbt.librarymanagement.syntax._
|
||||||
import sbt.librarymanagement.ivy.UpdateOptions
|
import sbt.librarymanagement.ivy.UpdateOptions
|
||||||
import Resolver._
|
|
||||||
|
|
||||||
object ModuleResolversTest extends BaseIvySpecification {
|
object ModuleResolversTest extends BaseIvySpecification {
|
||||||
override final val resolvers = Vector(
|
override final val resolvers = Vector(
|
||||||
DefaultMavenRepository,
|
MavenRepository(
|
||||||
JavaNet2Repository,
|
"JFrog OSS Releases",
|
||||||
JCenterRepository,
|
"https://releases.jfrog.io/artifactory/oss-releases/"
|
||||||
|
),
|
||||||
Resolver.sbtPluginRepo("releases")
|
Resolver.sbtPluginRepo("releases")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -45,8 +45,7 @@ object ModuleResolversTest extends BaseIvySpecification {
|
||||||
println(s"NORMAL RESOLUTION TIME $normalResolutionTime")
|
println(s"NORMAL RESOLUTION TIME $normalResolutionTime")
|
||||||
println(s"FASTER RESOLUTION TIME $fasterResolutionTime")
|
println(s"FASTER RESOLUTION TIME $fasterResolutionTime")
|
||||||
|
|
||||||
// Check that faster resolution is at least 1/5 faster than normal resolution
|
// Check that faster resolution is faster
|
||||||
// This is a conservative check just to make sure we don't regress -- speedup is higher
|
assert(fasterResolutionTime < normalResolutionTime)
|
||||||
assert(fasterResolutionTime <= (normalResolutionTime * 0.80))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
|
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
|
||||||
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
|
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
|
||||||
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")
|
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")
|
||||||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.2")
|
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
|
||||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.3")
|
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.3")
|
||||||
|
|
||||||
scalacOptions += "-language:postfixOps"
|
scalacOptions += "-language:postfixOps"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue