summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ScriptRunner.scala
Commit message (Collapse)AuthorAgeFilesLines
* Remove abstraction layer in classpath implementationLukas Rytz2016-05-021-3/+2
|
* remove recursive classpath implementationLukas Rytz2016-04-231-5/+1
|
* ScalaDoc fixes for compilerJanek Bogucki2015-07-291-6/+6
|
* Integrate flat classpath with the compilermpociecha2014-12-051-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit integrates with the compiler the whole flat classpath representation build next to the recursive one as an alternative. From now flat classpath really works and can be turned on. There's added flag -YclasspathImpl with two options: recursive (the default one) and flat. It was needed to make the dynamic dispatch to the particular classpath representation according to the chosen type of a classpath representation. There's added PathResolverFactory which is used instead of a concrete implementation of a path resolver. It turned out that only a small subset of path resolvers methods is used outside this class in Scala sources. Therefore, PathResolverFactory returns an instance of a base interface PathResolverResult providing only these used methods. PathResolverFactory in combination with matches in some other places ensures that in all places using classpath we create/get the proper representation. Also the classPath method in Global is modified to use the dynamic dispatch. This is very important change as a return type changed to the base ClassFileLookup providing subset of old ClassPath public methods. It can be problematic if someone was using in his project the explicit ClassPath type or public methods which are not provided via ClassFileLookup. I tested flat classpath with sbt and Scala IDE and there were no problems. Also was looking at sources of some other projects like e.g. Scala plugin for IntelliJ and there shouldn't be problems, I think, but it would be better to check these changes using the community build. Scalap's Main.scala is changed to be able to use both implementations and also to use flags related to the classpath implementation. The classpath invalidation is modified to work properly with the old (recursive) classpath representation after changes made in a Global. In the case of the attempt to use the invalidation for the flat cp it just throws exception with a message that the flat one currently doesn't support the invalidation. And also that's why the partest's test for the invalidation has been changed to use (always) the old implementation. There's added an adequate comment with TODO to this file. There's added partest test generating various dependencies (directories, zips and jars with sources and class files) and testing whether the compilation and further running an application works correctly, when there are these various types of entries specified as -classpath and -sourcepath. It should be a good approximation of real use cases.
* SI-5254 running an empty scala script should succeedAntoine Gourlay2014-08-261-11/+23
| | | | | | | | | | The script runner made the assumption that "compilation succeeded" implies "there is a Main class to run", but this can be wrong if the script is empty (or only contains imports/comments). The ScriptRunner now uses the ClassPath utility to check if there really is a main class. If not, it doesn't try to run it and returns peacefully. This also makes `scala -e ''` succeed.
* SI-7711 Do not emit extra argv in script bodySom Snytt2014-02-141-2/+2
| | | | | | | | | | | | | | | Take away `argv` and make `args` the standard parameter name. This is a quick fix to avoid "unused local" lint error. All the examples use `args`; in particular, "Step 4. Write some Scala scripts" in "Programming in Scala" uses `args`. I see the footnote there is also where Odersky concatenation is specified, `"Hello, "+ args(0) +"!"` with no space next to the literals. Also removes `argv` from `StdNames`. Was torn whether just to add `argc`. Maybe start a new project to house Names, emeritus.
* Absolutized paths involving the scala package.Paul Phillips2013-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
* SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlagSom Snytt2013-03-271-2/+2
| | | | | | | This commit shortens expressions of the form `if (settings.debug.value)` to `if (settings.debug)` for various settings. Rarely, the setting is supplied as a method argument. The conversion is not employed in simple definitions where the Boolean type would have to be specified.
* Doc -> C-style comments for local symbols to avoid "discardingEugene Vigdorchik2013-03-211-6/+6
| | | | | unmoored doc comment" warning when building distribution for scala itself.
* Remove code from compiler central.Paul Phillips2012-11-201-2/+0
| | | | | All those old-timey methods whose melodies have become unfashionable.
* Revert "Commenting out unused members."Paul Phillips2012-11-191-1/+1
| | | | This reverts commit 951fc3a486.
* Commenting out unused members.Paul Phillips2012-11-191-1/+1
| | | | | | | | | | | | | | | | | | I want to get this commit into the history because the tests pass here, which demonstrates that every commented out method is not only unnecessary internally but has zero test coverage. Since I know (based on the occasional source code comment, or more often based on knowing something about other source bases) that some of these can't be removed without breaking other things, I want to at least record a snapshot of the identities of all these unused and untested methods. This commit will be reverted; then there will be another commit which removes the subset of these methods which I believe to be removable. The remainder are in great need of tests which exercise the interfaces upon which other repositories depend.
* Removed unused imports.Paul Phillips2012-11-061-1/+0
| | | | | | | | | A dizzying number of unused imports, limited to files in src/compiler. I especially like that the unused import option (not quite ready for checkin itself) finds places where feature implicits have been imported which are no longer necessary, e.g. this commit includes half a dozen removals of "import scala.language.implicitConversions".
* Merge commit 'refs/pull/1574/head' into merge-210Paul Phillips2012-11-051-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'refs/pull/1574/head': (24 commits) Fixing issue where OSGi bundles weren't getting used for distribution. Fixes example in Type.asSeenFrom Fix for SI-6600, regression with ScalaNumber. SI-6562 Fix crash with class nested in @inline method Brings copyrights in Scaladoc footer and manpage up-to-date, from 2011/12 to 2013 Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013 SI-6606 Drops new icons in, replaces abstract types placeholder icons SI-6132 Revisited, cleaned-up, links fixed, spelling errors fixed, rewordings Labeling scala.reflect and scala.reflect.macros experimental in the API docs Typo-fix in scala.concurrent.Future, thanks to @pavelpavlov Remove implementation details from Position (they are still under reflection.internal). It probably needs more cleanup of the api wrt to ranges etc but let's leave it for later SI-6399 Adds API docs for Any and AnyVal Removing actors-migration from main repository so it can live on elsewhere. Fix for SI-6597, implicit case class crasher. SI-6578 Harden against synthetics being added more than once. SI-6556 no assert for surprising ctor result type Removing actors-migration from main repository so it can live on elsewhere. Fixes SI-6500 by making erasure more regular. Modification to SI-6534 patch. Fixes SI-6559 - StringContext not using passed in escape function. ... Conflicts: src/actors-migration/scala/actors/migration/StashingActor.scala src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala src/compiler/scala/tools/nsc/settings/AestheticSettings.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/library/scala/Application.scala src/library/scala/collection/immutable/GenIterable.scala.disabled src/library/scala/collection/immutable/GenMap.scala.disabled src/library/scala/collection/immutable/GenSeq.scala.disabled src/library/scala/collection/immutable/GenSet.scala.disabled src/library/scala/collection/immutable/GenTraversable.scala.disabled src/library/scala/collection/mutable/GenIterable.scala.disabled src/library/scala/collection/mutable/GenMap.scala.disabled src/library/scala/collection/mutable/GenSeq.scala.disabled src/library/scala/collection/mutable/GenSet.scala.disabled src/library/scala/collection/mutable/GenTraversable.scala.disabled src/library/scala/collection/parallel/immutable/ParNumericRange.scala.disabled
| * Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
| |
* | Remove unused private members.Paul Phillips2012-11-011-11/+0
|/ | | | | | | | | That's a lot of unused code. Most of this is pure cruft; a small amount is debugging code which somebody might want to keep around, but we should not be using trunk as a repository of our personal snippets of undocumented, unused, unintegrated debugging code. So let's make the easy decision to err in the removing direction. If it isn't built to last, it shouldn't be checked into master.
* update and normalize copyright noticeAdriaan Moors2012-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are the regexp replacements performed: Sxcala -> Scala Copyright (\d*) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*)(,?) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*) Scala Solutions and LAMP/EPFL -> Copyright $1-2012 Scala Solutions and LAMP/EPFL \(C\) (\d*)-(\d*) LAMP/EPFL -> (C) $1-2012 LAMP/EPFL Copyright \(c\) (\d*)-(\d*)(.*?)EPFL -> Copyright (c) $1-2012$3EPFL The last one was needed for two HTML-ified copyright notices. Here's the summarized diff: Created using ``` git diff -w | grep ^- | sort | uniq | mate git diff -w | grep ^+ | sort | uniq | mate ``` ``` - <div id="footer">Scala programming documentation. Copyright (c) 2003-2011 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> - copyright.string=Copyright 2002-2011, LAMP/EPFL - <meta name="Copyright" content="(C) 2002-2011 LAMP/EPFL"/> - * Copyright 2002-2011 LAMP/EPFL - * Copyright 2004-2011 LAMP/EPFL - * Copyright 2005 LAMP/EPFL - * Copyright 2005-2011 LAMP/EPFL - * Copyright 2006-2011 LAMP/EPFL - * Copyright 2007 LAMP/EPFL - * Copyright 2007-2011 LAMP/EPFL - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL - * Copyright 2009-2011 Scxala Solutions and LAMP/EPFL - * Copyright 2010-2011 LAMP/EPFL - * Copyright 2012 LAMP/EPFL -# Copyright 2002-2011, LAMP/EPFL -* Copyright 2005-2011 LAMP/EPFL -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ -rem # Copyright 2002-2011, LAMP/EPFL ``` ``` + <div id="footer">Scala programming documentation. Copyright (c) 2003-2012 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> + copyright.string=Copyright 2002-2012 LAMP/EPFL + <meta name="Copyright" content="(C) 2002-2012 LAMP/EPFL"/> + * Copyright 2002-2012 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL + * Copyright 2010-2012 LAMP/EPFL + * Copyright 2011-2012 LAMP/EPFL +# Copyright 2002-2012 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ +rem # Copyright 2002-2012 LAMP/EPFL ```
* address "this would catch all throwables" warningsMartin Odersky2012-07-201-1/+1
| | | | | | | | original patch by @odersky in #955 -- criterion for the refactor: "catch Throwable as long as there's no obvious control flow exception going through the catch and the caught exception is processed further" rebased & updated with review comments in #955 and #954
* Made it possible to supply a custom Global to t...Paul Phillips2011-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Made it possible to supply a custom Global to the core scala runners. The absence of "Global pluggability", combined with the fact that most of the functionality in Global is unnecessarily rigid due to the phases being implemented as objects, means that it has been close to impossible to do interesting compiler development in a way which doesn't require modifying the scalac source tree. This then leaves you continually subject to punishment by code drift as the various places you were forced to modify change out from under you. This is somewhat less true now, thanks to new option: -Yglobal-class The primary wielders of Global (fsc/scala/scalac) now instantiate the compiler via a (Settings, Reporter) => Global factory method in the Global companion. If -Yglobal-class was given, that class (which must have a (Settings, Reporter) constructor) will be instantiated if possible, falling back on the standard one. See test/files/pos/CustomGlobal.scala for a working example. (It's not in run because I would have to be able to give partest a different set of flags for successive compiles in the same test.) Review by odersky.
* Cleanup in scriptrunner, no review.Paul Phillips2011-05-211-12/+3
|
* [I'm laptop only so there's some chance this wi...Paul Phillips2011-03-211-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | [I'm laptop only so there's some chance this will incur temporary breakage, but it needs committing.] Heading off gratuitous complications which haven't yet shipped, I eliminated the -jar startup option in favor of doing what we already do, figuring it out. So now all these things work. scala foo/bar.scala // if file is a script or has one main method scala foo.Bar // if it has a legal main method scala foo.jar // if it has a legal MainClass attribute Also changed "-savecompiled" to "-save" and given scala source called foo.scala, generate foo.jar rather than foo.scala.jar. Cleaned up a bunch of related code and further polished the scala startup message. And unbroke choice settings and improved that error too, which closes #3849. While trying to write a test for the choice setting, was reminded that partest just discards invalid flags files. Made it fail instead, which closes #3712. Fixed the new failures that revealed. No review.
* Accumulated work on fsc.Paul Phillips2011-03-181-6/+0
| | | | | | | | | | | | | | | | | | | | adds the following new options. -ipv4 Use IPv4 rather than IPv6 for the server socket absolute-cp Make -classpath elements absolute paths before sending to server max-idle -Set idle timeout in minutes for fsc (use 0 for no timeout) My question marks are what are the right defaults for the first two. Former behavior is to absolutize the classpath always and never prefer IPv4 sockets. I changed the default to not absolutize the classpath, with the option if you need it; I left the system default in place for the socket creation, but I have a feeling we should default to IPv4. My only hesitation is that the only way to request an IPv4 socket from java involves mutating a global system property. (Robustness FTW.) So for now, you have to give -ipv4. Closes #3626, #3785, #3788, #3789. Review by community.
* Undoing some much too hacky code to implement a...Paul Phillips2011-03-161-44/+8
| | | | | | | | | | | | | | | | | | | Undoing some much too hacky code to implement a -jar option and then following wherever that led me. Tangible results include: * much beautified scala -help, including documenting some things never before documented in this plane of existence * an improved Jar abstraction * further systemization of system properties In addition, the jars created by -savecompiled are given the right manifest so the jar is runnable. That means you can: scala -savecompiled bippy.scala arg1 arg2 scala -jar bippy.scala.jar arg1 arg2 And both lines should yield the same result. No review.
* Working on fsc.Paul Phillips2011-02-081-3/+3
| | | | | | | | | for me anyway, with this commit scripts will occasionally reuse a compiler instance, instead of never. Since any tests I write will fail on platforms which aren't mine, there are no tests. I might have to start a platform-specific testing area to break some ice around these huge untested zones. No review.
* Eliminating duplication and trying to outrun ob...Paul Phillips2011-02-011-31/+15
| | | | | | Eliminating duplication and trying to outrun obsolescence in the exciting world of fsc. No review.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Imported sbt.Process into trunk, in the guise o...Paul Phillips2011-01-121-3/+3
| | | | | | | | | | | | | | | | | | | Imported sbt.Process into trunk, in the guise of package scala.sys.process. It is largely indistinguishable from the version in sbt, at least from the outside. Also, I renamed package system to sys. I wanted to do that from the beginning and the desire has only grown since then. Sometimes a short identifier is just critical to usability: with a function like error("") called from hundreds of places, the difference between system.error and sys.error is too big. sys.error and sys.exit have good vibes (at least as good as the vibes can be for functions which error and exit.) Note: this is just the first cut. I need to check this in to finish fixing partest. I will be going over it with a comb and writing documentation which will leave you enchanted, as well as removing other bits which are now redundant or inferior. No review.
* fixed issue with EnclosingMethod attribute.michelou2010-12-301-19/+19
| | | | | | The above issue was made explicit using the dx tool for the Android SDK to convert Java bytecode to Dalvik bytecode.
* Mopping up after the deprecation of exit and er...Paul Phillips2010-12-051-2/+2
| | | | | | | | | | | | | | Mopping up after the deprecation of exit and error. It is decidedly non-trivial (at least for the IDE-impaired) to be completely sure of which error function was being called when there were about twenty with the same signature in trunk and they are being variously inherited, imported, shadowed, etc. So although I was careful, the possibility exists that something is now calling a different "error" function than before. Caveat programmer. (And let's all make it our policy not to name anything "error" or "exit" from here on out....) No review.
* Introducing scala.system, the product of a whir...Paul Phillips2010-12-041-2/+2
| | | | | | | | | | Introducing scala.system, the product of a whirlwind couple of hours. More useful stuff than you can shake three sticks at. See the scala.system package object. It's even documented. And since it has methods error and exit, proceeded to deprecate the ones in Predef. No review.
* Some cleanups in the *Runners and a few compile...Paul Phillips2010-11-271-1/+1
| | | | | | Some cleanups in the *Runners and a few compiler I/O conveniences. No review.
* In the absence of known reasons why some except...Paul Phillips2010-11-261-5/+3
| | | | | | | | In the absence of known reasons why some exceptions are intercepted or have their stack trace printed and others fly unchallenged, changed script and object runners to handle everything consistently when an exception is thrown. Closes #3978 again, no review.
* Introduces "Origins" for all your superhero bac...Paul Phillips2010-11-111-9/+1
| | | | | | | | Introduces "Origins" for all your superhero backstory needs. It logs where all the calls are coming from: that's all for the moment. It's explained in the comments and test case, so I'm sure you don't need it all repeated here. No review.
* Restored the stack traces I'd accidentally smot...Paul Phillips2010-11-081-12/+18
| | | | | | Restored the stack traces I'd accidentally smothered in r23426, and cleaned up ObjectRunner/ScriptRunner a bit. Closes #3978, no review.
* Since r22186 scripts wait for all non-daemon th...Paul Phillips2010-08-151-6/+13
| | | | | | | | | | | Since r22186 scripts wait for all non-daemon threads to exit before the script will exit (not doing so was the cause of several other bugs involving early script termination) but this means we must be careful not to introduce unnecessary non-daemon threads in the script infrastructure. Two such sources (now fixed) were the shutdown hook which deletes temporary files and the stream consumers used by Process. Closes #3678, review by harrah.
* Fixed a bug in scripts which put the classfile ...Paul Phillips2010-06-161-1/+1
| | | | | | Fixed a bug in scripts which put the classfile directory at the wrong end of the classpath. No review.
* Made scripts wait for all non-daemon threads to...Paul Phillips2010-06-071-22/+28
| | | | | | Made scripts wait for all non-daemon threads to exit before calling System.exit. Closes #1955, #2006, #3408. Review by community.
* Changed the script runner mechanism to alchemiz...Paul Phillips2010-05-231-68/+9
| | | | | | | | Changed the script runner mechanism to alchemize from AST atoms rather than generating wrapper source, and fixed script position reporting. This patch does not include a discussed change to mark some positions as synthetic. Closes #3119, #3121. Review by milessabin.
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* As a brief diversion from real work, implemente...Paul Phillips2010-04-061-1/+1
| | | | | | | | | As a brief diversion from real work, implemented Damerau–Levenshtein and ran it on trunk to elicit obvious misspellings. Unfortunately they're mostly in places like compiler comments which real people never see, but I fixed them anyway. All those English Lit majors who peruse our sources are sure to be pleased. No review.
* Some minor I/O changes. No review.Paul Phillips2010-03-261-1/+1
|
* A few yards short of the goal posts attempt at ...Paul Phillips2010-03-041-1/+1
| | | | | | | | | | | A few yards short of the goal posts attempt at making our usage of Throwable subclasses more consistent. This patch eliminates a lot of ad hoc Exception/Error/etc. creation and various arbitrary choices are rendered slightly less arbitrary. From now on let's try not to use the word "Exception" or "Error" in the names of Throwable subclasses unless they actually derive (and make sense to derive) from Exception or Error. Review by community.
* More laboring on Settings, ClassPaths, Ant Task...Paul Phillips2010-02-221-2/+2
| | | | | | More laboring on Settings, ClassPaths, Ant Tasks, Partest, and similar epicenters of thrilldom. No review.
* Some script fixes tied up with classpaths.Paul Phillips2010-02-191-11/+2
|
* The first reasonably satisfying classpath commit.Paul Phillips2010-02-181-2/+2
| | | | | there with this one. Documentation to come. Review by community.
* More classpath work, and cleanups in the vicini...Paul Phillips2010-02-141-15/+4
| | | | | | | More classpath work, and cleanups in the vicinities of everything manipulating classpaths. Review by anyone willing to slog through the approximately dozen different ways the classpath can be influenced.
* More work on classpaths.Paul Phillips2010-02-101-11/+3
| | | | | | | | to have command line options following source files, at the price of temporarily breaking tools/pathResolver. Working my way through all the usages of classpath in trunk zeroing in on fully consistent handling. Review by community.
* Fixed a number of faulty Scaladoc comments in l...Gilles Dubochet2010-01-261-4/+4
| | | | | | Fixed a number of faulty Scaladoc comments in library and compiler sources. No review.
* Digging into why the repl is so slow, discovere...Paul Phillips2010-01-191-2/+2
| | | | | | | | | | | | | | | | | | Digging into why the repl is so slow, discovered that fsc is once again never reusing compiler instances (but for a different reason than #1683.) Small changes break equality and the little troopers are so darn quiet about it. Steady state, hot fsc repl startup times before this patch: 0m1.747s 0m1.789s 0m1.842s 0m1.690s After this patch: 0m1.139s 0m1.148s 0m1.090s 0m1.091s No review. Could use a test case but I have trouble coaxing partest this far outside the box.
* Another round of deprecation warning elimination.Paul Phillips2009-12-151-1/+1
|