Commit Graph

4852 Commits

Author SHA1 Message Date
Martin Duhem be8ba763fa Include ONLY non-public members in API hash of traits
The previous logic was wrong and included all members of traits in their
API hash, which degraded the performance of the incremental compiler.

This commit changes this logic so that only the non-public members of
traits are included into their API hash.

Fixes #2436
2016-02-04 16:32:36 +01:00
Grzegorz Kossakowski 207dd762f4 Move `trait-member-modified` to source-dependencies
It's not clear what the distinction between compiler-project and
source-dependencies scripted tests is so let's stick to the one that has
the biggest number of tests for incremental compiler.
2016-02-04 16:32:35 +01:00
Grzegorz Kossakowski 74ffe5d064 Add a pending test for a modified member of a trait
The test shows that name hashing optimization is broken for members
defined in traits. The problem is that modification of a member of a trait
triggers change of a hash of trait's name.

The behavior covered by this test regressed in
40ebc82531
The bug is tracked in #2436.
2016-02-04 16:32:35 +01:00
Antonio Cunei 3e50fdc825 Do not create dir, if trying to output classes to a jar 2016-02-04 15:11:55 +01:00
Martin Duhem 34d2aabfa9 Attempt at fixing Codacy's complaints 2016-02-04 13:24:22 +01:00
Grzegorz Kossakowski 6e5082e5a7 Merge pull request #2437 from gkossakowski/nameHashing-trait-regression
Add a pending test for a modified member of a trait
2016-02-03 17:11:51 +01:00
Martin Duhem b7b1f2453d Do not rely on filename of package objects
Add a new field in `Source` that indicates whether this `Source`
represents a package object. This field is used in the incrmental
compiler to perform recompilation of package objects rather than relying
on the file name being `package.scala`.

Mark pending test `source-dependencies/package-object-name` as passing.
2016-02-03 16:32:35 +01:00
Martin Duhem 09bf5255ad Pending test for recompilation of package object
The convention says to place package objects in files named
`package.scala`, but this is not enforced by the scala specification.
The incremental compiler currently offers special treatment for files
whose name is `package.scala`, but it should rather care about whether a
file defines a package object or not.

This test fails because it defines a package object in a file whose name
is not `package.scala`.
2016-02-03 14:49:59 +01:00
Grzegorz Kossakowski d5c719b7f5 Move `trait-member-modified` to source-dependencies
It's not clear what the distinction between compiler-project and
source-dependencies scripted tests is so let's stick to the one that has
the biggest number of tests for incremental compiler.
2016-02-03 14:34:31 +01:00
Martin Duhem a58eff8f5a Merge pull request #2432 from gkossakowski/nameHashing-pkg-objects
Invalidate package objects transitively in name hashing
2016-02-03 14:28:30 +01:00
Grzegorz Kossakowski 0ceb79cff4 Add a pending test for a modified member of a trait
The test shows that name hashing optimization is broken for members
defined in traits. The problem is that modification of a member of a trait
triggers change of a hash of trait's name.

The behavior covered by this test regressed in
40ebc82531
The bug is tracked in #2436.
2016-02-02 16:50:57 +01:00
Grzegorz Kossakowski 65f7958898 Invalidate package objects transitively in name hashing
Modify `invalidatedPackageObjects` to look for package objects that
transitively inherit from an invalidated class instead of just inheriting
directly. This is the correct behavior that should have been implemented
in the first place. The bug comes from a subtle copy&paste mistake. The old
implementation used `publicInherited` relation and new one looks identical
but uses `inheritance` relation. The difference is that `publicInherited`
was a relation that was expanded transitively along inheritance chain but
`inheritance` is not. We have to perform the transitive walk in
`IncrementalNameHashing.invalidatedPackageObjects` implementation.

Mark `pkg-self` test as passing.

Fixes #2326
2016-02-02 01:33:43 +01:00
Grzegorz Kossakowski f78b7112a2 Print both memberRef and inheritance relations.
To aid debugging, modify Relations.toString to include `inheritance` in
addition to already printed `memberRef` relation.

