Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
5656c0b807 !5 add patch
Merge pull request !5 from small_leek/xsl
2020-03-10 14:42:29 +08:00
small_leek
fc385c463f add patch 2020-03-10 02:25:01 -04:00
small_leek
f16109e777 add patch 2020-03-10 02:21:15 -04:00
openeuler-ci-bot
ac3fcac057 !4 remove unused files
Merge pull request !4 from small_leek/xsl
2020-02-24 16:55:09 +08:00
small_leek
9edd9d60d7 remove unused files 2020-02-24 02:01:42 -05:00
small_leek
424d2ca282 remove unused files 2020-02-24 01:59:03 -05:00
openeuler-ci-bot
067e38bbb2 !3 fix CVE-2017-15288
Merge pull request !3 from compile_success/master
2019-12-26 16:59:29 +08:00
compile_success
4380af6452 CVE-2017-15288 2019-12-26 16:38:01 +08:00
openeuler-ci-bot
b8601533d7 !1 package scala init
Merge pull request !1 from jackie_wu123/master
2019-12-17 11:34:44 +08:00
jackie_wu123
d0ff34bfd8 package init 2019-12-17 11:31:11 +08:00
18 changed files with 2268 additions and 0 deletions

277
CVE-2017-15288-pre.patch Normal file
View File

