Fix deprecation warnings

This commit is contained in:
Alexandre Archambault 2018-03-12 11:18:20 +01:00
parent b1fde7291d
commit 6f8a9d295f
24 changed files with 44 additions and 31 deletions

View File

@ -32,7 +32,8 @@ object Native {
Seq(s"$binaryName$major$minor", s"$binaryName-$major.$minor")
} :+ binaryName
Process("which" +: binaryNames).lines_!
Process("which" +: binaryNames)
.lineStream_!
.map(new File(_))
.headOption
.getOrElse {
@ -325,7 +326,7 @@ object Native {
val compileOpts = {
val includes = {
val includedir =
Try(Process("llvm-config --includedir").lines_!)
Try(Process("llvm-config --includedir").lineStream_!)
.getOrElse(Seq.empty)
("/usr/local/include" +: includedir).map(s => s"-I$s")
}
@ -392,7 +393,7 @@ object Native {
val nativeCompileOptions = {
val includes = {
val includedir =
Try(Process("llvm-config --includedir").lines_!)
Try(Process("llvm-config --includedir").lineStream_!)
.getOrElse(Seq.empty)
("/usr/local/include" +: includedir).map(s => s"-I$s")
}
@ -444,7 +445,7 @@ object Native {
val nativeLinkingOptions = {
val libs = {
val libdir =
Try(Process("llvm-config --libdir").lines_!)
Try(Process("llvm-config --libdir").lineStream_!)
.getOrElse(Seq.empty)
("/usr/local/lib" +: libdir).map(s => s"-L$s")
}

View File

@ -81,7 +81,7 @@ object CoursierPlugin extends AutoPlugin {
IvyXml.writeFiles(currentProject, shadedConfigOpt, ivySbt.value, streams.value.log)
}).value
private val pluginIvySnapshotsBase = Resolver.SbtPluginRepositoryRoot.stripSuffix("/") + "/ivy-snapshots"
private val pluginIvySnapshotsBase = Resolver.SbtRepositoryRoot.stripSuffix("/") + "/ivy-snapshots"
// allows to get the actual repo list when sbt starts up
private val hackHack = Seq(
@ -93,25 +93,33 @@ object CoursierPlugin extends AutoPlugin {
// hack to trigger https://github.com/sbt/sbt/blob/v1.0.1/main/src/main/scala/sbt/Defaults.scala#L2856,
// to have the third case be used instead of the second one, at https://github.com/sbt/sbt/blob/v1.0.1/main/src/main/scala/sbt/Defaults.scala#L2069
// 😃🔫
new xsbti.AppConfiguration {
def provider() = {
import scala.language.reflectiveCalls
val prov = app.provider()
val noWarningForDeprecatedStuffProv = prov.asInstanceOf[{
def mainClass(): Class[_ <: xsbti.AppMain]
}]
new xsbti.AppProvider {
def newMain() = prov.newMain()
def components() = prov.components()
def mainClass() = prov.mainClass()
def mainClass() = noWarningForDeprecatedStuffProv.mainClass()
def mainClasspath() = prov.mainClasspath()
def loader() = prov.loader()
def scalaProvider() = {
val scalaProv = prov.scalaProvider()
val noWarningForDeprecatedStuffScalaProv = scalaProv.asInstanceOf[{
def libraryJar(): File
def compilerJar(): File
}]
new xsbti.ScalaProvider {
def app(id: xsbti.ApplicationID) = scalaProv.app(id)
def loader() = scalaProv.loader()
def jars() = scalaProv.jars()
def libraryJar() = scalaProv.libraryJar()
def libraryJar() = noWarningForDeprecatedStuffScalaProv.libraryJar()
def version() = scalaProv.version()
def compilerJar() = scalaProv.compilerJar()
def compilerJar() = noWarningForDeprecatedStuffScalaProv.compilerJar()
def launcher() = {
val launch = scalaProv.launcher()
new xsbti.Launcher {
@ -152,7 +160,7 @@ object CoursierPlugin extends AutoPlugin {
packageConfigs: Seq[(Configuration, String)]
) = hackHack ++ Seq(
clean := {
clean.value
val noWarningPlz = clean.value
Tasks.resolutionsCache.clear()
Tasks.reportsCache.clear()
},

View File

@ -4,7 +4,7 @@ import utest._
object IvyXmlTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
"no truncation" - {
val project = Project(

View File

@ -3,4 +3,8 @@ package coursier
object SbtCompatibility {
def needsIvyXmlLocal = List(sbt.Keys.deliverLocalConfiguration)
def needsIvyXml = List(sbt.Keys.deliverConfiguration)
implicit class ResolverCompationExtraOps(val res: sbt.Resolver.type) {
def SbtRepositoryRoot = res.SbtPluginRepositoryRoot
}
}

View File

@ -9,7 +9,7 @@ import scala.concurrent.{ Future, Promise }
object JsTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'promise{
val p = Promise[Unit]()
Future(p.success(()))

View File

@ -22,7 +22,7 @@ object DirectoryListingTests extends TestSuite {
val module = Module("com.abc", "test")
val version = "0.1"
val tests = TestSuite {
val tests = Tests {
'withListing - {
'jar - CentralTests.withArtifacts(
module,

View File

@ -7,7 +7,7 @@ import coursier.maven.MavenRepository
object HttpAuthenticationTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'httpAuthentication - {
// requires an authenticated HTTP server to be running on localhost:8080 with user 'user'
// and password 'pass'

View File

@ -66,7 +66,7 @@ object CacheFetchTests extends TestSuite {
assert(errors.isEmpty)
}
val tests = TestSuite {
val tests = Tests {
// using scala-test would allow to put the below comments in the test names...

View File

@ -11,7 +11,7 @@ import scala.concurrent.{ExecutionContext, Future}
object ChecksumTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'parse - {

View File

@ -18,7 +18,7 @@ object IvyTests extends TestSuite {
throw new Exception("Cannot happen")
)
val tests = TestSuite {
val tests = Tests {
'dropInfoAttributes - {
CentralTests.resolutionCheck(
module = Module(

View File

@ -9,7 +9,7 @@ object MavenTests extends TestSuite {
// only tested on the JVM for lack of support of XML attributes in the platform-dependent XML stubs
val tests = TestSuite {
val tests = Tests {
'testSnapshotNoVersioning - {
val dep = Dependency(

View File

@ -5,7 +5,7 @@ import utest._
object PropertiesTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'version - {
assert(Properties.version.nonEmpty)

View File

@ -13,7 +13,7 @@ import scalaz.concurrent.Task
object ResolutionProcessTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'fetchAll - {

View File

@ -22,7 +22,7 @@ object ActivationTests extends TestSuite {
// - condition on OS or JDK, but no OS or JDK info provided (-> no match)
// - negated OS infos (starting with "!") - not implemented yet
val tests = TestSuite {
val tests = Tests {
'OS - {
'fromProperties - {
'MacOSX - {

View File

@ -214,7 +214,7 @@ abstract class CentralTests extends TestSuite {
assert(artifact.url.endsWith("." + extension))
}
val tests = TestSuite {
val tests = Tests {
'logback - {
async {

View File

@ -8,7 +8,7 @@ object ExclusionsTests extends TestSuite {
def exclusionsAdd(e1: Set[(String, String)], e2: Set[(String, String)]) =
core.Exclusions.minimize(e1 ++ e2)
val tests = TestSuite {
val tests = Tests {
val e1 = Set(("org1", "name1"))
val e2 = Set(("org2", "name2"))

View File

@ -8,7 +8,7 @@ import utest._
object IvyPatternParserTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'plugin - {
val strPattern = "[organization]/[module](/scala_[scalaVersion])(/sbt_[sbtVersion])/[revision]/resolved.xml.[ext]"

View File

@ -22,7 +22,7 @@ object ParseTests extends TestSuite {
val url = "file%3A%2F%2Fsome%2Fencoded%2Furl"
val tests = TestSuite {
val tests = Tests {
"bintray-ivy:" - {
val obtained = Parse.repository("bintray-ivy:scalameta/maven")
assert(obtained.right.exists(isIvyRepo))

View File

@ -8,7 +8,7 @@ import utest._
object PomParsingTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'readClassifier{
val depNode ="""
<dependency>

View File

@ -206,7 +206,7 @@ object ResolutionTests extends TestSuite {
testRepository
)
val tests = TestSuite {
val tests = Tests {
'empty{
async{
val res = await(resolve0(

View File

@ -6,7 +6,7 @@ import utest._
object VersionConstraintTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'parse{
'empty{
val c0 = Parse.versionConstraint("")

View File

@ -14,7 +14,7 @@ object VersionTests extends TestSuite {
versions.iterator.sliding(2).withPartial(false).forall{case Seq(a, b) => compare(a, b) < 0 }
val tests = TestSuite {
val tests = Tests {
'stackOverflow - {
val s = "." * 100000

View File

@ -6,7 +6,7 @@ import utest._
object PrintTests extends TestSuite {
val tests = TestSuite {
val tests = Tests {
'ignoreAttributes - {
val dep = Dependency(
Module("org", "name"),

View File

@ -54,7 +54,7 @@ object TreeTests extends TestSuite {
e.addChild(f)
val tests = TestSuite {
val tests = Tests {
'basic {
val str = Tree[Node](roots)(_.children, _.label)
assert(str ==