Modify it for both name hashing and old implementation.
2016-02-01 19:23:12 +01:00
Grzegorz Kossakowski c8bf46e893 Expand `pkg-self` scripted test to cover #2326
The previous version of `pkg-self` covered scenario where a package object
inherited directly from a class that is being modified and recompiled in
subsequent steps. The #2326 shows that name hashing fails to handle
a package object that inherits indirectly from a modified class. In that
case, name hashing fails to invalidate the source file that defines the
package object.
This commit expands `pkg-self` with a class B that inherits from modified
class `A` and makes package object inherit from B. We mark that test as
pending to show that this indeed trigger the bug in name hashing.
2016-02-01 19:14:44 +01:00
Martin Duhem 6cabb9b4cb Update bridge retrieval in `consoleProject`
Fixes sbt/sbt#2428
2016-01-31 17:09:56 +01:00
Dale Wijnand a92e50929c Merge pull request #2419 from eed3si9n/wip/2415
Fixes #2415. Hide global setting fix behind sbt.globalsettingfix
2016-01-25 23:00:44 +00:00
Eugene Yokota 9da5fc871b Changed the flag name to "sbt.global.autoimport" per review. 2016-01-26 03:05:30 +09:00
Martin Duhem e966329776 Merge pull request #2414 from smarter/fix/duplicate-defs
[0.13.10] ExtractAPI: avoid unnecessary duplication of defs with primitive types
2016-01-25 09:26:29 +01:00
Dale Wijnand 03524e3329 Merge pull request #2413 from smarter/fix/vc-return-type
[0.13.10] Always invalidate API when return type is a value class
2016-01-25 07:02:20 +00:00
Guillaume Martres 726b5c8a30 ExtractAPI: avoid unnecessary duplication of defs with primitive types
If a method's type contains a non-primitive value class then it has two
signatures: one before erasure and one after erasure. Before this
commit, we checked if this was the case using `isAnyValSubtype`, but
this is too crude since primitive value classes are also subtypes of
`AnyVal` but do not change signature after erasure.

This commit replaces `isAnyValSubtype` by `isDerivedValueClass` which
excludes primitive value classes.

In practice, for an empty class, this reduces the size of the output of
`DefaultShowAPI` from 65 lines to 25 lines.
Before:
https://gist.github.com/smarter/cf1d6fe58efda88d6ee6#file-old-api
After:
https://gist.github.com/smarter/cf1d6fe58efda88d6ee6#file-new-api
2016-01-25 02:53:52 +01:00
Guillaume Martres 0993c1c7cc Always invalidate API when return type is a value class
Before this commit, we did not do the invalidation for methods with
multiple parameter list, the comment above `hasValueClassAsReturnType`
said:

  Note: We only inspect the "outermost type" (i.e. no recursion) because
  we don't need to inspect after erasure a function that would, for
  instance, return a function that returns a subtype of AnyVal.

But this is wrong: a method with signature:
  def foo(a: A)(b: B): C
is erased to:
  def foo(a: A, b: B): C
and not, as the comment in the code suggest, to:
  def foo(a: A): B => C
