mirror of https://github.com/sbt/sbt.git
Merge pull request #8443 from xuwei-k/deprecated-scala-App
This commit is contained in:
commit
7320b7176a
|
|
@ -1,5 +1,7 @@
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
object Hello extends App {
|
object Hello {
|
||||||
println("hello")
|
def main(args: Array[String]): Unit = {
|
||||||
|
println("hello")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
object Hello extends App {
|
object Hello {
|
||||||
println("hello" + args.toList.toString)
|
def main(args: Array[String]): Unit = {
|
||||||
|
println("hello" + args.toList.toString)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
object Main extends App {
|
object Main {
|
||||||
class Foo
|
class Foo
|
||||||
new Thread {
|
|
||||||
override def run(): Unit = {
|
def main(args: Array[String]): Unit = {
|
||||||
Thread.sleep(500)
|
new Thread {
|
||||||
try new Foo
|
override def run(): Unit = {
|
||||||
catch { case t: Throwable => sys.exit(1) }
|
Thread.sleep(500)
|
||||||
}
|
try new Foo
|
||||||
}.start()
|
catch { case t: Throwable => sys.exit(1) }
|
||||||
}
|
}
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
object Foo extends App {
|
object Foo {
|
||||||
println("yay")
|
def main(args: Array[String]): Unit = {
|
||||||
|
println("yay")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import scala.util.Try
|
import scala.util.Try
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
|
|
||||||
def classFound(clsName: String) = Try(
|
def classFound(clsName: String) = Try(
|
||||||
Thread.currentThread()
|
Thread.currentThread()
|
||||||
|
|
@ -12,7 +12,10 @@ object Main extends App {
|
||||||
).toOption.nonEmpty
|
).toOption.nonEmpty
|
||||||
|
|
||||||
val name = "org.jclouds.openstack.nova.functions.ParseServerFromJsonResponseTest"
|
val name = "org.jclouds.openstack.nova.functions.ParseServerFromJsonResponseTest"
|
||||||
val classifierTest = classFound(name)
|
|
||||||
|
|
||||||
assert(classifierTest, s"Couldn't find $name")
|
def main(args: Array[String]): Unit = {
|
||||||
|
val classifierTest = classFound(name)
|
||||||
|
|
||||||
|
assert(classifierTest, s"Couldn't find $name")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import scala.util.Try
|
import scala.util.Try
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
|
|
||||||
def classFound(clsName: String) = Try(
|
def classFound(clsName: String) = Try(
|
||||||
Thread.currentThread()
|
Thread.currentThread()
|
||||||
|
|
@ -11,22 +11,24 @@ object Main extends App {
|
||||||
.loadClass(clsName)
|
.loadClass(clsName)
|
||||||
).toOption.nonEmpty
|
).toOption.nonEmpty
|
||||||
|
|
||||||
val shapelessFound = classFound("shapeless.HList")
|
def main(args: Array[String]): Unit = {
|
||||||
val argonautFound = classFound("argonaut.Json")
|
val shapelessFound = classFound("shapeless.HList")
|
||||||
val argonautShapelessFound = classFound("argonaut.derive.MkEncodeJson")
|
val argonautFound = classFound("argonaut.Json")
|
||||||
|
val argonautShapelessFound = classFound("argonaut.derive.MkEncodeJson")
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
argonautShapelessFound,
|
argonautShapelessFound,
|
||||||
"Expected to find class from argonaut-shapeless"
|
"Expected to find class from argonaut-shapeless"
|
||||||
)
|
)
|
||||||
assert(
|
assert(
|
||||||
!shapelessFound,
|
!shapelessFound,
|
||||||
"Expected not to find classes from shapeless"
|
"Expected not to find classes from shapeless"
|
||||||
)
|
)
|
||||||
assert(
|
assert(
|
||||||
!argonautFound,
|
!argonautFound,
|
||||||
"Expected not to find classes from argonaut"
|
"Expected not to find classes from argonaut"
|
||||||
)
|
)
|
||||||
|
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import org.apache.zookeeper.ZooKeeper
|
import org.apache.zookeeper.ZooKeeper
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
Files.write(new File("output").toPath, classOf[ZooKeeper].getSimpleName.getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, classOf[ZooKeeper].getSimpleName.getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import argonaut._, Argonaut._, ArgonautShapeless._
|
import argonaut._, Argonaut._, ArgonautShapeless._
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
|
|
||||||
case class CC(i: Int, s: String)
|
case class CC(i: Int, s: String)
|
||||||
|
|
||||||
val msg = CC(2, A.msg).asJson.spaces2
|
def main(args: Array[String]): Unit = {
|
||||||
|
val msg = CC(2, A.msg).asJson.spaces2
|
||||||
|
|
||||||
Files.write(new File("output").toPath, msg.getBytes("UTF-8"))
|
Files.write(new File("output").toPath, msg.getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,21 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
val p = new java.util.Properties
|
def main(args: Array[String]): Unit = {
|
||||||
p.load(
|
val p = new java.util.Properties
|
||||||
Thread.currentThread()
|
p.load(
|
||||||
.getContextClassLoader
|
Thread.currentThread()
|
||||||
.getResource("common-version-info.properties")
|
.getContextClassLoader
|
||||||
.openStream()
|
.getResource("common-version-info.properties")
|
||||||
)
|
.openStream()
|
||||||
|
)
|
||||||
|
|
||||||
val hadoopVersion = p.getProperty("version")
|
val hadoopVersion = p.getProperty("version")
|
||||||
Console.err.println(s"Found hadoop version $hadoopVersion")
|
Console.err.println(s"Found hadoop version $hadoopVersion")
|
||||||
|
|
||||||
assert(hadoopVersion == "2.6.0")
|
assert(hadoopVersion == "2.6.0")
|
||||||
|
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,10 @@ package scala.collection.immutable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
object A extends App {
|
object A {
|
||||||
println(scala.util.Properties.versionString)
|
def main(args: Array[String]): Unit = {
|
||||||
|
println(scala.util.Properties.versionString)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object AMacro {
|
object AMacro {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import java.nio.file.{Paths, Files}
|
import java.nio.file.{Paths, Files}
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
object B extends App {
|
object B {
|
||||||
println(AMacro.m(33)) // fails
|
def main(args: Array[String]): Unit = {
|
||||||
Files.write(Paths.get(s"s${scala.util.Properties.versionNumberString}.txt"), "nix".getBytes)
|
println(AMacro.m(33)) // fails
|
||||||
|
Files.write(Paths.get(s"s${scala.util.Properties.versionNumberString}.txt"), "nix".getBytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import java.nio.file.{Paths, Files}
|
import java.nio.file.{Paths, Files}
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
object C extends App {
|
object C {
|
||||||
assert(scala.collection.immutable.Exp.v == null)
|
def main(args: Array[String]): Unit = {
|
||||||
Files.write(Paths.get(s"s${scala.util.Properties.versionNumberString}.txt"), "nix".getBytes)
|
assert(scala.collection.immutable.Exp.v == null)
|
||||||
|
Files.write(Paths.get(s"s${scala.util.Properties.versionNumberString}.txt"), "nix".getBytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import scala.language.reflectiveCalls
|
import scala.language.reflectiveCalls
|
||||||
|
|
||||||
object A extends App {
|
object A {
|
||||||
println(scala.util.Properties.versionString)
|
def main(args: Array[String]): Unit = {
|
||||||
|
println(scala.util.Properties.versionString)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object AMacro {
|
object AMacro {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import java.nio.file.{Paths, Files}
|
import java.nio.file.{Paths, Files}
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
object B extends App {
|
object B {
|
||||||
println(AMacro.m(33))
|
def main(args: Array[String]): Unit = {
|
||||||
Files.write(Paths.get(s"s${scala.util.Properties.versionNumberString}.txt"), "nix".getBytes)
|
println(AMacro.m(33))
|
||||||
|
Files.write(Paths.get(s"s${scala.util.Properties.versionNumberString}.txt"), "nix".getBytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
// Not using directly the NetLogo 5.x lib, which seems to depend on Scala 2.9
|
// Not using directly the NetLogo 5.x lib, which seems to depend on Scala 2.9
|
||||||
// Can't find a way to check that NetLogo.jar is in the classpath
|
// Can't find a way to check that NetLogo.jar is in the classpath
|
||||||
// These don't work, even with fork := true:
|
// These don't work, even with fork := true:
|
||||||
// assert(Thread.currentThread.getContextClassLoader.getResource("org/nlogo/nvm/Task.class") != null)
|
// assert(Thread.currentThread.getContextClassLoader.getResource("org/nlogo/nvm/Task.class") != null)
|
||||||
// Thread.currentThread.getContextClassLoader.getResource("org/nlogo/nvm/Task.class")
|
// Thread.currentThread.getContextClassLoader.getResource("org/nlogo/nvm/Task.class")
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,16 @@ package pkg
|
||||||
import java.nio.file.{ Paths, Files }
|
import java.nio.file.{ Paths, Files }
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
|
|
||||||
object A extends App {
|
object A {
|
||||||
val out = Paths.get("out.txt")
|
def main(args: Array[String]): Unit = {
|
||||||
val content = sys.props("java.version")
|
val out = Paths.get("out.txt")
|
||||||
val w = Files.newBufferedWriter(out, Charset.forName("UTF-8"))
|
val content = sys.props("java.version")
|
||||||
try {
|
val w = Files.newBufferedWriter(out, Charset.forName("UTF-8"))
|
||||||
w.write(content)
|
try {
|
||||||
w.flush()
|
w.write(content)
|
||||||
} finally {
|
w.flush()
|
||||||
w.close
|
} finally {
|
||||||
|
w.close
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import scala.util.Try
|
import scala.util.Try
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
|
|
||||||
def classFound(clsName: String) = Try(
|
def classFound(clsName: String) = Try(
|
||||||
Thread.currentThread()
|
Thread.currentThread()
|
||||||
|
|
@ -12,7 +12,10 @@ object Main extends App {
|
||||||
).toOption.nonEmpty
|
).toOption.nonEmpty
|
||||||
|
|
||||||
val name = "org.jclouds.openstack.nova.functions.ParseServerFromJsonResponseTest"
|
val name = "org.jclouds.openstack.nova.functions.ParseServerFromJsonResponseTest"
|
||||||
val classifierTest = classFound(name)
|
|
||||||
|
|
||||||
assert(classifierTest, s"Couldn't find $name")
|
def main(args: Array[String]): Unit = {
|
||||||
|
val classifierTest = classFound(name)
|
||||||
|
|
||||||
|
assert(classifierTest, s"Couldn't find $name")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import ch.qos.logback.classic.BasicConfigurator
|
import ch.qos.logback.classic.BasicConfigurator
|
||||||
import ch.qos.logback.classic.LoggerContext
|
import ch.qos.logback.classic.LoggerContext
|
||||||
|
|
||||||
object GcMetricsApp extends App {
|
object GcMetricsApp {
|
||||||
BasicConfigurator.configure(new LoggerContext())
|
def main(args: Array[String]): Unit = {
|
||||||
|
BasicConfigurator.configure(new LoggerContext())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,3 @@
|
||||||
object Main extends App
|
object Main {
|
||||||
|
def main(args: Array[String]): Unit = ()
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,3 @@
|
||||||
object Main extends App
|
object Main {
|
||||||
|
def main(args: Array[String]): Unit = ()
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,3 @@
|
||||||
object Main extends App
|
object Main {
|
||||||
|
def main(args: Array[String]): Unit = ()
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,3 @@
|
||||||
object Main extends App
|
object Main {
|
||||||
|
def main(args: Array[String]): Unit = ()
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
// Not using directly the NetLogo 5.x lib, which seems to depend on Scala 2.9
|
// Not using directly the NetLogo 5.x lib, which seems to depend on Scala 2.9
|
||||||
// Can't find a way to check that NetLogo.jar is in the classpath
|
// Can't find a way to check that NetLogo.jar is in the classpath
|
||||||
// These don't work, even with fork := true:
|
// These don't work, even with fork := true:
|
||||||
// assert(Thread.currentThread.getContextClassLoader.getResource("org/nlogo/nvm/Task.class") != null)
|
// assert(Thread.currentThread.getContextClassLoader.getResource("org/nlogo/nvm/Task.class") != null)
|
||||||
// Thread.currentThread.getContextClassLoader.getResource("org/nlogo/nvm/Task.class")
|
// Thread.currentThread.getContextClassLoader.getResource("org/nlogo/nvm/Task.class")
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,14 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import shapeless._
|
import shapeless._
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
case class CC(s: String)
|
case class CC(s: String)
|
||||||
val cc = CC("OK")
|
|
||||||
val l = Generic[CC].to(cc)
|
|
||||||
val msg = l.head
|
|
||||||
|
|
||||||
Files.write(new File("output").toPath, msg.getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
val cc = CC("OK")
|
||||||
|
val l = Generic[CC].to(cc)
|
||||||
|
val msg = l.head
|
||||||
|
|
||||||
|
Files.write(new File("output").toPath, msg.getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,14 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import shapeless._
|
import shapeless._
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
case class CC(s: String)
|
case class CC(s: String)
|
||||||
val cc = CC("OK")
|
|
||||||
val l = Generic[CC].to(cc)
|
|
||||||
val msg = l.head
|
|
||||||
|
|
||||||
Files.write(new File("output").toPath, msg.getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
val cc = CC("OK")
|
||||||
|
val l = Generic[CC].to(cc)
|
||||||
|
val msg = l.head
|
||||||
|
|
||||||
|
Files.write(new File("output").toPath, msg.getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
|
|
||||||
// TODO Use some jvm-repr stuff as a test
|
// TODO Use some jvm-repr stuff as a test
|
||||||
|
|
||||||
Files.write(new File("output").toPath, A.default.msg.getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, A.default.msg.getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import java.nio.file.Files
|
||||||
* @author A
|
* @author A
|
||||||
* @param may not be `'''null'''`!!!
|
* @param may not be `'''null'''`!!!
|
||||||
*/
|
*/
|
||||||
object Main extends App {
|
object Main {
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
|
|
||||||
// TODO Use some jvm-repr stuff
|
// TODO Use some jvm-repr stuff
|
||||||
|
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,64 +3,66 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
|
|
||||||
val cp = new collection.mutable.ArrayBuffer[File]
|
def main(args: Array[String]): Unit = {
|
||||||
|
val cp = new collection.mutable.ArrayBuffer[File]
|
||||||
|
|
||||||
def buildCp(loader: ClassLoader): Unit =
|
def buildCp(loader: ClassLoader): Unit =
|
||||||
if (loader != null) {
|
if (loader != null) {
|
||||||
loader match {
|
loader match {
|
||||||
case u: java.net.URLClassLoader =>
|
case u: java.net.URLClassLoader =>
|
||||||
cp ++= u.getURLs
|
cp ++= u.getURLs
|
||||||
.map(_.toURI)
|
.map(_.toURI)
|
||||||
.map(new File(_))
|
.map(new File(_))
|
||||||
case _ =>
|
case _ =>
|
||||||
|
}
|
||||||
|
|
||||||
|
buildCp(loader.getParent)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildCp(loader.getParent)
|
buildCp(Thread.currentThread().getContextClassLoader)
|
||||||
|
|
||||||
|
System.err.println("Classpath:")
|
||||||
|
for (f <- cp)
|
||||||
|
System.err.println(s" $f")
|
||||||
|
System.err.println()
|
||||||
|
|
||||||
|
val sbtBase = new File(sys.props.getOrElse(
|
||||||
|
"sbt.global.base",
|
||||||
|
sys.props("user.home") + "/.sbt"
|
||||||
|
))
|
||||||
|
val prefixes = Seq(new File(sbtBase, "boot").getAbsolutePath) ++
|
||||||
|
Seq("coursier.sbt-launcher.dirs.scala-jars", "coursier.sbt-launcher.dirs.base", "user.dir")
|
||||||
|
.flatMap(sys.props.get(_))
|
||||||
|
.map(new File(_).getAbsolutePath)
|
||||||
|
val home = new File(sys.props("user.home")).getAbsolutePath
|
||||||
|
|
||||||
|
def notFromCoursierCache(name: String): Unit = {
|
||||||
|
val jars = cp.filter(_.getName.startsWith(name)).distinct
|
||||||
|
assert(jars.nonEmpty, s"Found no JARs for $name")
|
||||||
|
|
||||||
|
for (jar <- jars)
|
||||||
|
assert(
|
||||||
|
!jar.getAbsolutePath.startsWith(home) ||
|
||||||
|
!jar.getAbsolutePath.toLowerCase(java.util.Locale.ROOT).contains("coursier") ||
|
||||||
|
prefixes.exists(jar.getAbsolutePath.startsWith),
|
||||||
|
s"JAR for $name ($jar) under $home and not under any of ${prefixes.mkString(", ")}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildCp(Thread.currentThread().getContextClassLoader)
|
val props = Thread.currentThread()
|
||||||
|
.getContextClassLoader
|
||||||
|
.getResources("library.properties")
|
||||||
|
.asScala
|
||||||
|
.toVector
|
||||||
|
.map(_.toString)
|
||||||
|
.sorted
|
||||||
|
.distinct // TODO should not need distinct
|
||||||
|
|
||||||
System.err.println("Classpath:")
|
notFromCoursierCache("scala-library")
|
||||||
for (f <- cp)
|
assert(props.lengthCompare(1) == 0, s"Found several library.properties files in classpath: $props")
|
||||||
System.err.println(s" $f")
|
|
||||||
System.err.println()
|
|
||||||
|
|
||||||
val sbtBase = new File(sys.props.getOrElse(
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
"sbt.global.base",
|
|
||||||
sys.props("user.home") + "/.sbt"
|
|
||||||
))
|
|
||||||
val prefixes = Seq(new File(sbtBase, "boot").getAbsolutePath) ++
|
|
||||||
Seq("coursier.sbt-launcher.dirs.scala-jars", "coursier.sbt-launcher.dirs.base", "user.dir")
|
|
||||||
.flatMap(sys.props.get(_))
|
|
||||||
.map(new File(_).getAbsolutePath)
|
|
||||||
val home = new File(sys.props("user.home")).getAbsolutePath
|
|
||||||
|
|
||||||
def notFromCoursierCache(name: String): Unit = {
|
|
||||||
val jars = cp.filter(_.getName.startsWith(name)).distinct
|
|
||||||
assert(jars.nonEmpty, s"Found no JARs for $name")
|
|
||||||
|
|
||||||
for (jar <- jars)
|
|
||||||
assert(
|
|
||||||
!jar.getAbsolutePath.startsWith(home) ||
|
|
||||||
!jar.getAbsolutePath.toLowerCase(java.util.Locale.ROOT).contains("coursier") ||
|
|
||||||
prefixes.exists(jar.getAbsolutePath.startsWith),
|
|
||||||
s"JAR for $name ($jar) under $home and not under any of ${prefixes.mkString(", ")}"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val props = Thread.currentThread()
|
|
||||||
.getContextClassLoader
|
|
||||||
.getResources("library.properties")
|
|
||||||
.asScala
|
|
||||||
.toVector
|
|
||||||
.map(_.toString)
|
|
||||||
.sorted
|
|
||||||
.distinct // TODO should not need distinct
|
|
||||||
|
|
||||||
notFromCoursierCache("scala-library")
|
|
||||||
assert(props.lengthCompare(1) == 0, s"Found several library.properties files in classpath: $props")
|
|
||||||
|
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
}
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ import java.nio.file.Files
|
||||||
|
|
||||||
import org.apache.zookeeper.ZooKeeper
|
import org.apache.zookeeper.ZooKeeper
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
Files.write(new File("output").toPath, classOf[ZooKeeper].getSimpleName.getBytes("UTF-8"))
|
def main(args: Array[String]): Unit = {
|
||||||
|
Files.write(new File("output").toPath, classOf[ZooKeeper].getSimpleName.getBytes("UTF-8"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package example
|
package example
|
||||||
|
|
||||||
object Hello extends App {
|
object Hello {
|
||||||
println("Hello!")
|
def main(args: Array[String]): Unit = {
|
||||||
|
println("Hello!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.config
|
package com.config
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
|
def main(args: Array[String]): Unit = {
|
||||||
println(s"Version: ${MyClass.configValue()}")
|
println(s"Version: ${MyClass.configValue()}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package a
|
package a
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
val core = Core
|
def main(args: Array[String]): Unit = {
|
||||||
|
val core = Core
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
object Main extends App {
|
object Main {
|
||||||
println(com.example.Lib.getMessage)
|
def main(args: Array[String]): Unit = {
|
||||||
|
println(com.example.Lib.getMessage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
object Main extends App {
|
object Main {
|
||||||
println(com.example.Lib.getMessage)
|
def main(args: Array[String]): Unit = {
|
||||||
|
println(com.example.Lib.getMessage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
object B extends App {
|
object B {
|
||||||
println(A.`=`)
|
def main(args: Array[String]): Unit = {
|
||||||
|
println(A.`=`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
@hello
|
@hello
|
||||||
case class Test(x: Int)
|
case class Test(x: Int)
|
||||||
|
|
||||||
object Main extends App {
|
object Main {
|
||||||
Test(3).hello
|
def main(args: Array[String]): Unit = {
|
||||||
}
|
Test(3).hello
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue