Commit Graph

17940 Commits

Author SHA1 Message Date
Eugene Yokota 306db4d788 Check for git diff at Travis CI 2017-04-21 03:11:48 -04:00
Eugene Yokota 9d87e6b3d4 Add Scalafmt 2017-04-21 03:11:48 -04:00
eugene yokota d148103eda Merge pull request #3130 from eed3si9n/wip/fix-loaded-build-configuration
Improve `Load` in sbt
2017-04-21 03:09:56 -04:00
jvican 5c48b11d3f Simplify and document `load`
This commit has two goals:

* Simplify the `load` API endpoints, removing the unused ones to shorten
  the surface of the API.
* Add documentation to the main `load` methods.
2017-04-21 01:09:06 -04:00
jvican d2a51d5085 Indent timing logs
Sbt has a feature to show timed logs for every operation at startup.
However, its output is cluttered and users cannot read how much time
single methods consume nor if they call other methods.

This commit improves the status quo by adding indentation.
2017-04-21 01:09:06 -04:00
jvican 9175193df3 Remove unused `pluginDefinitionLoader` methods
This commit reduces the complexity around `loadPluginDefinition` et al.
`pluginDefinitionLoader` is not used anywhere in sbt, so the extra
definitions are removed.

Both the implementation of `loadPluginDefinition` and
`pluginDefinitionLoader` are reduced to a bare minimum where the
components at hand (definition classpath, dependency classpath) are
properly defined.

Documentation to the three methods has been added.
2017-04-21 01:09:06 -04:00
jvican 90782b1cd0 Fix implementation of `LoadBuildConfiguration`
It mainly does three things:

* Clean up the implementation, removing unused values like
  `globalPluginDefs`.
* Make the implementation more readable.
* And the big one: Remove the creation of a classloader that we were
  instantiating but whose value we were throwing away. This has an impact
  in performance, but I'm yet to benchmark how much it is.
2017-04-21 01:09:06 -04:00
Eugene Yokota ab5e875ce4 notes 2017-04-19 16:15:48 -04:00
Eugene Yokota c6e8cc2e04 Release note for sbt 1.0.0-M5
Ref #3063
2017-04-19 16:02:13 -04:00
eugene yokota cc541210dc Merge pull request #3115 from scalacenter/speed-up-startup-time-1.0
Speed up start up and reload times
2017-04-19 10:52:55 -04:00
Dale Wijnand 4bcc2999e2 Merge pull request #3120 from scalacenter/fix-intellij
Fix sbt 1.0 in Intellij
2017-04-19 06:39:56 -05:00
Alexandre Archambault c144feca94 Merge pull request #504 from coursier/topic/tweak-dir-listing-cache
Tweak dir listing cache
2017-04-19 11:49:30 +02:00
jvican fe23df1e52
Fix #3062: Reduce red squiggles in Intellij
This commit fixes most of the red squiggles created by the lack of
analysis of Contraband-generated Scala files. It does not end with all
the red squiggles but it substantially decreases the amount of them.
2017-04-19 07:53:40 +02:00
eugene yokota 2bde37571d Merge pull request #3118 from eed3si9n/wip/repooverride
Fix repo override test
2017-04-18 18:54:52 -04:00
Eugene Yokota d45833b29b Fix repo override test 2017-04-18 15:57:39 -04:00
jvican 2f61114108
Avoid the use of `synchronized` while parsing
Previous commit used `synchronized` to ensure that the global reporter
was not reporting errors from other parsing sessions. Theoretically,
though, sbt could invoke parsing in parallel, so it's better to ensure
we remove the `synchronized` block, which could also be preventing some
JVM optimizations.

The following commit solves the issue by introducing a reporter id.

A reporter id is a unique identifier that is mapped to a reporter. Every
parsing session gets its own identifier, which then is reused for
recursive parsing. Error reports between recursive parses cannot collide
because the reporter is cleaned in `parse`.
2017-04-18 20:30:05 +02:00
jvican f482a6cf0d
Reuse the same global instance for parsing
The previous implementation was instantiating a toolbox to parse every
time it parsed a sbt file (and even recursively!!!).

