Commit Graph
104 Commits
Author SHA1 Message Date
Dale Wijnand dfff1ed928 Merge pull request #4032 from eed3si9n/wip/servertest
improve server testing
2018-04-18 07:12:53 +02:00
Dale Wijnand 8c1337455d Fix migrate URL
Fixes #4062
2018-04-04 14:26:03 +01:00
Eugene Yokota 67e1e4a9ff improve server testing
previously I was using separate thread in a forked test to test the server, but that is not enough isolation to run multiple server tests.
This adds `RunFromSourceMain.fork(workingDirectory: File)`, which allows us to run a fresh sbt on the given working directory. Next, I've refactored the stateful client-side buffer to a class `TestServer`.
2018-03-24 12:09:41 -04:00
Dale Wijnand 27fe5a6957 Re-write toolboxClasspath to use sbt-buildinfo 2018-02-23 13:20:19 +00:00
Dale Wijnand 9f1d60be60 Rewrite to polymorphic function syntax 2017-10-25 10:23:46 +01:00
Dale Wijnand f662fdda8e Rewrite to function syntax 2017-10-25 10:22:48 +01:00
Simon Schäfer 93e08b7ee7 Fix warnings about unused pattern vars in various projects 2017-10-19 13:07:24 +02:00
Dale Wijnand 668ace98ee Remove some duplication when only Scoped is required 2017-10-08 19:07:38 +01:00
Dale Wijnand 5e0b080f51 Fix some minor errors 2017-10-07 18:42:26 +01:00
Dale Wijnand ef4828cfc2 Add slash syntax for AttrKey that parity with "in" syntax 2017-10-07 13:12:17 +01:00
Dale Wijnand d19c350687 Correct name of WithoutScope properties 2017-10-07 13:12:16 +01:00
Dale Wijnand 8af3110c00 Add .previous tests to SlashSyntaxTest 2017-10-07 13:12:16 +01:00
Dale Wijnand fb28c201c8 Make scoped keys more frequent 2017-10-07 13:12:16 +01:00
Dale Wijnand 74ac7d9e07 Drop redudant label in expectValue 2017-10-07 13:12:15 +01:00
Dale Wijnand 025075efd0 Dedup, cleanup & cover all key types 2017-10-07 13:12:15 +01:00
Dale Wijnand 165dc794ca Extract gen{Input,Setting,Task}Key 2017-10-07 13:12:15 +01:00
Dale Wijnand 18d615701f Remove WithScope wrapping 2017-10-07 13:12:15 +01:00
Dale Wijnand 0bcd7c3b6d Remove boilerplate around sbtSlashSyntaxRichConfiguration 2017-10-07 12:08:32 +01:00
Dale Wijnand e5898111fe Replace CanScope with Scoped.ScopingSetting 2017-10-07 12:07:19 +01:00
Eugene Yokota 2a6385fd94 Remove thunk for slash syntax
Ref #3606, #3611, and #3613

This removes unnecessary thunk for slash syntax.
The semantics using this approach is strictly better than the previous `in (ref, config, task)`. By removing the thunk, we retain `(a / b) / c == a / b / c`.

See the following example:

```scala
scala> import sbt._, Keys._
scala> val t: TaskKey[Unit] = (test in Test)
t: sbt.TaskKey[Unit] = TaskKey(This / Select(ConfigKey(test)) / This / test)

scala> ThisBuild / t
ThisBuild / t
res1: sbt.TaskKey[Unit] = TaskKey(Select(ThisBuild) / Select(ConfigKey(test)) / This / test)

scala> ThisBuild / t / name
ThisBuild / t / name
res2: sbt.SettingKey[String] = SettingKey(Select(ThisBuild) / Select(ConfigKey(test)) / Select(test) / name)
```

so far so good? Now look at this:

```
scala> scala> name in (ThisBuild, t)
name in (ThisBuild, t)
res3: sbt.SettingKey[String] = SettingKey(Select(ThisBuild) / This / Select(test) / name)
```

`Test` configuration knowledge is lost! For `in (..)` maybe it was ok because mostly we don't use unscoped keys, but that's the difference between `in (..)` and `/`.

Fixes #3605
2017-10-06 15:47:46 -04:00
Dale Wijnand 5b03379693 Extract withScope 2017-10-06 17:41:06 +01:00
Dale Wijnand 9b526f54bf Rarely include custom scopes in key generators 2017-10-06 15:41:28 +01:00
Dale Wijnand db87e4c871 Add SlashSyntaxSpec to validate syntax parity 2017-10-06 15:07:18 +01:00
Dale Wijnand 97ddc1ffb7 Copy the non-runtime parts of project/unified to SlashSyntaxTest 2017-10-06 15:07:17 +01:00
Dale Wijnand f22843f91c Move SlashSyntax to the settings component 2017-10-06 09:52:34 +01:00
eugene yokota 1251817cf2 Merge pull request #3612 from dwijnand/scope-toString
Handle Global in Scope#toString
2017-10-05 17:43:25 -04:00
Dale Wijnand 2a5ba9475d Handle Global in Scope#toString
Print "Global" instead of "Zero / Zero / Zero".
2017-10-05 20:29:42 +01:00
Dale Wijnand f4b2fc4228 Correct handling of resolving ThisProject
In ca71b4b902 I went about fixing the
inexhaustive matching in Scope's resolveProjectBuild and
resolveProjectRef. Looking back the change was wrong.

For resolveProjectBuild the new implementation is less wrong, but still
not great, seeing as it doesn't actually do any build resolving.

For resolveProjectRef the new implementation now blows up instead of
lies. Which means it's less leneant, more "fail-fast".