@ -0,0 +1,277 @@
From caa9ebc482969a884da5f9c9c246470811b8599d Mon Sep 17 00:00:00 2001
From: Teemu Lehtinen <teemu.t.lehtinen@aalto.fi>
Date: Wed, 20 Aug 2014 13:20:41 +0300
Subject: [PATCH] Add option -port to fsc
Option "port" limits compile server lookup and start to given port.
Normally fsc will start a compile server in a random port if no server
is yet running. This can be problematic with firewalls and/or remote
compile servers. Option "port" should not be confused with option
"server" which looks for a compile server in given host and port and
fails if such server is not found.
Automatic tests for command line user interface do not exist at all.
Thus, adding a test for one new option would require designing a whole
new testing method.
Cherry picked from 7daecd8
---
.../scala/tools/nsc/CompileClient.scala | 4 +-
.../scala/tools/nsc/CompileServer.scala | 56 ++++++++++++-------
.../scala/tools/nsc/CompileSocket.scala | 37 +++++++-----
.../tools/nsc/settings/FscSettings.scala | 4 +-
.../scala/tools/util/SocketServer.scala | 4 +-
5 files changed, 65 insertions(+), 40 deletions(-)
diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala
index 731f6926f00..842d6ac535b 100644
--- a/src/compiler/scala/tools/nsc/CompileClient.scala
+++ b/src/compiler/scala/tools/nsc/CompileClient.scala
@@ -43,8 +43,8 @@ class StandardCompileClient extends HasCompileSocket with CompileOutputCommon {
info(vmArgs.mkString("[VM arguments: ", " ", "]"))
val socket =
- if (settings.server.value == "") compileSocket.getOrCreateSocket(vmArgs mkString " ", !shutdown)
- else Some(compileSocket.getSocket(settings.server.value))
+ if (settings.server.value == "") compileSocket.getOrCreateSocket(vmArgs mkString " ", !shutdown, settings.port.value)
+ else compileSocket.getSocket(settings.server.value)
socket match {
case Some(sock) => compileOnServer(sock, fscArgs)
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index 7a0a072bb8d..6352d75686a 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -5,11 +5,13 @@
package scala.tools.nsc
-import java.io.{ BufferedOutputStream, FileOutputStream, PrintStream }
-import scala.tools.nsc.reporters.{Reporter, ConsoleReporter}
-import scala.reflect.internal.util.FakePos //Position
+import java.io.PrintStream
+
+import scala.reflect.internal.util.FakePos
+import scala.tools.nsc.io.Directory
+import scala.tools.nsc.reporters.{ConsoleReporter, Reporter}
+import scala.tools.nsc.settings.FscSettings
import scala.tools.util.SocketServer
-import settings.FscSettings
/**
* The server part of the fsc offline compiler. It awaits compilation
@@ -19,7 +21,7 @@ import settings.FscSettings
* @author Martin Odersky
* @version 1.0
*/
-class StandardCompileServer extends SocketServer {
+class StandardCompileServer(fixPort: Int = 0) extends SocketServer(fixPort) {
lazy val compileSocket: CompileSocket = CompileSocket
private var compiler: Global = null
@@ -34,7 +36,7 @@ class StandardCompileServer extends SocketServer {
val MaxCharge = 0.8
private val runtime = Runtime.getRuntime()
- import runtime.{ totalMemory, freeMemory, maxMemory }
+ import runtime.{freeMemory, maxMemory, totalMemory}
/** Create a new compiler instance */
def newGlobal(settings: Settings, reporter: Reporter) =
@@ -170,16 +172,16 @@ class StandardCompileServer extends SocketServer {
}
-object CompileServer extends StandardCompileServer {
+object CompileServer {
/** A directory holding redirected output */
- private lazy val redirectDir = (compileSocket.tmpDir / "output-redirects").createDirectory()
+ //private lazy val redirectDir = (compileSocket.tmpDir / "output-redirects").createDirectory()
- private def createRedirect(filename: String) =
- new PrintStream((redirectDir / filename).createFile().bufferedOutput())
+ private def createRedirect(dir: Directory, filename: String) =
+ new PrintStream((dir / filename).createFile().bufferedOutput())
- def main(args: Array[String]) =
+ def main(args: Array[String]) =
execute(() => (), args)
-
+
/**
* Used for internal testing. The callback is called upon
* server start, notifying the caller that the server is
@@ -191,21 +193,33 @@ object CompileServer extends StandardCompileServer {
*/
def execute(startupCallback : () => Unit, args: Array[String]) {
val debug = args contains "-v"
+ var port = 0
+
+ val i = args.indexOf("-p")
+ if (i >= 0 && args.length > i + 1) {
+ scala.util.control.Exception.ignoring(classOf[NumberFormatException]) {
+ port = args(i + 1).toInt
+ }
+ }
+
+ // Create instance rather than extend to pass a port parameter.
+ val server = new StandardCompileServer(port)
+ val redirectDir = (server.compileSocket.tmpDir / "output-redirects").createDirectory()
if (debug) {
- echo("Starting CompileServer on port " + port)
- echo("Redirect dir is " + redirectDir)
+ server.echo("Starting CompileServer on port " + server.port)
+ server.echo("Redirect dir is " + redirectDir)
}
- Console.withErr(createRedirect("scala-compile-server-err.log")) {
- Console.withOut(createRedirect("scala-compile-server-out.log")) {
- Console.err.println("...starting server on socket "+port+"...")
+ Console.withErr(createRedirect(redirectDir, "scala-compile-server-err.log")) {
+ Console.withOut(createRedirect(redirectDir, "scala-compile-server-out.log")) {
+ Console.err.println("...starting server on socket "+server.port+"...")
Console.err.flush()
- compileSocket setPort port
+ server.compileSocket setPort server.port
startupCallback()
- run()
-
- compileSocket deletePort port
+ server.run()
+
+ server.compileSocket deletePort server.port
}
}
}
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala
index 4051bda9144..f5039b8303f 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -5,16 +5,13 @@
package scala.tools.nsc
-import java.io.{ IOException, FileNotFoundException, PrintWriter, FileOutputStream }
-import java.io.{ BufferedReader, FileReader }
-import java.util.regex.Pattern
-import java.net._
+import java.io.FileNotFoundException
import java.security.SecureRandom
-import io.{ File, Path, Directory, Socket }
-import scala.util.control.Exception.catching
-import scala.tools.util.CompileOutputCommon
+
import scala.reflect.internal.util.StringOps.splitWhere
import scala.sys.process._
+import scala.tools.nsc.io.{File, Path, Socket}
+import scala.tools.util.CompileOutputCommon
trait HasCompileSocket {
def compileSocket: CompileSocket
@@ -50,6 +47,9 @@ class CompileSocket extends CompileOutputCommon {
protected lazy val compileClient: StandardCompileClient = CompileClient
def verbose = compileClient.verbose
+ /* Fixes the port where to start the server, 0 yields some free port */
+ var fixPort = 0
+
/** The prefix of the port identification file, which is followed
* by the port number.
*/
@@ -67,7 +67,7 @@ class CompileSocket extends CompileOutputCommon {
/** The class name of the scala compile server */
protected val serverClass = "scala.tools.nsc.CompileServer"
- protected def serverClassArgs = if (verbose) List("-v") else Nil // debug
+ protected def serverClassArgs = (if (verbose) List("-v") else Nil) ::: (if (fixPort > 0) List("-p", fixPort.toString) else Nil)
/** A temporary directory to use */
val tmpDir = {
@@ -107,9 +107,14 @@ class CompileSocket extends CompileOutputCommon {
def portFile(port: Int) = portsDir / File(port.toString)
/** Poll for a server port number; return -1 if none exists yet */
- private def pollPort(): Int = portsDir.list.toList match {
+ private def pollPort(): Int = if (fixPort > 0) {
+ if (portsDir.list.toList.exists(_.name == fixPort.toString)) fixPort else -1
+ } else portsDir.list.toList match {
case Nil => -1
- case x :: xs => try x.name.toInt finally xs foreach (_.delete())
+ case x :: xs => try x.name.toInt catch {
+ case e: Exception => x.delete()
+ throw e
+ }
}
/** Get the port number to which a scala compile server is connected;
@@ -155,7 +160,8 @@ class CompileSocket extends CompileOutputCommon {
* create a new daemon if necessary. Returns None if the connection
* cannot be established.
*/
- def getOrCreateSocket(vmArgs: String, create: Boolean = true): Option[Socket] = {
+ def getOrCreateSocket(vmArgs: String, create: Boolean = true, fixedPort: Int = 0): Option[Socket] = {
+ fixPort = fixedPort
val maxMillis = 10 * 1000 // try for 10 seconds
val retryDelay = 50
val maxAttempts = maxMillis / retryDelay
@@ -189,13 +195,16 @@ class CompileSocket extends CompileOutputCommon {
try { Some(x.toInt) }
catch { case _: NumberFormatException => None }
- def getSocket(serverAdr: String): Socket = (
+ def getSocket(serverAdr: String): Option[Socket] = (
for ((name, portStr) <- splitWhere(serverAdr, _ == ':', true) ; port <- parseInt(portStr)) yield
getSocket(name, port)
) getOrElse fatal("Malformed server address: %s; exiting" format serverAdr)
- def getSocket(hostName: String, port: Int): Socket =
- Socket(hostName, port).opt getOrElse fatal("Unable to establish connection to server %s:%d; exiting".format(hostName, port))
+ def getSocket(hostName: String, port: Int): Option[Socket] = {
+ val sock = Socket(hostName, port).opt
+ if (sock.isEmpty) warn("Unable to establish connection to server %s:%d".format(hostName, port))
+ sock
+ }
def getPassword(port: Int): String = {
val ff = portFile(port)
diff --git a/src/compiler/scala/tools/nsc/settings/FscSettings.scala b/src/compiler/scala/tools/nsc/settings/FscSettings.scala
index 5c852ae07c1..f5f971d697e 100644
--- a/src/compiler/scala/tools/nsc/settings/FscSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/FscSettings.scala
@@ -22,13 +22,15 @@ class FscSettings(error: String => Unit) extends Settings(error) {
val reset = BooleanSetting("-reset", "Reset compile server caches")
val shutdown = BooleanSetting("-shutdown", "Shutdown compile server")
val server = StringSetting ("-server", "hostname:portnumber", "Specify compile server socket", "")
+ val port = IntSetting ("-port", "Search and start compile server in given port only",
+ 0, Some((0, Int.MaxValue)), (_: String) => None)
val preferIPv4 = BooleanSetting("-ipv4", "Use IPv4 rather than IPv6 for the server socket")
val idleMins = IntSetting ("-max-idle", "Set idle timeout in minutes for fsc (use 0 for no timeout)",
30, Some((0, Int.MaxValue)), (_: String) => None)
// For improved help output, separating fsc options from the others.
def fscSpecific = Set[Settings#Setting](
- currentDir, reset, shutdown, server, preferIPv4, idleMins
+ currentDir, reset, shutdown, server, port, preferIPv4, idleMins
)
val isFscSpecific: String => Boolean = fscSpecific map (_.name)
diff --git a/src/compiler/scala/tools/util/SocketServer.scala b/src/compiler/scala/tools/util/SocketServer.scala
index 1b06ce2ff2e..edbc7ecc554 100644
--- a/src/compiler/scala/tools/util/SocketServer.scala
+++ b/src/compiler/scala/tools/util/SocketServer.scala
@@ -27,12 +27,12 @@ trait CompileOutputCommon {
* @author Martin Odersky
* @version 1.0
*/
-abstract class SocketServer extends CompileOutputCommon {
+abstract class SocketServer(fixPort: Int = 0) extends CompileOutputCommon {
def shutdown: Boolean
def session(): Unit
def timeout(): Unit = () // called after a timeout is detected for subclasses to cleanup
// a hook for subclasses
- protected def createServerSocket(): ServerSocket = new ServerSocket(0)
+ protected def createServerSocket(): ServerSocket = new ServerSocket(fixPort)
var in: BufferedReader = _
var out: PrintWriter = _

506
CVE-2017-15288.patch Normal file
View File

@ -0,0 +1,506 @@
From 67e1437e55df6789d0883cb8846d12071de75c63 Mon Sep 17 00:00:00 2001
From: Jason Zaugg <jzaugg@gmail.com>
Date: Mon, 2 Oct 2017 10:06:55 +1000
Subject: [PATCH] Move compilation daemon portfile under `~/.scalac/`
Store the compilation daemon's administrativia (port file, redirection)
under `~/.scalac/`, instead of the less standard
`/tmp/scala-devel/${USER:shared}/scalac-compile-server-port`.
On creation, remove group- and other-permissions from these
private files, ditto for the repl's history file.
On Java 6 on Windows, opt in to compilation daemon using `-nc:false`.
Cherry picked from b64ad85, aa133c9, 2ceb09c
---
.../scala/tools/nsc/CompileServer.scala | 22 ++--
.../scala/tools/nsc/CompileSocket.scala | 68 ++++++-----
.../tools/nsc/GenericRunnerSettings.scala | 5 +-
src/compiler/scala/tools/nsc/Properties.scala | 5 +
.../scala/tools/nsc/ScriptRunner.scala | 20 +++-
.../session/FileBackedHistory.scala | 32 +++++-
.../tools/nsc/util/ScalaClassLoader.scala | 27 ++---
.../internal/util/OwnerOnlyChmod.scala | 107 ++++++++++++++++++
8 files changed, 221 insertions(+), 65 deletions(-)
create mode 100644 src/reflect/scala/reflect/internal/util/OwnerOnlyChmod.scala
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index 6352d75686a..c454ba8b62b 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -183,14 +183,15 @@ object CompileServer {
execute(() => (), args)
/**
- * Used for internal testing. The callback is called upon
- * server start, notifying the caller that the server is
- * ready to run. WARNING: the callback runs in the
- * server's thread, blocking the server from doing any work
- * until the callback is finished. Callbacks should be kept
- * simple and clients should not try to interact with the
- * server while the callback is processing.
- */
+ * The server's main loop.
+ *
+ * `startupCallback` is used for internal testing; it's called upon server start,
+ * notifying the caller that the server is ready to run.
+ *
+ * WARNING: the callback runs in the server's thread, blocking the server from doing any work
+ * until the callback is finished. Callbacks should be kept simple and clients should not try to
+ * interact with the server while the callback is processing.
+ */
def execute(startupCallback : () => Unit, args: Array[String]) {
val debug = args contains "-v"
var port = 0
@@ -198,14 +199,13 @@ object CompileServer {
val i = args.indexOf("-p")
if (i >= 0 && args.length > i + 1) {
scala.util.control.Exception.ignoring(classOf[NumberFormatException]) {
- port = args(i + 1).toInt
+ port = args(i + 1).toInt
}
}
// Create instance rather than extend to pass a port parameter.
val server = new StandardCompileServer(port)
- val redirectDir = (server.compileSocket.tmpDir / "output-redirects").createDirectory()
-
+ val redirectDir = server.compileSocket.mkDaemonDir("fsc_redirects")
if (debug) {
server.echo("Starting CompileServer on port " + server.port)
server.echo("Redirect dir is " + redirectDir)
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala
index f5039b8303f..b73d251e9cc 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -5,13 +5,17 @@
package scala.tools.nsc
-import java.io.FileNotFoundException
+import java.math.BigInteger
import java.security.SecureRandom
+import scala.io.Codec
+import scala.reflect.internal.util.OwnerOnlyChmod
import scala.reflect.internal.util.StringOps.splitWhere
import scala.sys.process._
-import scala.tools.nsc.io.{File, Path, Socket}
+import scala.tools.nsc.Properties.scalacDir
+import scala.tools.nsc.io.{File, Socket}
import scala.tools.util.CompileOutputCommon
+import scala.util.control.NonFatal
trait HasCompileSocket {
def compileSocket: CompileSocket
@@ -46,14 +50,10 @@ trait HasCompileSocket {
class CompileSocket extends CompileOutputCommon {
protected lazy val compileClient: StandardCompileClient = CompileClient
def verbose = compileClient.verbose
-
+ def verbose_=(v: Boolean) = compileClient.verbose = v
/* Fixes the port where to start the server, 0 yields some free port */
var fixPort = 0
- /** The prefix of the port identification file, which is followed
- * by the port number.
- */
- protected lazy val dirName = "scalac-compile-server-port"
protected def cmdName = Properties.scalaCmd
/** The vm part of the command to start a new scala compile server */
@@ -69,20 +69,8 @@ class CompileSocket extends CompileOutputCommon {
protected val serverClass = "scala.tools.nsc.CompileServer"
protected def serverClassArgs = (if (verbose) List("-v") else Nil) ::: (if (fixPort > 0) List("-p", fixPort.toString) else Nil)
- /** A temporary directory to use */
- val tmpDir = {
- val udir = Option(Properties.userName) getOrElse "shared"
- val f = (Path(Properties.tmpDir) / ("scala-devel" + udir)).createDirectory()
-
- if (f.isDirectory && f.canWrite) {
- info("[Temp directory: " + f + "]")
- f
- }
- else fatal("Could not find a directory for temporary files")
- }
-
/* A directory holding port identification files */
- val portsDir = (tmpDir / dirName).createDirectory()
+ private lazy val portsDir = mkDaemonDir("fsc_port")
/** The command which starts the compile server, given vm arguments.
*
@@ -104,7 +92,7 @@ class CompileSocket extends CompileOutputCommon {
}
/** The port identification file */
- def portFile(port: Int) = portsDir / File(port.toString)
+ def portFile(port: Int): File = portsDir / File(port.toString)
/** Poll for a server port number; return -1 if none exists yet */
private def pollPort(): Int = if (fixPort > 0) {
@@ -138,19 +126,19 @@ class CompileSocket extends CompileOutputCommon {
}
info("[Port number: " + port + "]")
if (port < 0)
- fatal("Could not connect to compilation daemon after " + attempts + " attempts.")
+ fatal(s"Could not connect to compilation daemon after $attempts attempts. To run without it, use `-nocompdaemon` or `-nc`.")
port
}
/** Set the port number to which a scala compile server is connected */
- def setPort(port: Int) {
- val file = portFile(port)
- val secret = new SecureRandom().nextInt.toString
-
- try file writeAll secret catch {
- case e @ (_: FileNotFoundException | _: SecurityException) =>
- fatal("Cannot create file: %s".format(file.path))
- }
+ def setPort(port: Int): Unit = {
+ val file = portFile(port)
+ // 128 bits of delicious randomness, suitable for printing with println over a socket,
+ // and storage in a file -- see getPassword
+ val secretDigits = new BigInteger(128, new SecureRandom()).toString.getBytes("UTF-8")
+
+ try OwnerOnlyChmod().chmodAndWrite(file.jfile, secretDigits)
+ catch chmodFailHandler(s"Cannot create file: ${file}")
}
/** Delete the port number to which a scala compile server was connected */
@@ -208,7 +196,7 @@ class CompileSocket extends CompileOutputCommon {
def getPassword(port: Int): String = {
val ff = portFile(port)
- val f = ff.bufferedReader()
+ val f = ff.bufferedReader(Codec.UTF8)
// allow some time for the server to start up
def check = {
@@ -223,6 +211,24 @@ class CompileSocket extends CompileOutputCommon {
f.close()
result
}
+
+ private def chmodFailHandler(msg: String): PartialFunction[Throwable, Unit] = {
+ case NonFatal(e) =>
+ if (verbose) e.printStackTrace()
+ fatal(msg)
+ }
+
+ def mkDaemonDir(name: String) = {
+ val dir = (scalacDir / name).createDirectory()
+
+ if (dir.isDirectory && dir.canWrite) info(s"[Temp directory: $dir]")
+ else fatal(s"Could not create compilation daemon directory $dir")
+
+ try OwnerOnlyChmod().chmod(dir.jfile)
+ catch chmodFailHandler(s"Failed to change permissions on $dir. The compilation daemon requires a secure directory; use -nc to disable the daemon.")
+ dir
+ }
+
}
diff --git a/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala b/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala
index 9c2db11a56e..edfc095c7f7 100644
--- a/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala
+++ b/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala
@@ -38,8 +38,11 @@ class GenericRunnerSettings(error: String => Unit) extends Settings(error) {
val nc = BooleanSetting(
"-nc",
- "do not use the fsc compilation daemon") withAbbreviation "-nocompdaemon"
+ "do not use the fsc compilation daemon") withAbbreviation "-nocompdaemon" withPostSetHook((x: BooleanSetting) => {_useCompDaemon = !x.value })
@deprecated("Use `nc` instead", "2.9.0") def nocompdaemon = nc
@deprecated("Use `save` instead", "2.9.0") def savecompiled = save
+
+ private[this] var _useCompDaemon = true
+ def useCompDaemon: Boolean = _useCompDaemon
}
diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala
index 55fd1967164..8b314ba0b82 100644
--- a/src/compiler/scala/tools/nsc/Properties.scala
+++ b/src/compiler/scala/tools/nsc/Properties.scala
@@ -5,6 +5,8 @@
package scala.tools.nsc
+import scala.tools.nsc.io.Path
+
/** Loads `compiler.properties` from the jar archive file.
*/
object Properties extends scala.util.PropertiesTrait {
@@ -22,4 +24,7 @@ object Properties extends scala.util.PropertiesTrait {
// derived values
def isEmacsShell = propOrEmpty("env.emacs") != ""
def fileEndings = fileEndingString.split("""\|""").toList
+
+ // Where we keep fsc's state (ports/redirection)
+ lazy val scalacDir = (Path(Properties.userHome) / ".scalac").createDirectory(force = false)
}
diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala
index 107c4b3df3d..9af0079ffd6 100644
--- a/src/compiler/scala/tools/nsc/ScriptRunner.scala
+++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala
@@ -77,7 +77,10 @@ class ScriptRunner extends HasCompileSocket {
val coreCompArgs = compSettings flatMap (_.unparse)
val compArgs = coreCompArgs ++ List("-Xscript", scriptMain(settings), scriptFile)
- CompileSocket getOrCreateSocket "" match {
+ // TODO: untangle this mess of top-level objects with their own little view of the mutable world of settings
+ compileSocket.verbose = settings.verbose.value
+
+ compileSocket getOrCreateSocket "" match {
case Some(sock) => compileOnServer(sock, compArgs)
case _ => false
}
@@ -109,14 +112,23 @@ class ScriptRunner extends HasCompileSocket {
settings.outdir.value = compiledPath.path
- if (settings.nc.value) {
- /** Setting settings.script.value informs the compiler this is not a
- * self contained compilation unit.
+ // can't reliably lock down permissions on the portfile in this environment => disable by default.
+ // not the cleanest to do this here, but I don't see where else to decide this and emit the warning below
+ val cantLockdown = !settings.nc.isSetByUser && scala.util.Properties.isWin && !scala.util.Properties.isJavaAtLeast("7")
+
+ if (cantLockdown) settings.nc.value = true
+
+ if (!settings.useCompDaemon) {
+ /* Setting settings.script.value informs the compiler this is not a
+ * self contained compilation unit.
*/
settings.script.value = mainClass
val reporter = new ConsoleReporter(settings)
val compiler = newGlobal(settings, reporter)
+ if (cantLockdown)
+ reporter.echo("[info] The compilation daemon is disabled by default on this platform. To force its usage, use `-nocompdaemon:false`.")
+
new compiler.Run compile List(scriptFile)
if (reporter.hasErrors) None else Some(compiledPath)
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
index dddfb1b8f64..5467c0a61ef 100644
--- a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
@@ -7,14 +7,37 @@ package scala.tools.nsc
package interpreter
package session
-import scala.tools.nsc.io._
-import FileBackedHistory._
+import scala.reflect.internal.util.OwnerOnlyChmod
+import scala.reflect.io.{File, Path}
+import scala.tools.nsc.Properties.{propOrNone, userHome}
+import scala.util.control.NonFatal
/** TODO: file locking.
*/
trait FileBackedHistory extends JLineHistory with JPersistentHistory {
def maxSize: Int = 2500
- protected lazy val historyFile: File = defaultFile
+
+ // For a history file in the standard location, always try to restrict permission,
+ // creating an empty file if none exists.
+ // For a user-specified location, only lock down permissions if we're the ones
+ // creating it, otherwise responsibility for permissions is up to the caller.
+ protected lazy val historyFile: File = File {
+ propOrNone("scala.shell.histfile").map(Path.apply) match {
+ case Some(p) => if (!p.exists) secure(p) else p
+ case None => secure(Path(userHome) / FileBackedHistory.defaultFileName)
+ }
+ }
+
+ private def secure(p: Path): Path = {
+ try OwnerOnlyChmod().chmodOrCreateEmpty(p.jfile)
+ catch { case NonFatal(e) =>
+ if (interpreter.isReplDebug) e.printStackTrace()
+ interpreter.replinfo(s"Warning: history file ${p}'s permissions could not be restricted to owner-only.")
+ }
+
+ p
+ }
+
private var isPersistent = true
locally {
@@ -79,6 +102,5 @@ object FileBackedHistory {
// val ContinuationNL: String = Array('\003', '\n').mkString
import Properties.userHome
- def defaultFileName = ".scala_history"
- def defaultFile: File = File(Path(userHome) / defaultFileName)
+ final val defaultFileName = ".scala_history"
}
diff --git a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
index 1f6fa68f572..0673fa1f758 100644
--- a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
+++ b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
@@ -3,19 +3,18 @@
* @author Paul Phillips
*/
-package scala.tools.nsc
-package util
-
-import java.lang.{ ClassLoader => JClassLoader }
-import java.lang.reflect.{ Constructor, Modifier, Method }
-import java.io.{ File => JFile }
-import java.net.{ URLClassLoader => JURLClassLoader }
-import java.net.URL
-import scala.reflect.runtime.ReflectionUtils.unwrapHandler
-import ScalaClassLoader._
-import scala.util.control.Exception.{ catching }
+package scala.tools.nsc.util
+
+import java.io.{File => JFile}
+import java.lang.reflect.{Constructor, Modifier}
+import java.lang.{ClassLoader => JClassLoader}
+import java.net.{URL, URLClassLoader => JURLClassLoader}
+
import scala.language.implicitConversions
-import scala.reflect.{ ClassTag, classTag }
+import scala.reflect.runtime.ReflectionUtils.unwrapHandler
+import scala.reflect.{ClassTag, classTag}
+import scala.tools.nsc.io.Streamable
+import scala.util.control.Exception.catching
trait HasClassPath {
def classPathURLs: Seq[URL]
@@ -25,6 +24,8 @@ trait HasClassPath {
* of java reflection.
*/
trait ScalaClassLoader extends JClassLoader {
+ import ScalaClassLoader._
+
/** Executing an action with this classloader as context classloader */
def asContext[T](action: => T): T = {
val saved = contextLoader
@@ -52,7 +53,7 @@ trait ScalaClassLoader extends JClassLoader {
/** The actual bytes for a class file, or an empty array if it can't be found. */
def classBytes(className: String): Array[Byte] = classAsStream(className) match {
case null => Array()
- case stream => io.Streamable.bytes(stream)
+ case stream => Streamable.bytes(stream)
}
/** An InputStream representing the given class name, or null if not found. */
diff --git a/src/reflect/scala/reflect/internal/util/OwnerOnlyChmod.scala b/src/reflect/scala/reflect/internal/util/OwnerOnlyChmod.scala
new file mode 100644
index 00000000000..c0da65db387
--- /dev/null
+++ b/src/reflect/scala/reflect/internal/util/OwnerOnlyChmod.scala
@@ -0,0 +1,107 @@
+/* NSC -- new Scala compiler
+ * Copyright 2017 LAMP/EPFL
+ * @author Martin Odersky
+ */
+package scala.reflect.internal.util
+
+import java.io.{File, FileOutputStream, IOException}
+
+
+trait OwnerOnlyChmod {
+ /** Remove group/other permissions for `file`, it if exists */
+ def chmod(file: java.io.File): Unit
+
+ /** Delete `file` if it exists, recreate it with no group/other permissions, and write `contents` */
+ final def chmodAndWrite(file: File, contents: Array[Byte]): Unit = {
+ file.delete()
+ val fos = new FileOutputStream(file)
+ fos.close()
+ chmod(file)
+ val fos2 = new FileOutputStream(file)
+ try {
+ fos2.write(contents)
+ } finally {
+ fos2.close()
+ }
+ }
+
+ // TODO: use appropriate NIO call instead of two-step exists?/create!
+ final def chmodOrCreateEmpty(file: File): Unit =
+ if (!file.exists()) chmodAndWrite(file, Array[Byte]()) else chmod(file)
+
+}
+
+object OwnerOnlyChmod {
+ def apply(): OwnerOnlyChmod = {
+ if (!util.Properties.isWin) Java6UnixChmod
+ else if (util.Properties.isJavaAtLeast("7")) new NioAclChmodReflective
+ else NoOpOwnerOnlyChmod
+ }
+}
+
+object NoOpOwnerOnlyChmod extends OwnerOnlyChmod {
+ override def chmod(file: File): Unit = ()
+}
+
+
+/** Adjust permissions with `File.{setReadable, setWritable}` */
+object Java6UnixChmod extends OwnerOnlyChmod {
+
+ def chmod(file: File): Unit = if (file.exists()) {
+ def clearAndSetOwnerOnly(f: (Boolean, Boolean) => Boolean): Unit = {
+ def fail() = throw new IOException("Unable to modify permissions of " + file)
+ // attribute = false, ownerOnly = false
+ if (!f(false, false)) fail()
+ // attribute = true, ownerOnly = true
+ if (!f(true, true)) fail()
+ }
+ if (file.isDirectory) {
+ clearAndSetOwnerOnly(file.setExecutable)
+ }
+ clearAndSetOwnerOnly(file.setReadable)
+ clearAndSetOwnerOnly(file.setWritable)
+ }
+}
+
+
+object NioAclChmodReflective {
+ val file_toPath = classOf[java.io.File].getMethod("toPath")
+ val files = Class.forName("java.nio.file.Files")
+ val path_class = Class.forName("java.nio.file.Path")
+ val getFileAttributeView = files.getMethod("getFileAttributeView", path_class, classOf[Class[_]], Class.forName("[Ljava.nio.file.LinkOption;"))
+ val linkOptionEmptyArray = java.lang.reflect.Array.newInstance(Class.forName("java.nio.file.LinkOption"), 0)
+ val aclFileAttributeView_class = Class.forName("java.nio.file.attribute.AclFileAttributeView")
+ val aclEntry_class = Class.forName("java.nio.file.attribute.AclEntry")
+ val aclEntryBuilder_class = Class.forName("java.nio.file.attribute.AclEntry$Builder")
+ val newBuilder = aclEntry_class.getMethod("newBuilder")
+ val aclEntryBuilder_build = aclEntryBuilder_class.getMethod("build")
+ val userPrinciple_class = Class.forName("java.nio.file.attribute.UserPrincipal")
+ val setPrincipal = aclEntryBuilder_class.getMethod("setPrincipal", userPrinciple_class)
+ val setPermissions = aclEntryBuilder_class.getMethod("setPermissions", Class.forName("[Ljava.nio.file.attribute.AclEntryPermission;"))
+ val aclEntryType_class = Class.forName("java.nio.file.attribute.AclEntryType")
+ val setType = aclEntryBuilder_class.getMethod("setType", aclEntryType_class)
+ val aclEntryPermission_class = Class.forName("java.nio.file.attribute.AclEntryPermission")
+ val aclEntryPermissionValues = aclEntryPermission_class.getDeclaredMethod("values")
+ val aclEntryType_ALLOW = aclEntryType_class.getDeclaredField("ALLOW")
+}
+
+/** Reflective version of `NioAclChmod` */
+final class NioAclChmodReflective extends OwnerOnlyChmod {
+ import NioAclChmodReflective._
+ def chmod(file: java.io.File): Unit = {
+ val path = file_toPath.invoke(file)
+ val view = getFileAttributeView.invoke(null, path, aclFileAttributeView_class, linkOptionEmptyArray)
+ val setAcl = aclFileAttributeView_class.getMethod("setAcl", classOf[java.util.List[_]])
+ val getOwner = aclFileAttributeView_class.getMethod("getOwner")
+ val owner = getOwner.invoke(view)
+ setAcl.invoke(view, acls(owner))
+ }
+
+ private def acls(owner: Object) = {
+ val builder = newBuilder.invoke(null)
+ setPrincipal.invoke(builder, owner)
+ setPermissions.invoke(builder, aclEntryPermissionValues.invoke(null))
+ setType.invoke(builder, aclEntryType_ALLOW.get(null))
+ java.util.Collections.singletonList(aclEntryBuilder_build.invoke(builder))
+ }
+}

107
scala-2.10-jline.patch Normal file
View File

@ -0,0 +1,107 @@
diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
index 10f9724..2970276 100644
--- a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
@@ -42,7 +42,7 @@ class JLineReader(_completion: => Completion) extends InteractiveReader {
def readOneKey(prompt: String) = {
this.print(prompt)
this.flush()
- this.readVirtualKey()
+ this.readCharacter()
}
def eraseLine() = consoleReader.resetPromptLine("", "", 0)
def redrawLineAndFlush(): Unit = { flush() ; drawLine() ; flush() }
diff --git a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
index dddfb1b..e598ac5 100644
--- a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
@@ -13,7 +13,7 @@ import FileBackedHistory._
/** TODO: file locking.
*/
trait FileBackedHistory extends JLineHistory with JPersistentHistory {
- def maxSize: Int
+ def maxSize: Int = 2500
protected lazy val historyFile: File = defaultFile
private var isPersistent = true
diff --git a/src/compiler/scala/tools/nsc/interpreter/session/JLineHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/JLineHistory.scala
index 18e0ee7..fc33192 100644
--- a/src/compiler/scala/tools/nsc/interpreter/session/JLineHistory.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/session/JLineHistory.scala
@@ -13,7 +13,6 @@ package session
trait JLineHistory extends JHistory with History {
def size: Int
def isEmpty: Boolean
- def index: Int
def clear(): Unit
def get(index: Int): CharSequence
def add(line: CharSequence): Unit
@@ -42,7 +41,8 @@ object JLineHistory {
addLineToFile(item)
}
}
- override def toString = "History(size = " + size + ", index = " + index + ")"
+ override def toString = "History(size = " + size + ", _index = " + index + ")"
+ override def maxSize: Int = 2500
}
def apply(): JLineHistory = try new JLineFileHistory catch { case x: Exception => new SimpleHistory() }
diff --git a/src/compiler/scala/tools/nsc/interpreter/session/SimpleHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/SimpleHistory.scala
index 9f4e2b9..8933849 100644
--- a/src/compiler/scala/tools/nsc/interpreter/session/SimpleHistory.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/session/SimpleHistory.scala
@@ -10,7 +10,7 @@ package session
import scala.collection.mutable.{ Buffer, ListBuffer }
import scala.collection.JavaConverters._
-class SimpleHistory extends JLineHistory {
+class SimpleHistory extends JMemoryHistory with JLineHistory {
private var _index: Int = 0
private val buf: Buffer[String] = new ListBuffer[String]
private def toEntries(): Seq[JEntry] = buf.zipWithIndex map { case (x, i) => Entry(i, x) }
@@ -32,27 +32,27 @@ class SimpleHistory extends JLineHistory {
def maxSize: Int = 2500
def last = if (isEmpty) fail("last") else buf.last
- def size = buf.size
- def index = _index
- def isEmpty = buf.isEmpty
- def clear() = buf.clear()
- def get(idx: Int): CharSequence = buf(idx)
- def add(item: CharSequence): Unit = buf += item
- def replace(item: CharSequence): Unit = {
+ override def size = buf.size
+ override def index = _index
+ override def isEmpty = buf.isEmpty
+ override def clear() = buf.clear()
+ override def get(idx: Int): CharSequence = buf(idx)
+ override def add(item: CharSequence): Unit = buf += item
+ override def replace(item: CharSequence): Unit = {
buf trimEnd 1
add(item)
}
- def entries(idx: Int): JListIterator[JEntry] = toEntries().asJava.listIterator(idx)
- def entries(): JListIterator[JEntry] = toEntries().asJava.listIterator()
- def iterator: JIterator[JEntry] = toEntries().iterator.asJava
-
- def current() = if (index >= 0 && index < buf.size) buf(index) else fail("current()")
- def previous() = (index > 0) && minusOne
- def next() = (index <= lastIndex) && plusOne
- def moveToFirst() = (size > 0) && (index != 0) && setTo(0)
- def moveToLast() = (size > 0) && (index < lastIndex) && setTo(lastIndex)
- def moveTo(idx: Int) = (idx > 0) && (idx <= lastIndex) && setTo(idx)
- def moveToEnd(): Unit = setTo(size)
+ override def entries(idx: Int): JListIterator[JEntry] = toEntries().asJava.listIterator(idx)
+ override def entries(): JListIterator[JEntry] = toEntries().asJava.listIterator()
+ override def iterator: JIterator[JEntry] = toEntries().iterator.asJava
+
+ override def current() = if (index >= 0 && index < buf.size) buf(index) else fail("current()")
+ override def previous() = (index > 0) && minusOne
+ override def next() = (index <= lastIndex) && plusOne
+ override def moveToFirst() = (size > 0) && (index != 0) && setTo(0)
+ override def moveToLast() = (size > 0) && (index < lastIndex) && setTo(lastIndex)
+ override def moveTo(idx: Int) = (idx > 0) && (idx <= lastIndex) && setTo(idx)
+ override def moveToEnd(): Unit = setTo(size)
// scala legacy interface
def asList: List[JEntry] = toEntries().toList

View File

@ -0,0 +1,21 @@
diff -up scala-2.10.0-RC3/src/compiler/scala/tools/ant/templates/tool-unix.tmpl.tool scala-2.10.0-RC3/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
--- scala-2.10.0-RC3/src/compiler/scala/tools/ant/templates/tool-unix.tmpl.tool 2012-11-21 17:01:54.000000000 +0100
+++ scala-2.10.0-RC3/src/compiler/scala/tools/ant/templates/tool-unix.tmpl 2012-11-25 14:55:22.583111734 +0100
@@ -68,7 +68,16 @@ if uname | grep -q ^MINGW; then
fi
# Finding the root folder for this Scala distribution
-SCALA_HOME="$(findScalaHome)"
+export JAVA_HOMe=/usr/share/jvm/java
+
+[ -r @@JAVADIR@@-utils/java-functions ] && . @@JAVADIR@@-utils/java-functions || exit 1
+
+set_javacmd || exit 3
+check_java_env || exit 4
+set_jvm_dirs || exit 5
+
+export SCALA_HOME=@@DATADIR@@/scala
+
SEP=":"
# Possible additional command line options

198
scala-2.10.2-java7.patch Normal file
View File

@ -0,0 +1,198 @@
diff -up scala-2.10.0-RC3-sources/src/swing/scala/swing/ComboBox.scala.jdk7 scala-2.10.0-RC3-sources/src/swing/scala/swing/ComboBox.scala
--- scala-2.10.0-RC3-sources/src/swing/scala/swing/ComboBox.scala.jdk7 2012-11-05 02:49:19.000000000 +0100
+++ scala-2.10.0-RC3-sources/src/swing/scala/swing/ComboBox.scala 2012-12-07 23:29:32.821949227 +0100
@@ -9,7 +9,7 @@
package scala.swing
import event._
-import javax.swing.{JList, JComponent, JComboBox, JTextField, ComboBoxModel, AbstractListModel, ListCellRenderer}
+import javax.swing.{ JComponent, JComboBox, JTextField, ComboBoxModel, AbstractListModel, ListCellRenderer }
import java.awt.event.ActionListener
object ComboBox {
@@ -118,10 +118,10 @@ object ComboBox {
implicit def floatEditor(c: ComboBox[Float]): Editor[Float] = new BuiltInEditor(c)(s => s.toFloat, s => s.toString)
implicit def doubleEditor(c: ComboBox[Double]): Editor[Double] = new BuiltInEditor(c)(s => s.toDouble, s => s.toString)
- def newConstantModel[A](items: Seq[A]): ComboBoxModel = {
- new AbstractListModel with ComboBoxModel {
+ def newConstantModel[A](items: Seq[A]): ComboBoxModel[A] = {
+ new AbstractListModel[A] with ComboBoxModel[A] {
private var selected: A = if (items.isEmpty) null.asInstanceOf[A] else items(0)
- def getSelectedItem: AnyRef = selected.asInstanceOf[AnyRef]
+ def getSelectedItem = selected.asInstanceOf[AnyRef]
def setSelectedItem(a: Any) {
if ((selected != null && selected != a) ||
selected == null && a != null) {
@@ -129,7 +129,7 @@ object ComboBox {
fireContentsChanged(this, -1, -1)
}
}
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
+ def getElementAt(n: Int) = items(n).asInstanceOf[A]
def getSize = items.size
}
}
@@ -157,7 +157,7 @@ object ComboBox {
* @see javax.swing.JComboBox
*/
class ComboBox[A](items: Seq[A]) extends Component with Publisher {
- override lazy val peer: JComboBox = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
+ override lazy val peer: JComboBox[A] = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
object selection extends Publisher {
def index: Int = peer.getSelectedIndex
@@ -182,7 +182,8 @@ class ComboBox[A](items: Seq[A]) extends
* of the component to its own defaults _after_ the renderer has been
* configured. That's Swing's principle of most suprise.
*/
- def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getRenderer)
+ def renderer: ListView.Renderer[A] = ListView.Renderer.wrap[A](peer.getRenderer.asInstanceOf[ListCellRenderer[A]])
+ // def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getRenderer)
def renderer_=(r: ListView.Renderer[A]) { peer.setRenderer(r.peer) }
/* XXX: currently not safe to expose:
@@ -201,8 +202,8 @@ class ComboBox[A](items: Seq[A]) extends
peer.setEditor(editor(this).comboBoxPeer)
}
- def prototypeDisplayValue: Option[A] = toOption[A](peer.getPrototypeDisplayValue)
+ def prototypeDisplayValue: Option[A] = Option(peer.getPrototypeDisplayValue)
def prototypeDisplayValue_=(v: Option[A]) {
- peer.setPrototypeDisplayValue((v map toAnyRef).orNull)
+ peer.setPrototypeDisplayValue((v map toAnyRef).orNull.asInstanceOf[A])
}
}
diff -up scala-2.10.0-RC3-sources/src/swing/scala/swing/ListView.scala.jdk7 scala-2.10.0-RC3-sources/src/swing/scala/swing/ListView.scala
--- scala-2.10.0-RC3-sources/src/swing/scala/swing/ListView.scala.jdk7 2012-11-05 02:49:19.000000000 +0100
+++ scala-2.10.0-RC3-sources/src/swing/scala/swing/ListView.scala 2012-12-07 22:58:13.267919851 +0100
@@ -24,21 +24,21 @@ object ListView {
val MultiInterval = Value(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
}
- def wrap[A](c: JList) = new ListView[A] {
+ def wrap[A](c: JList[A]) = new ListView[A] {
override lazy val peer = c
}
object Renderer {
- def wrap[A](r: ListCellRenderer): Renderer[A] = new Wrapped[A](r)
+ def wrap[A](r: ListCellRenderer[A]): Renderer[A] = new Wrapped[A](r)
/**
* Wrapper for <code>javax.swing.ListCellRenderer<code>s
*/
- class Wrapped[A](override val peer: ListCellRenderer) extends Renderer[A] {
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int) = {
+ class Wrapped[A](override val peer: ListCellRenderer[A]) extends Renderer[A] {
+ def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int) = {
Component.wrap(peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused).asInstanceOf[JComponent])
+ }
}
- }
/**
* Returns a renderer for items of type <code>A</code>. The given function
@@ -55,8 +55,8 @@ object ListView {
* </code>
*/
def apply[A,B](f: A => B)(implicit renderer: Renderer[B]): Renderer[A] = new Renderer[A] {
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component =
- renderer.componentFor(list, isSelected, focused, f(a), index)
+ def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component =
+ renderer.componentFor(list.asInstanceOf[ListView[_ <: B]], isSelected, focused, f(a), index)
}
}
@@ -69,11 +69,11 @@ object ListView {
* @see javax.swing.ListCellRenderer
*/
abstract class Renderer[-A] {
- def peer: ListCellRenderer = new ListCellRenderer {
- def getListCellRendererComponent(list: JList, a: Any, index: Int, isSelected: Boolean, focused: Boolean) =
- componentFor(ListView.wrap[A](list), isSelected, focused, a.asInstanceOf[A], index).peer
+ def peer: ListCellRenderer[_ >: A] = new ListCellRenderer[A] {
+ def getListCellRendererComponent(list: JList[_ <: A], a: A, index: Int, isSelected: Boolean, focused: Boolean) =
+ componentFor(ListView.wrap[A](list.asInstanceOf[JList[A]]), isSelected, focused, a, index).peer
}
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component
+ def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component
}
/**
@@ -110,7 +110,7 @@ object ListView {
/**
* Configures the component before returning it.
*/
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component = {
+ def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component = {
preConfigure(list, isSelected, focused, a, index)
configure(list, isSelected, focused, a, index)
component
@@ -123,10 +123,10 @@ object ListView {
* that renders the string returned from an item's <code>toString</code>.
*/
implicit object GenericRenderer extends Renderer[Any] {
- override lazy val peer: ListCellRenderer = new DefaultListCellRenderer
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: Any, index: Int): Component = {
- val c = peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused).asInstanceOf[JComponent]
- Component.wrap(c)
+ override lazy val peer: ListCellRenderer[Any] = (new DefaultListCellRenderer).asInstanceOf[ListCellRenderer[Any]]
+ def componentFor(list: ListView[_ <: Any], isSelected: Boolean, focused: Boolean, a: Any, index: Int): Component = {
+ val c = peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused)
+ Component.wrap(c.asInstanceOf[JComponent])
}
}
}
@@ -142,34 +142,34 @@ object ListView {
*/
class ListView[A] extends Component {
import ListView._
- override lazy val peer: JList = new JList with SuperMixin
+ override lazy val peer: JList[A] = new JList[A] with SuperMixin
def this(items: Seq[A]) = {
this()
listData = items
}
- protected class ModelWrapper(val items: Seq[A]) extends AbstractListModel {
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
+ protected class ModelWrapper[A](val items: Seq[A]) extends AbstractListModel[A] {
+ def getElementAt(n: Int) = items(n)
def getSize = items.size
}
def listData: Seq[A] = peer.getModel match {
- case model: ModelWrapper => model.items
- case model @ _ => new Seq[A] { selfSeq =>
+ case model: ModelWrapper[a] => model.items
+ case model => new Seq[A] { selfSeq =>
def length = model.getSize
def iterator = new Iterator[A] {
var idx = 0
def next = { idx += 1; apply(idx-1) }
def hasNext = idx < selfSeq.length
}
- def apply(n: Int) = model.getElementAt(n).asInstanceOf[A]
+ def apply(n: Int): A = model.getElementAt(n)
}
}
def listData_=(items: Seq[A]) {
- peer.setModel(new AbstractListModel {
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
+ peer.setModel(new AbstractListModel[A] {
+ def getElementAt(n: Int) = items(n)
def getSize = items.size
})
}
@@ -216,7 +216,7 @@ class ListView[A] extends Component {
def adjusting = peer.getSelectionModel.getValueIsAdjusting
}
- def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getCellRenderer)
+ def renderer: ListView.Renderer[A] = ListView.Renderer.wrap[A](peer.getCellRenderer.asInstanceOf[ListCellRenderer[A]])
def renderer_=(r: ListView.Renderer[A]) { peer.setCellRenderer(r.peer) }
def fixedCellWidth = peer.getFixedCellWidth

View File

@ -0,0 +1,15 @@
diff -up scala-2.10.3/src/build/maven/scala-compiler-pom.xml.compiler-pom scala-2.10.3/src/build/maven/scala-compiler-pom.xml
--- scala-2.10.3/src/build/maven/scala-compiler-pom.xml.compiler-pom 2013-12-09 18:00:10.765090809 +0100
+++ scala-2.10.3/src/build/maven/scala-compiler-pom.xml 2013-12-09 18:02:31.251138135 +0100
@@ -43,9 +43,9 @@
<version>@VERSION@</version>
</dependency>
<dependency>
- <groupId>org.scala-lang</groupId>
+ <groupId>jline</groupId>
<artifactId>jline</artifactId>
- <version>@VERSION@</version>
+ <version>2.10</version>
<optional>true</optional>
</dependency>
</dependencies>

View File

@ -0,0 +1,109 @@
diff -up scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala.sysjline scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala
--- scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala.sysjline 2013-10-10 21:03:24.000000000 +0200
+++ scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala 2013-10-13 15:28:24.478283303 +0200
@@ -6,8 +6,8 @@
package scala.tools.nsc
package interpreter
-import scala.tools.jline.console.{ ConsoleReader, CursorBuffer }
-import scala.tools.jline.console.completer.CompletionHandler
+import jline.console.{ ConsoleReader, CursorBuffer }
+import jline.console.completer.CompletionHandler
import Completion._
trait ConsoleReaderHelper extends ConsoleReader {
diff -up scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/Delimited.scala.sysjline scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/Delimited.scala
--- scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/Delimited.scala.sysjline 2013-10-10 21:03:24.000000000 +0200
+++ scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/Delimited.scala 2013-10-13 15:28:24.483282990 +0200
@@ -6,7 +6,7 @@
package scala.tools.nsc
package interpreter
-import scala.tools.jline.console.completer.ArgumentCompleter.{ ArgumentDelimiter, ArgumentList }
+import jline.console.completer.ArgumentCompleter.{ ArgumentDelimiter, ArgumentList }
class JLineDelimiter extends ArgumentDelimiter {
def toJLine(args: List[String], cursor: Int) = args match {
diff -up scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala.sysjline scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala
--- scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala.sysjline 2013-10-10 21:03:24.000000000 +0200
+++ scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala 2013-10-13 15:28:24.487282739 +0200
@@ -6,8 +6,8 @@
package scala.tools.nsc
package interpreter
-import scala.tools.jline._
-import scala.tools.jline.console.completer._
+import jline._
+import jline.console.completer._
import Completion._
import scala.collection.mutable.ListBuffer
diff -up scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala.sysjline scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
--- scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala.sysjline 2013-10-10 21:03:24.000000000 +0200
+++ scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala 2013-10-13 15:30:16.619034744 +0200
@@ -6,8 +6,8 @@
package scala.tools.nsc
package interpreter
-import scala.tools.jline.console.ConsoleReader
-import scala.tools.jline.console.completer._
+import jline.console.ConsoleReader
+import jline.console.completer._
import session._
import scala.collection.JavaConverters._
import Completion._
@@ -71,6 +71,9 @@ class JLineReader(_completion: => Comple
def eraseLine() = consoleReader.eraseLine()
// Alternate implementation, not sure if/when I need this.
// def eraseLine() = while (consoleReader.delete()) { }
- def readOneLine(prompt: String) = consoleReader readLine prompt
+ def readOneLine(prompt: String) = {
+ consoleReader.setExpandEvents(false)
+ consoleReader readLine prompt
+ }
def readOneKey(prompt: String) = consoleReader readOneKey prompt
}
diff -up scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/Parsed.scala.sysjline scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/Parsed.scala
--- scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/Parsed.scala.sysjline 2013-10-10 21:03:24.000000000 +0200
+++ scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/Parsed.scala 2013-10-13 15:28:24.496282176 +0200
@@ -6,7 +6,7 @@
package scala.tools.nsc
package interpreter
-import scala.tools.jline.console.completer.ArgumentCompleter.{ ArgumentDelimiter, ArgumentList }
+import jline.console.completer.ArgumentCompleter.{ ArgumentDelimiter, ArgumentList }
import util.returning
/** One instance of a command buffer.
diff -up scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala.sysjline scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala
--- scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala.sysjline 2013-10-10 21:03:24.000000000 +0200
+++ scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala 2013-10-13 15:28:24.500281925 +0200
@@ -13,8 +13,8 @@ class ReplProps {
private def bool(name: String) = BooleanProp.keyExists(name)
private def int(name: String) = IntProp(name)
- val jlineDebug = bool("scala.tools.jline.internal.Log.debug")
- val jlineTrace = bool("scala.tools.jline.internal.Log.trace")
+ val jlineDebug = bool("jline.internal.Log.debug")
+ val jlineTrace = bool("jline.internal.Log.trace")
val info = bool("scala.repl.info")
val debug = bool("scala.repl.debug")
diff -up scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/session/package.scala.sysjline scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/session/package.scala
--- scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/session/package.scala.sysjline 2013-10-10 21:03:24.000000000 +0200
+++ scala-2.10.3/src/compiler/scala/tools/nsc/interpreter/session/package.scala 2013-10-13 15:28:24.504281675 +0200
@@ -14,10 +14,10 @@ package object session {
type JIterator[T] = java.util.Iterator[T]
type JListIterator[T] = java.util.ListIterator[T]
- type JEntry = scala.tools.jline.console.history.History.Entry
- type JHistory = scala.tools.jline.console.history.History
- type JMemoryHistory = scala.tools.jline.console.history.MemoryHistory
- type JPersistentHistory = scala.tools.jline.console.history.PersistentHistory
+ type JEntry = jline.console.history.History.Entry
+ type JHistory = jline.console.history.History
+ type JMemoryHistory = jline.console.history.MemoryHistory
+ type JPersistentHistory = jline.console.history.PersistentHistory
private[interpreter] implicit def charSequenceFix(x: CharSequence): String = x.toString
}

View File

@ -0,0 +1,675 @@
--- a/build.xml 2014-09-15 16:38:35.523938086 -0500
+++ b/build.xml 2014-09-18 14:37:16.648133327 -0500
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project name="sabbus" default="build" xmlns:artifact="urn:maven-artifact-ant">
+<project name="sabbus" default="build">
<description>
SuperSabbus for Scala core, builds the scala library and compiler. It can also package it as a simple distribution, tests it for stable bootstrapping and against the Scala test suite.
</description>
@@ -44,8 +44,8 @@
<!-- ===========================================================================
END-USER TARGETS
============================================================================ -->
- <target name="build" depends="pack.done" description="Builds the Scala compiler and library. Executables are in 'build/pack/bin'."/>
- <target name="test" depends="test.done" description="Runs test suite and bootstrapping test on Scala compiler and library."/>
+ <target name="build" depends="quick.done, pack.bin" description="Builds the Scala compiler and library. Executables are in 'build/pack/bin'."/>
+ <target name="test" description="Runs test suite and bootstrapping test on Scala compiler and library."/>
<target name="docs" depends="docs.done" description="Builds documentation for the Scala library. Scaladoc is in 'build/scaladoc/library'."/>
<target name="docscomp" depends="docs.comp" description="Builds documentation for the Scala compiler and library. Scaladoc is in 'build/scaladoc'."/>
<target name="dist" depends="all.clean, all.done" description="Cleans all and builds and tests a new distribution."/>
@@ -68,7 +68,7 @@
<target name="distpack-opt" description="Builds an optimised distribution."> <optimized name="distpack"/></target>
<target name="distpack-maven-opt" description="Builds an optimised maven distribution."><optimized name="distpack-maven"/></target>
- <target name="all.done" depends="dist.done, test.done"/>
+ <target name="all.done" depends="dist.done"/>
<!-- must use depends for all.done, not antcall: need the properties defined in there (dist.dir) -->
<target name="nightly-nopt" depends="all.done, docs.done">
@@ -89,14 +89,13 @@
</sequential>
</macrodef>
+
<!-- ===========================================================================
PROPERTIES
============================================================================ -->
<property environment="env"/>
<!-- Prevents system classpath from being used -->
- <property name="build.sysclasspath" value="ignore"/>
-
<!-- Defines the repository layout -->
<property name="docs.dir" value="${basedir}/docs"/>
<property name="lib.dir" value="${basedir}/lib"/>
@@ -122,8 +121,8 @@
<property name="reflect.starr.jar" value="${lib.dir}/scala-reflect.jar"/>
<property name="compiler.starr.jar" value="${lib.dir}/scala-compiler.jar"/>
<property name="msil.starr.jar" value="${lib.dir}/msil.jar"/>
- <property name="jline.jar" value="${lib.dir}/jline.jar"/>
- <property name="ant.jar" value="${ant.home}/lib/ant.jar"/>
+ <property name="jline.jar" value="@JLINE@"/>
+ <property name="ant.jar" value="/usr/share/java/ant.jar"/>
<property name="scalacheck.jar" value="${lib.dir}/scalacheck.jar"/>
<!-- Sets location of build folders -->
@@ -181,91 +180,57 @@
</target>
<target name="boot" depends="desired.jars.uptodate" unless="lib.jars.uptodate">
- <echo level="warn" message="Updating bootstrap libs. (To do this by hand, run ./pull-binary-libs.sh)"/>
- <exec osfamily="unix" vmlauncher="false" executable="./pull-binary-libs.sh" failifexecutionfails="true" />
- <exec osfamily="windows" vmlauncher="false" executable="pull-binary-libs.sh" failifexecutionfails="true" />
- <!-- uptodate task needs to know these are what's in the sha. -->
- <touch>
- <fileset dir="${basedir}"><patternset refid="desired.jars"/></fileset>
- <mapper type="glob" from="*.desired.sha1" to="*"/>
- </touch>
</target>
<target name="init" depends="boot">
<!-- Set up Ant contrib tasks so we can use <if><then><else> instead of the clunky `unless` attribute -->
- <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${lib-ant.dir}/ant-contrib.jar"/>
-
- <!-- Add our maven ant tasks -->
- <path id="maven-ant-tasks.classpath" path="${lib-ant.dir}/maven-ant-tasks-2.1.1.jar" />
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
+ <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="/usr/share/java/ant-contrib/ant-contrib.jar"/>
- <!-- Resolve maven dependencies -->
-
- <!-- work around http://jira.codehaus.org/browse/MANTTASKS-203:
- java.lang.ClassCastException: org.codehaus.plexus.DefaultPlexusContainer cannot be cast to org.codehaus.plexus.PlexusContainer
- on repeated use of artifact:dependencies
- -->
- <if><not><isset property="maven-deps-done"></isset></not><then>
- <mkdir dir="${user.home}/.m2/repository"/>
- <!-- This task has an issue where if the user directory does not exist, so we create it above. UGH. -->
- <artifact:dependencies pathId="extra.tasks.classpath" filesetId="extra.tasks.fileset">
- <dependency groupId="biz.aQute" artifactId="bnd" version="1.50.0"/>
- </artifact:dependencies>
-
- <!-- JUnit -->
- <property name="junit.version" value="4.10"/>
- <artifact:dependencies pathId="junit.classpath" filesetId="junit.fileset">
- <dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
- </artifact:dependencies>
-
- <!-- Pax runner -->
- <property name="pax.exam.version" value="2.6.0"/>
- <artifact:dependencies pathId="pax.exam.classpath" filesetId="pax.exam.fileset">
- <dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-container-native" version="${pax.exam.version}"/>
- <dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-junit4" version="${pax.exam.version}"/>
- <dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-link-assembly" version="${pax.exam.version}"/>
- <!-- upgraded to 1.6.0 to get fix for https://ops4j1.jira.com/browse/PAXURL-217
- https://ops4j1.jira.com/browse/PAXURL-138 is still unresolved... -->
- <dependency groupId="org.ops4j.pax.url" artifactId="pax-url-aether" version="1.6.0"/>
- <dependency groupId="org.ops4j.pax.swissbox" artifactId="pax-swissbox-framework" version="1.5.1"/>
- <dependency groupId="ch.qos.logback" artifactId="logback-core" version="0.9.20"/>
- <dependency groupId="ch.qos.logback" artifactId="logback-classic" version="0.9.20"/>
- <dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
- <dependency groupId="org.apache.felix" artifactId="org.apache.felix.framework" version="3.2.2"/>
- </artifact:dependencies>
-
-
- <artifact:dependencies pathId="partest.extras.classpath" filesetId="partest.extras.fileset" versionsId="partest.extras.versions">
- <dependency groupId="com.googlecode.java-diff-utils" artifactId="diffutils" version="1.3.0"/>
- </artifact:dependencies>
-
- <!-- BND support -->
- <typedef resource="aQute/bnd/ant/taskdef.properties" classpathref="extra.tasks.classpath" />
-
- <artifact:remoteRepository id="extra-repo" url="${extra.repo.url}"/>
-
- <!-- Download STARR via maven if `starr.use.released` is set,
- and `starr.version` is specified (see the starr.number properties file).
- Want to slow down STARR changes, using only released versions. -->
- <if><isset property="starr.use.released"/><then>
- <echo message="Using Scala ${starr.version} for STARR."/>
- <artifact:dependencies pathId="starr.core.path">
- <artifact:remoteRepository refid="extra-repo"/>
- <dependency groupId="org.scala-lang" artifactId="scala-library" version="${starr.version}"/>
- <dependency groupId="org.scala-lang" artifactId="scala-reflect" version="${starr.version}"/>
- <dependency groupId="org.scala-lang" artifactId="scala-compiler" version="${starr.version}"/>
- </artifact:dependencies></then>
+ <if>
+ <isset property="doBootstrapBuild"></isset>
+ <then>
+ <path id="scalabootstrap.classpath">
+ <fileset dir="lib">
+ <include name="scala*.jar"/>
+ </fileset>
+ </path>
+ </then>
<else>
- <path id="starr.core.path">
- <pathelement location="${library.starr.jar}"/>
- <pathelement location="${reflect.starr.jar}"/>
- <pathelement location="${compiler.starr.jar}"/>
- <pathelement location="${msil.starr.jar}"/>
- </path></else>
- </if>
+ <path id="scalabootstrap.classpath">
+ <fileset dir="/usr/share/scala/lib/">
+ <include name="scala*.jar"/>
+ </fileset>
+ </path>
+ </else>
+ </if>
- <property name="maven-deps-done" value="yep!"/>
- </then></if>
+ <taskdef name="classloadVerify"
+ classpathref="scalabootstrap.classpath"
+ classname="scala.tools.ant.ClassloadVerify"/>
+ <taskdef name="fsc"
+ classpathref="scalabootstrap.classpath"
+ classname="scala.tools.ant.FastScalac"/>
+ <taskdef name="scalac"
+ classpathref="scalabootstrap.classpath"
+ classname="scala.tools.ant.Scalac"/>
+ <taskdef name="scalascript"
+ classpathref="scalabootstrap.classpath"
+ classname="scala.tools.ant.ScalaTool"/>
+ <taskdef name="scaladoc"
+ classpathref="scalabootstrap.classpath"
+ classname="scala.tools.ant.Scaladoc"/>
+ <taskdef name="scalatool"
+ classpathref="scalabootstrap.classpath"
+ classname="scala.tools.ant.ScalaTool"/>
+ <taskdef name="same"
+ classpathref="scalabootstrap.classpath"
+ classname="scala.tools.ant.Same"/>
+ <taskdef name="pack200"
+ classpathref="scalabootstrap.classpath"
+ classname="scala.tools.ant.Pack200Task"/>
+
+ <typedef resource="aQute/bnd/ant/taskdef.properties"
+ classpath="/usr/share/java/aqute-bnd.jar" />
<!-- NOTE: ant properties are write-once: second writes are silently discarded; the logic below relies on this -->
@@ -337,7 +302,7 @@
<if><isset property="build.release"/><then>
<property name="version.number" value="${maven.version.number}"/>
</then><else>
- <property name="version.number" value="${version.major}.${version.minor}.${version.patch}${version.suffix}-${git.commit.date}-${git.commit.sha}"/>
+ <property name="version.number" value="${version.major}.${version.minor}.${version.patch}${version.suffix}"/>
</else></if>
<condition property="has.java6">
@@ -466,6 +431,13 @@
There must be a variable of the shape @{stage}.compiler.path for all @{stage} in starr, locker, quick, strap.
-->
+ <path id="starr.core.path">
+ <pathelement location="${library.starr.jar}"/>
+ <pathelement location="${reflect.starr.jar}"/>
+ <pathelement location="${compiler.starr.jar}"/>
+ <pathelement location="${msil.starr.jar}"/>
+ </path>
+
<path id="starr.compiler.path">
<path refid="starr.core.path"/>
<pathelement location="${lib.dir}/forkjoin.jar"/>
@@ -576,13 +548,6 @@
<path id="quick.scalap.build.path">
<path refid="quick.compiler.build.path"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
- <pathelement location="${build-quick.dir}/classes/partest"/>
- </path>
-
- <path id="quick.partest.build.path">
- <path refid="quick.scalap.build.path"/>
- <path refid="partest.extras.classpath"/>
- <pathelement location="${scalacheck.jar}"/>
</path>
<path id="quick.bin.tool.path">
@@ -605,12 +570,10 @@
<pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-reflect.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
- <pathelement location="${build-pack.dir}/lib/scala-partest.jar"/>
<pathelement location="${build-pack.dir}/lib/scalap.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-actors.jar"/>
<pathelement location="${ant.jar}"/>
<pathelement location="${jline.jar}"/>
- <path refid="partest.extras.classpath"/>
<path refid="aux.libs"/>
</path>
@@ -647,18 +610,6 @@
<path id="pack.scalap.files"> <fileset dir="${build-quick.dir}/classes/scalap"/>
<fileset file="${src.dir}/scalap/decoder.properties"/> </path>
- <path id="pack.partest.files">
- <fileset dir="${build-quick.dir}/classes/partest">
- <exclude name="scala/tools/partest/javaagent/**"/>
- </fileset>
- </path>
-
- <path id="pack.partest-javaagent.files">
- <fileset dir="${build-quick.dir}/classes/partest">
- <include name="scala/tools/partest/javaagent/**"/>
- </fileset>
- </path>
-
<!-- STRAP -->
<path id="strap.library.build.path">
<pathelement location="${build-strap.dir}/classes/library"/>
@@ -733,10 +684,6 @@
<path id="test.positions.sub.build.path" path="${build-quick.dir}/classes/library"/>
<!-- TODO: consolidate *.includes -->
- <patternset id="partest.includes">
- <include name="**/*.xml"/>
- </patternset>
-
<patternset id="lib.includes">
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
@@ -765,7 +712,8 @@
<include name="**/*.txt"/>
</patternset>
- <taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.compiler.path"/>
+ <taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.compiler.path"/>
+
</target>
<!-- ===========================================================================
@@ -811,7 +759,8 @@
classpath="${@{project}-classes}"
includes="**/*.java"
target="1.6" source="1.5"
- compiler="javac1.6">
+ compiler="javac1.6"
+ includeantruntime="false" >
<compilerarg line="${javac.args} @{args}"/>
</javac>
<if><equals arg1="@{jar}" arg2="yes"/><then>
@@ -844,6 +793,7 @@
destdir="${build-@{stage}.dir}/classes/@{destproject}"
includes="**/*.java"
excludes="@{excludes}"
+ includeantruntime="false"
target="1.6" source="1.5">
<compilerarg line="${javac.args} @{args}"/>
<classpath refid="@{stage}.@{destproject}.build.path"/>
@@ -1015,7 +965,7 @@
</srcfiles>
</check>
<do>
- <taskdef name="mk-bin" classname="scala.tools.ant.ScalaTool" classpathref="@{stage}.bin.tool.path"/>
+ <taskdef name="mk-bin" classname="scala.tools.ant.ScalaTool" classpathref="starr.core.path"/>
<mkdir dir="${build-@{stage}.dir}/bin"/>
<if><equals arg1="@{classpathref}" arg2="NOT SET"/><then>
<mk-bin file="${build-@{stage}.dir}/bin/scala" class="scala.tools.nsc.MainGenericRunner" javaFlags="${java.flags}"/>
@@ -1183,10 +1133,7 @@
<target name="quick.scalap" depends="quick.comp">
<staged-build with="locker" stage="quick" project="scalap"/> </target>
- <target name="quick.partest" depends="quick.scalap, quick.comp, asm.done">
- <staged-build with="locker" stage="quick" project="partest" version="partest"/> </target>
-
- <target name="quick.swing" depends="quick.actors, quick.lib" if="has.java6">
+ <target name="quick.swing" depends="quick.actors, quick.lib">
<staged-build with="locker" stage="quick" project="swing"/> </target>
<target name="quick.plugins" depends="quick.comp">
@@ -1222,7 +1169,7 @@
</staged-uptodate>
</target>
- <target name="quick.bin" depends="quick.lib, quick.reflect, quick.comp, quick.scalacheck, quick.scalap, quick.swing, quick.plugins, quick.partest">
+ <target name="quick.bin" depends="quick.lib, quick.reflect, quick.comp, quick.scalacheck, quick.scalap, quick.swing, quick.plugins">
<staged-bin stage="quick" classpathref="quick.bin.tool.path"/>
</target>
@@ -1237,7 +1184,7 @@
<staged-pack project="library"/></target>
<target name="pack.actors" depends="quick.lib"> <staged-pack project="actors"/> </target>
- <target name="pack.swing" if="has.java6" depends="quick.swing"> <staged-pack project="swing"/> </target>
+ <target name="pack.swing" depends="quick.swing"> <staged-pack project="swing"/> </target>
<target name="pack.reflect" depends="quick.reflect"> <staged-pack project="reflect"/> </target>
<target name="pack.comp" depends="quick.comp, asm.done">
@@ -1267,36 +1214,16 @@
<target name="pack.plugins" depends="quick.plugins"> <staged-pack project="plugins" targetdir="misc/scala-devel/plugins" targetjar="continuations.jar"/> </target>
<target name="pack.scalacheck" depends="quick.scalacheck"> <staged-pack project="scalacheck" targetjar="scalacheck.jar"/> </target>
- <target name="pack.partest" depends="quick.partest">
- <staged-pack project="partest"/>
- <!-- TODO the manifest should influence actuality of this target -->
- <staged-pack project="partest-javaagent" manifest="${src.dir}/partest/scala/tools/partest/javaagent/MANIFEST.MF"/>
- </target>
-
<target name="pack.scalap" depends="quick.scalap"> <staged-pack project="scalap" targetjar="scalap.jar"/> </target>
- <target name="pack.bin" depends="pack.comp, pack.lib, pack.actors, pack.partest, pack.plugins, pack.reflect, pack.scalacheck, pack.scalap, pack.swing">
+ <target name="pack.bin" depends="pack.comp, pack.lib, pack.actors, pack.plugins, pack.reflect, pack.scalacheck, pack.scalap, pack.swing">
<staged-bin stage="pack"/>
</target>
- <!-- depend on quick.done so quick.bin is run when pack.done is -->
- <target name="pack.done" depends="quick.done, pack.bin">
- <!-- copy dependencies to build/pack/lib, it only takes a second so don't bother with uptodate checks -->
- <copy todir="${build-pack.dir}/lib">
- <resources refid="partest.extras.fileset"/>
- <mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper"
- from="${partest.extras.versions}" to="flatten"/>
- </copy>
-
- <taskdef resource="scala/tools/ant/antlib.xml" classpathref="pack.compiler.path"/>
- <taskdef resource="scala/tools/partest/antlib.xml" classpathref="partest.classpath"/>
- </target>
-
-
<!-- ===========================================================================
BOOTSTRAPPING BUILD (STRAP)
============================================================================ -->
- <target name="strap.done" depends="pack.done">
+ <target name="strap.done" depends="quick.done, pack.bin">
<staged-build with="pack" stage="strap" project="library" srcpath="${src.dir}/library" includes="lib.rootdoc.includes"/>
<staged-build with="pack" stage="strap" project="msil" java-excludes="**/tests/**"/>
<staged-build with="pack" stage="strap" project="reflect"/>
@@ -1331,7 +1258,7 @@
<!-- ===========================================================================
OSGi Artifacts
============================================================================ -->
- <target name="osgi.done" depends="pack.done">
+ <target name="osgi.done" depends="quick.done, pack.bin">
<mkdir dir="${build-osgi.dir}"/>
<!-- simplify fixing pom versions -->
@@ -1378,7 +1305,6 @@
</uptodate>
<if><not><isset property="osgi.bundles.available"/></not><then>
- <stopwatch name="osgi.bundle.timer"/>
<make-bundle name="scala-library" version="${osgi.version.number}" />
<make-bundle name="scala-actors" version="${osgi.version.number}" />
<make-bundle name="scala-reflect" version="${osgi.version.number}" />
@@ -1386,10 +1312,7 @@
<make-plugin-bundle name="continuations" version="${osgi.version.number}" />
<touch file="${build-osgi.dir}/bundles.complete" verbose="no"/>
- <if><isset property="has.java6"/><then>
- <make-bundle name="scala-swing" version="${osgi.version.number}"/></then>
- </if>
- <stopwatch name="osgi.bundle.timer" action="total"/></then>
+ <make-bundle name="scala-swing" version="${osgi.version.number}"/></then>
</if>
</target>
@@ -1519,81 +1442,6 @@
<stopwatch name="test.junit.timer" action="total"/>
</target>
- <property name="partest.srcdir" value="files" /> <!-- TODO: make targets for `pending` and other subdirs -->
-
- <target name="test.run" depends="pack.done">
- <partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
- timeout="1200000"
- srcdir="${partest.srcdir}"
- scalacopts="${scalac.args.optimise}">
-
- <compilationpath refid="partest.build.path"/>
- <runtests dir="${partest.dir}/${partest.srcdir}/run" includes="*.scala"/>
- <jvmtests dir="${partest.dir}/${partest.srcdir}/jvm" includes="*.scala"/>
- </partest>
- </target>
-
- <target name="test.suite" depends="pack.done">
- <partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
- timeout="2400000"
- srcdir="${partest.srcdir}"
- scalacopts="${scalac.args.optimise}">
- <compilationpath refid="partest.build.path"/>
- <postests dir="${partest.dir}/${partest.srcdir}/pos" includes="*.scala"/>
- <negtests dir="${partest.dir}/${partest.srcdir}/neg" includes="*.scala"/>
- <runtests dir="${partest.dir}/${partest.srcdir}/run" includes="*.scala"/>
- <jvmtests dir="${partest.dir}/${partest.srcdir}/jvm" includes="*.scala"/>
- <residenttests dir="${partest.dir}/${partest.srcdir}/res" includes="*.res"/>
- <buildmanagertests dir="${partest.dir}/${partest.srcdir}/buildmanager" includes="*"/>
- <scalaptests dir="${partest.dir}/${partest.srcdir}/scalap" includes="**/*.scala"/>
- <scalachecktests dir="${partest.dir}/${partest.srcdir}/scalacheck">
- <include name="*.scala"/>
- </scalachecktests>
- <specializedtests dir="${partest.dir}/${partest.srcdir}/specialized">
- <include name="*.scala"/>
- </specializedtests>
- <instrumentedtests dir="${partest.dir}/${partest.srcdir}/instrumented">
- <include name="*.scala"/>
- </instrumentedtests>
- </partest>
- </target>
-
- <target name="test.continuations.suite" depends="pack.done">
- <partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
- timeout="2400000"
- srcdir="${partest.srcdir}"
- scalacopts="${scalac.args.optimise} -Xplugin-require:continuations -P:continuations:enable">
- <compilerarg value="-Xpluginsdir"/>
- <compilerarg file="${build-quick.dir}/misc/scala-devel/plugins"/>
- <compilationpath refid="partest.build.path"/>
- <negtests dir="${partest.dir}/${partest.srcdir}/continuations-neg" includes="*.scala"/>
- <runtests dir="${partest.dir}/${partest.srcdir}/continuations-run" includes="*.scala"/>
- </partest>
- </target>
-
- <target name="test.scaladoc" depends="pack.done">
- <partest erroronfailed="yes" scalacopts="${scalac.args.optimise}" showlog="yes">
- <compilationpath refid="partest.build.path"/>
- <runtests dir="${partest.dir}/scaladoc/run" includes="*.scala" />
- <scalachecktests dir="${partest.dir}/scaladoc/scalacheck" includes="*.scala" />
- </partest>
- </target>
-
- <target name="test.interactive" depends="pack.done">
- <partest erroronfailed="yes" scalacopts="${scalac.args.optimise}" showlog="yes">
- <compilationpath refid="partest.build.path"/>
- <presentationtests dir="${partest.dir}/${partest.srcdir}/presentation">
- <include name="*/*.scala"/>
- </presentationtests>
- </partest>
- </target>
-
- <!-- for use in PR validation, where stability is rarely broken, so we're going to use starr for locker,
- and skip test.stability (which requires locker == quick) -->
- <target name="test.core" depends="test.osgi, test.sbt, test.bc, test.junit, test.interactive, test.continuations.suite, test.scaladoc, test.suite"/>
- <target name="test.done" depends="test.core, test.stability"/>
-
-
<!-- ===========================================================================
BINARY COMPATIBILITY TESTING
============================================================================ -->
@@ -1604,71 +1452,37 @@
<!-- Obtain mima -->
<mkdir dir="${bc-build.dir}"/>
<!-- Pull down MIMA -->
- <artifact:dependencies pathId="mima.classpath">
- <dependency groupId="com.typesafe" artifactId="mima-reporter_2.10" version="0.1.6"/>
- </artifact:dependencies>
- <artifact:dependencies pathId="old.bc.classpath">
- <dependency groupId="org.scala-lang" artifactId="scala-swing" version="${bc-reference-version}"/>
- <dependency groupId="org.scala-lang" artifactId="scala-library" version="${bc-reference-version}"/>
- <dependency groupId="org.scala-lang" artifactId="scala-reflect" version="${bc-reference-version}"/>
- </artifact:dependencies>
<property name="maven-deps-done-mima" value="true"/>
</target>
<macrodef name="bc.run-mima">
- <attribute name="jar-name"/>
- <attribute name="prev"/>
- <attribute name="curr"/>
- <attribute name="direction"/>
- <sequential>
- <echo message="Checking @{direction} binary compatibility for @{jar-name} (against ${bc-reference-version})"/>
- <java taskname="mima"
- fork="true"
- failonerror="true"
- classname="com.typesafe.tools.mima.cli.Main">
- <arg value="--prev"/>
- <arg value="@{prev}"/>
- <arg value="--curr"/>
- <arg value="@{curr}"/>
- <arg value="--filters"/>
- <arg value="${basedir}/bincompat-@{direction}.whitelist.conf"/>
- <arg value="--generate-filters"/>
- <classpath>
- <path refid="mima.classpath"/>
- </classpath>
- </java>
- </sequential>
+ <sequential></sequential>
</macrodef>
<macrodef name="bc.check">
- <attribute name="jar-name"/>
- <sequential>
- <bc.run-mima
- jar-name="@{jar-name}"
- prev="${org.scala-lang:@{jar-name}:jar}"
- curr="${build-pack.dir}/lib/@{jar-name}.jar"
- direction="backward"/>
- <bc.run-mima
- jar-name="@{jar-name}"
- prev="${build-pack.dir}/lib/@{jar-name}.jar"
- curr="${org.scala-lang:@{jar-name}:jar}"
- direction="forward"/>
- </sequential>
+ <sequential></sequential>
</macrodef>
<target name="test.bc-opt" description="Optimized version of test.bc."> <optimized name="test.bc"/></target>
<target name="test.bc" depends="bc.init, pack.lib, pack.reflect, pack.swing">
- <bc.check jar-name="scala-library"/>
- <bc.check jar-name="scala-reflect"/>
- <bc.check jar-name="scala-swing"/>
</target>
<!-- ===========================================================================
DOCUMENTATION
============================================================================ -->
- <target name="docs.start" depends="pack.done">
+ <target name="docs.start" depends="quick.done, pack.bin">
<!-- Set the github commit scaladoc sources point to -->
<!-- For releases, look for the tag with the same name as the maven version -->
+
+ <pathconvert property="packBinToolPath" refid="pack.bin.tool.path"/>
+ <echo>pack.bin.tool.path is ${packBinToolPath}</echo>
+
+ <taskdef name="scaladoc" classname="scala.tools.ant.Scaladoc">
+ <classpath>
+ <path refid="starr.core.path"/>
+ </classpath>
+ </taskdef>
+
<condition property="scaladoc.git.commit" value="v${maven.version.number}">
<isset property="build.release"/>
</condition>
@@ -1688,6 +1502,7 @@
</target>
<target name="docs.lib" depends="docs.start">
+
<staged-uptodate stage="docs" project="library">
<check><srcfiles dir="${src.dir}">
<include name="library/**"/>
@@ -1740,15 +1555,14 @@
</target>
<target name="docs.comp" depends="docs.start">
- <staged-docs project="compiler" title="Scala Compiler" docroot="rootdoc.txt">
- <include name="**/*.scala"/>
- </staged-docs>
- </target>
+ <taskdef name="scaladoc" classname="scala.tools.ant.Scaladoc">
+ <classpath>
+ <path refid="starr.core.path"/>
+ </classpath>
+ </taskdef>
- <target name="docs.jline" depends="docs.start">
- <staged-docs project="jline" dir="jline/src/main/java" title="Scala JLine">
+ <staged-docs project="compiler" title="Scala Compiler" docroot="rootdoc.txt">
<include name="**/*.scala"/>
- <include name="**/*.java"/>
</staged-docs>
</target>
@@ -1758,12 +1572,6 @@
</staged-docs>
</target>
- <target name="docs.partest" depends="docs.start">
- <staged-docs project="partest" title="Scala Parallel Testing Framework">
- <include name="**/*.scala"/>
- </staged-docs>
- </target>
-
<target name="docs.continuations-plugin" depends="docs.start">
<staged-docs project="continuations-plugin" dir="continuations/plugin" title="Delimited Continuations Compiler Plugin">
<include name="**/*.scala"/>
@@ -1771,10 +1579,12 @@
</target>
<target name="docs.man" depends="docs.start">
+ <taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.compiler.path"/>
<staged-uptodate stage="docs" project="manual">
<check><srcfiles dir="${src.dir}/manual"/></check>
<do>
<mkdir dir="${build.dir}/manmaker/classes"/>
+
<scalac
destdir="${build.dir}/manmaker/classes"
classpathref="pack.compiler.path"
@@ -1807,13 +1617,13 @@
</staged-uptodate>
</target>
- <target name="docs.done" depends="docs.jline, docs.comp, docs.man, docs.lib, docs.scalap, docs.partest, docs.continuations-plugin"/>
+ <target name="docs.done" depends="docs.comp, docs.man, docs.lib, docs.scalap, docs.continuations-plugin"/>
<!-- ===========================================================================
DISTRIBUTION
============================================================================ -->
- <target name="dist.base" depends="pack.done, osgi.done">
+ <target name="dist.base" depends="quick.done, pack.bin, osgi.done">
<property name="dist.name" value="scala-${version.number}"/>
<property name="dist.dir" value="${dists.dir}/${dist.name}"/>
@@ -1836,7 +1646,6 @@
<mkdir dir="${dist.dir}/lib"/>
<copy toDir="${dist.dir}/lib">
<fileset dir="${build-pack.dir}/lib">
- <include name="jline.jar"/>
<include name="scala-partest.jar"/> <!-- needed for maven publish -->
<include name="scalap.jar"/>
</fileset>
@@ -2027,10 +1836,9 @@
</fail>
<!-- needs antcall to enforce ordering -->
<antcall target="locker.clean"/>
- <antcall target="pack.done"/>
+ <antcall target="quick.done, pack.bin"/>
<antcall target="starr.done"/>
<antcall target="locker.clean"/>
- <antcall target="test.done"/>
</target>
<target name="replacestarr-opt" description="Replaces the Starr compiler and library by fresh, optimised ones built from current sources and tests them.">
@@ -2047,7 +1855,6 @@
<echo message="CAUTION: Make sure to execute 'ant locker.clean build' prior to calling 'replacestarrwin'."/>
<antcall target="starr.done"/>
<antcall target="locker.clean"/>
- <antcall target="test.done"/>
</target>
<target name="replacestarrwin-opt" description="Creates a new Starr on Windows. Manually execute 'ant locker.clean build' first!">

View File

@ -0,0 +1,25 @@
From f9b8176c668d3dff01da73fe65308bc50e355226 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 12 Oct 2018 16:43:59 +0000
Subject: [PATCH] Stop scaladoc from bundling web assets in generated docs
---
src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala
index 4630c3d..648a588 100644
--- a/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala
@@ -121,8 +121,6 @@ class HtmlFactory(val universe: doc.Universe, index: doc.Index) {
DiagramGenerator.initialize(universe.settings)
- libResources foreach (s => copyResource("lib/" + s))
-
new page.Index(universe, index) writeFor this
new page.IndexScript(universe, index) writeFor this
--
2.17.2

BIN
scala-2.10.6.tar.gz Normal file

Binary file not shown.

152
scala-bootstript.xml Normal file
View File

@ -0,0 +1,152 @@
<?xml version="1.0"?>
<!-- scala 2.10.0-RC3 build file by gil -->
<!-- for rebuild only this scala components -->
<project name="scala-components" basedir=".">
<property name="version" value="2.10.0-RC3"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="fjbg.dir" value="${basedir}/fjbg"/>
<property name="fjbg.src.dir" value="${basedir}/src/fjbg"/>
<property name="fjbg.build.dir" value="${fjbg.dir}/classes"/>
<property name="fjbg.jar" value="${basedir}/lib/fjbg.jar"/>
<property name="forkjoin.dir" value="${basedir}/forkjoin"/>
<property name="forkjoin.src.dir" value="${basedir}/src/forkjoin"/>
<property name="forkjoin.build.dir" value="${forkjoin.dir}/classes"/>
<property name="forkjoin.jar" value="${basedir}/lib/forkjoin.jar"/>
<property name="msil.dir" value="${basedir}/msil"/>
<property name="msil.src.dir" value="${basedir}/src/msil"/>
<property name="msil.build.dir" value="${msil.dir}/classes/msil"/>
<property name="msil.jar" value="${basedir}/lib/msil.jar"/>
<target name="build"
depends="build.fjbg,build.forkjoin,build.msil" description="Compile the sources">
</target>
<target name="dist" depends="clean,build"
description="generate the distribution" >
</target>
<target name="clean">
<delete file="${fjbg.jar}" />
<delete file="${forkjoin.jar}" />
<delete file="${msil.jar}" />
<delete dir="${fjbg.dir}" />
<delete dir="${forkjoin.dir}" />
<delete dir="${msil.dir}" />
</target>
<path id="scalac.classpath">
<fileset dir="/usr/share/java" includes="ant.jar"/>
<fileset dir="${lib.dir}" includes="scala-compiler.jar"/>
<fileset dir="${lib.dir}" includes="scala-library.jar"/>
<fileset dir="${lib.dir}" includes="scala-reflect.jar"/>
<fileset dir="${basedir}/lib" includes="fjbg.jar"/>
<fileset dir="${basedir}/lib" includes="forkjoin.jar"/>
<pathelement location="${msil.build.dir}"/>
</path>
<target name="build.fjbg" description="Build Scala fjbg component">
<compile-javac
dirsrc="${fjbg.src.dir}"
destfile="${fjbg.build.dir}"/>
<make-jar
basedir="${fjbg.build.dir}"
destfile="${fjbg.jar}"/>
</target>
<target name="build.forkjoin" description="Build Scala forkjoin component">
<compile-javac
dirsrc="${forkjoin.src.dir}"
destfile="${forkjoin.build.dir}"/>
<make-jar
basedir="${forkjoin.build.dir}"
destfile="${forkjoin.jar}"/>
</target>
<target name="build.msil" description="Build Scala msil component">
<mkdir dir="${msil.build.dir}"/>
<compile-scala
dirsrc="${msil.src.dir}"
destfile="${msil.build.dir}" />
<make-jar
basedir="${msil.build.dir}"
destfile="${msil.jar}"/>
</target>
<macrodef name="compile-javac">
<attribute name="destfile"/>
<attribute name="dirsrc"/>
<attribute name="excludes" default=""/>
<attribute name="includes" default=""/>
<attribute name="buildclasspath" default=""/>
<sequential>
<mkdir dir="@{destfile}"/>
<javac
srcdir="@{dirsrc}"
destdir="@{destfile}"
debug="true"
target="1.5" source="1.5">
<exclude name="@{excludes}"/>
</javac>
</sequential>
</macrodef>
<taskdef name="scalac" classname="scala.tools.ant.sabbus.ScalacFork" classpathref="scalac.classpath"/>
<macrodef name="compile-scala">
<attribute name="destfile"/>
<attribute name="dirsrc"/>
<attribute name="excludes" default=""/>
<attribute name="includes" default=""/>
<attribute name="buildclasspath" default=""/>
<sequential>
<javac
srcdir="@{dirsrc}"
destdir="@{destfile}"
includes="**/*.java"
excludes="**/tests/**"
debug="true"
target="1.5" source="1.5">
</javac>
<scalac
srcdir="@{dirsrc}"
destdir="@{destfile}"
compilerpathref="scalac.classpath">
<include name="**/*.scala"/>
<compilationpath>
<pathelement location="${msil.build.dir}"/>
<pathelement location="/usr/share/java/ant.jar"/>
<pathelement location="${lib.dir}/scala-compiler.jar"/>
<pathelement location="${lib.dir}/scala-library.jar"/>
<pathelement location="${lib.dir}/scala-reflect.jar"/>
<pathelement location="${basedir}/lib/fjbg.jar"/>
<pathelement location="${basedir}/lib/forkjoin.jar"/>
</compilationpath>
</scalac>
</sequential>
</macrodef>
<macrodef name="make-jar">
<attribute name="destfile"/>
<attribute name="basedir"/>
<attribute name="excludes" default=""/>
<attribute name="includes" default="**"/>
<attribute name="resources" default=""/>
<attribute name="paramvalue" default=""/>
<sequential>
<jar destfile="@{destfile}"
basedir="@{basedir}"
includes="@{includes}">
</jar>
</sequential>
</macrodef>
</project>

View File

@ -0,0 +1,3 @@
Bundle-Name: Scala Distribution
Bundle-SymbolicName: org.scala-ide.scala.library
Export-Package: scala.*

8
scala-mime-info.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="text/x-scala">
<sub-class-of type="text/plain"/>
<comment>Scala source code</comment>
<glob pattern="*.scala" />
</mime-type>
</mime-info>

1
scala.ant.d Normal file
View File

@ -0,0 +1 @@
scala

2
scala.gitinfo Normal file
View File

@ -0,0 +1,2 @@
b66a39653b9bccab72036ba58fec5fd7d596d313
20140209

4
scala.keys Normal file
View File

@ -0,0 +1,4 @@
text/x-scala
description=Scala source code
category=Software Development/Source Code
can_be_executable=TRUE

2
scala.mime Normal file
View File

@ -0,0 +1,2 @@
text/x-scala
ext: scala

163
scala.spec Normal file
View File

@ -0,0 +1,163 @@
%global _default_patch_fuzz 2
%{?filter_setup: %filter_from_requires /ant/d; %filter_setup}
Name: scala
Version: 2.10.6
Release: 15
Summary: Combination of object-oriented and functional programming
License: BSD and CC0 and Public Domain
URL: http://www.scala-lang.org/
Source0: %{name}-%{version}.tar.gz
Source1: scala-library-2.10.0-bnd.properties
Source2: scala.gitinfo
Source3: scala.keys
Source4: scala.mime
Source5: scala-mime-info.xml
Source6: scala.ant.d
Source7: scala-bootstript.xml
Patch0: scala-2.10.0-tooltemplate.patch
Patch1: scala-2.10.3-use_system_jline.patch
Patch2: scala-2.10.3-compiler-pom.patch
Patch3: scala-2.10.2-java7.patch
Patch4: scala-2.10-jline.patch
Patch5: scala-2.10.4-build_xml.patch
Patch6: scala-2.10.6-scaladoc-resources.patch
Patch6000: CVE-2017-15288-pre.patch
Patch6001: CVE-2017-15288.patch
BuildArch: noarch
BuildRequires: java-devel >= 1:1.7.0, ant, ant-junit, ant-contrib, jline >= 2.10, aqute-bnd, junit, javapackages-local, scala
Requires: jpackage-utils, jansi, java-headless >= 1:1.7.0, jline >= 2.10
Provides: %{name}-apidoc%{?_isa} %{name}-apidoc
Obsoletes: %{name}-apidoc
Provides: %{name}-swing%{?_isa} %{name}-swing
Obsoletes: %{name}-swing
Provides: ant-scala%{?_isa} ant-scala
Obsoletes: ant-scala
%description
Scala combines object-oriented and functional programming in one concise, high-level language.
Scala's static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes
let you build high-performance systems with easy access to huge ecosystems of libraries.
It provides a common, uniform, and all-encompassing framework for collection types.
This framework enables you to work with data in memory at a high level, with the basic building
blocks of a program being whole collections, instead of individual elements.
This style of programming requires some learning. Fortunately, the adaptation is helped by several
nice properties of the Scala collections. They are easy to use, concise, safe, fast, universal.
%prep
%autosetup -p1
echo "starr.version=2.10.4\nstarr.use.released=0" > starr.number
cd src
rm -rf jline
cd -
sed -i '/is not supported by/d' build.xml
sed -i '/exec.*pull-binary-libs.sh/d' build.xml
pushd lib
rm -rf scala-compiler.jar scala-library.jar scala-reflect.jar
ln -s $(build-classpath scala/scala-compiler.jar) scala-compiler.jar
ln -s $(build-classpath scala/scala-library.jar) scala-library.jar
ln -s $(build-classpath scala/scala-reflect.jar) scala-reflect.jar
pushd ant
rm -rf ant.jar ant-contrib.jar
ln -s $(build-classpath ant.jar) ant.jar
ln -s $(build-classpath ant/ant-contrib) ant-contrib.jar
popd
popd
cp -rf %{SOURCE7} .
sed -i -e 's!@JLINE@!%{_javadir}/jline/jline.jar!g' build.xml
echo echo $(head -n 1 %{SOURCE2}) > tools/get-scala-commit-sha
echo echo $(tail -n 1 %{SOURCE2}) > tools/get-scala-commit-date
chmod 755 tools/get-scala-*
%build
export ANT_OPTS="-Xms2048m -Xmx2048m %{nil}"
ant build || exit 1
cd build/pack/lib
mv scala-library.jar scala-library.jar.no
bnd wrap --properties %{SOURCE1} --output scala-library.jar --version "%{version}" scala-library.jar.no
cd -
%check
pushd test/files/run
rm -rf parserJavaIdent.scala t6223.scala
pushd ../presentation
rm -rf implicit-member t5708 ide-bug-1000349 ide-bug-1000475 ide-bug-1000531 visibility ping-pong callcc-interpreter
pushd ../../osgi/src
rm -rf ReflectionToolboxTest.scala
popd
popd
popd
%install
install -d $RPM_BUILD_ROOT%{_bindir}
for prog in scaladoc fsc scala scalac scalap; do
install -p -m 755 build/pack/bin/$prog $RPM_BUILD_ROOT%{_bindir}
done
install -p -m 755 -d $RPM_BUILD_ROOT%{_datadir}/scala/lib
%mvn_file ':{*}:jar:' %{name}/@1 %{_datadir}/scala/lib/@1
%mvn_file ':{*}:pom:' %{name}/@1 JPP.%{name}-@1
%mvn_package :scala-swing swing
for libname in scala-compiler scala-library scala-reflect scalap scala-swing ; do
sed -i "s|@VERSION@|%{version}|" src/build/maven/$libname-pom.xml
sed -i "s|@RELEASE_REPOSITORY@|http://nexus.scala-tools.org/content/repositories/releases|" src/build/maven/$libname-pom.xml
sed -i "s|@SNAPSHOT_REPOSITORY@|http://nexus.scala-tools.org/content/repositories/snapshots|" src/build/maven/$libname-pom.xml
%mvn_artifact src/build/maven/$libname-pom.xml build/pack/lib/$libname.jar
done
ln -s $(abs2rel %{_javadir}/jline/jline.jar %{_datadir}/scala/lib) $RPM_BUILD_ROOT%{_datadir}/scala/lib
ln -s $(abs2rel %{_javadir}/jansi/jansi.jar %{_datadir}/scala/lib) $RPM_BUILD_ROOT%{_datadir}/scala/lib
%mvn_install
install -d $RPM_BUILD_ROOT%{_sysconfdir}/ant.d
install -p -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/ant.d/scala
install -d $RPM_BUILD_ROOT%{_datadir}/mime-info
install -p -m 644 %{SOURCE3} %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}/mime-info/
install -d $RPM_BUILD_ROOT%{_datadir}/mime/packages/
install -p -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_datadir}/mime/packages/
sed -i -e 's,@JAVADIR@,%{_javadir},g' -e 's,@DATADIR@,%{_datadir},g' $RPM_BUILD_ROOT%{_bindir}/*
%post
touch --no-create %{_datadir}/mime/packages > /dev/null 2>&1 || :
%postun
if [ $1 -eq 0 ]; then
update-mime-database %{_datadir}/mime > /dev/null 2>&1 || :
fi
%posttrans
update-mime-database -n %{_datadir}/mime > /dev/null 2>&1 || :
%files -f .mfiles
%license docs/LICENSE
%config %{_sysconfdir}/ant.d/*
%{_bindir}/*
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/lib
%{_datadir}/%{name}/lib/*.jar
%{_datadir}/mime-info/*
%{_datadir}/mime/packages/*
%{_javadir}/%{name}/*
/usr/share/maven*
%changelog
* Tue Mar 10 2020 Senlin Xia <xiasenlin1@huawei.com> - 2.10.6-15
- add scala-2.10.6-scaladoc-resources.patch
* Tue Feb 18 2020 Senlin Xia <xiasenlin1@huawei.com> - 2.10.6-14
- remove unused files