Clean lm-coursier scripted

This commit is contained in:
Adrien Piquerez 2024-10-09 14:32:16 +02:00
parent ef17173fcf
commit eaf604f14d
195 changed files with 2 additions and 1854 deletions

View File

@ -1,18 +0,0 @@
scalaVersion := "2.12.8"
libraryDependencies += {
sys.props("sbt.log.noformat") = "true" // disables colors in coursierWhatDependsOn output
"org.apache.zookeeper" % "zookeeper" % "3.5.0-alpha"
}
lazy val whatDependsOnCheck = TaskKey[Unit]("whatDependsOnCheck")
import java.nio.file.{Files, Paths}
import CoursierPlugin.autoImport._
whatDependsOnCheck := {
val result = (coursierWhatDependsOn in Compile).toTask(" log4j:log4j").value
.replace(System.lineSeparator(), "\n")
val expected = new String(Files.readAllBytes(Paths.get("whatDependsOnResult.log")), "UTF-8")
assert(expected == result, s"Expected '$expected', got '$result'")
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,2 +0,0 @@
> coursierDependencyTree
> whatDependsOnCheck

View File

@ -1,5 +0,0 @@
dependency-graph (configurations compile)
└─ log4j:log4j:1.2.17
├─ org.apache.zookeeper:zookeeper:3.5.0-alpha log4j:log4j:1.2.16 -> 1.2.17
└─ org.slf4j:slf4j-log4j12:1.7.5
└─ org.apache.zookeeper:zookeeper:3.5.0-alpha

View File

@ -1,10 +0,0 @@
scalaVersion := "2.12.8"
coursierArtifacts := {
val f = file("coursier-artifacts")
if (f.exists())
sys.error(s"$f file found")
java.nio.file.Files.write(f.toPath, Array.empty[Byte])
coursierArtifacts.value
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,4 +0,0 @@
$ delete coursier-artifacts
> update
$ exists coursier-artifacts
> update

View File

@ -1,56 +0,0 @@
scalaVersion := "2.12.8"
resolvers += "Private S3 Snapshots" atS3
"s3://s3-us-west-2.amazonaws.com/bucket-name/snapshots"
resolvers += "Private S3 Releases" atS3
"s3://s3-us-west-2.amazonaws.com/bucket-name/releases"
// TODO: Would need a public s3 bucket to download an artifact
lazy val check = taskKey[Unit]("")
// Checks FromSbt.repository parses the "s3://" urls correctly.
check := {
val s: TaskStreams = streams.value
val sbtResolvers: Seq[sbt.librarymanagement.Resolver] = coursierResolvers.value
// Sanity check to ensure SBT is loading the resolvers properly
assert(sbtResolvers.exists(_.name == "Private S3 Snapshots"))
assert(sbtResolvers.exists(_.name == "Private S3 Releases"))
// Have Coursier SBT Plugin Parse the SBT Resolvers
val parsedCoursierResolvers: Seq[coursier.core.Repository] =
sbtResolvers.flatMap{ sbtResolver: sbt.librarymanagement.Resolver =>
lmcoursier.internal.Resolvers.repository(
resolver = sbtResolver,
ivyProperties = lmcoursier.internal.ResolutionParams.defaultIvyProperties(
ivyPaths.value.ivyHome
),
log = s.log,
authentication = None,
classLoaders = Seq()
)
}
// Verify the input resolvers == output resolvers
assert(
sbtResolvers.size == parsedCoursierResolvers.size,
s"SBT resolvers size (${sbtResolvers.size}) did not match " +
s"Coursier resolvers size (${parsedCoursierResolvers.size})"
)
def containsRepo(repo: String): Boolean = {
val accepted = Set(repo, repo.stripSuffix("/"))
parsedCoursierResolvers.exists {
case m: coursier.maven.MavenRepositoryLike => accepted(m.root)
case _ => false
}
}
assert(containsRepo("s3://s3-us-west-2.amazonaws.com/bucket-name/snapshots/"),
"Didn't have snapshots s3 repo")
assert(containsRepo("s3://s3-us-west-2.amazonaws.com/bucket-name/releases/"),
"Didn't have releases s3 repo")
}

View File

@ -1 +0,0 @@
addSbtPlugin("com.frugalmechanic" % "fm-sbt-s3-resolver" % "0.18.0")

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,4 +0,0 @@
scalaVersion := "2.13.1"
libraryDependencies += "com.typesafe.play" %% "play-test" % "2.8.0-RC1" % Test // worked around in 2.8.0
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % Test

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,20 +0,0 @@
package t
import com.typesafe.config.ConfigFactory
import org.scalatest.{ MustMatchers, WordSpec }
class UnitSpec extends WordSpec with MustMatchers {
def conf = ConfigFactory.defaultReference()
"Config" should {
"return Akka HTTP server provider" in {
val serverProvider = conf.getString("play.server.provider")
serverProvider mustBe "play.core.server.AkkaHttpServerProvider"
}
"be able to load Netty settings" in {
val nettyTransport = conf.getString("play.server.netty.transport")
nettyTransport mustBe "jdk"
}
}
}

View File

@ -1,6 +0,0 @@
# https://github.com/coursier/coursier/issues/1466
> test
# ideally we can flip & assert the test fails
# but need to run this scripted test on sbt 1.3 in order to have a csrConfiguration
# > set csrConfiguration ~= (_.withClasspathOrder(false))
# -> test

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,4 +0,0 @@
# currently, the coursier-based sbt launcher starts sbt in the scripted tests
# without the coursier sbt plugins. This pulls the lm-coursier-shaded version
# that sbt depends on, which lacks some methods
> updateClassifiers

View File

@ -1,2 +0,0 @@
# testing regression since this sbt version
sbt.version=1.3.0-RC1

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,6 +0,0 @@
scalaVersion := "2.12.8"
libraryDependencies += ("com.rengwuxian.materialedittext" % "library" % "2.1.4")
.exclude("com.android.support", "support-v4")
.exclude("com.android.support", "support-annotations")
.exclude("com.android.support", "appcompat-v7")

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,6 +0,0 @@
import java.io.File
import java.nio.file.Files
object Main extends App {
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
}

View File

@ -1,3 +0,0 @@
$ delete output
> run
$ exists output

View File

@ -1,11 +0,0 @@
scalaVersion := "2.12.8"
organization := "io.get-coursier.test"
name := "sbt-coursier-all-exclude-dependencies"
version := "0.1.0-SNAPSHOT"
libraryDependencies += "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M11"
allExcludeDependencies += sbt.ExclusionRule("com.chuusai", "shapeless_2.12")
allExcludeDependencies += "io.argonaut" %% "argonaut"

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,30 +0,0 @@
import java.io.File
import java.nio.file.Files
import scala.util.Try
object Main extends App {
def classFound(clsName: String) = Try(
Thread.currentThread()
.getContextClassLoader()
.loadClass(clsName)
).toOption.nonEmpty
val shapelessFound = classFound("shapeless.HList")
val argonautFound = classFound("argonaut.Json")
val argonautShapelessFound = classFound("argonaut.derive.MkEncodeJson")
assert(
argonautShapelessFound,
"Expected to find class from argonaut-shapeless"
)
assert(
!shapelessFound,
"Expected not to find classes from shapeless"
)
assert(
!argonautFound,
"Expected not to find classes from argonaut"
)
}

View File

@ -1,3 +0,0 @@
> run
> publishLocal
$ exec java -jar coursier launch io.get-coursier.test:sbt-coursier-all-exclude-dependencies_2.12:0.1.0-SNAPSHOT

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,20 +0,0 @@
autoScalaLibrary := false
libraryDependencies += "com.chuusai" % "shapeless_2.12" % "2.3.2"
val checkScalaLibrary = TaskKey[Unit]("checkScalaLibrary")
checkScalaLibrary := {
val scalaLibsJars = managedClasspath
.in(Compile)
.value
.map(_.data.getName)
.filter(_.startsWith("scala-library"))
.sorted
val expectedScalaLibsJars = Seq(
"scala-library-2.12.0.jar"
)
assert(
scalaLibsJars == expectedScalaLibsJars,
s"$scalaLibsJars != $expectedScalaLibsJars"
)
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1 +0,0 @@
> checkScalaLibrary

View File

@ -1 +0,0 @@
Imported from https://github.com/sbt/sbt/tree/f5edeec2fdabd4313d2976b389bb6101775a5554/sbt/src/sbt-test/dependency-management/cache-local

View File

@ -1 +0,0 @@
ivyPaths := { IvyPaths(baseDirectory.value, Some(target.value / ".ivy2")) }

View File

@ -1,7 +0,0 @@
organization := "org.example"
name := "def"
version := "1.0"
autoScalaLibrary := false

View File

@ -1,5 +0,0 @@
publishTo := baseDirectory(base => Some(Resolver.file("filesys-publish", base / "repo")) ).value
resolvers += baseDirectory(base => "filesys" at (base / "repo").toURI.toString).value

View File

@ -1,9 +0,0 @@
organization := "org.example"
name := "use"
version := "1.0"
autoScalaLibrary := false
libraryDependencies += "org.example" %% "def" % "1.0"

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,21 +0,0 @@
$ copy-file changes/def.sbt build.sbt
$ copy-file changes/resolver.sbt resolver.sbt
> reload
> publishLocal
> publish
$ delete build.sbt
$ delete resolver.sbt
$ copy-file changes/use.sbt build.sbt
> reload
> update
> update
# needed for sbt-coursier (clear in-memory cache)
> clean
$ delete target/.ivy2/local
-> update
$ copy-file changes/resolver.sbt resolver.sbt
> reload
> update

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,7 +0,0 @@
scalaVersion := "2.12.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
coursierCredentials += "authenticated" -> coursier.Credentials(file("credentials"))
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,10 +0,0 @@
scalaVersion := "2.12.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
coursierCredentials += "authenticated" -> coursier.Credentials(
sys.env("TEST_REPOSITORY_USER"),
sys.env("TEST_REPOSITORY_PASSWORD")
)
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,11 +0,0 @@
scalaVersion := "2.12.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
coursierExtraCredentials += lmcoursier.credentials.Credentials(
uri(sys.env("TEST_REPOSITORY")).getHost,
sys.env("TEST_REPOSITORY_USER"),
sys.env("TEST_REPOSITORY_PASSWORD")
).withHttpsOnly(false).withMatchHost(true)
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1 +0,0 @@
Adapted from https://github.com/sbt/sbt/tree/57a86e60f6d7c6fd428fb73a6786b62972fdae54/sbt/src/sbt-test/dependency-management/default-artifact

View File

@ -1,13 +0,0 @@
resolvers += Resolver.file("buggy", file("repo"))(
Patterns(
ivyPatterns = Vector("[organization]/[module]/[revision]/ivy.xml"),
artifactPatterns = Vector("[organization]/[module]/[revision]/[artifact].[ext]"),
isMavenCompatible = false,
descriptorOptional = true,
skipConsistencyCheck = true
)
)
libraryDependencies += "a" % "b" % "1.0.0" % "compile->runtime" artifacts(Artifact("b1", "jar", "jar"))
libraryDependencies += "a" % "b" % "1.0.0" % "test->runtime" artifacts(Artifact("b1", "jar", "jar"))

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,14 +0,0 @@
<ivy-module xmlns:e="http://ant.apache.org/ivy/extra" version="2.0">
<info organisation="a" module="b" revision="1.0.0" status="release" publication="20160201120702">
<description>a</description>
</info>
<configurations>
<conf name="runtime" description="..."/>
</configurations>
<publications>
<artifact name="b1" type="jar" ext="jar" conf="runtime"/>
<artifact name="fake" type="jar" ext="jar" conf="runtime"/>
</publications>
<dependencies>
</dependencies>
</ivy-module>

View File

@ -1,5 +0,0 @@
# Verify that we successfully get the artifacts.
# This project depends on a module for which we cannot generate a "default artifact",
# because no such artifact exists.
> update

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,25 +0,0 @@
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.

View File

@ -1 +0,0 @@
Cut-n-pasted from https://github.com/lampepfl/dotty-example-project/tree/a753b14e281bbaa6c69f26298913ad6feba969c7

View File

@ -1,24 +0,0 @@
scalaVersion.in(ThisBuild) := "0.16.0-RC3"
organization.in(ThisBuild) := "ch.epfl.lamp"
version.in(ThisBuild) := "0.16.0-bin-SNAPSHOT"
// same projects (same module / versions) as the dotty-build
// these shouldn't make the internal dependency resolutions of sbt-dotty crash
lazy val `dotty-compiler` = project
lazy val `dotty-doc` = project
lazy val `dotty-interfaces` = project
lazy val `dotty-library` = project
lazy val `dotty-sbt-bridge` = project
lazy val `dotty` = project
lazy val foo = project
.in(file("."))
.dependsOn(
`dotty-compiler`,
`dotty-doc`,
`dotty-interfaces`,
`dotty-library`,
`dotty-sbt-bridge`,
`dotty`
)

View File

@ -1,3 +0,0 @@
# 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

View File

@ -1,2 +0,0 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.3")
addSbtCoursier

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,16 +0,0 @@
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()
}
}

View File

@ -1,21 +0,0 @@
/**
* 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)
}
}

View File

@ -1 +0,0 @@
> foo/scalaInstance

View File

@ -1,25 +0,0 @@
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.

View File

@ -1 +0,0 @@
Cut-n-pasted from https://github.com/lampepfl/dotty-example-project/tree/a753b14e281bbaa6c69f26298913ad6feba969c7

View File

@ -1 +0,0 @@
scalaVersion := "0.13.0-RC1"

View File

@ -1,3 +0,0 @@
# 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

View File

@ -1,2 +0,0 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.0")
addSbtCoursier

View File

@ -1,13 +0,0 @@
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
}

View File

@ -1,16 +0,0 @@
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()
}
}

View File

@ -1,21 +0,0 @@
/**
* 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)
}
}

View File

@ -1,30 +0,0 @@
import java.io.File
import java.nio.file.Files
import scala.util.Try
object Main extends App {
def classFound(clsName: String) = Try(
Thread.currentThread()
.getContextClassLoader()
.loadClass(clsName)
).toOption.nonEmpty
val shapelessFound = classFound("shapeless.HList")
val argonautFound = classFound("argonaut.Json")
val argonautShapelessFound = classFound("argonaut.derive.MkEncodeJson")
assert(
argonautShapelessFound,
"Expected to find class from argonaut-shapeless"
)
assert(
!shapelessFound,
"Expected not to find classes from shapeless"
)
assert(
!argonautFound,
"Expected not to find classes from argonaut"
)
}

View File

@ -1,30 +0,0 @@
import java.io.File
import java.nio.file.Files
import scala.util.Try
object Main extends App {
def classFound(clsName: String) = Try(
Thread.currentThread()
.getContextClassLoader()
.loadClass(clsName)
).toOption.nonEmpty
val shapelessFound = classFound("shapeless.HList")
val argonautFound = classFound("argonaut.Json")
val argonautShapelessFound = classFound("argonaut.derive.MkEncodeJson")
assert(
argonautShapelessFound,
"Expected to find class from argonaut-shapeless"
)
assert(
!shapelessFound,
"Expected not to find classes from shapeless"
)
assert(
!argonautFound,
"Expected not to find classes from argonaut"
)
}

View File

@ -1,26 +0,0 @@
lazy val a = project
.settings(
organization := "io.get-coursier.test",
name := "sbt-coursier-exclude-dependencies",
version := "0.1.0-SNAPSHOT",
scalaVersion := "2.12.8",
libraryDependencies += "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M11",
excludeDependencies += sbt.ExclusionRule("com.chuusai", "shapeless_2.12"),
excludeDependencies += "io.argonaut" %% "argonaut"
)
lazy val b = project
.settings(
organization := "io.get-coursier.test",
name := "sbt-coursier-exclude-dependencies-2",
version := "0.1.0-SNAPSHOT",
scalaVersion := "2.12.8",
libraryDependencies ++= Seq(
"com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M11",
"com.chuusai" %% "shapeless" % "2.3.3",
"io.argonaut" %% "argonaut" % "6.2.3"
),
excludeDependencies += sbt.ExclusionRule("com.chuusai", "shapeless_2.12"),
excludeDependencies += "io.argonaut" %% "argonaut"
)

Some files were not shown because too many files have changed in this diff Show More