isProjectThis is unused; remnant of the pre-AutoPlugin days when build
settings where defined in Plugin.settings.
2017-10-05 19:00:48 +01:00
Dale Wijnand a41727fb17 Add, configure & enforce file headers 2017-10-05 09:03:40 +01:00
Eugene Yokota 60f2498c0a Implement toString for keys
toString added for REPL testing:

```
scala> Zero / Zero / Zero / name
res0: sbt.SlashSyntax.ScopeAndKey[sbt.SettingKey[String]] = Zero / Zero / Zero / name
```
2017-10-05 02:46:09 -04:00
Eugene Yokota b0306b738e Add whitespaces in Show of scoped keys
```
Provided by:
    ProjectRef(uri("...."), "root") / Test / test
Dependencies:
    Test / executeTests
    Test / test / streams
    Test / state
    Test / test / testResultLogger
```
2017-09-28 03:34:49 -04:00
Eugene Yokota 33a01f3ceb Unified slash syntax
Fixes sbt/sbt#1812

This adds unified slash syntax for both sbt shell and the build.sbt DSL.
Instead of the current `<project-id>/config:intask::key`,
this adds `<project-id>/<config-ident>/intask/key` where <config-ident> is the Scala identifier notation for the configurations like `Compile` and `Test`.

This also adds a series of implicits called `SlashSyntax` that adds `/` operators to project refererences, configuration, and keys such that the same syntax works in build.sbt.

These examples work for both from the shell and in build.sbt.

    Global / cancelable
    ThisBuild / scalaVersion
    Test / test
    root / Compile / compile / scalacOptions
    ProjectRef(uri("file:/xxx/helloworld/"),"root")/Compile/scalacOptions
    Zero / Zero / name

The inspect command now outputs something that can be copy-pasted:

    > inspect compile
    [info] Task: sbt.inc.Analysis
    [info] Description:
    [info] 	Compiles sources.
    [info] Provided by:
    [info] 	ProjectRef(uri("file:/xxx/helloworld/"),"root")/Compile/compile
    [info] Defined at:
    [info] 	(sbt.Defaults) Defaults.scala:326
    [info] Dependencies:
    [info] 	Compile/manipulateBytecode
    [info] 	Compile/incCompileSetup
    [info] Reverse dependencies:
    [info] 	Compile/printWarnings
    [info] 	Compile/products
    [info] 	Compile/discoveredSbtPlugins
    [info] 	Compile/discoveredMainClasses
    [info] Delegates:
    [info] 	Compile/compile
    [info] 	compile
    [info] 	ThisBuild/Compile/compile
    [info] 	ThisBuild/compile
    [info] 	Zero/Compile/compile
    [info] 	Global/compile
    [info] Related:
    [info] 	Test/compile
2017-09-28 01:01:43 -04:00
eugene yokota 45765583a6 Merge branch '1.0.x' into 1.0.x 2017-09-15 19:47:08 -04:00
Răzvan Flavius Panda 0124a8ad0e Fix unused imports warnings 2017-09-15 16:35:08 +01:00
Dale Wijnand 936733b2b1 Cleanup 2017-09-13 16:03:51 +01:00
Dale Wijnand d3d105515a Don't warn on by-name keys
.. which is apparently what the type of bare vals in *.sbt files are.

Fixes #3299, again.
2017-09-11 14:46:33 +01:00
Dale Wijnand 8d9a3a35d2 Fix warnings in TaskLinterDSL.scala 2017-09-11 14:45:40 +01:00
eugene yokota 33d3ba9d7c Merge pull request #3438 from Duhemm/source-appender
[1.0.x] `Append` instance to add `File` to `Seq[Source]`
2017-08-23 18:31:58 -04:00
Dale Wijnand 4f0d2f9ffd Scalafmt 1.2.0 2017-08-14 15:47:52 +01:00
Martin Duhem 5815f1db0a Append instance to add File to Seq[Source] 2017-08-14 15:47:17 +02:00
Dale Wijnand 805b76f3d4 Add back, re-configure & re-enable Scalafmt 2017-08-10 16:35:23 +01:00
Eugene Yokota 467617a4b9 Implement withRank 2017-07-25 01:50:53 -04:00
Martin Duhem 9dfe1a8406 Allow .value on SettingKey inside ifs & lambdas
Calling `.value` on a SettingKey doesn't trigger any execution and
doesn't have any side effect, so we can safely allow calls to `.value`
inside conditionals and lambdas.

Fixes #3299
2017-07-21 16:26:45 +02:00
Martin Duhem 347914191a Adapt to new library management API 2017-07-15 18:09:40 -04:00
Martin Duhem 3fe068a4c1 Adapt to changes in ConsoleAppender 2017-07-15 17:15:42 +02:00
Eugene Yokota 42a1e2a291 Improve the default prompt
Fixes #3313

This changes the default prompt to include "sbt:" + current project name.
See https://twitter.com/eed3si9n/status/884914670351659009
2017-07-13 14:58:10 -04:00
Dale Wijnand 0fe0de5fb3 Move the tuple enrichments into sbt.TupleSyntax
This undeprecates the syntax, but at the same times moves it out of
implicit scope, therefore requiring a 'import TupleSyntax._' to opt-in
to the old syntax.
2017-06-27 12:42:46 +01:00
Dale Wijnand c5b21ab9d9 Format Structure 2017-06-26 13:49:18 +01:00
jvican c85fb95851 Remove unnecessary infra for .value DSL check 2017-05-28 18:36:14 +02:00
jvican 6a31251a01 Add tests that check sbtUnchecked is respected 2017-05-28 18:31:45 +02:00