Commit Graph

483 Commits

Author SHA1 Message Date
Josh Suereth 755f792262 Remove ivy-specific hackery for interface-src in favor of raw maven publishing. 2015-07-14 11:17:37 -04:00
Martin Duhem 5557de4fe4 Depend more on ComponentManager to get sources 2015-07-13 15:51:07 +02:00
Martin Duhem e9b2ac99d7 Disable travis notification 2015-07-13 15:00:52 +02:00
Martin Duhem a7a5c3eb2b Retrieve compiler-interface sources via Ivy
This commit modifies the build definition so that there's no need
anymore to build precompiled versions of the compiler-interface, and
introduces a new mechanism that allows the `ComponentCompiler` to
retrieve the sources of the compiler-interface using Ivy.
2015-07-13 14:51:24 +02: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
Martin Duhem 82152b8905 Don't hardcode existing relations in TextAnalysisFormat
The previous implementation of TextAnalysisFormat contained the list
of all the existing relations that sbt knew of, and used this
information to write to and read from the disk the persisted analyses.

In this knew implementation, TextAnalysisFormat gets from the
Relations object what are the existing relations, and then persists
them to disk.

The previous situation was not optimal since it meant that, in order
to add a new dependency kind, one had to modify both the Relations
and TextAnalysisFormat.

Using this new implementation, no change to TextAnalysisFormat is
required whenever a new dependency kind is added.
2014-09-11 14:45:47 +02:00
Martin Duhem 8542c9b31a Fix SOE with macros in dependencies extraction
In some cases, expanded macros report that their original tree and
its expansion are the same, thus creating a cyclic chain. This chain
may then produce a SOE during dependencies or used names extraction.

This kind of problem was already reported in sbt/sbt#1237 and
sbt/sbt#1408. Unfortunately, the fix that was applied to the
dependencies extraction part was not sufficient.

Mark test 'source-dependencies/macro' as passing

Fixes #1544
2014-09-10 15:54:06 +02:00
Martin Duhem efa71548d1 Add unit tests for TextAnalysisFormat
Those tests use the random Analysis generator that is used in the
unit tests for the subproject `incremental-compiler`.

Random Analyses are serialized and then constructed back from this
representation.
2014-09-03 23:24:08 +02:00
Martin Duhem c55ae4fd18 Fix random Analysis generator for ScalaCheck
Unit tests in incremental-compiler subproject use a generator to
create random Analysis objects. This generator was unfortunately
not working properly and generated only empty Analyses (it failed
to generate any non-empty Analysis because of a bug in the `unique`
generator).
2014-09-03 23:10:22 +02:00
Eugene Yokota bb20310922 Run AnalysisTest without name hashing 2014-08-23 02:58:44 -04:00
Eugene Yokota 112052241c #1550. Fixes scripted/join that broke with #1546
Name hashing is now turned on by default, so I’m changing the value for
inc.Relations.empty, so inc.Analysis.empty functions as expected when
it’s joined with name hashing analyses.
2014-08-22 19:12:27 -04:00
Grzegorz Kossakowski c440c578fc Enable name hashing incremental compilation by default.
This commit changes the default value of `IncOptions.nameHashing` to be
set to true. It means, the improved incremental compilation algorithm
known as "name hashing" will be enabled by default.

In order to disable it, users should add this to their sbt configuration:

  incOptions := incOptions.value.withNameHashing(false)

Number of tests has been cleaned up as part of this change. All tests
that were marked as name hashing specific are removed. The list includes:

  * constants-name-hashing
  * import-class-name-hashing
  * java-static-name-hashing
  * macro-name-hashing
  * struct-name-hashing

We'll keep just regular version of those tests. The tests will just
exercise the default algorithm: name hashing. This is the first step
towards phasing out of the old incremental compilation algorithm.

Apart from that, a few tests changed its status due to enabling name
hashing algorithm.

The `constants` test has been marked pending due to issue described in
#1543.

The `import-class` test has been marked as passing because name hashing
tracks dependencies introduced by import statements correctly, now.

The `macro` test has been marked as pending due to issue described in
#1544.

The `struct` test has been marked as pending due to issue described in
#1545.

The `java-static` has been slightly modified to exercise just static field
and not run into the same issue as with `constants` test.

There are no other known issues related to name hashing so we conclude
that name hashing is ready to be shipped to all sbt, Scala IDE and zinc
users.
2014-08-22 02:08:07 +02:00
Martin Duhem 26e2449263 Never inspect twice the same macro application
In Scala 2.10.4, this macro can produce a stack overflow :

    def foo(a: Any): Any = macro impl
    def impl(c: Context)(a: c.Expr[Any]): c.Expr[Any] = a

Here, an application such as `foo(someVal)` will produce the expansion
`someVal`. As expected, `someVal` has `original` tree `foo(someVal)`,
but if we inspect this tree, we will find that `someVal` has an
original tree, but it shouldn't.

Moreover, in Scala 2.11, some macros have their own application as
`original` trees.

See sbt/sbt#1237 for a description of these problems.

This commit fixes these two problems.

Fixes sbt/sbt#1237
2014-08-18 09:22:16 +02:00
Brian McKenna 2fefaf5758 Change "Not a simple type" warning to log message
Workaround for -Xfatal-warnings being triggered because of #830.
2014-07-30 07:45:03 -06:00
Grzegorz Kossakowski 129c870a1d Break Incremental.scala into smaller files.
Incremental.scala contained all three strategies of incremental
compilation:

  * ant-style
  * the default one (before name hashing)
  * name hashing

Let's move all those classes into separate files. Also, move common code
into a separate file.
2014-05-21 16:23:55 +02:00
Grzegorz Kossakowski 7849361c82 Remove stale, commented out code from Incremental.scala
The commented out code was sitting here since 2010. It bit-rotted to the
point of not being useful anymore. Let's remove it.
2014-05-20 19:51:28 +02:00
Benjy 00f12c6046 Ensure sequences in analysis files are read in order.
For various reasons, we serialize sequences as:

0 -> foo
1 -> bar
...

Until now we were implicitly relying on the sequences being in order.
However external code may end up (due to bugs or otherwise) messing
with the ordering:

1 -> bar
0 -> foo
...

This change ensures that we don't get confused by that. Although
it's best if external code doesn't mess up the ordering, it's still
a good idea to be defensive about this.

Note that the sequences we serialize are short, so the extra sort
is not a performance concern.
2014-05-17 01:04:14 +00:00
Josh Suereth abffc3e1bd Bump expected 2.11 module versions so we can compile with 2.11
Add scala 2.11 test/build verification.

* Add 2.11 build configuratoin to travis ci
* Create command which runs `safe` unit tests
* Create command to test the scala 2.11 build
* Update scalacheck to 1.11.4
* Update specs2 to 2.3.11
* Fix various 2.11/deprecation removals
  and other changes.

Fix eval test failure in scala 2.11 with XML not existing.
2014-05-14 19:08:05 -04:00