Commit Graph

17940 Commits

Author SHA1 Message Date
Ethan Atkins 8ce2578060 Introduce FileChanges
Prior to this commit, change tracking in sbt 1.3.0 was done via the
changed(Input|Output)Files tasks which were tasks returning
Option[ChangedFiles]. The ChangedFiles case class was defined in io as

case class ChangedFiles(created: Seq[Path], deleted: Seq[Path], updated: Seq[Path])

When no changes were found, or if there were no previous stamps, the
changed(Input|Output)Files tasks returned None. This made it impossible
to tell whether nothing had changed or if it was the first time.
Moreover, the api was awkward as it required pattern matching or folding
the result into a default value.

To address these limitations, I introduce the FileChanges class. It can
be generated regardless of whether or not previous file stamps were
available. The changes contains all of the created, deleted, modified
and unmodified files so that the user can directly call these methods
without having to pattern match.
2019-08-09 12:18:22 -07:00
Ethan Atkins 8e9efbeaac Add extension methods for input and output files
It is tedious to write (foo / allInputFiles).value so I added simple
extension method macros that expand `foo.inputFiles` to
(foo / allInputFiles).value and `foo.outputFiles` to
`(foo / allOutputFiles).value`.
2019-08-09 12:18:22 -07:00
Ethan Atkins f126206231 Fix incremental task evaluation semantics
While writing documentation for the new file management/incremental
task evaluation features, I realized that incremental task evaluation
did not have the correct semantics. The problem was that calls to
`.previous` are not scoped within the current task. By this, I mean that
say there are tasks foo and bar and that the defintion of bar looks like

bar := {
    val current = foo.value
    foo.previous match {
        case Some(v) if v == current => // value hasn't changed
        case _ => process(current)
    }
}

The problem is that foo.previous is stored in
effectively (foo / streams).value.cacheDirectory / "previous". This
means that it is completely decoupled from foo. Now, suppose that the
user runs something like:
> set foo := 1
> bar // processes the value 1
> set foo := 2
> foo
> bar // does not process the new value 2 because foo was called, which updates the previous value

This is not an unrealistic scenario and is, in fact, common if the
incremental task evaluation is changed across multiple processing steps.
For example, in the make-clone scripted test, the linkLib task processes
the outputs of the compileLib task. If compileLib is invoked separately
from linkLib, then when we next call linkLib, it might not do anything
even if there was recompilation of objects because the objects hadn't
changed since the last time we called compileLib.

To fix this, I generalizedthe previous cache so that it can be keyed on
two tasks, one is the task whose value is being stored (foo in the
example above) and the other is the task in which the stored task value
is retrieved (bar in the example above). When the two tasks are the
same, the behavior is the same as before.

Currently the previous value for foo might be stored somewhere like:

base_directory/target/streams/_global/_global/foo/previous

Now, if foo is stored with respect to bar, it might be stored in

base_directory/target/streams/_global/_global/bar/previous-dependencies/_global/_gloal/foo/previous

By storing the files this way, it is easy to remove all of the previous
values for the dependencies of a task.

In addition to changing how the files are stored on disk, we have to store
the references in memory differently. A given task can now have multiple
previous references (if, say, two tasks bar and baz both depend on the
previous value). When we complete the results, we first have to collect
all of the successful tasks. Then for each successful task, we find all
of its references. For each of the references, we only complete the
value if the scope in which the task value is used is successful.

