Commit Graph

4445 Commits

Author SHA1 Message Date
Adriaan Moors 0f616294c4 Extract dependencies in one pass.
Also a bit more complete: handle SelectFromTypeTree,
consider the self type an inheritance dependency,
and flatten any refinement types in inherited types,
to get to the symbols of their parents, instead of the
useless symbol of the refinement class.

Include inheritance dependencies in regular ones

Also, update test to reflect the self type is now seen as an inheritance dependency.

self types are local, so don't treat them like inherited types

note inheritanceSymbols dealiases, where allSymbols is constructed differently

fix NPE in source-dependencies/macro-annotation
2016-01-06 13:56:54 -05:00
Adriaan Moors 8c73b2f221 Refactor mkStructure
Specialize two implementations for each value of the `inherit` boolean argument.
Also use a more direct way of distinguishing declared and inherited members.

backwards compat for source-dependencies/inherited-dependencies
2016-01-06 13:56:54 -05:00
Adriaan Moors 9346e2bb4d Only include all base types for class definitions
For refinement types, the Structure was already restricted
to declarations (and not inherited members), but all base types
were still included for a refinement's parents, which would
create unwieldy, and even erroneous (cyclic) types by expanding
all constituents of an intersection type to add all base types.

Since the logic already disregarded inherited members, it seems
logical to only include direct parents, and not all ancestor types.

```
class Dep {
  def bla(c: Boolean) = if (c) new Value else "bla"
}

class Value extends java.lang.Comparable[Value] { def compareTo(that: Value): Int = 1 }
```
2016-01-06 13:56:54 -05:00
Adriaan Moors 3e03e0d1b5 Clean up ShowApi implicit overload
Motivated because we want to make it more robust & configurable.
Original motivation was to diagnose a cyclic type representation,
likely due to an f-bounded existential type, as illustrated by the following:

```
class Dep {
  // The API representation for `bla`'s result type contains a cycle
  // (an existential's type variable's bound is the existential type itself)
  // This results in a stack overflow while showing the API diff.
  // Note that the actual result type in the compiler is not cyclic
  // (the f-bounded existential for Comparable is truncated)
  def bla(c: Boolean) = if (c) new Value else "bla"
}

class Value extends java.lang.Comparable[Value] { def compareTo(that: Value): Int = 1 }
```

Limit nesting (`-Dsbt.inc.apidiff.depth=N`, where N defaults to `2`),
and number of declarations shown for a class/structural type
(via `sbt.inc.apidiff.decls`, which defaults to `0` -- no limit).

Limiting nesting is crucial in keeping the size of api diffs of large programs
within a reasonable amount of RAM...

For example, compiling the Scala library, the API diff with nesting at `4`
exhausts 4G of RAM...
2016-01-06 13:56:54 -05:00
Adriaan Moors 51524055f7 Reduce memory usage of ExtractDependenciesTraverser 2016-01-06 13:56:54 -05:00
Adriaan Moors 1ce1123054 API only tracks declared type of self variable
The only aspect of the self variable that's relevant for
incremental compilation is its explicitly declared type,
and only when it's different from the type of the class that declares it.

Technically, any self type that's a super type of the class could be ignored,
as it cannot affect external use (instantiation/subclassing) of the class.
2016-01-06 13:56:54 -05:00
Adriaan Moors 214451c51f API extraction ensures class symbol is initialized
Call `initialize` in case symbol's `info` hadn't been completed
during normal compilation.

Also, normalize to the class symbol immediately.

