Commit Graph

68 Commits

Author SHA1 Message Date
Eugene Yokota 3b4547718e Remove deprecated methods 2025-05-11 05:23:41 -04:00
Eugene Yokota 967ecb49bc deps: Scala 3.7.0 2025-05-11 01:30:07 -04:00
xuwei-k 5d660ab8b5 remove unnecessary `case`
- 3ca3633505/rules/src/main/scala/fix/RemoveParameterUntuplingCase.scala
- https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling.html
- https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling-spec.html
2025-02-22 08:48:29 +09:00
xuwei-k 13d6626564 update .scalafmt.conf. enforce new scala 3 syntax 2025-01-02 11:25:34 +09:00
xuwei-k d7ec1013da remove unused type params 2025-01-01 18:42:59 +09:00
xuwei-k d193c990d1 remove implicit params. change to using 2024-11-18 06:49:22 +09:00
xuwei-k 5dd0ab0e60 use extension instead of implicit 2024-11-17 10:24:33 +09:00
Adrien Piquerez d54647a46c Use referential equality on Task 2024-11-13 10:55:29 +01:00
Adrien Piquerez e5cedbe56b Fuse Info in Task to reduce instances 2024-11-12 17:05:20 +01:00
Eugene Yokota 56941dac04 refactor: Update Scala 3 syntax 2024-10-27 23:55:30 -04:00
xuwei-k cfb9ffea95 remove deprecated `[this]` qualifier
https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
2024-10-03 21:16:48 +09:00
Adrien Piquerez 31710c0879 Reduce allocation of Action.Mapped
For a tuple (t1, t2, ..., tn) of tasks we instantiate a unique Mapped instead of many
Mapped(t1, Mapped(t2, Mapped(...))
2024-10-02 15:54:20 +02:00
Adrien Piquerez 57db671073 Optimize TupleMapExtension 2024-10-02 15:54:20 +02:00
Eugene Yokota a6b4cfef12 refactor: Remove old sbt 0.13 shell syntax 2024-09-28 13:51:14 -04:00
Eugene Yokota c81d269ed2 Merge branch '1.10.x' into wip/merge-1.10.x 2024-05-07 04:39:25 -04:00
Adrien Piquerez 12e9267e1e Remove more unused 2024-03-05 15:25:25 +01:00
Adrien Piquerez c15a4031a9 Fix or mute warnings 2024-03-05 10:39:00 +01:00
Adrien Piquerez 7ac3cd321d Remove the unused ~> 2024-02-07 11:12:43 +01:00
Adrien Piquerez cf3c9bbf0d Remove ~>| and use polymorphic function instead 2024-02-07 10:49:23 +01:00
Adrien Piquerez a15fb91c5c Remove AList 2023-12-13 14:01:57 +01:00
Adrien Piquerez 7ea0506736 Introduce TaskId to reduce abstraction around Execute 2023-11-28 14:26:52 +01:00
xuwei-k 6c032b8283 some trivial refactoring
- remove unused type params
- use `withFilter` if possible
- use `collectFirst` instead of `collect` and `headOption`
- use `length` instead of `size` if `Array` or `String`
- use `foreach` instead of `map`
2023-06-25 08:57:41 +09:00
Julien Richard-Foy 72bfb3f45a Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
Eugene Yokota cba7a0efc3 Refactor to build mainProj 2023-01-15 23:48:11 -05:00
Eugene Yokota 441f56bf6e Fix task-standard tests 2023-01-15 23:45:35 -05:00
Eugene Yokota 340721c4a1 KeyMacro 2023-01-15 23:43:57 -05:00
Eugene Yokota 01d7f400d7 Port Task Std 2023-01-15 23:40:57 -05:00
Eugene Yokota 50b062b795 Port util-logging 2023-01-15 23:40:57 -05:00
xuwei-k 535b15b83e fix Scala 2.13 warnings 2021-11-14 22:59:34 +09:00
Eugene Yokota 8f5759e48d Cross build to Scala 2.13 2021-01-10 20:24:05 -05:00
João Ferreira dd411cac9f introduce a new new Input/Output: FileInput/FileOutput
* FileInput avoids the intermediate String parsing of PlainInput
* FileOuput also avoid the intermediate String representation of PlainOutput
2020-11-25 14:04:56 +00: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
Jason Zaugg 43cc55a24c Avoid tens of thousands of duplicated "TypeFuntions.const(())" strings 2020-05-09 13:02:16 -04:00
Eugene Yokota 54b3405f42 apply -Yno-lub
To demonstrate [-Yno-lub](http://eed3si9n.com/stricter-scala-with-ynolub), this shows the code changes that removes lubing (Not all subprojects are done).

After I made the changes, I switched the Scala back to normal 2.12.10.
2019-10-13 23:46:23 -04:00
Ethan Atkins af16d33700 Add per file stream locks
We have seen failures in scripted to create the output file for streams
and it has also been reported in https://github.com/sbt/sbt/issues/5067.
I believe this may caused by the same stream output being initialized by
multiple tasks. To fix this, I add locking on a per-file basis. There
was (and is) additional synchronization on the Streams _instance_, but
the per-file locks are stored in the Streams companion object so the
locking should be honored no matter which Streams instance calls make.

I also skip the call to IO.touch if the file already exists. I believe
that this is the common case and since IO.touch was being called with
setModified = false, it should be fine to skip the touch when the file
exists.

Prior to this change, I was able to induce the issue in #5067 in roughly
1/50 of calls to `scripted actions/cross-multiproject`. I wasn't able to
reproduce after this change.
2019-09-14 15:22:05 -07:00
xuwei-k dfe789d7c6 avoid deprecated /: and :\
use foldLeft and foldRight

https://github.com/scala/scala/blob/v2.13.0/src/library/scala/collection/IterableOnce.scala#L682-L686
2019-08-30 11:20:53 +09:00
Ethan Atkins cad89d17a9 Add support for in memory cache store
It can be quite slow to read and parse a large json file. Often, we are
reading and writing the same file over and over even though it isn't
actually changing. This is particularly noticeable with the
UpdateReport*. To speed this up, I introduce a global cache that can be
used to read values from a CacheStore. When using the cache, I've seen
the time for the update task drop from about 200ms to about 1ms. This
ends up being a 400ms time savings for test because update is called for
both Compile / compile and Test / compile.

The way that this works is that I add a new abstraction
CacheStoreFactoryFactory, which is the most enterprise java thing I've
ever written. We store a CacheStoreFactoryFactory in the sbt State.
When we make Streams for the task, we make the Stream's
cacheStoreFactory field using the CacheStoreFactoryFactory. The
generated CacheStoreFactory may or may not refer to a global cache.

The CacheStoreFactoryFactory may produce CacheStoreFactory instances
that delegate to a Caffeine cache with a max size parameter that is
specified in bytes by the fileCacheSize setting (which can also be set
with -Dsbt.file.cache.size). The size of the cache entry is estimated by
the size of the contents on disk. Since we are generally storing things
in the cache that are serialized as json, I figure that this should be a
reasonable estimate. I set the default max cache size to 128MB, which is
plenty of space for the previous cache entries for most projects. If the
size is set to 0, the CacheStoreFactoryFactory generates a regular
DirectoryStoreFactory.

To ensure that the cache accurately reflects the disk state of the
previous cache (or other cache's using a CacheStore), the Caffeine cache
stores the last modified time of the file whose contents it should
represent. If there is a discrepancy in the last modified times (which
would happen if, say, clean has been run), then the value is read from
disk even if the value hasn't changed.

* With the following build.sbt file, it takes roughly 200ms to read and
parse the update report on my compute:

libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.3"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1"

This is because spark-sql has an enormous number of dependencies and the
update report ends up being 3MB.
2019-07-11 17:45:16 -07:00
Dale Wijnand 5036f339f8
Remove unused Task#mapTask 2019-05-29 14:43:42 +01:00
Eugene Yokota 1e157b991a apply formatting 2019-04-20 03:23:54 -04:00
Ethan Atkins a556fc654a Lint Transform.scala
The file is green in intellij after this change.
2019-01-31 10:53:07 -08:00
Ethan Atkins da1cc40314 Rename System.scala to Transform.scala
The System.scala contained a single scala object called Transform, hence
the rename to Transform.scala.
2019-01-31 10:52:43 -08:00
Eugene Yokota 4ff4f6e45e Update header 2018-09-14 04:53:36 -04:00
Dale Wijnand 8f4b8abb7b
Run scalafmt & test:scalafmt 2018-04-24 16:12:10 +01:00
Dale Wijnand 82c39ec96f
Fix a "discarded non-Unit value" warning in TaskRunnerFork 2018-03-06 11:54:13 +00:00
Dale Wijnand 87dfb2c0f5
Remove all warnings from stdTaskProj 2017-12-12 13:02: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
Dale Wijnand 35c3542492
Get rid of Fn1 2017-10-25 10:21:00 +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 a41727fb17
Add, configure & enforce file headers 2017-10-05 09:03:40 +01:00