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") Seq(s"$binaryName$major$minor", s"$binaryName-$major.$minor")
} :+ binaryName } :+ binaryName
Process("which" +: binaryNames).lines_! Process("which" +: binaryNames)
.lineStream_!
.map(new File(_)) .map(new File(_))
.headOption .headOption
.getOrElse { .getOrElse {
@ -325,7 +326,7 @@ object Native {
val compileOpts = { val compileOpts = {
val includes = { val includes = {
val includedir = val includedir =
Try(Process("llvm-config --includedir").lines_!) Try(Process("llvm-config --includedir").lineStream_!)
.getOrElse(Seq.empty) .getOrElse(Seq.empty)
("/usr/local/include" +: includedir).map(s => s"-I$s") ("/usr/local/include" +: includedir).map(s => s"-I$s")
} }
@ -392,7 +393,7 @@ object Native {
val nativeCompileOptions = { val nativeCompileOptions = {
val includes = { val includes = {
val includedir = val includedir =
Try(Process("llvm-config --includedir").lines_!) Try(Process("llvm-config --includedir").lineStream_!)
.getOrElse(Seq.empty) .getOrElse(Seq.empty)
("/usr/local/include" +: includedir).map(s => s"-I$s") ("/usr/local/include" +: includedir).map(s => s"-I$s")
} }
@ -444,7 +445,7 @@ object Native {
val nativeLinkingOptions = { val nativeLinkingOptions = {
val libs = { val libs = {
val libdir = val libdir =
Try(Process("llvm-config --libdir").lines_!) Try(Process("llvm-config --libdir").lineStream_!)
.getOrElse(Seq.empty) .getOrElse(Seq.empty)
("/usr/local/lib" +: libdir).map(s => s"-L$s") ("/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) IvyXml.writeFiles(currentProject, shadedConfigOpt, ivySbt.value, streams.value.log)
}).value }).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 // allows to get the actual repo list when sbt starts up
private val hackHack = Seq( 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, // 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 // 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 { new xsbti.AppConfiguration {
def provider() = { def provider() = {
import scala.language.reflectiveCalls
val prov = app.provider() val prov = app.provider()
val noWarningForDeprecatedStuffProv = prov.asInstanceOf[{
def mainClass(): Class[_ <: xsbti.AppMain]
}]
new xsbti.AppProvider { new xsbti.AppProvider {
def newMain() = prov.newMain() def newMain() = prov.newMain()
def components() = prov.components() def components() = prov.components()
def mainClass() = prov.mainClass() def mainClass() = noWarningForDeprecatedStuffProv.mainClass()
def mainClasspath() = prov.mainClasspath() def mainClasspath() = prov.mainClasspath()
def loader() = prov.loader() def loader() = prov.loader()
def scalaProvider() = { def scalaProvider() = {
val scalaProv = prov.scalaProvider() val scalaProv = prov.scalaProvider()
val noWarningForDeprecatedStuffScalaProv = scalaProv.asInstanceOf[{
def libraryJar(): File
def compilerJar(): File
}]
new xsbti.ScalaProvider { new xsbti.ScalaProvider {
def app(id: xsbti.ApplicationID) = scalaProv.app(id) def app(id: xsbti.ApplicationID) = scalaProv.app(id)
def loader() = scalaProv.loader() def loader() = scalaProv.loader()
def jars() = scalaProv.jars() def jars() = scalaProv.jars()
def libraryJar() = scalaProv.libraryJar() def libraryJar() = noWarningForDeprecatedStuffScalaProv.libraryJar()
def version() = scalaProv.version() def version() = scalaProv.version()
def compilerJar() = scalaProv.compilerJar() def compilerJar() = noWarningForDeprecatedStuffScalaProv.compilerJar()
def launcher() = { def launcher() = {
val launch = scalaProv.launcher() val launch = scalaProv.launcher()
new xsbti.Launcher { new xsbti.Launcher {
@ -152,7 +160,7 @@ object CoursierPlugin extends AutoPlugin {
packageConfigs: Seq[(Configuration, String)] packageConfigs: Seq[(Configuration, String)]
) = hackHack ++ Seq( ) = hackHack ++ Seq(
clean := { clean := {
clean.value val noWarningPlz = clean.value
Tasks.resolutionsCache.clear() Tasks.resolutionsCache.clear()
Tasks.reportsCache.clear() Tasks.reportsCache.clear()
}, },

View File

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

View File

@ -3,4 +3,8 @@ package coursier
object SbtCompatibility { object SbtCompatibility {
def needsIvyXmlLocal = List(sbt.Keys.deliverLocalConfiguration) def needsIvyXmlLocal = List(sbt.Keys.deliverLocalConfiguration)
def needsIvyXml = List(sbt.Keys.deliverConfiguration) 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 { object JsTests extends TestSuite {
val tests = TestSuite { val tests = Tests {
'promise{ 'promise{
val p = Promise[Unit]() val p = Promise[Unit]()
Future(p.success(())) Future(p.success(()))

View File

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

View File

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

View File

@ -66,7 +66,7 @@ object CacheFetchTests extends TestSuite {
assert(errors.isEmpty) assert(errors.isEmpty)
} }
val tests = TestSuite { val tests = Tests {
// using scala-test would allow to put the below comments in the test names... // 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 { object ChecksumTests extends TestSuite {
val tests = TestSuite { val tests = Tests {
'parse - { 'parse - {

View File

@ -18,7 +18,7 @@ object IvyTests extends TestSuite {
throw new Exception("Cannot happen") throw new Exception("Cannot happen")
) )
val tests = TestSuite { val tests = Tests {
'dropInfoAttributes - { 'dropInfoAttributes - {
CentralTests.resolutionCheck( CentralTests.resolutionCheck(
module = Module( 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 // 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 - { 'testSnapshotNoVersioning - {
val dep = Dependency( val dep = Dependency(

View File

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

View File

@ -13,7 +13,7 @@ import scalaz.concurrent.Task
object ResolutionProcessTests extends TestSuite { object ResolutionProcessTests extends TestSuite {
val tests = TestSuite { val tests = Tests {
'fetchAll - { '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) // - condition on OS or JDK, but no OS or JDK info provided (-> no match)
// - negated OS infos (starting with "!") - not implemented yet // - negated OS infos (starting with "!") - not implemented yet
val tests = TestSuite { val tests = Tests {
'OS - { 'OS - {
'fromProperties - { 'fromProperties - {
'MacOSX - { 'MacOSX - {

View File

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

View File

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

View File

@ -8,7 +8,7 @@ import utest._
object IvyPatternParserTests extends TestSuite { object IvyPatternParserTests extends TestSuite {
val tests = TestSuite { val tests = Tests {
'plugin - { 'plugin - {
val strPattern = "[organization]/[module](/scala_[scalaVersion])(/sbt_[sbtVersion])/[revision]/resolved.xml.[ext]" 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 url = "file%3A%2F%2Fsome%2Fencoded%2Furl"
val tests = TestSuite { val tests = Tests {
"bintray-ivy:" - { "bintray-ivy:" - {
val obtained = Parse.repository("bintray-ivy:scalameta/maven") val obtained = Parse.repository("bintray-ivy:scalameta/maven")
assert(obtained.right.exists(isIvyRepo)) assert(obtained.right.exists(isIvyRepo))

View File

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

View File

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

View File

@ -6,7 +6,7 @@ import utest._
object VersionConstraintTests extends TestSuite { object VersionConstraintTests extends TestSuite {
val tests = TestSuite { val tests = Tests {
'parse{ 'parse{
'empty{ 'empty{
val c0 = Parse.versionConstraint("") 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 } versions.iterator.sliding(2).withPartial(false).forall{case Seq(a, b) => compare(a, b) < 0 }
val tests = TestSuite { val tests = Tests {
'stackOverflow - { 'stackOverflow - {
val s = "." * 100000 val s = "." * 100000

View File

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

View File

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