Commit Graph

219 Commits

Author SHA1 Message Date
Eugene Yokota 2642ba30cc Fix InputKey 2023-01-15 23:50:30 -05:00
Eugene Yokota 193b47b49b Fix taskDyn 2023-01-15 23:50:30 -05:00
Eugene Yokota 9f5525c989 inline parameter removes let binding 2023-01-15 23:50:29 -05:00
Eugene Yokota fbc98ed72e Use ClassTag instead of Manifest 2023-01-15 23:50:29 -05:00
Eugene Yokota cba7a0efc3 Refactor to build mainProj 2023-01-15 23:48:11 -05:00
Eugene Yokota 100f1ac09c Use flatMapTask instead of taskDyn 2023-01-15 23:47:41 -05:00
Eugene Yokota e9490e203b Use Type to compare types instead of TypeRepr 2023-01-15 23:45:35 -05:00
Eugene Yokota 0ee7d11afe Migrate updateTask via tuple syntax 2023-01-15 23:45:35 -05:00
Eugene Yokota 0c6eb093ac Rename tuple syntax to use mapN 2023-01-15 23:45:35 -05:00
Eugene Yokota fe0de6ca30 Fix input task macro 2023-01-15 23:45:35 -05:00
Eugene Yokota d802c2ba04 valStart to change synthetic variable names 2023-01-15 23:45:35 -05:00
Eugene Yokota 73c7236c2c Refactor to use Type instead of TypeRepr 2023-01-15 23:45:35 -05:00
Eugene Yokota 61d4fe2d30 Implement input task helper Def.input 2023-01-15 23:45:35 -05:00
Eugene Yokota cec131f6ed Fix conditional task 2023-01-15 23:45:34 -05:00
Eugene Yokota 81a05430bd Split buildfile parsing to a subproject 2023-01-15 23:45:30 -05:00
Eugene Yokota 66fa46a912 Fix InputTask macro 2023-01-15 23:44:28 -05:00
Eugene Yokota c7fa4937ef Bump to Scala 3.1.3 2023-01-15 23:44:25 -05:00
Eugene Yokota f3dd2dff36 Starting input task 2023-01-15 23:43:59 -05:00
Eugene Yokota b715917d95 Inline append macros 2023-01-15 23:43:59 -05:00
Eugene Yokota a1e50f8a2e Append macros 2023-01-15 23:43:59 -05:00
Eugene Yokota 9c1e8abb91 transform can be an inline 2023-01-15 23:43:59 -05:00
Eugene Yokota 37f6ee6184 Setting macro 2023-01-15 23:43:59 -05:00
Eugene Yokota 6662dbad26 InputWrapper can be inline method 2023-01-15 23:43:59 -05:00
Eugene Yokota 340721c4a1 KeyMacro 2023-01-15 23:43:57 -05:00
David Gregory dd497063e5
Add Remove instances for Set and Map 2022-03-30 19:03:14 +01:00
eugene yokota b3aae681bf
Merge pull request #6711 from xuwei-k/fix-scala-2-13-warn
fix Scala 2.13 warnings
2021-11-14 21:53:57 -05:00
xuwei-k 535b15b83e fix Scala 2.13 warnings 2021-11-14 22:59:34 +09:00
xuwei-k aa8b1141f8 Update scalatest 2021-11-14 22:03:59 +09:00
Eugene Yokota 695261a068 Migrate most of the internal usage of in 2021-02-22 00:09:36 -05:00
Eugene Yokota 833024b1d9 `in` is no longer in
Ref https://github.com/sbt/sbt/pull/6309

This deprecates the sbt 0.13 style `key in (Compile, intask)` syntax.
2021-02-21 23:38:56 -05:00
Eugene Yokota 8f5759e48d Cross build to Scala 2.13 2021-01-10 20:24:05 -05:00
Eugene Yokota a6d03c819c Backtick the unicode letters in method 2021-01-10 14:21:50 -05:00
Ethan Atkins 78620cd902 Manage ansi codes and color codes separately
The ConsoleAppender formatEnabledInEnv field was being used both as an
indicator that ansi codes were supported and that color codes are
enabled. There are cases in which general ansi codes are not supported
but color codes are and these use cases need to be handled separately.
To make things more explicit, this commit adds isColorEnabled and
isAnsiSupported to the Terminal companion object so that we can be more
specific about what the requirements are (general ansi escape codes or
just colors). There are a few cases in ConsoleAppender itself where
formatEnabledInEnv was used to set flags for both color and ansi codes.
When that is the case, we use Terminal.isAnsiSupported because when that
is true, colors should at least work but there are terminals that
support color but not general ansi escape codes.
2020-10-21 08:01:12 -07:00
Eugene Yokota c85e5b8bc0 Upgrade scala version to 2.12.12
This introduces `Def.unit(...)` to workaround the pure expression does nothing warning.
2020-08-11 23:33:12 -04:00
Eugene Yokota 002f97cae7 Build pipelining
Ref https://github.com/sbt/zinc/pull/744

