diff --git a/.travis.yml b/.travis.yml index 8ecb9677a..c7d814a1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,15 @@ -language: scala -scala: 2.12.7 +language: java os: linux -jdk: oraclejdk8 +jdk: openjdk8 +git: + depth: false # https://stackoverflow.com/a/51727114/3714539 before_install: - - git fetch --tags -script: - - scripts/travis.sh + - mkdir .bin + - curl -Lo .bin/sbt https://raw.githubusercontent.com/coursier/sbt-extras/77c93346a2b52cf35cc72382125cfdbb25a00197/sbt + - chmod +x .bin/sbt + - export PATH="$(pwd)/.bin:$PATH" + - export TRAVIS_SCALA_VERSION=2.12.8 +script: scripts/travis.sh stages: - name: test - name: release diff --git a/appveyor.yml b/appveyor.yml index 1aed4d288..5c52755c0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,18 +2,12 @@ version: '{build}' os: Windows Server 2012 install: - - ps: | - Add-Type -AssemblyName System.IO.Compression.FileSystem - if (!(Test-Path -Path "C:\sbt" )) { - (new-object System.Net.WebClient).DownloadFile( - 'https://dl.bintray.com/sbt/native-packages/sbt/0.13.8/sbt-0.13.8.zip', - 'C:\sbt-bin.zip' - ) - [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\sbt-bin.zip", "C:\sbt") - } + - cmd: mkdir C:\sbt + - cmd: curl -Lo C:\sbt\sbt https://github.com/coursier/sbt-launcher/releases/download/v1.2.5/csbt + - cmd: curl -Lo C:\sbt\sbt.bat https://github.com/coursier/sbt-launcher/releases/download/v1.2.5/csbt.bat - cmd: SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0 - - cmd: SET PATH=C:\sbt\sbt\bin;%JAVA_HOME%\bin;%PATH% - - cmd: SET SBT_OPTS=-Xmx4g -Xss2m + - cmd: SET PATH=C:\sbt;%JAVA_HOME%\bin;%PATH% + - cmd: SET JAVA_OPTS=-Xmx4g -Xss2m - git submodule update --init --recursive environment: TEST_REPOSITORY_HOST: localhost @@ -22,6 +16,7 @@ environment: TEST_REPOSITORY_PASSWORD: pass TEST_REPOSITORY: http://localhost:8080 build_script: + - cmd: .\metadata\coursier fetch io.get-coursier:http-server_2.12:1.0.0 - ps: Start-Job -filepath .\metadata\scripts\start-it-auth-server.ps1 -ArgumentList $pwd\metadata, $env:TEST_REPOSITORY_HOST, $env:TEST_REPOSITORY_PORT, $env:TEST_REPOSITORY_USER, $env:TEST_REPOSITORY_PASSWORD test_script: - sbt ++2.12.7 "sbt-lm-coursier/scripted shared-2/simple" sbt-coursier/scripted sbt-shading/scripted diff --git a/build.sbt b/build.sbt index bf6e64fbd..70b49c7a2 100644 --- a/build.sbt +++ b/build.sbt @@ -15,16 +15,13 @@ inThisBuild(List( ) )) -val coursierVersion = "1.1.0-M12" - lazy val `lm-coursier` = project .in(file("modules/lm-coursier")) .enablePlugins(ContrabandPlugin) .settings( shared, libraryDependencies ++= Seq( - "io.get-coursier" %% "coursier" % coursierVersion, - "io.get-coursier" %% "coursier-extra" % coursierVersion, + "io.get-coursier" %% "coursier" % "1.1.0-M13", // We depend on librarymanagement-ivy rather than just // librarymanagement-core to handle the ModuleDescriptor passed // to DependencyResolutionInterface.update, which is an diff --git a/metadata b/metadata index a0752761c..eb8d9e382 160000 --- a/metadata +++ b/metadata @@ -1 +1 @@ -Subproject commit a0752761c58fddd917f8b0c4bc8e69c8111ea606 +Subproject commit eb8d9e382fe9640dd4bea86ecf5d4ba99c8995a0 diff --git a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ArtifactsRun.scala b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ArtifactsRun.scala index 7d995391c..41737d70e 100644 --- a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ArtifactsRun.scala +++ b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ArtifactsRun.scala @@ -6,7 +6,7 @@ import coursier.cache.FileCache import coursier.Artifact import coursier.cache.loggers.{ProgressBarRefreshDisplay, RefreshLogger} import coursier.core.Type -import coursier.util.Schedulable +import coursier.util.Sync import sbt.util.Logger object ArtifactsRun { @@ -29,7 +29,7 @@ object ArtifactsRun { else "" - Schedulable.withFixedThreadPool(params.cacheParams.parallel) { pool => + Sync.withFixedThreadPool(params.cacheParams.parallel) { pool => coursier.Artifacts() .withResolutions(params.resolutions) diff --git a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/CoursierDependencyResolution.scala b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/CoursierDependencyResolution.scala index b106635c4..0f771d70b 100644 --- a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/CoursierDependencyResolution.scala +++ b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/CoursierDependencyResolution.scala @@ -4,9 +4,9 @@ import java.io.File import _root_.coursier.{Artifact, Organization, Resolution, organizationString} import _root_.coursier.core.{Classifier, Configuration, ModuleName} -import _root_.coursier.extra.Typelevel import _root_.coursier.lmcoursier.Inputs.withAuthenticationByHost import coursier.cache.{CacheDefaults, CachePolicy} +import coursier.internal.Typelevel import coursier.params.CacheParams import sbt.internal.librarymanagement.IvySbt import sbt.librarymanagement._ @@ -108,9 +108,9 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen val dependencies = module0 .dependencies .flatMap { d => - // crossVersion already taken into account, wiping it here - val d0 = d.withCrossVersion(CrossVersion.Disabled()) - FromSbt.dependencies(d0, sv, sbv) + // crossVersion sometimes already taken into account (when called via the update task), sometimes not + // (e.g. sbt-dotty 0.13.0-RC1) + FromSbt.dependencies(d, sv, sbv, optionalCrossVer = true) } .map { case (config, dep) => diff --git a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/FromSbt.scala b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/FromSbt.scala index d9ea873cb..25b15b3e7 100644 --- a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/FromSbt.scala +++ b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/FromSbt.scala @@ -2,7 +2,7 @@ package coursier.lmcoursier import coursier.ivy.IvyRepository import coursier.ivy.IvyXml.{mappings => ivyXmlMappings} -import java.net.{MalformedURLException, URL} +import java.net.MalformedURLException import coursier.cache.CacheUrl import coursier.{Attributes, Dependency, Module} @@ -17,9 +17,21 @@ object FromSbt { def sbtModuleIdName( moduleId: ModuleID, scalaVersion: => String, - scalaBinaryVersion: => String - ): String = - sbtCrossVersionName(moduleId.name, moduleId.crossVersion, scalaVersion, scalaBinaryVersion) + scalaBinaryVersion: => String, + optionalCrossVer: Boolean = false + ): String = { + val name0 = moduleId.name + val updatedName = sbtCrossVersionName(name0, moduleId.crossVersion, scalaVersion, scalaBinaryVersion) + if (!optionalCrossVer || updatedName.length <= name0.length) + updatedName + else { + val suffix = updatedName.substring(name0.length) + if (name0.endsWith(suffix)) + name0 + else + updatedName + } + } def sbtCrossVersionName( name: String, @@ -40,10 +52,11 @@ object FromSbt { def moduleVersion( module: ModuleID, scalaVersion: String, - scalaBinaryVersion: String + scalaBinaryVersion: String, + optionalCrossVer: Boolean = false ): (Module, String) = { - val fullName = sbtModuleIdName(module, scalaVersion, scalaBinaryVersion) + val fullName = sbtModuleIdName(module, scalaVersion, scalaBinaryVersion, optionalCrossVer) val module0 = Module(Organization(module.organization), ModuleName(fullName), FromSbt.attributes(module.extraDependencyAttributes)) val version = module.revision @@ -54,12 +67,13 @@ object FromSbt { def dependencies( module: ModuleID, scalaVersion: String, - scalaBinaryVersion: String + scalaBinaryVersion: String, + optionalCrossVer: Boolean = false ): Seq[(Configuration, Dependency)] = { // TODO Warn about unsupported properties in `module` - val (module0, version) = moduleVersion(module, scalaVersion, scalaBinaryVersion) + val (module0, version) = moduleVersion(module, scalaVersion, scalaBinaryVersion, optionalCrossVer) val dep = Dependency( module0, diff --git a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ResolutionParams.scala b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ResolutionParams.scala index f980bcf6f..9c8f8e576 100644 --- a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ResolutionParams.scala +++ b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ResolutionParams.scala @@ -3,8 +3,9 @@ package coursier.lmcoursier import java.io.File import coursier.cache.CacheLogger -import coursier.{FallbackDependenciesRepository, ProjectCache} +import coursier.ProjectCache import coursier.core._ +import coursier.util.InMemoryRepository import sbt.librarymanagement.{Resolver, URLRepository} final case class ResolutionParams( @@ -33,7 +34,7 @@ final case class ResolutionParams( }.toMap Seq( - FallbackDependenciesRepository(map) + InMemoryRepository(map) ) } diff --git a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ResolutionRun.scala b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ResolutionRun.scala index 7ad211c02..8a07af83d 100644 --- a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ResolutionRun.scala +++ b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ResolutionRun.scala @@ -6,7 +6,7 @@ import coursier.cache.loggers.{ProgressBarRefreshDisplay, RefreshLogger} import coursier.core._ import coursier.ivy.IvyRepository import coursier.maven.MavenRepository -import coursier.util.Schedulable +import coursier.util.Sync import sbt.util.Logger object ResolutionRun { @@ -64,7 +64,7 @@ object ResolutionRun { if (verbosityLevel >= 2) log.info(initialMessage) - Schedulable.withFixedThreadPool(params.cacheParams.parallel) { pool => + Sync.withFixedThreadPool(params.cacheParams.parallel) { pool => Resolve() .withDependencies( diff --git a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ToSbt.scala b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ToSbt.scala index 258dd163b..53143405e 100644 --- a/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ToSbt.scala +++ b/modules/lm-coursier/src/main/scala/coursier/lmcoursier/ToSbt.scala @@ -218,7 +218,11 @@ object ToSbt { val configReports = configs.map { case (config, extends0) => - val configDeps = extends0.toSeq.sortBy(_.value).flatMap(configDependencies.getOrElse(_, Nil)) + val configDeps = extends0 + .toSeq + .sortBy(_.value) + .flatMap(configDependencies.getOrElse(_, Nil)) + .distinct val subRes = resolutions(config).subset(configDeps) val reports = ToSbt.moduleReports( diff --git a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/ResolutionTasks.scala b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/ResolutionTasks.scala index c066a9e0b..89adbbeb9 100644 --- a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/ResolutionTasks.scala +++ b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/ResolutionTasks.scala @@ -2,7 +2,7 @@ package coursier.sbtcoursier import coursier.ProjectCache import coursier.core._ -import coursier.extra.Typelevel +import coursier.internal.Typelevel import coursier.lmcoursier._ import coursier.lmcoursier.Inputs.withAuthenticationByHost import coursier.sbtcoursier.Keys._ @@ -85,7 +85,7 @@ object ResolutionTasks { val (currentProject, fallbackDependencies, configGraphs) = currentProjectTask.value - val autoScalaLib = autoScalaLibrary.value + val autoScalaLib = autoScalaLibrary.value && scalaModuleInfo.value.forall(_.overrideScalaVersion) val resolvers = resolversTask.value diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/clean/test b/modules/sbt-coursier/src/sbt-test/shared-1/clean/test index 6dc6f6976..f2a470ad5 100644 --- a/modules/sbt-coursier/src/sbt-test/shared-1/clean/test +++ b/modules/sbt-coursier/src/sbt-test/shared-1/clean/test @@ -1,3 +1,4 @@ +> clean > checkEmpty > update > checkNotEmpty diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/LICENSE b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/LICENSE new file mode 100644 index 000000000..728844ee3 --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2015 The dotty-example-project contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/README.md b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/README.md new file mode 100644 index 000000000..e476c5c1d --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/README.md @@ -0,0 +1 @@ +Cut-n-pasted from https://github.com/lampepfl/dotty-example-project/tree/a753b14e281bbaa6c69f26298913ad6feba969c7 diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/build.sbt b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/build.sbt new file mode 100644 index 000000000..e38070b5e --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/build.sbt @@ -0,0 +1 @@ +scalaVersion := "0.13.0-RC1" diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/build.properties b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/build.properties new file mode 100644 index 000000000..16dc090c5 --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/build.properties @@ -0,0 +1,3 @@ +# sbt-coursier scripted tests: required, as we default to sbt 1.0.3, +# but sbt-dotty requires sbt >= 1.2.7 +sbt.version=1.2.7 diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/plugins.sbt b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/plugins.sbt new file mode 100644 index 000000000..115463586 --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/plugins.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.0") +addSbtCoursier diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/project/plugins.sbt b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/project/plugins.sbt new file mode 100644 index 000000000..71a44ffd3 --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/project/project/plugins.sbt @@ -0,0 +1,13 @@ +addSbtPlugin { + + val name = sys.props.getOrElse( + "plugin.name", + sys.error("plugin.name Java property not set") + ) + val version = sys.props.getOrElse( + "plugin.version", + sys.error("plugin.version Java property not set") + ) + + "io.get-coursier" % name % version +} \ No newline at end of file diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/src/main/scala/Main.scala b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/src/main/scala/Main.scala new file mode 100644 index 000000000..8a44ae4ef --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/src/main/scala/Main.scala @@ -0,0 +1,16 @@ + +object Main { + + def main(args: Array[String]): Unit = { + + runExample("Trait Params")(TraitParams.test) + + } + + private def runExample(name: String)(f: => Unit) = { + println(Console.MAGENTA + s"$name example:" + Console.RESET) + f + println() + } + +} diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/src/main/scala/TraitParams.scala b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/src/main/scala/TraitParams.scala new file mode 100644 index 000000000..5d4409971 --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/src/main/scala/TraitParams.scala @@ -0,0 +1,21 @@ +/** + * Trait Parameters: https://dotty.epfl.ch/docs/reference/other-new-features/trait-parameters.html + */ +object TraitParams { + + trait Base(val msg: String) + class A extends Base("Hello") + class B extends Base("Dotty!") + + // Union types only exist in Dotty, so there's no chance that this will accidentally be compiled with Scala 2 + private def printMessages(msgs: (A | B)*) = println(msgs.map(_.msg).mkString(" ")) + + def test: Unit = { + + printMessages(new A, new B) + + // Sanity check the classpath: this won't run if the dotty jar is not present. + val x: Int => Int = z => z + x(1) + } +} diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/dotty/test b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/test new file mode 100644 index 000000000..62ea636c1 --- /dev/null +++ b/modules/sbt-coursier/src/sbt-test/shared-1/dotty/test @@ -0,0 +1 @@ +> run diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/logger/build.sbt b/modules/sbt-coursier/src/sbt-test/shared-1/logger/build.sbt index d45af224f..a9c823b68 100644 --- a/modules/sbt-coursier/src/sbt-test/shared-1/logger/build.sbt +++ b/modules/sbt-coursier/src/sbt-test/shared-1/logger/build.sbt @@ -7,7 +7,7 @@ coursierCache := baseDirectory.value / "cache" logFile := baseDirectory.value / "log" coursierLogger := { - val logStream = new java.io.PrintStream(logFile.value) + var logStream: java.io.PrintStream = null def log(msg: String): Unit = { println(msg) logStream.println(msg) @@ -16,6 +16,9 @@ coursierLogger := { val logger = new coursier.cache.CacheLogger { override def init(sizeHint: Option[Int]): Unit = { + logStream = new java.io.PrintStream( + new java.io.FileOutputStream(logFile.value, true) + ) log("init") } override def foundLocally(url: String): Unit = { @@ -29,6 +32,9 @@ coursierLogger := { } override def stop(): Unit = { log("stop") + logStream.flush() + logStream.close() + logStream = null } } diff --git a/modules/sbt-coursier/src/sbt-test/shared-1/logger/test b/modules/sbt-coursier/src/sbt-test/shared-1/logger/test index 157471011..995210423 100644 --- a/modules/sbt-coursier/src/sbt-test/shared-1/logger/test +++ b/modules/sbt-coursier/src/sbt-test/shared-1/logger/test @@ -2,5 +2,6 @@ $ delete cache > update > checkDownloaded > reload +> clean > update > checkFound diff --git a/modules/sbt-coursier/src/sbt-test/shared-2/scala-jars/src/main/scala/Main.scala b/modules/sbt-coursier/src/sbt-test/shared-2/scala-jars/src/main/scala/Main.scala index 43f0726f1..932b548a8 100644 --- a/modules/sbt-coursier/src/sbt-test/shared-2/scala-jars/src/main/scala/Main.scala +++ b/modules/sbt-coursier/src/sbt-test/shared-2/scala-jars/src/main/scala/Main.scala @@ -26,7 +26,10 @@ object Main extends App { "sbt.global.base", sys.props("user.home") + "/.sbt" )) - val prefix = new File(sbtBase, "boot").getAbsolutePath + val prefixes = Seq(new File(sbtBase, "boot").getAbsolutePath) ++ + Seq("coursier.sbt-launcher.dirs.scala-jars", "coursier.sbt-launcher.dirs.base") + .flatMap(sys.props.get(_)) + .map(new File(_).getAbsolutePath) def fromBootAndUnique(name: String): Unit = { val jars = cp.filter(_.getName.startsWith(name)).distinct @@ -34,7 +37,7 @@ object Main extends App { val Seq(jar) = jars - assert(jar.getAbsolutePath.startsWith(prefix), s"JAR for $name ($jar) not under $prefix") + assert(prefixes.exists(jar.getAbsolutePath.startsWith), s"JAR for $name ($jar) not under any of ${prefixes.mkString(", ")}") } val props = Thread.currentThread() diff --git a/modules/sbt-lm-coursier/src/main/scala/coursier/sbtlmcoursier/LmCoursierPlugin.scala b/modules/sbt-lm-coursier/src/main/scala/coursier/sbtlmcoursier/LmCoursierPlugin.scala index 9c5c1da1c..857871620 100644 --- a/modules/sbt-lm-coursier/src/main/scala/coursier/sbtlmcoursier/LmCoursierPlugin.scala +++ b/modules/sbt-lm-coursier/src/main/scala/coursier/sbtlmcoursier/LmCoursierPlugin.scala @@ -7,7 +7,7 @@ import coursier.sbtcoursiershared.SbtCoursierShared import sbt.{AutoPlugin, Classpaths, Def, Setting, Task, taskKey} import sbt.Project.inTask import sbt.KeyRanks.DTask -import sbt.Keys.{appConfiguration, autoScalaLibrary, classpathTypes, dependencyResolution, excludeDependencies, scalaBinaryVersion, scalaOrganization, scalaVersion, streams, updateClassifiers, updateSbtClassifiers} +import sbt.Keys.{appConfiguration, autoScalaLibrary, classpathTypes, dependencyResolution, excludeDependencies, scalaBinaryVersion, scalaModuleInfo, scalaOrganization, scalaVersion, streams, updateClassifiers, updateSbtClassifiers} import sbt.librarymanagement.DependencyResolution object LmCoursierPlugin extends AutoPlugin { @@ -84,7 +84,7 @@ object LmCoursierPlugin extends AutoPlugin { streams.value.log ) val fallbackDeps = coursierFallbackDependencies.value - val autoScalaLib = autoScalaLibrary.value + val autoScalaLib = autoScalaLibrary.value && scalaModuleInfo.value.forall(_.overrideScalaVersion) val profiles = mavenProfiles.value val authenticationByRepositoryId = coursierCredentials.value.mapValues(_.authentication) diff --git a/modules/sbt-shading/src/main/scala/coursier/Shading.scala b/modules/sbt-shading/src/main/scala/coursier/Shading.scala index 77d9b5a63..dfeb45bcc 100644 --- a/modules/sbt-shading/src/main/scala/coursier/Shading.scala +++ b/modules/sbt-shading/src/main/scala/coursier/Shading.scala @@ -8,7 +8,7 @@ import com.tonicsystems.jarjar.classpath.ClassPath import com.tonicsystems.jarjar.transform.JarTransformer import com.tonicsystems.jarjar.transform.config.ClassRename import com.tonicsystems.jarjar.transform.jar.DefaultJarProcessor -import coursier.core.{Configuration, Orders, Type} +import coursier.core.{Configuration, Orders} import sbt.file object Shading { diff --git a/modules/sbt-shading/src/main/scala/coursier/ShadingPlugin.scala b/modules/sbt-shading/src/main/scala/coursier/ShadingPlugin.scala index f27ef8b90..f7412dff3 100644 --- a/modules/sbt-shading/src/main/scala/coursier/ShadingPlugin.scala +++ b/modules/sbt-shading/src/main/scala/coursier/ShadingPlugin.scala @@ -2,7 +2,7 @@ package coursier import java.io.File -import coursier.core.{Configuration, Type} +import coursier.core.Configuration import coursier.ivy.IvyXml.{mappings => ivyXmlMappings} import coursier.sbtcoursier.{CoursierPlugin, InputsTasks, Keys} import coursier.sbtcoursiershared.{IvyXml, SbtCoursierShared} diff --git a/project/Settings.scala b/project/Settings.scala index a06e76ca3..b870c5c7f 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -42,7 +42,8 @@ object Settings { "-Xmx1024M", "-Dplugin.name=" + name.value, "-Dplugin.version=" + version.value, - "-Dsbttest.base=" + (sourceDirectory.value / "sbt-test").getAbsolutePath + "-Dsbttest.base=" + (sourceDirectory.value / "sbt-test").getAbsolutePath, + "-Dcoursier.sbt-launcher.add-plugin=false" ), scriptedBufferLog := false, sbtPlugin := true, diff --git a/scripts/travis.sh b/scripts/travis.sh index b45bd8a02..55382af60 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -1,12 +1,6 @@ #!/usr/bin/env bash set -euvx -downloadInstallSbtExtras() { - mkdir -p bin - curl -L -o bin/sbt https://github.com/paulp/sbt-extras/raw/9ade5fa54914ca8aded44105bf4b9a60966f3ccd/sbt - chmod +x bin/sbt -} - lmCoursier() { [ "${LM_COURSIER:-""}" = 1 ] } @@ -55,8 +49,6 @@ addPgpKeys() { } -downloadInstallSbtExtras - if sbtShading; then runSbtShadingTests elif sbtPgpCoursier; then