This is inefficient and translates to instantiating a `ReflectGlobal`
every time we want to parse something.

This commit takes another approach:

1. It removes the dependency on `ReflectGlobal`.
2. It reuses the same `Global` and `Run` instances for parsing.

This is an efficient as it can get without doing a whole overhaul of it.
I think that in the future we may want to reimplement it to avoid the
recursive parsing to work around Scalac's bug.
2017-04-18 20:30:05 +02:00
jvican 3e812dc71a
Add global toolbox to parse sbt files
This change was proposed by Jason in case that the new parsing mechanism
implemented later on has to be reverted. This change provides a good
baseline, but it's far from ideal with regard to readability of the
parser and performance.
2017-04-18 20:30:05 +02:00
jvican a36d8401e1
Don't use runtime universe to discover autoImport
The previous implementation was using the Scala runtime universe to
check whether a plugin had or not an `autoImport` member. This is a bad
idea for the following reasons:

* The first time you use it, you class load the whole Scalac compiler
  universe. Not efficient. Measurements say this is about a second.
* There is a small overhead of going through the reflection API.

There exists a better approach that consists in checking if `autoImport`
exists with pure Java reflection. Since the class is already class
loaded, we check for:

* A class file named after the plugin FQN that includes `autoImport$` at
  the end, which means that an object named `autoImport` exists.
* A field in the plugin class that is named `autoImport`.

This complies with the plugin sbt specification:

http://www.scala-sbt.org/1.0/docs/Plugins.html#Controlling+the+import+with+autoImport
2017-04-18 20:30:04 +02:00
Eugene Yokota c86f64b451 support for packaging sbt 1 2017-04-18 13:28:12 -04:00
eugene yokota 4e3bdf411f Merge pull request #3114 from eed3si9n/wip/scala2122
[sbt 1.0] Scala 2.12.2
2017-04-18 12:37:48 -04:00
Alexandre Archambault 68b9eeeda8 Don't use missing directory listing fallback if it can be avoided
If the POM is in cache, but not the directory listing (nor a .error file for it), the LocalUpdate and LocalUpdateChanging policies make MavenRepository do as if the directory listing is missing - it is not even checked with the subsequent cache policies if any (because the POM was found with LocalUpdate / LocalUpdateChanging in the first place).

This PR fixes that - getting the POM will fail if the directory listing or an error file for it is missing from cache. That way, subsequent cache policies can fetch the directory listing.