This implements `ThisBuild / usePipelining`, which configures subproject pipelining available from Zinc 1.4.0.

The basic idea is to start subproject compilation as soon as pickle JARs (early output) becomes available. This is in part enabled by Scala compiler's new flags `-Ypickle-java` and `-Ypickle-write`.

The other part of magic is the use of `Def.promise`:

```
earlyOutputPing := Def.promise[Boolean],
```

This notifies `compileEarly` task, which to the rest of the tasks would look like a normal task but in fact it is promise-blocked. In other words, without calling full `compile` task together, `compileEarly` will never return, forever waiting for the `earlyOutputPing`.
2020-08-06 02:31:01 -04:00
Ethan Atkins ba345dd797 Add multi-client ui to server
This commit makes it possible for the sbt server to render the same ui
to multiple clients. The network client ui should look nearly identical
to the console ui except for the log messages about the experimental
client.

The way that it works is that it associates a ui thread with each
terminal. Whenever a command starts or completes, callbacks are invoked
on the various channels to update their ui state. For example, if there
are two clients and one of them runs compile, then the prompt is changed
from AskUser to Running for the terminal that initiated the command
while the other client remains in the AskUser state. Whenever the client
changes uses ui states, the existing thread is terminated if it is
running and a new thread is begun.

The UITask formalizes this process. It is based on the AskUser class
from older versions of sbt. In fact, there is an AskUserTask which is
very similar. It uses jline to read input from the terminal (which could
be a network terminal). When it gets a line, it submits it to the
CommandExchange and exits. Once the next command is run (which may or
may not be the command it submitted), the ui state will be reset.

The debug, info, warn and error commands should work with the multi
client ui. When run, they set the log level globally, not just for the
client that set the level.
2020-06-24 19:40:17 -07:00
Eugene Yokota 9821b83048 Forward type to the conditional tasks to fix Seq[Nothing]
Fixes https://github.com/sbt/sbt/issues/5625
2020-06-17 18:08:59 -04:00
eugene yokota 2b557851ca
Merge pull request #5041 from jsoref/https
Https
2020-06-14 17:34:58 -04:00
eugene yokota 975e3db43e
Merge pull request #5558 from eed3si9n/wip/selective
Selective functor
2020-06-10 17:39:13 -04:00
Eugene Yokota b78e4f0919 implement Def.promise
This adds `Def.promise` a facility that wraps `scala.concurrent.Promise`. Project layer, there's an implicit for task-that-returns-promise (`Def.Initialize[Task[PromiseWrap[A]]]`) that would inject `await` method, which returns a task. This is a special task that is tagged with `Tags.Sentinel` so that it will bypass the concurrent restrictions. Since there's no CPU- or IO-bound work, this should be ok.

The purpose of this promise for long-running task to communicate with another task midway.
2020-06-10 15:16:25 -04:00
Eugene Yokota b43f663b0e Automatic conversion to Def.taskIf
When `Def.task`, `:=`, `+=` etc contains `if` and only `if` expression automatically treat it as a conditional task even if the else clause contains `.value`.
2020-05-19 15:02:57 -04:00
Eugene Yokota 45e8426d27 def taskIf[A](a: A): Initialize[Task[A]]
Make `Def.taskIf` accept pure `A` type, as opposed to `Def.task { ... }`.
2020-05-17 23:44:35 -04:00
Eugene Yokota c6f62293f1 Def.taskIf macro
Def.taskIf accepts an if-expression or a block ending in an if-expression.
2020-05-17 23:36:04 -04:00
Eugene Yokota 2feecf8a1f Selective functor
This implements Selective functor for `Either[A, B]` "task" (`Initialize[Task[Either[A, B]]]`).
The selective functor allows an encoding of if-expression:

```
  def ifS[A](
      x: Def.Initialize[Task[Boolean]]
  )(t: Def.Initialize[Task[A]])(e: Def.Initialize[Task[A]]): Def.Initialize[Task[A]]
```

The benefit of this approach is that task dependencies are still visible to inspect command.
2020-05-17 23:36:04 -04:00
eugene yokota 0b12862caf
Merge pull request #5439 from dwijnand/introduce-Taskable
Introduce Taskable & toTaskable
2020-02-28 10:43:16 -05:00
eugene yokota 9c384dca15
Merge pull request #5435 from dwijnand/tweak-Def.displayRelative
Tweak Def.displayRelative
2020-02-28 09:57:04 -05:00
Dale Wijnand 23702b6432 Add toTaskable to Init/+Task, for tuple syntax 2020-02-17 12:22:53 +00:00
Dale Wijnand 722022ae97 Add conversions from Init/+Task to Taskable 2020-02-17 12:22:53 +00:00
Dale Wijnand fdfdd1ca47 Extract Taskable from ScopedTaskable 2020-02-17 12:22:53 +00:00
Dale Wijnand 2608f8ade6 Document parts of AList & components of TupleSyntax
Also, extract the AList.SplitK type lambda helper for call-site reuse.
2020-02-17 07:15:37 +00:00