mirror of https://github.com/sbt/sbt.git
Merge pull request #42 from alexarchambault/develop
Switch to coursier-based sbt-launcher
This commit is contained in:
commit
c24e8dd4e1
16
.travis.yml
16
.travis.yml
|
|
@ -1,11 +1,15 @@
|
||||||
language: scala
|
language: java
|
||||||
scala: 2.12.7
|
|
||||||
os: linux
|
os: linux
|
||||||
jdk: oraclejdk8
|
jdk: openjdk8
|
||||||
|
git:
|
||||||
|
depth: false # https://stackoverflow.com/a/51727114/3714539
|
||||||
before_install:
|
before_install:
|
||||||
- git fetch --tags
|
- mkdir .bin
|
||||||
script:
|
- curl -Lo .bin/sbt https://raw.githubusercontent.com/coursier/sbt-extras/77c93346a2b52cf35cc72382125cfdbb25a00197/sbt
|
||||||
- scripts/travis.sh
|
- chmod +x .bin/sbt
|
||||||
|
- export PATH="$(pwd)/.bin:$PATH"
|
||||||
|
- export TRAVIS_SCALA_VERSION=2.12.8
|
||||||
|
script: scripts/travis.sh
|
||||||
stages:
|
stages:
|
||||||
- name: test
|
- name: test
|
||||||
- name: release
|
- name: release
|
||||||
|
|
|
||||||
17
appveyor.yml
17
appveyor.yml
|
|
@ -2,18 +2,12 @@
|
||||||
version: '{build}'
|
version: '{build}'
|
||||||
os: Windows Server 2012
|
os: Windows Server 2012
|
||||||
install:
|
install:
|
||||||
- ps: |
|
- cmd: mkdir C:\sbt
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
- cmd: curl -Lo C:\sbt\sbt https://github.com/coursier/sbt-launcher/releases/download/v1.2.5/csbt
|
||||||
if (!(Test-Path -Path "C:\sbt" )) {
|
- cmd: curl -Lo C:\sbt\sbt.bat https://github.com/coursier/sbt-launcher/releases/download/v1.2.5/csbt.bat
|
||||||
(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: SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0
|
- cmd: SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0
|
||||||
- cmd: SET PATH=C:\sbt\sbt\bin;%JAVA_HOME%\bin;%PATH%
|
- cmd: SET PATH=C:\sbt;%JAVA_HOME%\bin;%PATH%
|
||||||
- cmd: SET SBT_OPTS=-Xmx4g -Xss2m
|
- cmd: SET JAVA_OPTS=-Xmx4g -Xss2m
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
environment:
|
environment:
|
||||||
TEST_REPOSITORY_HOST: localhost
|
TEST_REPOSITORY_HOST: localhost
|
||||||
|
|
@ -22,6 +16,7 @@ environment:
|
||||||
TEST_REPOSITORY_PASSWORD: pass
|
TEST_REPOSITORY_PASSWORD: pass
|
||||||
TEST_REPOSITORY: http://localhost:8080
|
TEST_REPOSITORY: http://localhost:8080
|
||||||
build_script:
|
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
|
- 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:
|
test_script:
|
||||||
- sbt ++2.12.7 "sbt-lm-coursier/scripted shared-2/simple" sbt-coursier/scripted sbt-shading/scripted
|
- sbt ++2.12.7 "sbt-lm-coursier/scripted shared-2/simple" sbt-coursier/scripted sbt-shading/scripted
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,13 @@ inThisBuild(List(
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
val coursierVersion = "1.1.0-M12"
|
|
||||||
|
|
||||||
lazy val `lm-coursier` = project
|
lazy val `lm-coursier` = project
|
||||||
.in(file("modules/lm-coursier"))
|
.in(file("modules/lm-coursier"))
|
||||||
.enablePlugins(ContrabandPlugin)
|
.enablePlugins(ContrabandPlugin)
|
||||||
.settings(
|
.settings(
|
||||||
shared,
|
shared,
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"io.get-coursier" %% "coursier" % coursierVersion,
|
"io.get-coursier" %% "coursier" % "1.1.0-M13",
|
||||||
"io.get-coursier" %% "coursier-extra" % coursierVersion,
|
|
||||||
// We depend on librarymanagement-ivy rather than just
|
// We depend on librarymanagement-ivy rather than just
|
||||||
// librarymanagement-core to handle the ModuleDescriptor passed
|
// librarymanagement-core to handle the ModuleDescriptor passed
|
||||||
// to DependencyResolutionInterface.update, which is an
|
// to DependencyResolutionInterface.update, which is an
|
||||||
|
|
|
||||||
2
metadata
2
metadata
|
|
@ -1 +1 @@
|
||||||
Subproject commit a0752761c58fddd917f8b0c4bc8e69c8111ea606
|
Subproject commit eb8d9e382fe9640dd4bea86ecf5d4ba99c8995a0
|
||||||
|
|
@ -6,7 +6,7 @@ import coursier.cache.FileCache
|
||||||
import coursier.Artifact
|
import coursier.Artifact
|
||||||
import coursier.cache.loggers.{ProgressBarRefreshDisplay, RefreshLogger}
|
import coursier.cache.loggers.{ProgressBarRefreshDisplay, RefreshLogger}
|
||||||
import coursier.core.Type
|
import coursier.core.Type
|
||||||
import coursier.util.Schedulable
|
import coursier.util.Sync
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
|
|
||||||
object ArtifactsRun {
|
object ArtifactsRun {
|
||||||
|
|
@ -29,7 +29,7 @@ object ArtifactsRun {
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
|
|
||||||
Schedulable.withFixedThreadPool(params.cacheParams.parallel) { pool =>
|
Sync.withFixedThreadPool(params.cacheParams.parallel) { pool =>
|
||||||
|
|
||||||
coursier.Artifacts()
|
coursier.Artifacts()
|
||||||
.withResolutions(params.resolutions)
|
.withResolutions(params.resolutions)
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import java.io.File
|
||||||
|
|
||||||
import _root_.coursier.{Artifact, Organization, Resolution, organizationString}
|
import _root_.coursier.{Artifact, Organization, Resolution, organizationString}
|
||||||
import _root_.coursier.core.{Classifier, Configuration, ModuleName}
|
import _root_.coursier.core.{Classifier, Configuration, ModuleName}
|
||||||
import _root_.coursier.extra.Typelevel
|
|
||||||
import _root_.coursier.lmcoursier.Inputs.withAuthenticationByHost
|
import _root_.coursier.lmcoursier.Inputs.withAuthenticationByHost
|
||||||
import coursier.cache.{CacheDefaults, CachePolicy}
|
import coursier.cache.{CacheDefaults, CachePolicy}
|
||||||
|
import coursier.internal.Typelevel
|
||||||
import coursier.params.CacheParams
|
import coursier.params.CacheParams
|
||||||
import sbt.internal.librarymanagement.IvySbt
|
import sbt.internal.librarymanagement.IvySbt
|
||||||
import sbt.librarymanagement._
|
import sbt.librarymanagement._
|
||||||
|
|
@ -108,9 +108,9 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
|
||||||
val dependencies = module0
|
val dependencies = module0
|
||||||
.dependencies
|
.dependencies
|
||||||
.flatMap { d =>
|
.flatMap { d =>
|
||||||
// crossVersion already taken into account, wiping it here
|
// crossVersion sometimes already taken into account (when called via the update task), sometimes not
|
||||||
val d0 = d.withCrossVersion(CrossVersion.Disabled())
|
// (e.g. sbt-dotty 0.13.0-RC1)
|
||||||
FromSbt.dependencies(d0, sv, sbv)
|
FromSbt.dependencies(d, sv, sbv, optionalCrossVer = true)
|
||||||
}
|
}
|
||||||
.map {
|
.map {
|
||||||
case (config, dep) =>
|
case (config, dep) =>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package coursier.lmcoursier
|
||||||
|
|
||||||
import coursier.ivy.IvyRepository
|
import coursier.ivy.IvyRepository
|
||||||
import coursier.ivy.IvyXml.{mappings => ivyXmlMappings}
|
import coursier.ivy.IvyXml.{mappings => ivyXmlMappings}
|
||||||
import java.net.{MalformedURLException, URL}
|
import java.net.MalformedURLException
|
||||||
|
|
||||||
import coursier.cache.CacheUrl
|
import coursier.cache.CacheUrl
|
||||||
import coursier.{Attributes, Dependency, Module}
|
import coursier.{Attributes, Dependency, Module}
|
||||||
|
|
@ -17,9 +17,21 @@ object FromSbt {
|
||||||
def sbtModuleIdName(
|
def sbtModuleIdName(
|
||||||
moduleId: ModuleID,
|
moduleId: ModuleID,
|
||||||
scalaVersion: => String,
|
scalaVersion: => String,
|
||||||
scalaBinaryVersion: => String
|
scalaBinaryVersion: => String,
|
||||||
): String =
|
optionalCrossVer: Boolean = false
|
||||||
sbtCrossVersionName(moduleId.name, moduleId.crossVersion, scalaVersion, scalaBinaryVersion)
|
): 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(
|
def sbtCrossVersionName(
|
||||||
name: String,
|
name: String,
|
||||||
|
|
@ -40,10 +52,11 @@ object FromSbt {
|
||||||
def moduleVersion(
|
def moduleVersion(
|
||||||
module: ModuleID,
|
module: ModuleID,
|
||||||
scalaVersion: String,
|
scalaVersion: String,
|
||||||
scalaBinaryVersion: String
|
scalaBinaryVersion: String,
|
||||||
|
optionalCrossVer: Boolean = false
|
||||||
): (Module, String) = {
|
): (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 module0 = Module(Organization(module.organization), ModuleName(fullName), FromSbt.attributes(module.extraDependencyAttributes))
|
||||||
val version = module.revision
|
val version = module.revision
|
||||||
|
|
@ -54,12 +67,13 @@ object FromSbt {
|
||||||
def dependencies(
|
def dependencies(
|
||||||
module: ModuleID,
|
module: ModuleID,
|
||||||
scalaVersion: String,
|
scalaVersion: String,
|
||||||
scalaBinaryVersion: String
|
scalaBinaryVersion: String,
|
||||||
|
optionalCrossVer: Boolean = false
|
||||||
): Seq[(Configuration, Dependency)] = {
|
): Seq[(Configuration, Dependency)] = {
|
||||||
|
|
||||||
// TODO Warn about unsupported properties in `module`
|
// 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(
|
val dep = Dependency(
|
||||||
module0,
|
module0,
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,9 @@ package coursier.lmcoursier
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
import coursier.cache.CacheLogger
|
import coursier.cache.CacheLogger
|
||||||
import coursier.{FallbackDependenciesRepository, ProjectCache}
|
import coursier.ProjectCache
|
||||||
import coursier.core._
|
import coursier.core._
|
||||||
|
import coursier.util.InMemoryRepository
|
||||||
import sbt.librarymanagement.{Resolver, URLRepository}
|
import sbt.librarymanagement.{Resolver, URLRepository}
|
||||||
|
|
||||||
final case class ResolutionParams(
|
final case class ResolutionParams(
|
||||||
|
|
@ -33,7 +34,7 @@ final case class ResolutionParams(
|
||||||
}.toMap
|
}.toMap
|
||||||
|
|
||||||
Seq(
|
Seq(
|
||||||
FallbackDependenciesRepository(map)
|
InMemoryRepository(map)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import coursier.cache.loggers.{ProgressBarRefreshDisplay, RefreshLogger}
|
||||||
import coursier.core._
|
import coursier.core._
|
||||||
import coursier.ivy.IvyRepository
|
import coursier.ivy.IvyRepository
|
||||||
import coursier.maven.MavenRepository
|
import coursier.maven.MavenRepository
|
||||||
import coursier.util.Schedulable
|
import coursier.util.Sync
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
|
|
||||||
object ResolutionRun {
|
object ResolutionRun {
|
||||||
|
|
@ -64,7 +64,7 @@ object ResolutionRun {
|
||||||
if (verbosityLevel >= 2)
|
if (verbosityLevel >= 2)
|
||||||
log.info(initialMessage)
|
log.info(initialMessage)
|
||||||
|
|
||||||
Schedulable.withFixedThreadPool(params.cacheParams.parallel) { pool =>
|
Sync.withFixedThreadPool(params.cacheParams.parallel) { pool =>
|
||||||
|
|
||||||
Resolve()
|
Resolve()
|
||||||
.withDependencies(
|
.withDependencies(
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,11 @@ object ToSbt {
|
||||||
|
|
||||||
val configReports = configs.map {
|
val configReports = configs.map {
|
||||||
case (config, extends0) =>
|
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 subRes = resolutions(config).subset(configDeps)
|
||||||
|
|
||||||
val reports = ToSbt.moduleReports(
|
val reports = ToSbt.moduleReports(
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package coursier.sbtcoursier
|
||||||
|
|
||||||
import coursier.ProjectCache
|
import coursier.ProjectCache
|
||||||
import coursier.core._
|
import coursier.core._
|
||||||
import coursier.extra.Typelevel
|
import coursier.internal.Typelevel
|
||||||
import coursier.lmcoursier._
|
import coursier.lmcoursier._
|
||||||
import coursier.lmcoursier.Inputs.withAuthenticationByHost
|
import coursier.lmcoursier.Inputs.withAuthenticationByHost
|
||||||
import coursier.sbtcoursier.Keys._
|
import coursier.sbtcoursier.Keys._
|
||||||
|
|
@ -85,7 +85,7 @@ object ResolutionTasks {
|
||||||
|
|
||||||
val (currentProject, fallbackDependencies, configGraphs) = currentProjectTask.value
|
val (currentProject, fallbackDependencies, configGraphs) = currentProjectTask.value
|
||||||
|
|
||||||
val autoScalaLib = autoScalaLibrary.value
|
val autoScalaLib = autoScalaLibrary.value && scalaModuleInfo.value.forall(_.overrideScalaVersion)
|
||||||
|
|
||||||
val resolvers = resolversTask.value
|
val resolvers = resolversTask.value
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
> clean
|
||||||
> checkEmpty
|
> checkEmpty
|
||||||
> update
|
> update
|
||||||
> checkNotEmpty
|
> checkNotEmpty
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Cut-n-pasted from https://github.com/lampepfl/dotty-example-project/tree/a753b14e281bbaa6c69f26298913ad6feba969c7
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
scalaVersion := "0.13.0-RC1"
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.0")
|
||||||
|
addSbtCoursier
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
@ -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()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
> run
|
||||||
|
|
@ -7,7 +7,7 @@ coursierCache := baseDirectory.value / "cache"
|
||||||
logFile := baseDirectory.value / "log"
|
logFile := baseDirectory.value / "log"
|
||||||
|
|
||||||
coursierLogger := {
|
coursierLogger := {
|
||||||
val logStream = new java.io.PrintStream(logFile.value)
|
var logStream: java.io.PrintStream = null
|
||||||
def log(msg: String): Unit = {
|
def log(msg: String): Unit = {
|
||||||
println(msg)
|
println(msg)
|
||||||
logStream.println(msg)
|
logStream.println(msg)
|
||||||
|
|
@ -16,6 +16,9 @@ coursierLogger := {
|
||||||
|
|
||||||
val logger = new coursier.cache.CacheLogger {
|
val logger = new coursier.cache.CacheLogger {
|
||||||
override def init(sizeHint: Option[Int]): Unit = {
|
override def init(sizeHint: Option[Int]): Unit = {
|
||||||
|
logStream = new java.io.PrintStream(
|
||||||
|
new java.io.FileOutputStream(logFile.value, true)
|
||||||
|
)
|
||||||
log("init")
|
log("init")
|
||||||
}
|
}
|
||||||
override def foundLocally(url: String): Unit = {
|
override def foundLocally(url: String): Unit = {
|
||||||
|
|
@ -29,6 +32,9 @@ coursierLogger := {
|
||||||
}
|
}
|
||||||
override def stop(): Unit = {
|
override def stop(): Unit = {
|
||||||
log("stop")
|
log("stop")
|
||||||
|
logStream.flush()
|
||||||
|
logStream.close()
|
||||||
|
logStream = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,6 @@ $ delete cache
|
||||||
> update
|
> update
|
||||||
> checkDownloaded
|
> checkDownloaded
|
||||||
> reload
|
> reload
|
||||||
|
> clean
|
||||||
> update
|
> update
|
||||||
> checkFound
|
> checkFound
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,10 @@ object Main extends App {
|
||||||
"sbt.global.base",
|
"sbt.global.base",
|
||||||
sys.props("user.home") + "/.sbt"
|
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 = {
|
def fromBootAndUnique(name: String): Unit = {
|
||||||
val jars = cp.filter(_.getName.startsWith(name)).distinct
|
val jars = cp.filter(_.getName.startsWith(name)).distinct
|
||||||
|
|
@ -34,7 +37,7 @@ object Main extends App {
|
||||||
|
|
||||||
val Seq(jar) = jars
|
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()
|
val props = Thread.currentThread()
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import coursier.sbtcoursiershared.SbtCoursierShared
|
||||||
import sbt.{AutoPlugin, Classpaths, Def, Setting, Task, taskKey}
|
import sbt.{AutoPlugin, Classpaths, Def, Setting, Task, taskKey}
|
||||||
import sbt.Project.inTask
|
import sbt.Project.inTask
|
||||||
import sbt.KeyRanks.DTask
|
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
|
import sbt.librarymanagement.DependencyResolution
|
||||||
|
|
||||||
object LmCoursierPlugin extends AutoPlugin {
|
object LmCoursierPlugin extends AutoPlugin {
|
||||||
|
|
@ -84,7 +84,7 @@ object LmCoursierPlugin extends AutoPlugin {
|
||||||
streams.value.log
|
streams.value.log
|
||||||
)
|
)
|
||||||
val fallbackDeps = coursierFallbackDependencies.value
|
val fallbackDeps = coursierFallbackDependencies.value
|
||||||
val autoScalaLib = autoScalaLibrary.value
|
val autoScalaLib = autoScalaLibrary.value && scalaModuleInfo.value.forall(_.overrideScalaVersion)
|
||||||
val profiles = mavenProfiles.value
|
val profiles = mavenProfiles.value
|
||||||
|
|
||||||
val authenticationByRepositoryId = coursierCredentials.value.mapValues(_.authentication)
|
val authenticationByRepositoryId = coursierCredentials.value.mapValues(_.authentication)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import com.tonicsystems.jarjar.classpath.ClassPath
|
||||||
import com.tonicsystems.jarjar.transform.JarTransformer
|
import com.tonicsystems.jarjar.transform.JarTransformer
|
||||||
import com.tonicsystems.jarjar.transform.config.ClassRename
|
import com.tonicsystems.jarjar.transform.config.ClassRename
|
||||||
import com.tonicsystems.jarjar.transform.jar.DefaultJarProcessor
|
import com.tonicsystems.jarjar.transform.jar.DefaultJarProcessor
|
||||||
import coursier.core.{Configuration, Orders, Type}
|
import coursier.core.{Configuration, Orders}
|
||||||
import sbt.file
|
import sbt.file
|
||||||
|
|
||||||
object Shading {
|
object Shading {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package coursier
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
import coursier.core.{Configuration, Type}
|
import coursier.core.Configuration
|
||||||
import coursier.ivy.IvyXml.{mappings => ivyXmlMappings}
|
import coursier.ivy.IvyXml.{mappings => ivyXmlMappings}
|
||||||
import coursier.sbtcoursier.{CoursierPlugin, InputsTasks, Keys}
|
import coursier.sbtcoursier.{CoursierPlugin, InputsTasks, Keys}
|
||||||
import coursier.sbtcoursiershared.{IvyXml, SbtCoursierShared}
|
import coursier.sbtcoursiershared.{IvyXml, SbtCoursierShared}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ object Settings {
|
||||||
"-Xmx1024M",
|
"-Xmx1024M",
|
||||||
"-Dplugin.name=" + name.value,
|
"-Dplugin.name=" + name.value,
|
||||||
"-Dplugin.version=" + version.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,
|
scriptedBufferLog := false,
|
||||||
sbtPlugin := true,
|
sbtPlugin := true,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euvx
|
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() {
|
lmCoursier() {
|
||||||
[ "${LM_COURSIER:-""}" = 1 ]
|
[ "${LM_COURSIER:-""}" = 1 ]
|
||||||
}
|
}
|
||||||
|
|
@ -55,8 +49,6 @@ addPgpKeys() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
downloadInstallSbtExtras
|
|
||||||
|
|
||||||
if sbtShading; then
|
if sbtShading; then
|
||||||
runSbtShadingTests
|
runSbtShadingTests
|
||||||
elif sbtPgpCoursier; then
|
elif sbtPgpCoursier; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue