Commit Graph

66 Commits

Author SHA1 Message Date
Mark Harrah cd2b1edf6c IncOptions class backup directory should be per-compilation, not shared.
Otherwise, one concurrent compilation will clean the directory out from under another.
2013-05-30 15:00:26 -04:00
Mark Harrah 435bd1d587 Only invalidate package objects that inherit from invalidated files.
Originally described in cf355f1822.
2013-05-01 09:35:53 -04:00
Mark Harrah bedc8dbb10 Push full transitive invalidation out a step since step 3 is now relatively cheap. 2013-04-26 22:36:15 -04:00
Mark Harrah 658c3d06c4 Use public inherited dependencies in incremental compilation invalidation.
1. All parents of public/exported classes/modules/packages are tracked as
   'publicInherited' dependencies.  These are dealiased and normalized so
    that the dependency is on the actual underlying template and not the
    source enclosing the alias.
2. All CompilationUnit.depends dependencies are direct dependencies.  These
   include inherited dependencies.
3. When invalidating changed internal sources,
	a. Invalidate all inherited dependencies, transitively and include the
      originally modified sources,
	b. Invalidate all direct dependencies of these sources,
	c. Exclude any sources that were compiled in the previous step unless they
      depend on a newly invalidated source.
4. Invalidate changed external sources in the same way as #3 but remove the
   external sources from the final set.

Only public inheritance dependencies need to be considered because a template
that is not accessible outside its source file and that inherits from another
file can be handled as a normal, direct dependency.  Because the template
isn't public, changes to its API will not propagate outside of the source
file.

Several existing tests cover the correctness, especially:

1. transitive-a covers direct, transitive dependencies with inferred return
   types
2. transitive-b covers inherited, transitive dependencies with inferred return
   types

There are two new tests, one that tests that public inherited dependencies are
tracked and one that verifies the basic invalidation progression.
More tests are needed to verify the improvements that this algorithm brings:

1. Inheritance-related dependencies are processed in one step to avoid the
   otherwise unavoidable several steps.
2. Only immediate direct dependencies are ever processed, which should in many
   typical cases avoid large invalidation sets.
2013-04-26 22:36:06 -04:00
Mark Harrah 4dc75343ae Record and persist public inheritance dependencies.
Includes placeholders for adding public inherited dependencies for Java classes.
2013-04-26 22:35:27 -04:00
Mark Harrah 77001a4259 drop canonicalization of files on classpath and other cleanup. Fixes #723. 2013-04-09 20:13:06 -04:00
Mark Harrah d7971f6857 temporary option to disable classpath lookup in incremental compiler. Ref #710. 2013-03-14 16:47:46 -04:00
Mark Harrah 6b7fbfe779 Provided details of why external binaries are detected as modified in incremental compiler debug output. 2013-03-13 12:40:03 -04:00
Mark Harrah c9c392d424 toString for Stamp types 2013-03-13 12:40:03 -04:00
Mark Harrah 925ec98900 Restore class files after an unsuccessful compilation.
This is useful when an error occurs in a later incremental step that
requires a fix in the originally changed files.

CC @gkossakowski
2013-03-04 07:24:31 -05:00
Mark Harrah 6e30bd7842 short-circuit the macro check in the incremental compiler if the source isn't a Scala source file 2013-02-22 16:31:32 -05:00
Grzegorz Kossakowski f885458f37 Do not minimize APIs if API debugging option is enabled.
That's foundation for API dumping and tests based on API representation contents.

Specific list of changes introduced by this commit:
  * `AnalysisCallback` class takes `IncOptions` as argument so it
    can determine if API should be minimized in `api` callback.
  * Introduce `Incremental.apiDebug` method that determines if api debugging
    is enabled. There are two ways to enable api debugging: through system
    property and through incremental compiler options. The system property
    method will be soon deprecated. We introduce it to make it easier to enable
    API debugging until tools (like zinc and ide) catch up with making incremental
    compiler configurable.

NOTE: The `apiDebug` method has been introduced in Incremental for two reasons:
  1. It's analogous to `incDebug` method that's already there.
  2. In other branch I need `apiDebug` to be defined in Incremental.

Once we deprecate and remove enabling debugging options through system properties
the code will be cleaned up.
2013-02-20 10:52:27 -05:00
Grzegorz Kossakowski f3d2df0f9c Use `IncOptions` for `transitiveStep` and `recompileAllFraction`
Recently introduced IncOptions allow us to make both transitiveStep
and recompileAllFraction configurable in incremental compiler.
2013-02-19 12:23:07 -05:00
Grzegorz Kossakowski 70036812ab Introduce incremental compiler options.
Introduce a way to configure incremental compiler itself instead
of underlying Java/Scala compiler.

Specific list of changes in this commit:
  * Add a method to `xsbti.compile.Setup` that returns incremental
    compiler options as a `java.util.Map<String, String>`. We considered
    statis interface instead of a `Map` but based on mailing
    list feedback we decided that it's not the best way to go because
    static interface is hard to evolve it by adding new options.
  * Since passing `java.util.Map<String, String>` not very convenient
    we convert it immediately to `sbt.inc.IncOptions`
  * Add options argument to various methods/classes that implement
    incremental compilation so in the end options reach
    `sbt.inc.IncOptions` object
  * Add `incOptions` task that allows users to configure incremental
    compiler options in their build files. Default implementation of
    that tasks returns just `IncOptions.DEFAULT`
  * Both system property `xsbt.inc.debug` and `IncOptions.relationsDebug`
    trigger debugging of relations now. In the near future, we should
    deprecate use of `xsbt.inc.debug`.
2013-02-19 12:23:07 -05:00
Grzegorz Kossakowski 4fe0c02536 Break long argument list into multiple lines.
Some methods take a lot of arguments and I'm about to add one more
which will make them too long for easy reading.

This change is changes code formatting only. That's done on purpose
to make it easier to review other changes.
2013-02-19 12:18:26 -05:00
Grzegorz Kossakowski d6f4c5ae4f Strip down trailing whitespace.
I have Eclipse configured to do that automatically when saving file.
I decided to finally commit those changes to files I touch a lot.
2013-02-19 12:18:26 -05:00
Paolo G. Giarrusso 19aaaea923 Fix compile error in Eclipse
Let's consider compile/inc/src/main/scala/sbt/CompileSetup.scala.
There are multiple Output types, and according to Eclipse importing
xsbti.compile.Output within the package sbt does not work because the
import is shadowed by sbt.Output.

However, compilation proceeds just fine within SBT. Reproducing the
example however gives the same warning, if the files are in the same
project. The problem here is probably that the shadowing Output
is declared in the same package but in another project, and that seems
to give different results in Eclipse and SBT, but relying on
that looks fragile.
Reading the spec is inconclusive since it doesn't match with Scalac's
behavior — see
https://groups.google.com/d/topic/scala-internals/-Rquc2HBYLk/discussion .

ForkTests has the same behavior as CompileSetup.
2013-01-22 09:05:15 -05:00
Mark Harrah cf355f1822 Fix incremental compilation problem with package objects inheriting from invalidated sources in a subpackage.
Resolution of https://issues.scala-lang.org/browse/SI-4695 seems to be to deprecate
inheriting from a class in a subpackage.  This commit is an alternative solution,
possibly to be reverted or restricted if resolution of SI-4695 changes or if this
proves to be too conservative in practice.

Review by @gkossakowski.  With separate inheritance/function call dependency tracking,
this probably should only pull in package objects with inheritance dependencies on
invalidated files.
2012-12-19 10:17:56 -05:00
Grzegorz Kossakowski 78b0f485fa Add `compilations` field to `Analysis`.
We store `Seq[xsbt.api.Compilation]` in `Analysis`. Compilation are
being appended to sequence for every iteration of the incremental
compiler.

Note that `Compilation`s are never removed from the sequence unless
you start from scratch with empty `Analysis`. You can do that by using
sbt's `clean` command.

The main use-case for using `compilations` field is to determine how
many iterations it took to compilen give code. The `Compilation` object
are also stored in `Source` objects so there's an indirect way to recover
information about files being recompiled in every iteration.