Add a TODO regarding only looking at class symbols,
and thus ignoring the term symbol for objects,
as the corresponding class symbol has all the relevant info.
2016-01-06 13:56:54 -05:00
Dale Wijnand 5b7c55109e Merge pull request #2349 from gkossakowski/scripted-scala-version-cleanup
Upgrade Scala version in scripted tests
2016-01-06 03:51:04 +01:00
Grzegorz Kossakowski 8c9c61815a Upgrade Scala version in scripted tests
Both continuations and macro-config set scalaVersion explicitly but since
sbt relies now on Scala 2.10 it's not needed anymore. In particular, we
can upgrade continuations to 2.10 which makes it easier to work with Java
8.
2016-01-05 23:08:50 +01:00
eugene yokota f00f6fd541 Merge pull request #2344 from smarter/0.13-dotty
Make sbt aware of Dotty
2016-01-03 20:22:13 -05: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
eugene yokota 886b3647e3 Merge pull request #2345 from eed3si9n/wip/testtest
Maven compatibility changes (intransitive warnings and "configuration not public")
2016-01-01 01:23:59 -05:00
Eugene Yokota bdffad2845 Improve warning message 2015-12-31 22:36:04 -05:00
Eugene Yokota 0d925630df Fixes #1827. Adds withInterProjectFirst to update option.
withInterProjectFirst when set to true will prioritize inter-project
resolver over all other resolver and Ivy cache.
This aimed to workaround the fact that on Maven Test configuration is
considered private, and thus project dependency with `test->test`
configuration may not under some condition. The condition is when
someone resolves `x:y:1.0` and you have a subproject named and
versioned exactly that, and some other subproject tries to depend on
it. This happens when the project does not change the version number on
the Github.
2015-12-31 01:22:27 -05:00
Eugene Yokota f244815f7d Update warning message a bit. 2015-12-31 00:41:23 -05:00
Eugene Yokota 182374c712 Reproduce "configuration not public" on local test->test. #1827 2015-12-31 00:25:21 -05:00
Eugene Yokota e82e6652d0 Move intransitive warning to update. Ref #2127 2015-12-30 13:41:31 -05:00
eugene yokota bcb98ab6bb Merge pull request #2342 from sbt/wip/file-bincompat-in-io-for-pr2268
[0.13.10] Fix bincompat issue introduced in #2268
2015-12-30 12:48:10 -05:00
eugene yokota bfb602c29b Merge pull request #2313 from sbt/wip/refix-snapshots
Fixes #1514. Enable latest SNAPSHOT option by default
2015-12-30 10:31:07 -05:00
Eugene Yokota 068cffa578 Reimplement fallback to system classloader to maintain the 0.13 semantics 2015-12-30 07:36:12 -05:00
Eugene Yokota fd6373d8bf Bump up ivy to 2.3.0-sbt-2cc8d2761242b072cedb0a04cb39435c4fa24f9a 2015-12-30 07:21:07 -05:00
Eugene Yokota db81fa2109 Fix bincompat issue introduced in #2268 2015-12-30 06:22:55 -05:00
Eugene Yokota 1bf789eb3d Fixes #1616. Fixes the "latest snapshot" chain resolver
The "latest snapshot" chain resolver was assuming that there's at least
one artifact per module. I think that was the root cause of #1616.
2015-12-30 04:46:20 -05:00
Eugene Yokota cc07ad78eb Bump up ivy to 2.3.0-sbt-39ece6f17e1af62c2e89a9d88b59c0c3aad56145
Ref sbt/ivy#21
2015-12-30 04:07:39 -05:00
eugene yokota b87a4acc2e Merge pull request #2338 from sbt/wip/nightly_launchconfig
Include sbt-ivy-snapshots to launchconfig
2015-12-29 23:45:50 -05:00
eugene yokota 5ba7352a0d Merge pull request #2339 from sbt/wip/2325_notes
Release note for #2325
2015-12-29 21:46:19 -05:00
Eugene Yokota 585e727a97 Include sbt-ivy-snapshots to launchconfig
Include sbt-ivy-snapshots to launchconfig
Prior to this change, the launchconfig for sbt was generated using
Transform's resource generator so releases would include
`typesafe-ivy-releases` repo, and snapshot releases would include
`typesafe-ivy-snapshots` and `sonatype-snapshots` repos in addition.
This is no longer useful since nightly builds are now published to
`sbt-ivy-snapshots` instead, which is backed by Bintray.

This removes the switching logic, so both `typesafe-ivy-releases` and
`sbt-ivy-snapshots` repos are always included into the launchconfig.
This removes the step of needing to download a launcher just to try the
nightly builds.
2015-12-29 19:48:57 -05:00
Eugene Yokota fd347f0020 Release note for #2325 2015-12-29 18:13:58 -05:00
eugene yokota 05e5ae311b Merge pull request #2322 from dwijnand/drop-sealed-from-Append-typeclasses
Drop sealed from the typeclasses in Append
2015-12-29 13:00:57 -05:00
eugene yokota c5b0c7b733 Merge pull request #2325 from gkossakowski/nameHashing/private-members
Do not compute name hashes for private members.
2015-12-29 00:23:32 -05:00
eugene yokota 7b1c19d171 Merge pull request #2337 from sbt/wip/nightly
Adds bootIvyConfiguration to grab compiler bridge source.
2015-12-29 00:06:25 -05:00
Eugene Yokota a4715e80c2 Fixes test 2015-12-28 19:45:21 -05:00
Eugene Yokota 9699f4b1b7 Adds bootIvyConfiguration to grab compiler bridge source. Fixes #2336
As described in #2336, I noticed that when using 0.13 nightly from
Bintray, sbt was unable to locate the compiler source.
Since `updateSbtClassifiers` is already set up to download sbt's own
sources, the `ivyConfiguration` should be reused. However, `compilers`
is a derived task, which is unable to depend on a scoped key.
To workaround this I had to create a new key called
`bootIvyConfiguration`. This should now use the metabuild's resolvers
to download the compiler bridge source.
2015-12-28 17:15:02 -05:00
eugene yokota c1129ce5d9 Merge pull request #2335 from sbt/wip/bintrayfix
Add useJCenter settings and set it to false by default
2015-12-26 07:35:04 -05:00
Eugene Yokota c796c77386 Add useJCenter setting, which is set to false. Fixes #2217
Adds a new setting `useJCenter`, which is set to `false` by default.
When set to `true`, JCenter will be placed as the first external
resolver to find library dependencies.