As this only happens depending on what's in cache, it's a bit cumbersome to test as is. Relying fully on NIO2 in subsequent coursier versions should make it easier to add test cases for that (by using a virtual fs like jimfs to test what happens depending on what's in cache).

The test should basically do:

    $ coursier fetch org.apache.maven:apache-maven:3.3.9 # fill cache
    $ rm -f $CACHE_PATH/https/repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/.directory
    $ rm -f $CACHE_PATH/https/repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/..directory.checked
    $ coursier fetch org.apache.maven:apache-maven:3.3.9

 The second fetch should work fine, fetching the directory listing, seeing that it lists no JAR, and then not attempting to download one. Before this commit, the second attempt would assume that the directory listing is not available, do without it, so assume that a JAR exists, and fail to download it.
2017-04-18 18:31:37 +02:00
Alexandre Archambault f9de965638 Minor tweaking 2017-04-18 18:31:29 +02:00
Eugene Yokota 6a1b736c11 Scala 2.12.2
Fixes #3111
2017-04-18 10:41:43 -04:00
Alexandre Archambault 5a738b7bb7 Merge pull request #503 from coursier/topic/missing-commits
Missing commits
2017-04-18 15:00:39 +02:00
Alexandre Archambault 143fdc9720 Fix link in release notes
Reported by @ritschwumm (via https://gitter.im/coursier/coursier?at=58f15a5dbdf4acc1125e6d5f)
2017-04-18 14:17:11 +02:00
Alexandre Archambault 1a34ed6340 Merge commit '9bc6952' into topic/missing-commits 2017-04-18 14:11:20 +02:00
Alexandre Archambault 0467d85d97 Merge commit 'dacf8a7' 2017-04-18 14:10:08 +02:00
eugene yokota 27b4faebed Merge pull request #3099 from eed3si9n/wip/bump2
Bump to Zinc 1.0.0-X14
2017-04-18 03:10:12 -04:00
Eugene Yokota 9a81c4da3e Fix scripted dependency-management/cache-update 2017-04-18 01:58:41 -04:00
Eugene Yokota 9e02995ac0 Bump to Zinc 1.0.0-X14 2017-04-18 00:56:22 -04:00
Eugene Yokota ad7bd2c2d6 Bump to util 1.0.0-M22 and 1.0.0-X10
Bumping to the latest librarymanagement.
2017-04-17 16:05:56 -04:00
eugene yokota e2ab823c06 Merge pull request #85 from eed3si9n/wip/bumputil2
Bump to util 1.0.0-M23
2017-04-17 13:46:31 -04:00
Eugene Yokota 4b0b3a05f9 Bump to util 1.0.0-M23
I'm now going to use `CacheStore.apply` in `JsonUtil` (used by cached resolution). This gets rid of `fileToStore` parameter from a bunch of classes and simplifies the setup around librarymanagement.
2017-04-17 13:29:02 -04:00
eugene yokota ecf3dd3ae8 Merge pull request #78 from eed3si9n/wip/cached
Adds back overrides for File-based caching
2017-04-17 12:40:23 -04:00
Eugene Yokota f48848e5d4 Adds overrides for File-based caching
sbt/util#45 implemented caching using sjson-new. Now many of the functions take `CacheStore` that abstracts the caching ability.

sbt/sbt#3109 demonstrates that setting up CacheStore requires boilerplate involving concepts introduced in sbt 1.

This change adds back overrides using File by making assumption that majority of the time we would want standard JSON converter.
2017-04-17 10:24:54 -04:00
Eugene Yokota debda67b3d Bump lm 1.0.0-X9 2017-04-15 16:53:38 -04:00
Eugene Yokota 1d4ce85a43 Fix scripted tests 2017-04-15 16:53:37 -04:00
Eugene Yokota 81642138e1 Bump to ZInc 1.0.0-X12 2017-04-15 16:53:37 -04:00
eugene yokota 95da5bafc2 Merge pull request #3098 from eed3si9n/wip/server_by_default
[sbt 1.0] Make server command the default shell
2017-04-14 17:34:39 -04:00
Eugene Yokota 86342d0bdd server is now called shell
server command is renamed to shell,
and the old shell command is called oldshell.
2017-04-14 16:35:54 -04:00
Dale Wijnand 36eb7b1e84 Merge pull request #3093 from eed3si9n/wip/log_concurrency
[sbt 1.0] Fix logging + clean concurrency issue
2017-04-14 15:01:41 +01:00
eugene yokota d493a51032 Merge pull request #3104 from eed3si9n/wip/socket_taken
[sbt 1.0] Better error message if socket is taken
2017-04-13 18:11:47 -04:00
Eugene Yokota 0e8459ad66 Better error message if socket is taken
We need to communicate the error states in the thread, so I added a `Future[Unit]` called `ready`.

If something goes wrong during the startup, like if the port is already taken, this can be used to communicate back to the main thread, and display the error accordingly.
2017-04-13 15:49:21 -04:00
Eugene Yokota acf6c1191e Make clean task run exclusively 2017-04-13 15:29:13 -04:00
Eugene Yokota 7acb8764f5 Reimplement clean and cleanFiles tasks
cleanFiles is now a task that lists exactly what will be deleted recursively.
2017-04-13 15:28:48 -04:00
eugene yokota 6834def7b8 Merge pull request #3101 from dwijnand/document-and-cleanup-commands-and-misc
Document & cleanup commands (& misc cleanups)
2017-04-13 15:09:03 -04:00
eugene yokota 4e3693179b Merge pull request #84 from dwijnand/expose-more-RichUpdateReport
Expose more in RichUpdateReport
2017-04-13 14:31:48 -04:00
Dale Wijnand ec15837f43
Replace unnecessary uses of Command.make with Command.apply 2017-04-13 13:52:30 +01:00
Dale Wijnand 6c07972dd0
Cleanup Command/Help and usage 2017-04-13 13:52:30 +01:00