Since `Analysis` is persisted you can use this mechanism to track entire
sessions spanning multiple `compile` commands.
2012-12-10 09:15:52 -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
Benjy 657d842238 Analysis.groupBy implementation. 2012-11-10 19:01:41 -05:00
Mark Harrah 52b7dccff4 Handle removed files when skipping to recompiling all files. 2012-11-10 18:18:15 -05:00
Mark Harrah 4946115521 Recompile everything when invalidated sources exceed a certain fraction of all sources 2012-11-05 10:02:33 -05:00
nau bdfb570a42 Update compile/inc/Incremental.scala
Fix for http://stackoverflow.com/questions/12972183/sbt-always-does-full-rebuild-because-of-modified-binary-dependency-rt-jar
def externalBinaryModified uses java.io.File.equals() to check if files are the same. It's better to use File.getCanonicalPath in this case.
2012-10-22 08:23:23 -04:00
James Roper 5e2fc5f005 Reported file name when an error occurs while opening a corrupt zip file in Locate 2012-08-31 06:15:33 -04:00
Mark Harrah eca9ab9bb1 2.10 compatibility 2012-08-27 10:49:13 -04:00
Mark Harrah 8c0a2fbe1c require a smaller set of sources in the third (transitive) step of inc. compilation 2012-08-26 13:44:32 -04:00
Mark Harrah 089b4e284c three-stage incremental compilation 2012-08-25 07:15:23 -04:00
Eugene Vigdorchik 61dee253dd Convert println() to log.debug() 2012-08-19 22:19:39 -04:00
Eugene Vigdorchik b5a29987e6 Changes required to use sbt as-is from Scala-IDE. 2012-07-13 14:33:26 -04:00
Eugene Vigdorchik e23df839b7 Make compiler projects compilable with 2.10 2012-07-13 14:33:26 -04:00
Eugene Vigdorchik a6c2054292 Break compiler dependency from 'collection' project. 2012-07-13 14:33:26 -04:00
Mark Harrah 99a04466f1 move to revised warning interface in the compiler 2012-05-06 14:15:03 -04:00
Mark Harrah 6769c94208 basis for a resident compiler
unstable, but can be tested with -Dsbt.resident.limit=n
 n is the maximum Globals kept around
2012-04-28 18:58:52 -04:00
Mark Harrah d837f869bd using some of the embedding interfaces 2012-04-18 11:02:52 -04:00
Mark Harrah 1cbb7ce93c print-warnings task for Scala 2.10+ to avoid needing to rerun 'compile' to see deprecation/unchecked warnings 2012-03-17 19:31:55 -04:00
Mark Harrah 868196e652 delete empty parent directories of deleted class files. fixes #387 2012-03-05 13:40:17 -05:00
Jason Zaugg 17eeec6876 Move condition out of SameAPI.
It was tenuously relying on the caller short-circuiting with `shortcutSameSource`.
2012-03-04 21:28:01 +01:00
Jason Zaugg 067917a0fb Macro def aware recompilation.
- Read macro modifier from method definition.
 - Always recompile downstream files after a file containing macro defs is recompiled.
 - Source is extended with a hasMacro attribute. Mark suggests that this might be better
   tracked in Relations, but I'm not sure how to make that change.
2012-03-04 17:35:51 +01:00
Mark Harrah a49c907146 invalidate sources that claim to generate the same class. fixes #260 2011-11-10 21:30:30 -05:00
Mark Harrah 7632c0910a fixes #220. properly record source dependencies from separate compilation runs in the same step. 2011-10-10 20:53:57 -04:00
Mark Harrah e4848efcc8 store hashes of API instead of full API. fixes #21 2011-10-05 18:09:27 -04:00
Paul Phillips fae7c3b429 Make large Relations more readable.
For those poor suckers attempting to use -Dxsbt.inc.debug.
2011-09-06 11:55:18 -07:00
Mark Harrah 3b86fc628e fix Locate to only try to open archives 2011-08-05 21:56:32 -04:00
Mark Harrah 0b3ec05a81 support incremental recompilation when using exportJars. fixes #108 2011-07-18 17:14:22 -04:00
Mark Harrah 1dc3f0ed56 add missing file 2011-06-22 19:50:41 -04:00
Mark Harrah c919a9c3fd cache calls to definesClass within a run. closes #67 2011-06-22 19:17:10 -04:00
Mark Harrah c0a21c1524 implement shortcut for API equality checking, fixes #18 2011-06-01 02:19:46 -04:00
Mark Harrah 437a3f7f50 clean up incremental debugging messages 2011-05-29 19:17:31 -04:00
Mark Harrah a94247d1b6 more release-worthy compile message and analysis toString 2011-05-29 19:17:31 -04:00