The implementation of `externalResolvers` is changed to incorporate the
setting by calling `Resolver.reorganizeAppResolvers`. These changes
were required because `externalResolvers` uses whatever that's in the
launchconfig, which the build user may not upgrade.
2015-12-25 23:20:56 -05:00
Eugene Yokota 6b3f6901af Add JCenter change to 0.13.9's notes 2015-12-25 21:49:01 -05:00
Eugene Yokota b8b3252ca9 Remove JCenter from boot properties. #2217 2015-12-24 12:14:14 -05:00
Grzegorz Kossakowski d2aeff365b Merge branch 'nameHashing/private-members' of https://github.com/gkossakowski/sbt into nameHashing/private-members 2015-12-23 14:19:09 +01:00
Grzegorz Kossakowski 3a6b6aadc0 Add scripted (functional test) for #2324.
Add a test that shows the scenario described in #2324 is handled correctly
now.
2015-12-23 14:17:47 +01:00
Grzegorz Kossakowski b76db70044 Merge pull request #10 from adriaanm/gkossakowski-nameHashing/private-members
Test & fix for regression in Lazy serialization uncovered by #2325
2015-12-22 19:46:43 +01:00
Adriaan Moors 95da6ec5a6 `AbstractLazy`'s `writeObject` is `protected`
Fix for regression triggered by #2325 -- apparently, the API visitor would
force all the lazy stubs so the `AbstractLazy` `writeReplace` was not exercised.
With the private subtrees being ignored, the visitor didn't force the lazy stub,
and the `writeProtected` method was not inherited in `SafeLazy.Impl`.

From https://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html
`writeReplace` must be protected for its override to be inherited.

> `Serializable` classes that need to designate an alternative object to be used
> when writing an object to the stream should implement this special method with
> the exact signature:
> `ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;`
>
> This `writeReplace` method is invoked by serialization if the method exists and
> it would be accessible from a method defined within the class of the object
> being serialized. Thus, the method can have `private`, `protected` and
> `package-private` access.
>
> **Subclass access to this method follows java accessibility rules.**

(Thanks to retronym for digging up the docs.)

The fix is captured, indirectly, by the scripted test
`source-dependencies/java-analysis-serialization-error`.
2015-12-21 22:19:30 -08:00
Adriaan Moors 9a856be5ca Test for regression triggered by #2325
The crash manifested as a `NotSerializableException`,
because we don't visit the private subtrees of the API graph,
which would previously force all Lazy stubs as a side-effect.
There was a backstop in `AbstractLazy` (`writeReplace`), but
somehow that didn't work.

