Commit Graph

496 Commits

Author SHA1 Message Date
eugene yokota 5824ef6d7f Merge pull request #2106 from Duhemm/interface-specific-sources-clean
Find most specific version of compiler interface sources
2015-07-17 10:25:16 -04: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
Martin Duhem 90a8423d8e Find most specific version of compiler interface sources
This commit introduces a mechanism that allows sbt to find the most
specific version of the compiler interface sources that exists using
Ivy.

For instance, when asked for a compiler interface for Scala 2.11.8-M2,
sbt will look for sources for:

 - 2.11.8-M2 ;
 - 2.11.8 ;
 - 2.11 ;
 - the default sources.

This commit also modifies the build definition by removing the
precompiled projects and configuring the compiler-interface project so
that it publishes its source artifacts in a Maven-friendly format.
2015-07-16 11:18:48 +02:00
Stu Hood 7e7aca5f55 Mismatch APIs on type changes as well 2015-07-13 21:29:14 -07:00
Stu Hood a80c3e2bb8 Review feedback 2015-07-09 22:01:05 -07:00
Stu Hood aa11e9ca87 Improve comments 2015-07-07 10:56:51 -07:00
Stu Hood 592b19b35e Add non-string tests 2015-07-07 10:25:27 -07:00
Stu Hood 2982018e5a Parse ClassFile as a lazy val, and provide it to fieldToDef 2015-07-07 10:25:16 -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
Stu Hood 6846bbd3ed Encode static-final constant fields as Singletons, so that when the api changes, they change. 2015-07-01 21:37:32 -07:00
James Roper 18fb684143 Update incremental compile debug message
sbt 0.13.1 was changed so that products were invalidated
not just when they were deleted, but also when they were
modified, however the debug message was not updated to
reflect this, causing people to think invalidated class files
had been deleted.
2015-04-15 14:29:10 +10:00
Benjy b70345c61b Warn when ignoring previous analysis for various reasons.
This can confuse users and is hard to debug. It seems better to be
explicit about why we're choosing not to do an incremental compile.
2015-03-17 23:55:25 +00: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
Josh Suereth 488a62c8bf Merge pull request #1754 from Duhemm/fix-1655
Check for null type trees in dependency extraction
2014-12-04 17:57:44 -05:00
Jean-Rémi Desjardins ca736e55d3 Minor code cleanup 2014-12-03 09:56:34 -08:00
eugene yokota 7df9802f0c Merge pull request #1714 from sbt/wip/bytecode-enhancement
Expose mechanism whereby bytecode enhancement can be run *before* saving incremental compiler hashes.
2014-12-03 08:46:52 -05:00
Grzegorz Kossakowski 015c61ad69 Merge pull request #1736 from Duhemm/dependency-kind-compile
Abstract over dependency kind in Compile
2014-12-02 16:00:22 +01: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 ae4721aba0 Adding more scaladoc to incremental compiler library. 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
Josh Suereth 045ac1d984 Tweak remaining binary compatibility issues with design. 2014-12-01 13:35:51 -05:00
Josh Suereth 40bf599f4a Deprecating old APIs and attempting to document behavior correctly.
* Removed as many binary incompatibilities as I could find.
* Deprecating old APIs
* Attempt to construct new nomenclature that fits the design of Incremental API.
* Add as much documentation as I was comfortable writing (from my understanding of things).
2014-12-01 13:35:51 -05:00
James Roper 0f784ab101 Allow bytecode enhancement to update analysis
This breaks the loading/saving of the incremental compiler analysis out
into separate task, thereby providing the necessary hooks for byte code
enhancement tasks to enhance bytecode and update the analysis before the
analysis gets stored to disk.
2014-12-01 13:35:50 -05:00
Martin Duhem 18c521dd4b Check for null type trees in dependency extraction
In some cases the dependency extraction may encounter a null `TypeTree`
(eg. arguments of macro annotations that are untyped). In such cases,
we simply ignore the node.

