Commit Graph

7382 Commits

Author SHA1 Message Date
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
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
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 f0b54ca3a0
Merge pull request #4910 from eatkins/coursier-cache
Add coursier cache to CI
2019-08-01 16:21:19 -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
eugene yokota 20f46370ca
Merge pull request #4908 from eatkins/incremental-consistency
Override zinc compile analysis for source changes
2019-07-30 17:38:35 -04:00
Ethan Atkins 411c9fa8c7
Merge pull request #4904 from eatkins/parser-fix
Parser fix
2019-07-29 23:11:33 -07:00
Ethan Atkins 556a9384f3
Merge branch 'develop' into parser-fix 2019-07-29 21:57:44 -07:00
Ethan Atkins 4061dabf4d Override zinc compile analysis for source changes
Zinc records all of the compile source file hashes when compilation
completes. This is problematic because its possible that a source file
was changed during compilation. From the user perspective, this may mean
that their source change will not be recompiled even if a build is
triggered by the change.

To overcome this, I add logic in the sbt provided external hooks to
override the zinc analysis stamps. This is done by writing the source
file stamps to the previous cache after compilation completes. This
allows us to see the source differences from sbt's perspective, rather
than zinc's perspective. We then merge the combined differences in the
actual implementation of ExternalHooks. In some cases this may result in
over-compilation but generally over-compilation is preferred to under
compilation. Most of the time, the results should be the same.

The scripted test that I added modifies a file during compilation by
invoking a macro. It then effectively asserts that the file is
recompiled during the next test run by validating the compilation result
in the test. The test fails on the latest develop hash.
2019-07-29 20:13:41 -07:00
Ethan Atkins bbd88e04dc Add scripted test for symlink source monitoring
The swoval library automatically watches the _target_ of symlinks. I had
been meaning to add a scripted test to ensure that in sbt continuous
builds detect changes to the target of symlinks. The naive approach of
just watching all of the files in the source directory doesn't work
because the native watch process will just watch the symlink node itself
and not detect updates to its target. This test would have thus failed
with 1.2.8.

Watching symlinked files doesn't work at the moment on windows, but does
work on mac and linux. Eventually I'd like there to be feature parity,
but, for now, we'll just skip the file target test on windows. At least
this test makes it explicit what does and doesn't work on each platform.
2019-07-29 14:26:28 -07:00
eugene yokota 349d365bab
Merge pull request #4907 from eatkins/sbt-build-resource-generators
Sbt build resource generators
2019-07-29 17:04:21 -04:00
eugene yokota 5b0d0122af
Merge pull request #4906 from eatkins/turbo-resource-loader
Turbo resource loader
2019-07-29 16:21:17 -04:00
eugene yokota 85ab138187
Merge pull request #4901 from eatkins/no-exception-reload
Don't use exception for reloading
2019-07-29 16:08:16 -04:00
Ethan Atkins 9896f77012 Fix typo 2019-07-29 12:45:22 -07:00
Ethan Atkins 893f120dee Don't rewrite RunFromSource.classpath every time
In the sbt project, we often spuriously re-doc a number of projects that
haven't changed because we modify a file in the resource path.
2019-07-29 12:44:20 -07:00
Ethan Atkins 6686e833b1 Sort dependency jars
I realized that it would be a good idea to sort the dependencyJars so
that they appear in the same order that they do in the fullClasspath.
2019-07-29 12:30:42 -07:00
Ethan Atkins 621789eeb2 Remove resource layer for AllDependencyJars strategy
Changed resources were causing the dependency layer to be invalidated on
resource changes in turbo mode because the resource layer was in between
the scala library layer. This commit reworks the layers for the
AllDependencyJars strategy so that the top layer is able to load _all_
of the resources during a test run.

The resource layer was added to address the problem that dependencies
may need to be able to load resources from the project classpath but
wouldn't be able to do so if the dependencies were in a separate layer
from the rest of the classpath. The resource layer was a classloader
that could load any resource on the full classpath but couldn't load any
classes. When I added the resource layer, I was thinking that when
resources changed, the resource class loader needed to be invalidated.
Resources, however, are different from classes in that the same
ClassLoader can find the same resources in a different place because
getResource and getResourceAsStream just return locations but do not
actually do any loading.

