Commit Graph

88 Commits

Author SHA1 Message Date
Dale Wijnand 06cdefebb9 Replace var/set with withClassLoaderCache 2016-09-26 19:32:11 +10:00
Jason Zaugg 5005abfef2 SD-232 Recycle classloaders to be anti-hostile to JIT.
The compiler interface subclasses `scala.tools.nsc.Global`,
and loading this new subclass before each `compile` task forces
HotSpot JIT to deoptimize larges swathes of compiled code. It's
a bit like SBT has rigged the dice to always descend the longest
ladder in a game of Snakes and Ladders.

The slowdown seems to be larger with Scala 2.12. There are a number
of variables at play, but I think the main factor here is that
we now rely on JIT to devirtualize calls to final methods in traits
whereas we used to emit static calls. JIT does a good job at this,
so long as classloading doesn't undo that good work.

This commit extends the existing `ClassLoaderCache` to encompass
the classloader that includes the compiler interface JAR. I've
resorted to adding a var to `AnalyzingCompiler` to inject the
dependency to get the cache to the spot I need it without binary
incompatible changes to the intervening method signatures.
2016-09-26 14:49:47 +10:00
Guillaume Martres 10265efd9c Make sbt aware of Dotty
This small set of changes, together with the compiler-bridge I wrote
(https://github.com/smarter/dotty-bridge) enables us to compile code
using Dotty in sbt, see https://github.com/smarter/dotty-example-project
for an example.
2016-01-03 20:35:29 +01:00
Martin Duhem 69411c1876 Fix issues with Codacy 2015-11-12 18:50:03 +01:00
Martin Duhem a8d644eb45 Merge branch '0.13' into fix-1968 2015-11-12 09:15:47 +01:00
Martin Duhem d125a36b6c Parse javac non-compile-errors in JavaErrorParser
Upon startup, javac may report errors because (for instance) because it
received incorrect flags. These errors were not correctly parsed by the
JavaErrorParser and were never reported to the user.

This commit fixes this problem by adding a new parsing rule in
JavaErrorParser: errors that start with the prefix "javac:" are now
correctly parsed and reported to the user.

Fixes sbt/sbt#2256
2015-11-11 14:33:30 +01:00
Martin Duhem 7af0fea54e Don't pass `-J<flag>` option to local Java compiler
These options can only be given to a forked Java compiler. If we run a
local java compiler, we filter these options out and emit a warning.

Fixes sbt/sbt#1968
2015-11-11 14:33:16 +01:00
Martin Duhem 4a4a3ca94e Report failed compilation if errors are registered.
In some cases, the local java compiler may report compilation errors,
but succeed in compiling the source files (for instance, if there are
encoding problems in the source). However, the command line javac will
report a failed compilation on the same input.

To have the local java compiler behave like the forked java compiler, we
now report the compilation as failed if error messages have been
registered during compilation.

Fixes sbt/sbt#2228
2015-11-11 14:21:54 +01:00
fkorotkov cf8d7fbdff Use getPosition method to get an offset position instead of using line number 2015-09-10 16:35:09 -07:00
Pierre DAL-PRA 8f1fb2d232 Fix additional warnings 2015-08-07 00:23:14 +02:00
Pierre DAL-PRA 54d54b9f4f Replace procedure syntax by explicit Unit annotation 2015-08-04 10:07:38 +02:00
Pierre DAL-PRA b9171e59ad Simplify operations on collections 2015-08-01 02:25:17 +02:00
Josh Suereth d9360de473 Merge pull request #2108 from fkorotkov/javac-line-content
Line content from diagnostic classes if available
2015-07-17 09:27:12 -04:00
Pierre DAL-PRA 13b37cc987 Fix several warnings 2015-07-17 09:17:42 +02:00
fkorotkov e4f27ee2ca added a todo 2015-07-16 18:09:47 -04:00
fkorotkov 93ae6b2db0 catch Throwable 2015-07-16 17:34:33 -04:00
fkorotkov 5258b4c0d3 reverted check 2015-07-16 16:33:04 -04:00
fkorotkov c73f513016 review comments 2015-07-16 15:49:06 -04:00
fkorotkov 4c86117b79 Line content from diagnostic classes if available 2015-07-16 15:23:23 -04:00
Stu Hood 7e7aca5f55 Mismatch APIs on type changes as well 2015-07-13 21:29:14 -07:00
Stu Hood 592b19b35e Add non-string tests 2015-07-07 10:25:27 -07:00
Stu Hood cc052b598c Add test for stable APIs with identical constants 2015-07-06 16:54:02 -07:00
Stu Hood d52b6bfce7 Add tests missed during initial patch port 2015-07-06 12:50:14 -07:00
Indrajit Raychaudhuri 1f90ef6b43 Fix params order in `@deprecated` 2015-01-17 08:25:57 +05:30
eugene yokota be78b7fc4c Merge pull request #1759 from jedesah/topic/minor_cleanup
Minor code cleanup
2015-01-14 16:13:06 -05:00
Jean-Rémi Desjardins ca736e55d3 Minor code cleanup 2014-12-03 09:56:34 -08:00
Josh Suereth 59ba35ce90 Finish rearchitecting.
* IncrementalCompiler IC object now holds the actual logic to start incremental compilation (rather than AggresiveCompiler or other)
* MixedAnalyzingCompiler ONLY does anlaysis of Java/Scala code
* Moved the AnalyzingJavaCompiler into the integration library so that necessary dependencies are visible.
2014-12-01 13:35:51 -05:00
Josh Suereth 3c4bc23cdb First set of refactorings from review.
* Split Java analyzing compile into its own class.
* MixedAnalyzingCompiler now only does the mixing
* Start moving methods around to more-final locations
* Static analyzingCompile method now constructs a MixedAnalyzingCOmpiler and delegates to incremental compile.
2014-12-01 13:35:51 -05:00
Josh Suereth 067479f59e Debug issues with implicit usage for CompileSetup.
* Force CompileSetup Equiv typeclass to use Equiv relations defined locally.
* Add toString methods on many of the incremental compiler datatypes.
* Remove remaining binary compatibility issues in Defaults.scala.
2014-12-01 13:35:51 -05:00
Eugene Yokota 8c2149dfb6 Fixes #1743. Fixes IndexOutOfBoundsException on Java warning with no position
Enbugged in #1702.
The d.getPosition, d.getStartPosition uses -1 as NOPOS value, but they
weren’t being checked.
Added checkNoPos.
2014-11-20 20:54:06 -05:00
Josh Suereth 3876082172 Merge branch 'wip/incremental-compiler-javac-cleanup' of https://github.com/jsuereth/xsbt into wip/incremental-compiler-javac-cleanup 2014-10-31 11:00:35 -04:00
Josh Suereth a2e7b324f3 Fixes for windows.
* Move error parser into its own file.
* Add the ability to parse Windows filenames.
* Remove existence check for the file as a mandatory.
* Add specific test for the parser.
2014-10-31 10:58:51 -04:00
Josh Suereth 75402b26f2 More fixes from review.
* Fix regex for end of line.
* Rename NewJavaTool and friends to remove the New.
2014-10-30 19:37:22 -04:00
Josh Suereth 8d158e5ab6 TODO cleanups based on @havocp's comments. 2014-10-30 13:28:41 -04:00
Josh Suereth 5f9f38f300 Fix cross-JDK issues around invalid URIs in JDK6 2014-10-29 21:55:14 -04:00
Josh Suereth 70cdce0830 Create a new API for calling Java toolchains.
* Create a new sbt.compiler.javac package
* Create new interfaces to control running `javac` and `javadoc` whether forked or local.
* Ensure new interfaces make use of `xsbti.Reporter`.
* Create new method on `xsbti.compiler.JavaCompiler` which takes a `xsbti.Reporter`
* Create a new mechanism to parse (more accurately) Warnings + Errors, to distinguish the two.
* Ensure older xsbti.Compiler implementations still succeed via catcing NoSuchMethodError.
* Feed new toolchain through sbt.actions.Compiler API via dirty hackery until we can break things in sbt 1.0
* Added a set of unit tests for parsing errors from Javac/Javadoc
* Added a new integration test for hidden compilerReporter key, including testing threading of javac reports.

Fixes #875, Fixes #1542,  Related #1178 could be looked into/cleaned up.
2014-10-29 20:06:08 -04:00
Eugene Yokota adb41611cf added scalariform 2014-05-01 12:50:07 -04:00
Mark Harrah 0a7a579f5b Merge ExtendedReporter into Reporter. 2013-05-27 19:12:39 -04:00
Mark Harrah f2d29d8678 Export approximate command lines executed for 'doc', 'compile', and 'console' 2013-02-28 17:59:38 -05:00
Mark Harrah 1870edfd27 more deprecations 2013-02-26 07:39:23 -05:00
Mark Harrah a1c70c7462 Include jars from java.ext.dirs in incremental classpath. Fixes #678.
Ideally, we wouldn't need to construct the classpath ourselves and instead
reuse the classpath construction code from a compiler (scalac or javac).
However, we need to ensure that we only call the compiler when needed.
Because we need to construct the classpath even when compilation might
not happen, we have to duplicate classpath construction.
2013-02-22 16:31:32 -05:00
Mark Harrah 329b42453b move Eval test to correct location 2012-12-19 10:17:56 -05:00
Mark Harrah 71f12fbcdb 2.9 compatibility for incremental compilation modules 2012-12-11 14:41:22 -05:00
Mark Harrah e3745540c9 More cleanup of Scala version handling, including managedScalaInstance to control automatic 'scala-tool' configuration and dependencies. 2012-12-09 20:40:41 -05:00
Mark Harrah d4fd136192 support defining Projects in .sbt files
vals of type Project are added to the Build
2012-12-09 20:40:41 -05:00
Grzegorz Kossakowski ef39aeb9c1 Follow source layout convention supported by Eclipse.
Moved source files so directory structure follow package
structure. That makes it possible to use Scala Eclipse plugin
with sbt's source code.
2012-12-07 10:27:08 -08:00
Mark Harrah 3f12f2eb9f drop compilation tests
1. overlapped with integration tests
2. slower than integration tests
3. more fragile than integration tests
2012-07-01 15:16:41 -04:00
Mark Harrah 9ee30636b3 don't put scala-library.jar on the boot classpath unless it is on the classpath 2012-05-21 22:23:44 -04:00
Mark Harrah 7bed381bec cleanup compilation tests 2012-05-12 23:12:29 -04:00
Mark Harrah 82ad44a701 preserve API information needed for detecting annotations on defs. fixes #232 2011-10-19 22:23:47 -04:00