Fixes #1593, #1655.
2014-11-29 12:17:32 +01: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
Martin Duhem 98c789b826 Abstract over dependency context in Compile
This commit completes the abstraction over dependency kinds in the
incremental compiler, started with #1340.
2014-11-19 10:35:07 +01:00
Martin Duhem deda8eee70 Remove trait `DependencyContext` in favor of enum
Since `DependencyContext` is needed in the compiler interface
subproject, it has to be defined in this same subproject.

`DependencyContext` is needed in this subproject because the
`AnalysisCallback` interface uses it.
2014-11-19 10:35:07 +01:00
Grzegorz Kossakowski b2c2ff698e Merge pull request #1340 from Duhemm/abstract-over-dependency-kind
Abstract over dependency kind in Analysis
2014-11-18 16:32:06 +01:00
Martin Duhem 191c3ed675 Use new infrastructure in `AnalysisTest`
A new infrastructure to register sources and their dependencies has
been introduced in `c09a391`.

This commit brings the required modifications to `AnalysisTest`,
so that it uses it.
2014-11-18 13:09:07 +01:00
Martin Duhem b1a608cf1d Use new infrastructure in `AnalysisCallback`
A new infrastructure to register sources and their dependencies has
been introduced in `c09a391`.

This commit brings the required modifications to `AnalysisCallback`,
so that it uses it.
2014-11-18 13:08:51 +01:00
Martin Duhem c09a3912d1 Implement abstraction over dependency kinds
This commit implements the abstraction over the dependency kinds and
deprecates the methods that were used to register files and their
dependencies.

Dependencies are now divided into two categories : Internal and
External dependencies. Moreover, each internal or external dependency
has a Context, which describes what introduced the dependency (for
instance, a dependency may be introduced by member reference or by
inheritance).

Dependencies must now be registered using the method `addSource` in
`Analysis` and in `Relations`. This method has the advantage of being
independent from the existing dependency contexts. That is, its
signature does not need to be modified whenever a new dependency
context is introduced.
2014-11-18 13:07:58 +01: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
Martin Duhem 41f07be247 Port fix for #1544 from Dependency to ExtractUsedNames
The fix for sbt/sbt#1237 was unfortunately not completely correct,
and infinite loops could still occur during the extraction of used
names.

In sbt/sbt#1544, a fix that was robuster and easier to understand
was applied to `/compile/interface/src/main/scala/xsbt/Dependency.scala`
in a similar situation (cyclic chains of original trees in macro
expansions).

This commit ports this fix to `ExtractUsedNames.scala`.

Closes sbt/sbt#1640, sbt/sbt#1610.
2014-10-03 22:01:49 +02:00
Grzegorz Kossakowski 20f50100be Use Option.apply instead of Some.apply in ClassToAPI
When dealing with Java APIs (Java reflection in case of ClassToAPI), one
should always go through Option.apply that performs null check.

This is supposed to fix NPE reported in #1617. We don't have a reproduction
so this is just an educated guess.
2014-09-24 23:05:52 +02:00
Grzegorz Kossakowski f7c00ab581 Sketch of abstracting over dependency details in incremental compiler
This represents a sketch of the idea that we can abstract over details
of a specific dependency kind. The goal would that only a few
implementations of methods in incremental would be sensitive to specific
dependency kind:

  1. Dependency extraction logic
  2. Implementation of Relations which adds dependencies to specific
     relations (or abstract over specific relations)
  3. Invalidation algorithm (Incremental.scala) which has different
     of each kind of dependency
  4. TextAnalysisFormat

In particular, adding a new dependency kind would not affect signatures
of existing methods.

What needs to be done:

  - finish refactoring so the code compiles again and previous semantics
    are preserved
  - introduce deprecated overloads that preserve old method signatures
    (this is required for preserving binary compatibility)
2014-09-12 08:52:06 +02:00
Grzegorz Kossakowski 7885fd2558 Merge pull request #1572 from Duhemm/textanalysisformat-dependency-kinds
Don't hardcode existing relations in TextAnalysisFormat
2014-09-11 16:55:08 +02:00