Taking advantage of this, I add a proxy classloader for finding
resource locations to ReverseLookupClassLoader. We can reset the
classpath of the resource loader in
ReverseLookupClassLoaderHolder.checkout. This allows us to see the new
versions of the resources without invalidating the dependency layer.
2019-07-29 12:30:42 -07:00
Ethan Atkins be489e05ca Clear expired loaders
Sometimes turbo mode didn't work correctly for projects where resources
were modified. This was because it was possible for the resource
classloader to inadvertently evict the dependency classloader from the
classloader cache because they had the same file stamps. There were two
fixes:
1) remove expired entries from the cache based on the
    (Parent, Classpath) pair rather than just classpath
2) do not close the classloaders during cache eviction. They may still
   be in use when we evict them so we need to wait until they are
   explicitly closed elsewhere or until the go out of scope and are
   collected by the CleanupThread

I tested this change with a spark project in which I kept modifying the
resources. Prior to this change, I could get into a state where if I
modified the resources, the dependency layer would get evicted every
time so the benefits of turbo mode were not realized.
2019-07-29 12:30:42 -07:00
Ethan Atkins c7ec97d18f Rework multi parser to exclude 'alias'
There have been numerous issues with the multi parser incorrectly
splitting commands like `alias foo = ; bar` into
`"alias foo =" :: "bar" :: Nil`. To fix this, I update the multi parser
implementation to accept a list of commands that cannot be part of a
multi command. For now, the only excluded command is "alias", but if
other issues come up, we can add more. I also thought about adding a
system property for excluding more commands but it didn't seem worth the
maintenance cost at this point.

In addition to adding a filter for the excluded commands, I also
reworked the multi parser so that I think its more clear (and should
hopefully have more predictable performance). I changed the cmdPart
parser to accept empty strings. Prior to this, the parser explicitly
handled the non-leading semicolon and leading semicolon cases
separately. With the relaxed cmdPart, we can handle both cases with a
single parser. We just have to strip any empty commands at the beginning
or end of the command list.
2019-07-28 12:35:13 -07:00
Ethan Atkins 196318e619 Fix multi parser performance regression
It was reported in https://github.com/sbt/sbt/issues/4890 that cosmetic
white space could cause problems for the paser. I tracked this down to
primarily being because of the
`val semi = token(OptSpace ~> ';' ~> OptSpace)` line. This would cause
excessive backtracking. I added a test for a multi line command with a
lot of cosmetic whitespace that was adapted from #4890 except that I
made it even more taxing by running adding 100 commands instead of the
roughly 10 in the report. Before the parser changes, the test would
more or less block indefinitely. I never saw it successfully complete.
After these changes, it completes in 30-50ms (which drops to about 2-3
ms if the number of commands is dropped from 100 to 3).

I verified manually in a different project that a number of different
multi command completions still worked. In particular, I tested that
`~foo/test; foo/tes` would expand to `~foo/test; foo/test` which is one
of the hardest cases to get right.

I also added a few extra test cases for the parser since I wasn't sure
what the impact of removing the OptSpace ~> from the semi parser would
be.
2019-07-28 12:35:03 -07:00
Ethan Atkins f5c8b8aad5 Don't use exception for reloading
I completely forgot about the StateTransform class which allows a task
to modify the state through its return value.
2019-07-26 15:03:32 -07:00
eugene yokota e3e2f29bdd
Merge pull request #4898 from eatkins/underscore
Use '_' instead of '$' in path names
2019-07-26 15:12:01 -04:00
Ethan Atkins f7f6c3edfe Use '_' instead of '$' in path names
The use of '$' in the path names for streams is a pain because, since
'$' is a special character in the shell, it makes it impossible to
directly copy and paste the paths. If we make this change, some builds
will be left with vestigial directories with $global and $build in them
until they run clean. It also would break any scripts that manually
delete these paths. That doesn't seem like a common use case, but it's
worth mentioning.
2019-07-25 14:07:44 -07:00
eugene yokota 646e408adb
Merge pull request #4894 from eed3si9n/wip/zipping
Fix java.util.zip.ZipException: duplicate entry
2019-07-23 10:19:40 -04:00
Eugene Yokota 9512a60fa6 Fix java.util.zip.ZipException: duplicate entry
Fixes #4889