```
java.io.NotSerializableException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
[...]
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:329)
 at xsbt.api.SourceFormat$.writes(SourceFormat.scala:24)
 at xsbt.api.SourceFormat$.writes(SourceFormat.scala:15)
 at sbt.inc.TextAnalysisFormat21661anonfun.apply(TextAnalysisFormat.scala:329)
 at sbt.inc.TextAnalysisFormat21661anonfun.apply(TextAnalysisFormat.scala:329)
 at sbt.inc.TextAnalysisFormat21661anonfun at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.javr$.aggregate(TextAnalysisFormat.scala:18)
 at sbt.inc.TextAnalysisFormat$.objToString(TextAnalysisFormat.scala:329)
 at sbt.inc.TextAnalysisFormat21661anonfun.apply(TextAnalysisFormat.scala:213)
 at sbt.inc.TextAnalysisFormat21661anonfun.apply(TextAnalysisFormat.scala:213)
 at sbt.inc.TextAnalysisFormat21661anonfun21661writeMap.apply(TextAnalysisFormat.scala:381)
 at sbt.inc.TextAnalysisFormat21661anonfun21661writeMap.apply(TextAnalysisFormat.scala:377)
 at scala.collection.mutable.ResizableArray.foreach(Resizable at sbt.inc.TextAnalysisFormalection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
 at sbt.inc.TextAnalysisFormat$.sbt21661writeMap(TextAnalysisFormat.scala:377)
 at sbt.inc.TextAnalysisFormat$.write(TextAnalysisFormat.scala:216)
 at sbt.inc.TextAnalysisFormat21661anonfun.apply(TextAnalysisFormat.scala:64)
 at sbt.inc.TextAnalysisFormat21661anonfun.apply(TextAnalysisFormat.scala:64)
 at sbt.inc.TextAnalysisFormat21661anonfun.apply(TextAnalysisFormat.scala:64)
 at sbt.inc.FormatTimer$.aggregate(TextAnalysisFo at sbt.inc.TextAnalysisFormat21661anonfun.scala:25)
 at sbt.inc.TextAnalysisFormat$.write(TextAnalysisFormat.scala:64)
 at sbt.inc.FileBasedStore21661anon21661anonfun.apply(FileBasedStore.scala:12)
 at sbt.inc.FileBasedStore21661anon21661anonfun.apply(FileBasedStore.scala:12)
 at sbt.Using.apply(Using.scala:24)
 at sbt.inc.FileBasedStore21661anon.set(FileBasedStore.scala:12)
 at sbt.inc.AnalysisStore21661anon.set(AnalysisStore.scala:16)
 at sbt.inc.AnalysisStore21661anon.set(AnalysisStore.scala:27)
 at sbt.Defaults21661anonfun.apply(Defaults.scala:799)
 at sbt.Defaults21661anonfun at sbt.inc.TextAts.scala:793)
 at scala.Function121661anonfun.apply(Function1.scala:47)
 at sbt.21661anonfun21661u2219.apply(TypeFunctions.scala:40)
 at sbt.std.Transform21661anon.work(System.scala:63)
 at sbt.Execute21661anonfun21661anonfun.apply(Execute.scala:226)
 at sbt.Execute21661anonfun21661anonfun.apply(Execute.scala:226)
 at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
 at sbt.Execute.work(Execute.scala:235)
 at sbt.Execute21661anonfun.apply(Exe at sbt.Using.apply(Using.scala:24)
 mit.apply(Execute.scala:226)
 at sbt.ConcurrentRestrictions21661anon21661anonfun.apply(ConcurrentRestrictions.scala:159)
 at sbt.CompletionService21661anon.call(CompletionService.scala:28)
 at java.util.concurrent.FutureTask.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at java.util.concurrent.Executors.call(Executors.java:439)
 at java.util.concurrent.FutureTask.innerRun(FutureTask.java:303 at sbt.std.Transform21661anon.work(System(FutureTask.java:138)
 at java.util.concurrent.ThreadPoolExecutor.runTask(ThreadPoolExecutor.java:895)
 at java.util.concurrent.ThreadPoolExecutor.run(ThreadPoolExecutor.java:918)
 at java.lang.Thread.run(Thread.java:695)

[error] (compile:compile) java.io.NotSerializableException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
[error] Total time: 2 s, completed Dec 21, 2015 12:05:19 PM
```
2015-12-21 22:19:28 -08:00
Grzegorz Kossakowski bad824c0b1 Do not compute name hashes for private members.
The NameHashing classes assumed that extracted API data structure have
private members filtered out already. That assumption was wrong and
resulted in bug #2324.

We fix the bug by simply reusing the same logic as used by SameAPI class.

Fixes #2324.
2015-12-18 14:32:43 -08:00
Grzegorz Kossakowski 81c0d3daa9 Document ExtractAPI's handling of private members.
Mention that private members are being extracted and included in the api
structures but ignored in many other parts of incremental compiler. I've
made a mistake of assuming that private members are ignored at api
extraction time. This manifested itself as bug #2324.
2015-12-18 14:14:11 -08:00
Grzegorz Kossakowski ae2ddab009 Add pending test for #2324 (name hashes of private members)
Add a pending test that shows a bug in calculation of name hashes.
By design, only non-private members should contribute to name hashes. The
test shows that name hashes are calcuclated for strictly private members
too.
2015-12-18 14:05:00 -08:00
Dale Wijnand 164fb5f847 Drop sealed from the typeclasses in Append 2015-12-18 14:04:52 +00:00
eugene yokota d3cb46951b Merge pull request #2261 from Duhemm/fix-1171
Consider signatures of methods before and after erasure in ExtractAPI
2015-12-16 13:24:42 -05:00
eugene yokota 3e56a7f122 Merge pull request #2315 from sbt/wip/notes2
Release note for 0.13.10
2015-12-16 09:59:43 -05:00
Eugene Yokota 12bdfda224 Artisanal hand merging of release notes 2015-12-15 03:08:40 -05:00
Eugene Yokota d1caf32a86 Adds release note for #2303 2015-12-14 17:19:15 -05:00