Commit Graph

1726 Commits

Author SHA1 Message Date
Eugene Yokota 2b5637270a update TestFramework
- update reset.sh for debugging
- use Vector around TestFramework
- unbind existing appdenders from newLog
- register string codec for TestStringEvent
2017-05-19 00:16:19 -04:00
eugene yokota d3ff3fb63a migrate PluginTrigger and ProjectOrigin to Contraband (#3191)
and move TestFramework to a non case class.
2017-05-13 13:01:51 +01:00
Eugene Yokota 3724277704 migrate ForkOptions to Contraband 2017-05-12 05:22:08 -04:00
eugene yokota b1a1d03009 Merge pull request #3180 from eed3si9n/wip/zero2
[sbt 1.0] Rename scope component Global to Zero (`in Global` stays the same)
2017-05-10 16:48:40 -04:00
jvican 9d260f68c7
Use `ConsoleReporter` if no reporter is found
This change is necessary in the cases where we have global
initialization issues that have no position, like:

```
[info] [error] scala.reflect.internal.MissingRequirementError: object scala in compiler mirror not found.
```

Before, it was failing with a `sys.error` exception. Now we will report
these issues with a console reporter that is not meant to be
thread-safe.
2017-05-10 21:40:01 +02:00
Eugene Yokota 4182249526 Add InteractionService from sbt-core-next
Fixes sbt/sbt#3167
2017-05-08 21:54:58 -04:00
Eugene Yokota 2082f37e2a Rename Global as scope component to Zero
Fixes #3178

While working on the Scopes and Scope Delegation document, I noticed that the term Global in sbt is used for two different meaning.

1. Universal fallback scope component `*`
2. An alias for GlobalScope

This disambiguates the two by renaming ScopeAxis instance to Zero.
Since this is mostly internal to sbt code, the impact to the user should be minimal.
2017-05-08 11:41:48 -04:00
eugene yokota 6cd3cd2323 Merge pull request #3149 from scalacenter/clean-update
Clean up `update` in `Defaults`
2017-05-05 11:03:18 -04:00
jvican 1252db6b4a
Address Eugene's feedback 2017-05-04 13:33:21 +02:00
jvican 818b8c85ae
Bump util to X11 and rename `SbtExclusionRule` 2017-05-03 12:42:16 +02:00
jvican e7b8cbfe01
Move `cachedUpdate` to new `DependencyResolver`
The `cachedUpdate` implementation does not need to be in `Defaults`
since it's not using any of the tasks/settings defined there, that's
`updateTask`'s job.

This commit moves the utilities required by `updateTask` to the
`sbt.internal.librarymanagement` namespace.
2017-04-28 10:31:45 +02:00
jvican 1c961e8814
Move `AltLibraryManagementCodec` to internal
This is an implementation detail that should not be exposed in `Defaults`.

It is therefore moved to `librarymanagement.internal`.
2017-04-28 10:31:33 +02:00
jvican 8fd40e56df
Ease `updateTask` and `cachedUpdate` maintenance
This commit does some changes to the implementation with the purpose of
making this code more readable. I find that this rewrite was necessary
as I was implementing the dependency lock file.
2017-04-27 15:14:42 +02:00
Eugene Yokota da046791e0 Apply Scalafmt formatting 2017-04-21 04:48:31 -04:00
Eugene Yokota 1ec7e8d975 format: off / format: on 2017-04-21 03:11:48 -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
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 9e02995ac0 Bump to Zinc 1.0.0-X14 2017-04-18 00:56:22 -04:00
Eugene Yokota 81642138e1 Bump to ZInc 1.0.0-X12 2017-04-15 16:53:37 -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 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
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
Dale Wijnand 2caa324d52
Solve a scaladoc issue 2017-04-13 11:52:19 +01:00
Dale Wijnand 308abcde9f Merge pull request #3082 from dwijnand/remove-most-deprecated
Remove most @deprecated
2017-04-13 10:32:10 +01:00
eugene yokota 90e560aa55 Merge pull request #3095 from eed3si9n/fport/3089
[fport] Add three slashes (u3) for file URI
2017-04-12 05:46:43 -04:00
Eugene Yokota b0b5396769 Use IO.toFile 2017-04-12 03:50:35 -04:00
Dale Wijnand 881cb4246a Notify about shell less
+ Don't notify ScriptMain users by moving the logic to xMain
+ Only trigger shell if shell is a defined command
+ Use existing Shell/BootCommand strings instead of new ones
2017-04-12 03:24:38 -04:00
Dale Wijnand 3f590d8e13
Drop most remaining deprecations 2017-04-11 16:46:11 +01:00
Dale Wijnand 7ce389c1da
Define DefaultEvaluateTaskConfig 2017-04-11 16:46:09 +01:00
Dale Wijnand 6820bcf99c
Drop deprecated inputTask method
Temporarily (FLW) duplicate it in fullRunInputTask.
2017-04-11 16:45:26 +01:00
Dale Wijnand 01b19f0218
Drop deprecated seq method 2017-04-11 16:44:38 +01:00
Dale Wijnand 4ef5e85390
Drop deprecated default resolvers 2017-04-11 16:43:01 +01:00
Dale Wijnand a6015793e2
Code formatting only changes 2017-04-11 14:32:38 +01:00
Dale Wijnand be3fa7e66d
Just whitespace & comment changes 2017-04-11 11:48:24 +01:00
Dale Wijnand 31b1be2f3b Merge pull request #3081 from dwijnand/kill-project-delegation
Kill project delegation
2017-04-06 07:34:39 +01:00
Dale Wijnand a0eeec37e2
Kill project delegation 2017-04-05 22:47:39 +01:00
Dale Wijnand cd5c36a11f
Stop defining the artifact configuration based on the classifier
I believe this was accidentally not forward-ported from the 0.14 branch
to the 1.0.x branch.  Notice the change was present in #1016:

  https://github.com/sbt/sbt/pull/1016/files#diff-6373e7f7122325e753b75fe1cc76ff5fL576

and missing in #2478:

  https://github.com/sbt/sbt/pull/2478/files#diff-6373e7f7122325e753b75fe1cc76ff5fR680
2017-04-05 14:14:18 +01:00
eugene yokota 1f02e61819 Merge pull request #3077 from eed3si9n/fport/3008
[fport] Notify & enable users to stay in the warm shell
2017-04-04 20:33:05 -07:00
Eugene Yokota 15255c15b0 Don't warn on server command 2017-04-04 20:00:56 -04:00
Dale Wijnand c41d428dbc Handle non-shell sbt startup warning
The sbt/sbt-launcher-package doesn't invoke sbt with the "shell"
command. sbt has a mechanism for handling this in its "boot" command
that adds an "iflast shell" to the commands. Handle this when displaying
the "Executing in batch mode" warning.

Fixes #3004
2017-04-04 19:45:24 -04:00