#4329 switched from using Map to Seq during packaging. That allowed multiple files to be included with different paths, but it also started admitting duplicate files causing ZipException.
2019-07-23 01:28:32 -04:00
eugene yokota 8793034039
Merge pull request #4884 from naferx/msg
Minor clarification of logging message
2019-07-19 18:56:20 -04:00
Nafer Sanabria 3f3d7d47e3 Minor clarification of logging message 2019-07-19 06:01:15 -05:00
eugene yokota c76649024e
Merge pull request #4885 from eed3si9n/wip/creds
Fixes credential strictness
2019-07-18 22:43:47 -04:00
Eugene Yokota ef05e07cc5 Fixes credential strictness
Fixes #4882

In #4855 I inadvertently introduced `credential` strictness. This makes relaxes it again by ignoring if the credential file doesn't exist.
2019-07-18 18:30:30 -04:00
eugene yokota e1c7704e6c
Merge pull request #4876 from eatkins/bump-scalafmt
Bump scalafmt
2019-07-18 16:05:01 -04:00
Ethan Atkins a3ac4c76a6 Bump scalafmt
Intellij had issues resolving 2.0.0-RCX so it will be nice to be using
the latest.
2019-07-18 12:40:21 -07:00
eugene yokota 1ca295c2dc
Merge pull request #4877 from xuwei-k/oom-error-message
fix OutOfMemoryError message
2019-07-18 10:23:21 -04:00
eugene yokota abb72ce10d
Merge pull request #4874 from eatkins/drop-multi-command-validation
Don't validate multi commands
2019-07-17 23:40:17 -04:00
kenji yoshida 534fbfffbb
fix OutOfMemoryError message
s/werecommend/we recommend/
2019-07-18 12:05:46 +09:00
Ethan Atkins 125c4ba532 Don't validate multi commands
We tried to prevent users from doing something like running a multi
command "foo; bar" where foo is valid but bar is invalid so that we
wouldn't run foo only to discover bar was an invalid key. It isn't
possible to know in general if any command other than the first command
in a multi command is valid because it might update the state and add
the initially invalid command.

The validation caused the intellij plugin to not work with 1.3.0-RC3.
2019-07-17 19:27:07 -07:00
eugene yokota dd321da284
Merge pull request #4873 from eed3si9n/wip/useit
use sbt 1.3.0-RC3
2019-07-17 22:00:14 -04:00
Eugene Yokota 8bd1615e1f use sbt 1.3.0-RC3 2019-07-17 14:53:39 -04:00
eugene yokota 5c85ee572f
Merge pull request #4872 from eatkins/legacy-filters
Add scripted test for excludeFilter
2019-07-17 09:13:32 -04:00
Ethan Atkins 36f37d2fe3 Set linux compile options for make-clone
This scripted tests failed on the linux travis ci build with an
error around relocation. It said to use -fPIC in the compilation so
that's what I'm doing. It also said I needed to set the -std=c99 flag.
2019-07-16 22:18:45 -07:00
Ethan Atkins 995a1c6b8b Add nio tests to .travis.yml
These were inadvertently excluded when I refactored this file.
2019-07-16 20:48:07 -07:00
Ethan Atkins 1e1c92c57a Bump io version
This fixes the excludeFilter issue: #4868.
2019-07-16 20:35:44 -07:00
Ethan Atkins 69ed60653c Add scripted test for excludeFilter
It was reported in #4868 that exclueFilters didn't work correctly if
there was an || in the filter. This was an upstream issue in io, but
this commit adds a scripted test in sbt.
2019-07-16 20:35:44 -07:00
eugene yokota bf6814580c
Merge pull request #4871 from eatkins/relax-multi-parser
Relax strict commands
2019-07-16 22:18:04 -04:00
Ethan Atkins a93d9e77ad Relax strict commands
The recent changes to make the multi parser strict broke any multi
command, or alias, where the multi command contained a command or task
that was not yet defined, but was possibly added by reload. This was
reported as #4869. I had had to work around this issue in ScriptedTests
by running `reload` and `setUpScripted` separately instead of as a multi
command. This workaround doesn't work for aliasing boot, which has been
a recommended approach by Mark Harrah since 2011.

To fix this, I relax the strict parser. We don't require that the parser
be valid to create a multi command string. In the multiApplied state
transformation, however, we validate all of the commands up to 'reload'.
Since there is no way to validate any commands to the right of 'reload,
we optimistically allow those commands to run.

So long as there is no 'reload' in the multi commands, all of the
commands will be validated.
2019-07-16 15:17:21 -07:00