In the actual implemenation in Previous.scala, there are a number places
where we have to cast to ScopedKey[Task[Any]]. This is due to
limitations of ScopedKey and Task being type invariant. These casts are
all safe because we never try to get the value of anything, we only use
the portion of the apis of these types that are independent of the value
type. Structural typing where ScopedKey[Task[_]] gets inferred to
ScopedKey[Task[x]] forSome x is a big part of why we have problems with
type inference.
2019-08-09 12:18:22 -07:00
Ethan Atkins d18cb83b3c Switch from Vector to List in Settings
Using List instead of vector makes the code a bit more readable. We
don't need indexed access into the data structure so its unlikely that
Vector was providing any performance benefit.
2019-08-09 12:18:22 -07:00
Ethan Atkins fdeb6be667 Add scaladoc to FileStamp
As part of a documentation push, I noticed that these were undocumented
and that there were some public apis in FileStamp that I intended to be
private[sbt].
2019-08-09 12:18:22 -07:00
Ethan Atkins fb15065438 Move implicit FileStamp JsonFormats into object
I realized it was probably not ideal to have these implicit JsonFormats
defined directly in the FileStamp object because they might
inadvertently be brought into scope with a wildcard import.
2019-08-09 12:18:22 -07:00
Ethan Atkins 2990e08c5d Set make-clone c compile options for all platforms
I realized that it didn't make sense to specify these just for linux
even though they work fine with the version of gcc that runs on my mac.
I also ran scalafmt on this file.
2019-08-09 12:18:22 -07:00
Ethan Atkins 9cd88070ae Fix typo in allOutputFiles description 2019-08-09 12:18:22 -07:00
Ethan Atkins a7715e90a4 Rename cacheStoreFactory attribute
It references a CacheStoreFactoryFactory so it should have been named
accordingly.
2019-08-09 12:18:22 -07:00
Alexandre Archambault bd4a2d5adf Add extra namespaces in shading config
These aren't required, but passing them beforehand speeds up shading
2019-08-09 18:15:57 +02:00
Alexandre Archambault c0acb02efd Check that lmcoursier is the only ns in lm-coursier-shaded JAR 2019-08-09 18:15:57 +02:00
Alexandre Archambault cd1b9a39ce
Don't run MIMA checks for borked release (#119)
2.0.0-RC2-3
2019-08-09 18:15:10 +02:00
eugene yokota 6865f32eae
Merge pull request #4934 from eed3si9n/wip/publishTo
Revert "don't require publishTo specified if publishArtifact is `false`"
2019-08-09 09:24:31 -04:00
eugene yokota ebe96c613f Include reconciliation to CoursierConfiguration (#112)
Also re-enable sbt-contraband, and deal with Dependency change.
2019-08-09 11:55:57 +02:00
Ethan Atkins 5b5f239962
Merge pull request #4937 from eatkins/miscellaneous-fixups
Miscellaneous fixups
2019-08-08 21:47:33 -07:00
Ethan Atkins 9a1d874c37 Fix divide by zero 2019-08-08 16:06:13 -07:00
Ethan Atkins 14f7177619 Fix implicit numeric widening warning 2019-08-08 16:06:13 -07:00
Ethan Atkins 68a966178a
Merge pull request #4936 from eatkins/2.12.9-revert
2.12.9 revert
2019-08-08 13:36:32 -07:00
Ethan Atkins d86afb5745 Revert "Merge pull request #4930 from eatkins/2.12.9"
This reverts commit 053b72005d, reversing
changes made to d6b8e0388c.
2019-08-08 11:09:29 -07:00
Ethan Atkins f1538f76ce Revert "Merge pull request #4933 from eatkins/paradise"
This reverts commit 294a1c181e, reversing
changes made to 8365e4b189.
2019-08-08 11:08:06 -07:00
Eugene Yokota ec6cf15f12 Revert "don't require publishTo specified if publishArtifact is `false`"
This reverts commit 4668faff7c.
Ref https://github.com/sbt/sbt/pull/3760
Ref https://github.com/sbt/sbt/pull/4931
2019-08-08 00:36:36 -04:00
eugene yokota 294a1c181e
Merge pull request #4933 from eatkins/paradise
Bump source-dependencies/macro-annotation to 2.12.9
2019-08-06 18:17:38 -04:00
Ethan Atkins 0fc43cc95b Bump source-dependencies/macro-annotation to 2.12.9 2019-08-06 12:47:08 -07:00
Alexandre Archambault 63ddd4c616
Switch to coursier 2.0.0-RC3-2 (#116) 2019-08-06 17:02:57 +02:00
Scala Steward e0ade0d6ba Update sbt-coursier, sbt-shading to 2.0.0-RC3-1 (#115) 2019-08-06 10:35:32 +02:00
eugene yokota 8365e4b189
Merge pull request #4926 from eatkins/auto-reload-fix
Improve auto-reload
2019-08-05 19:04:50 -04:00
eugene yokota 053b72005d
Merge pull request #4930 from eatkins/2.12.9
Bump default scala version to 2.12.9
2019-08-05 19:04:13 -04:00
Ethan Atkins 86cb74bb96 Downgrade to 2.12.8 for project/semanticdb scripted test
Semanticdb hasn't been published for 2.12.9 yet.
2019-08-05 14:25:59 -07:00
Ethan Atkins 416cc653b6 Downgrade to 2.12.8 for source-dependencies/macro-annotation
The macro paradise library isn't published for 2.12.9 (yet).
2019-08-05 14:25:59 -07:00
Ethan Atkins 2a99f86b87 Fix dependency-management/sources for 2.12.9
An additional jar is required.
2019-08-05 14:25:54 -07:00
Ethan Atkins 9e165b01d9 Use https in scala url 2019-08-05 14:00:26 -07:00
Ethan Atkins c34de173ea Upgrade classloader-cache/resources libarary to 2.12.9 2019-08-05 13:59:17 -07:00
Ethan Atkins b26ce819ca Bump default scala version to 2.12.9
I automatically generated with:

git grep "2.12.8" | \
  cut -d ':' -f1 | uniq | xargs perl -p -i -e "s/2.12.8/2.12.9/"
2019-08-05 13:12:28 -07:00
Ethan Atkins aa62386f4d Improve auto-reload
I noticed that sometimes if I changed a build source and then ran reload
in the shell, I'd still see a warning about build sources having
changed. We can eliminate this behavior by resetting the
hasCheckedMetaBuild state attribute to false and skipping the
checkBuildSources step if the current command is 'reload'. We also now
skip checking the build source step if the command is exit or reboot.
2019-08-05 07:42:24 -07:00
Alexandre Archambault ab55269e63
Fix 2.0.0-RC3 regression (#113)
Disable classpath ordering of JARs for now

New coursier 2.0.0-RC3 feature, maybe enabled too early here.
2019-08-05 16:03:09 +02:00
eugene yokota d6b8e0388c
Merge pull request #4928 from eed3si9n/wip/ivy-settings-b
Remove ivy-settings-b scripted test
2019-08-05 01:26:48 -04:00
Eugene Yokota 54b6e1fc08 Remove ivy-settings-b scripted test 2019-08-05 00:24:44 -04:00
Alexandre Archambault aa53418218
Switch to coursier 2.0.0-RC3-1 (#108) 2019-08-03 17:25:30 +02:00
Dale Wijnand 030b6e8283
Fix typo in no-new-issues.md 2019-08-03 08:33:10 +01:00
Dale Wijnand 458ddd0e94
Update no-new-issues.md 2019-08-03 08:32:45 +01:00
Dale Wijnand 01e9cfee02
Merge pull request #278 from sbt/no-new-issues-template
No new issues template
2019-08-03 08:32:10 +01:00
Dale Wijnand 796e5d6ef8 Update issue templates 2019-08-03 08:31:38 +01:00
eugene yokota b0368cf320
Merge pull request #4924 from eed3si9n/wip/launcher
launcher 1.1.1
2019-08-02 17:31:29 -04:00
Eugene Yokota 1df9020249 launcher 1.1.1 2019-08-02 15:56:59 -04:00
Eugene Yokota fcc8b61011 use head -1
SDKMAN lists the latest one first.
2019-08-01 17:47:38 -04:00
eugene yokota f0b54ca3a0
Merge pull request #4910 from eatkins/coursier-cache
Add coursier cache to CI
2019-08-01 16:21:19 -04:00
Eugene Yokota c89695b4b2 Deprecate HTTP resolvers
Ref https://github.com/sbt/sbt/issues/4905
2019-08-01 16:20:22 -04:00
Ethan Atkins 4cee23043a Bump scalafmt
The latest version may fix some issues with concurrent builds running
scalafmt: https://github.com/scalameta/scalafmt/issues/1399.
2019-08-01 11:57:29 -07:00
Ethan Atkins ec281d8a14 Add coursier cache to CI
These locations are taken from https://get-coursier.io/docs/cache.
2019-08-01 11:57:29 -07:00
eugene yokota 96d6e0d52a
Merge pull request #4899 from eatkins/watch-symlink-scripted
Add scripted test for symlink source monitoring
2019-07-30 17:39:27 -04:00