so we do need to inspect the final result type of methods, because they
can be value classes that will be erased to their underlying value.
2016-01-25 02:53:34 +01:00
Eugene Yokota ceccbf2d5a Fixes #2415. Hide global setting fix behind sbt.globalsettingfix
We are hiding a bug fix on global setting that was not importing auto
imports because fixing this via sbt/sbt#2399 breaks the source
compatibility: sbt/sbt#2415
I've split out the relevant portion of the scripted test into
global-settings, and marked it pending.
2016-01-24 16:50:21 -08:00
Eugene Yokota e64b01142b Merge branch '0.13' into 0.13.10 2016-01-24 15:57:53 -08:00
eugene yokota 14dcca6a31 Merge pull request #2418 from Duhemm/fix-2411
Fix #2411
2016-01-24 15:56:21 -08:00
Martin Duhem 1ebe86b704 Restore compiler bridge source for Scala < 2.10 2016-01-24 18:54:03 +01:00
Martin Duhem a93f1e50c8 Add second test case for sbt/sbt#2411
Thanks @smarter, see sbt/sbt#2416
2016-01-24 09:42:01 +01:00
Adriaan Moors 49431eb6f8 determine bytecode type with transformedType
... not exitingPostErasure, as this phase-travel crashes the compile
(it's only really meant for going back in time, right?)
2016-01-24 09:31:53 +01:00
Eugene Yokota 27039e2b3c Reproduce #2411 2016-01-24 08:56:46 +01:00
Guillaume Martres bc3d2268ed CONTRIBUTING.md: Fix error in scripted test command 2016-01-23 17:39:17 +01:00
Dale Wijnand 395851147c Merge pull request #2409 from dwijnand/tweak-0.13.10-notes
[0.13.10] Tweak the release notes
2016-01-23 02:51:37 +00:00
Dale Wijnand 26b9d9c1ab Notes: Collapse an improvement into its fix 2016-01-22 23:19:03 +00:00
Dale Wijnand 8a12edbfa0 Notes: Reword some passages 2016-01-22 23:18:31 +00:00
Dale Wijnand 899ac9eb98 Notes: Fix links 2016-01-22 23:14:27 +00:00
Dale Wijnand 223cb2632e Notes: Sort issues, move ivy/jline to the top 2016-01-22 23:11:43 +00:00
Eugene Yokota 06658661a1 Hand merged notes 2016-01-22 14:47:37 -05:00
eugene yokota afa8603ef7 Merge pull request #2407 from eed3si9n/wip/2347
Adds CompatibilityWarningOptions
2016-01-22 13:24:41 -05:00
Eugene Yokota a9dc9be83b Adds CompatibilityWarningOptions. Fixes #2347
This addresses 0.13.10 regression, which currently warns users about
Maven incompatibility on a private configuration. This adds a config
class so the build user can control the level of the warning as well as
the target configuration to be monitored.
By default, we are only going to look at `Compile` and `Runtime`.
2016-01-22 01:39:00 -05:00
Dale Wijnand 35aed2bc20 Merge pull request #2399 from timcharper/0.13
bugfix - apply autoImports for global plugins at global configuration stage
2016-01-19 06:41:08 +00:00
Tim Harper 7d86bc70d3 bugfix - apply autoImports for global plugins at global configuration stage
Previously, the autoimports for globally defined plugins were not
imported for global configuration files, although they were imported for
project configuration files.

This patch causes an additional plugin discovery phase to happen during
global config evaluation, so that auto-plugins can be detected and their
imports subsequently included.
2016-01-18 15:05:29 -07:00
Tim Harper d6c80ba1bd add notes on running tests 2016-01-18 15:02:23 -07:00
Tim Harper d86e52830e Amend contributing build instructions to help solve potential build problems 2016-01-18 00:41:25 -07:00
eugene yokota d9f10853fb Merge pull request #2371 from dwijnand/update-sbt-plugins
Upgrade sbt plugins. Fixes #2368
2016-01-16 03:11:17 -05:00
Dale Wijnand 84cba9669c Upgrade sbt plugins. Fixes #2368
Tested manually:

  $ grep 'version.*:=' build.sbt
  version := "0.13.10-SNAPSHOT",
  $ git archive --prefix=sbt-0.13.10-SNAPSHOT/ -o ~/Desktop/sbt-0.13.10-SNAPSHOT.tgz HEAD
  $ cd ~/Desktop
  $ ls
  sbt-0.13.10-SNAPSHOT.tgz
  $ tar xfz sbt-0.13.10-SNAPSHOT.tgz
  $ cd sbt-0.13.10-SNAPSHOT/
  $ sbt info
  [info] Loading global plugins from /Users/dnw/.dotfiles/.sbt/0.13/plugins
  [info] Loading project definition from /Users/dnw/Desktop/sbt-0.13.10-SNAPSHOT/project
  [info] Updating {file:/Users/dnw/Desktop/sbt-0.13.10-SNAPSHOT/project/}sbt-0-13-10-snapshot-build...
  [info] Resolving org.fusesource.jansi#jansi;1.4 ...
  [info] Done updating.
  [warn] There may be incompatibilities among your library dependencies.
  [warn] Here are some of the libraries that were evicted:
  [warn]  * com.typesafe.sbt:sbt-site:0.8.1 -> 0.8.2
  [warn] Run 'evicted' to see detailed eviction warnings
  [info] Compiling 12 Scala sources to /Users/dnw/Desktop/sbt-0.13.10-SNAPSHOT/project/target/scala-2.10/sbt-0.13/classes...
  [info] This is sbt 0.13.9
  [info] The current project is {file:/Users/dnw/Desktop/sbt-0.13.10-SNAPSHOT/}sbtRoot 0.13.10-SNAPSHOT
  [info] The current project is built against Scala 2.10.6
  [info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin...
  [info] sbt, sbt plugins, and build definitions are using Scala 2.10.5
2016-01-16 00:24:05 +00:00
eugene yokota a5bda9d80d Merge pull request #2354 from eed3si9n/wip/internal
Inter-project dependency tracking
2016-01-13 14:26:45 -05:00
Eugene Yokota c55c3ec966 Merge branch 'backport/internal-tracking' into wip/internal 2016-01-13 12:59:51 -05:00
Eugene Yokota 98b26ae5d3 Inter-project dependency tracking. Fixes #2266
Adds `trackInternalDependencies` and `exportToInternal` settings. These
can be used to control whether to trigger compilation of a dependent
subprojects when you call `compile`. Both keys will take one of three
values: `TrackLevel.NoTracking`, `TrackLevel.TrackIfMissing`, and
`TrackLevel.TrackAlways`. By default they are both set to
`TrackLevel.TrackAlways`.

When `trackInternalDependencies` is set to `TrackLevel.TrackIfMissing`,
sbt will no longer try to compile internal (inter-project) dependencies
automatically, unless there are no `*.class` files (or JAR file when
`exportJars` is `true`) in the output directory. When the setting is
set to `TrackLevel.NoTracking`, the compilation of internal
dependencies will be skipped. Note that the classpath will still be
appended, and dependency graph will still show them as dependencies.
The motivation is to save the I/O overhead of checking for the changes
on a build with many subprojects during development. Here's how to set
all subprojects to `TrackIfMissing`.

    lazy val root = (project in file(".")).
      aggregate(....).
      settings(
        inThisBuild(Seq(
          trackInternalDependencies := TrackLevel.TrackIfMissing,
          exportJars := true
        ))
      )

The `exportToInternal` setting allows the dependee subprojects to opt
out of the internal tracking, which might be useful if you want to
track most subprojects except for a few. The intersection of the
`trackInternalDependencies` and `exportToInternal` settings will be
used to determine the actual track level. Here's an example to opt-out
one project:

    lazy val dontTrackMe = (project in file("dontTrackMe")).
      settings(
        exportToInternal := TrackLevel.NoTracking
      )
2016-01-13 12:56:28 -05:00
eugene yokota 7e88edbc25 Merge pull request #2358 from gkossakowski/compileInterface-tests
Run unit tests from compileInterface on Travis CI.
2016-01-08 20:52:18 -05:00
Grzegorz Kossakowski dd0ed7de5e Fix DependencySpecification test.
This is a fixup of 0f616294c4.
That commit assumed that dealiasing is being done for types referred in
self type. It was changed to not do that but the test wasn't updated.
Unfortunately, that mistake slipped by during PR review because unit tests
of compileInterface were not ran (see #2358).
2016-01-09 00:00:14 +01:00
Grzegorz Kossakowski e738bc3f73 Run unit tests from compileInterface on Travis CI.
Also, make the intent of the env variable clearer in travis configuration.

Fixes #2357.
2016-01-08 21:53:53 +01:00
eugene yokota d06b49d66d Merge pull request #2355 from eed3si9n/wip/scripted-more-mem
Adds more memory to internal scripted task
2016-01-08 11:22:27 -05:00