aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/vfs
Commit message (Collapse)AuthorAge
* Remove Root#getCodec, to bring Root in line with general style for codecGravatar cpeyser2018-02-02
| | | | | | declaration. PiperOrigin-RevId: 184304653
* Rephrase RootCodec as an InjectingObjectCodec.Gravatar cpeyser2018-01-29
| | | | PiperOrigin-RevId: 183677348
* Fix usages of PathFragment segments that will become inefficient.Gravatar tomlu2018-01-19
| | | | | | | An upcoming replacement to PathFragment will not have efficient segment semantics, causing code to become unnecessarily inefficient. RELNOTES: None PiperOrigin-RevId: 182553098
* Inline rarely used PathFragment methods that do not deserve to be on a core ↵Gravatar tomlu2018-01-19
| | | | | | path class. PiperOrigin-RevId: 182526427
* Add absolute root concept.Gravatar tomlu2018-01-18
| | | | | | | | An absolute root accepts any absolute path fragments and simply returns it. This concept replaces the FileSystem root directory concept. PiperOrigin-RevId: 182400471
* Introduce Root class.Gravatar tomlu2018-01-17
| | | | | | | | | | | This class represents a root (such as a package path or an output root) used for file lookups and artifacts. It is meant to be as opaque as possible in order to hide the user's environment from sky keys and sky functions. Roots are used by RootedPaths and ArtifactRoots. This CL attempts to make the minimum number of modifications necessary to change RootedPath and ArtifactRoot to use these fields. Deprecated methods and invasive accessors are permitted to minimise the risk of any observable changes. RELNOTES: None PiperOrigin-RevId: 182271759
* Remove trivial instances of FileSystem#getRootDirectory from testing code.Gravatar tomlu2018-01-11
| | | | PiperOrigin-RevId: 181686136
* Adds a CODEC for CppConfiguration.Gravatar shahan2018-01-10
| | | | | | | * Creates an enum for cpu transformer, which is easier to serialize than an opaque function. This also means moving FakeCPU to avoid introducing a circular dependency. * Adds a CODEC to Path using InjectingObjectCodec. PiperOrigin-RevId: 181445911
* Automated rollback of commit cb7689404ef9a69488d64bfc2e0bfb9326e664d6.Gravatar tomlu2018-01-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Rolling forward after the underlying issue has been fixed. *** Original change description *** Automated rollback of commit 6a54339bb943702bd7dffc43f85267dac98dc355. *** Reason for rollback *** b/71442447 *** Original change description *** Call through to Path#createDirectoryAndParents from FileUtils. This CL removes a method that due to its implementation causes threading difficulties for Path#createDirectory. The tests for the method are brought across to FileSystemTests since the methods are now implemented natively by the FileSystem classes. The tests were also cleaned up. The test revealed an edge c... *** PiperOrigin-RevId: 181367850
* Automated rollback of commit 6a54339bb943702bd7dffc43f85267dac98dc355.Gravatar tomlu2018-01-05
| | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** b/71442447 *** Original change description *** Call through to Path#createDirectoryAndParents from FileUtils. This CL removes a method that due to its implementation causes threading difficulties for Path#createDirectory. The tests for the method are brought across to FileSystemTests since the methods are now implemented natively by the FileSystem classes. The tests were also cleaned up. The test revealed an edge case bug in JavaIoFileSystem, so fix this. In two cases some code was using the return value from the old method. Returning "f... *** ROLLBACK_OF=179864042 PiperOrigin-RevId: 180946251
* Remove support for Windows relative-to-current-drive paths.Gravatar tomlu2018-01-05
| | | | | | Eg. 'C:foo' was previously "the directory 'foo' relative to the current directory of drive 'C:\'". Now it is simple interpreted as "the relative path fragment 'C:foo'". PiperOrigin-RevId: 180936012
* Call through to Path#createDirectoryAndParents from FileUtils.Gravatar tomlu2017-12-21
| | | | | | | | | | | | This CL removes a method that due to its implementation causes threading difficulties for Path#createDirectory. The tests for the method are brought across to FileSystemTests since the methods are now implemented natively by the FileSystem classes. The tests were also cleaned up. The test revealed an edge case bug in JavaIoFileSystem, so fix this. In two cases some code was using the return value from the old method. Returning "false" essentially means that the directory already existed, and the code doesn't look racy, so we can replace it with an existence check. PiperOrigin-RevId: 179864042
* Add FileSystem#createDirectoryAndParents.Gravatar tomlu2017-12-21
| | | | | | | | A native implementation of this (instead of using FileSystemUtils, which can only use public interfaces) should be more efficient and more easy to make correct. In particular, it should allow removing FileSystemUtils#createDirectoriesAndParents, which has poor thread safety characteristics. The latter method has a lot of logic that forces certain unnatural atomicity guarantees on createDirectory, and it also has logic that is conditional on sub-string content of exception messages. PiperOrigin-RevId: 179819623
* Makes PathFragment have internal CODEC definition.Gravatar Googler2017-12-19
| | | | PiperOrigin-RevId: 179588512
* Add regression test for JavaIoFileSystem#createDirectory.Gravatar tomlu2017-12-19
| | | | PiperOrigin-RevId: 179584358
* Automated rollback of commit 82e68b75304438c96ff878a0c2b8d18b42002486.Gravatar aehlig2017-12-19
| | | | | | | | | | | | | | Fixes #4322, #4306. *** Reason for rollback *** Introduces a deadlock (see https://github.com/bazelbuild/bazel/issues/4322) *** Original change description *** Make FileSystem operate on LocalPath instead of Path. PiperOrigin-RevId: 179549866
* Make FileSystem operate on LocalPath instead of Path.Gravatar tomlu2017-12-14
| | | | PiperOrigin-RevId: 179082062
* Add a new file path type, LocalPath.Gravatar tomlu2017-12-12
| | | | | | | | This path type is a local file path as a wrapper around a string. It works much the same as java.io.File, but without its file operations. For the most part, FilePath shouldn't add much overhead compared to using plain strings. Strings do get normalised on the way in, but no extra objects are allocated unless the path actually needs normalisation. PiperOrigin-RevId: 178798497
* Thread filesystem through codebase.Gravatar tomlu2017-12-08
| | | | | RELNOTES: None PiperOrigin-RevId: 178426166
* Remove some unused extension points.Gravatar Googler2017-11-29
| | | | | RELNOTES: None. PiperOrigin-RevId: 177326265
* Replace all usages of Blaze's Preconditions class with guava.Gravatar tomlu2017-11-09
| | | | | | | | Blaze had its own class to avoid GC from varargs array creation for the precondition happy path. Guava now (mostly) implements these, making it unnecessary to maintain our own. This change was almost entirely automated by search-and-replace. A few BUILD files needed fixing up since I removed an export of preconditions from lib:util, which was all done by add_deps. There was one incorrect usage of Preconditions that was caught by error prone (which checks Guava's version of Preconditions) that I had to change manually. PiperOrigin-RevId: 175033526
* Change FileSystem#getDirectoryEntries to return strings of the ↵Gravatar tomlu2017-10-23
| | | | | | | | file/directory names instead of paths. This is a small isolated change that can be done ahead of the big refactoring. PiperOrigin-RevId: 173124518
* Fix UnionFileSystem's implementation of supportsModifications and friends.Gravatar tomlu2017-10-23
| | | | | | It now correctly delegates to the right file system. PiperOrigin-RevId: 172916854
* Remove scope escaping capability from InMemoryFileSystem.Gravatar tomlu2017-10-23
| | | | | | | | Nobody sets a delegate anymore, meaning it should be fine to crash hard if we try to resolve a file outside scope. The CL was created by inlining ScopeEscapableFileSystem into InMemoryFileSystem, making it impossible to return an outOfScope file status (instead throwing an exception), then trivially fixing the code. PiperOrigin-RevId: 172886769
* Add Path argument to supportsModifications, supports*LinksNatively.Gravatar tomlu2017-10-20
| | | | | | | | This works better with UnionFileSystem, as (eg.) different mapped file systems might not agree on whether they are read-only. No actual code changes have been made that actually uses this argument, so this should be a behaviour no-op. PiperOrigin-RevId: 172782759
* Add follow-symlinks parameter to FileSystemUtils#copyTreesBelow, so that all ↵Gravatar janakr2017-10-12
| | | | | | the tool setup we do in tests doesn't necessarily have to be copied if we copy a workspace over. PiperOrigin-RevId: 171864170
* Make Fdo use straight zip files, delete ZipFileSystem.Gravatar tomlu2017-10-06
| | | | PiperOrigin-RevId: 171221156
* Make UnionFileSystem accept all paths Bazel can throw at it.Gravatar ccalvarin2017-09-27
| | | | | | | | | Instead of relying on a character-by-character StringTrie, segment paths based on PathFragments. This means UnionFS can accept any path that Bazel stores internally, removing the ASCII limitations. This also means removing the ability to have a filesystem bound for sub-PathFragments, /foo/barbar, /foo/barqux could have the same filesystem bound at /foo/bar. This feature was tested for when a use case was envisioned, but it was never used, so removing it is safe. RELNOTES: None. PiperOrigin-RevId: 170054656
* bep: Properly URI encode file pathsGravatar buchgr2017-09-14
| | | | | | RELNOTES: The Build Event Protocol's File.uri field is now properly encoded according to RFC2396. PiperOrigin-RevId: 168674865
* More BUILD file refactorings.Gravatar philwo2017-09-06
| | | | | | | | | Split collect, concurrent, vfs, windows into package-level BUILD files. Move clock classes out of "util", into their own Java package. Move CompactHashSet into its own Java package to break a dependency cycle. Give nestedset and inmemoryfs their own package-level BUILD files. PiperOrigin-RevId: 167702127
* Allow "[", "]", "{", and "}" in globs in BUILD files. (#3048)Gravatar Jonathan Bluett-Duncan2017-06-22
| | | | | | | | | | | | PR #2679 allowed parentheses ("(" and ")") in globs, but other bracket style characters were not allowed at the time. It was decided in issues #2583 and #3048 that other bracket characters should be allowed as well, since there is no apparent historical reason for disallowing them in the first place. Closes #3166. PiperOrigin-RevId: 159691498
* Adding support for SHA256 for remote execution. Switch remote execution to useGravatar olaola2017-06-20
| | | | | | | | | the currently defined hash function for blobs. Some refactoring. Adding an option to set the hash function in the remote worker, defaulting to the current behavior (unfortunately it is a build option, have not found a clean way to specify it at runtime). BUG=62622420 TESTED=remote worker RELNOTES: none PiperOrigin-RevId: 159473116
* Remove all imports of org.junit.Assert except for static imports of #fail().Gravatar lberki2017-06-01
| | | | | RELNOTES: None. PiperOrigin-RevId: 157685150
* Migrate Java tests to Truth.Gravatar lberki2017-05-30
| | | | | | RELNOTES: None. PiperOrigin-RevId: 157446717
* Fixes incorrectly-ordered arguments to calls to assertEqualsGravatar Googler2017-05-19
| | | | | | | | | | | | | | | [] This change has been automatically generated by an Error Prone check that detects incorrect argument ordering on calls to assertEquals-style methods. See [] Cleanup change automatically generated by javacflume/refactory Refactoring: third_party/java_src/error_prone/project/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects:AssertEqualsArgumentOrderChecker_refactoring Tested: TAP --sample for global presubmit queue [] PiperOrigin-RevId: 156539781
* Make PathFragment an abstract class.Gravatar nharmata2017-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are now four concrete implementations: RelativeUnixPathFragment, AbsoluteUnixPathFragment, RelativeWindowsPathFragment, AbsoluteWindowsPathFragment. Goals: -Reduce memory usage of PathFragment on non-Windows platforms while maintaining existing semantics. -Make a few simple performance improvements along the way. -Add TODOs for a few more simple performance improvements. -Open the way for reducing code complexity of PathFragment. All of the Windows-specific stuff ought not complicate the code so much. Non goals: -Make the entire codebase as pretty as possible wrt PathFragment & Windows. -Make PathFragment usage more sane in general (e.g. change semantics to ban coexistence of Windows and Unix PathFragments). -Optimize PathFragment as much as possible wrt memory or even in any other dimensions (e.g. gc churn, cpu). To elaborate, the primary motivation is per-instance memory usage of PathFragment on Unix platforms: Before this change ------------------ +UseCompressedOops --> 32 bytes per instance -UseCompressedOops --> 40 bytes per instance After this change ------------------ +UseCompressedOops --> 24 bytes per instance -UseCompressedOops --> 32 bytes per instance Since Bazel can retain lots of PathFragments, the memory savings of this CL are fairly large. RELNOTES: None PiperOrigin-RevId: 154052905
* Migrate UnixGlob to Path#statIfFound() instead of #statNullable(). The ↵Gravatar felly2017-04-18
| | | | | | | | | latter swallows all filesystem failures, and does not disambiguate missing files from filesystem problems. The syscall cache now tracks IOExceptions if they are present, just as it does with readdir(). RELNOTES: None PiperOrigin-RevId: 153185433
* Document the current confusing semantics of relative windows paths with ↵Gravatar nharmata2017-04-13
| | | | | | | drive letters. RELNOTES: None PiperOrigin-RevId: 152944088
* fix: Allow parentheses in glob patternsGravatar Harmandeep Kaur2017-04-11
| | | | | | | More info here #2583 Closes #2679. PiperOrigin-RevId: 152685327
* Refactor all ctor callsites of PathFragment to instead call a static ↵Gravatar nharmata2017-04-05
| | | | | | | | | | | | 'create' method. This paves the way for changing PathFragment to e.g. an abstract class with multiple subclasses. This way we can split out the windows-specific stuff into one of these concrete classes, making the code more readable and also saving memory (since the shallow heap size of the NonWindowsPathFragment subclass will hopefully be smaller than that of the current PathFragment). This also lets us pursue gc churn optimizations. We can now do interning in PathFragment#create and can also get rid of unnecessary intermediate PathFragment allocations. RELNOTES: None PiperOrigin-RevId: 152145768
* Move UnixFileSystem to lib.unix, WindowsFileSystem to lib.windowsGravatar Ulf Adams2017-02-28
| | | | | | -- PiperOrigin-RevId: 148749485 MOS_MIGRATED_REVID=148749485
* Windows: use JNI CreateJunction in Java code Gravatar Laszlo Csomor2017-02-15
| | | | | | | | | | | | | | | | Use the new CreateJunction in the Windows JNI code every time we need to create junctions. This means updating WindowsFileOperations and related tests. Add test for WindowsFileSystem.createSymbolicLink. See https://github.com/bazelbuild/bazel/issues/2238 -- Change-Id: I5827e2e70e8e147f5f102fabf95fa9a148b3bcdc Reviewed-on: https://cr.bazel.build/8896 PiperOrigin-RevId: 147598107 MOS_MIGRATED_REVID=147598107
* A minor refactoring of the way the test infrastructure gets the FileSystem ↵Gravatar Lukacs Berki2017-02-01
| | | | | | | | implementation for integration tests. -- PiperOrigin-RevId: 146114082 MOS_MIGRATED_REVID=146114082
* Windows: resolve shortened pathsGravatar Laszlo Csomor2017-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TL;DR: resolve "C:/progra~1" style paths, don't cache failed resolutions in the parent's Path.children When creating WindowsPath objects, resolve the "C:/progra~1" style paths to "C:/program files". This enables us to correctly compare paths on Windows. Without this canonicalization we incorrectly determine "C:/progra~1" and "C:/program files" to be different when they are actually the same. We only attempt to resolve such paths if the name looks like it's an abbreviated path. If resolution fails, probably due to the path not existing, then we don't cache this Path object in the parent's `children` list. This avoids stale cache entries in case the path springs into existence later in the server's lifetime. Fixes https://github.com/bazelbuild/bazel/issues/2145 We also need to rectify https://github.com/bazelbuild/bazel/issues/2173 -- PiperOrigin-RevId: 143442134 MOS_MIGRATED_REVID=143442134
* Bazel tests: fix j/c/g/.../lib:windows-testsGravatar Laszlo Csomor2016-12-21
| | | | | | -- PiperOrigin-RevId: 142664504 MOS_MIGRATED_REVID=142664504
* Windows, JNI: implement nativeGetLongPathGravatar Laszlo Csomor2016-12-15
| | | | | | | | | | | | | | | | | | | | Implement a JNI method that can resolve 8dot3 style paths. This is necessary because we need to be able to compare 8dot3 style paths and long paths [1], and because implementing this correctly in Java seems to be impossible [2]. This change also adds tests for the JNI isJunction implementation. See https://github.com/bazelbuild/bazel/issues/2101 [1] https://github.com/bazelbuild/bazel/issues/2145 [2] https://github.com/bazelbuild/bazel/issues/2145#issuecomment-266766716 -- PiperOrigin-RevId: 142123750 MOS_MIGRATED_REVID=142123750
* Bazel: make PathWindowsTest more robustGravatar Laszlo Csomor2016-11-22
| | | | | | | | | | | Also don't create "C:/first", tests don't really need it. Motivation: test failure in http://ci.bazel.io/job/bazel-tests/BAZEL_VERSION=HEAD,PLATFORM_NAME=linux-x86_64/331/console -- MOS_MIGRATED_REVID=139897644
* Windows: can now remove bazel-* symlinksGravatar Laszlo Csomor2016-11-04
| | | | | | | | | | | | | | | | | This change updates WindowsFileSystem so it: - retrieves the DosFileAttributes instead of the BasicFileAttributes, because the latter does not report junctions as directories - uses just isJunction to decide if a file is a symlink, doesn't look at whether it's a directory (again because java.nio.File also incorrectly reports junctions as non-directories) Fixes https://github.com/bazelbuild/bazel/issues/1850 -- MOS_MIGRATED_REVID=138187220
* Do not tickle TimestampGranularityMonitor for stable-status.txt no-op updates.Gravatar Julio Merino2016-11-03
| | | | | | | | | | | | | | | | | When rewriting stable-status.txt, which happens on each build, avoid updating the file's ctime and mtime if the new contents match what is already in the file. This prevents tickling the TimestampGranularityMonitor for what should be a no-op update, which in turn could cause null/incremental builds to stall for up to a second. The problem was magnified on macOS where the default HFS+ file system only has second-level granularity. (This also affects Linux, but because current Linux file systems have milli/nanosecond-level granularity, the wait imposed by TimestampGranularityMonitor is minimal and thus not generally noticeable.) -- MOS_MIGRATED_REVID=137983794
* VFS: PathFragment is no longer aware of MSYS pathsGravatar Laszlo Csomor2016-10-27
| | | | | | | | | | | | | PathFragment no longer parses "/c/foo" as "C:/foo" on Windows, but as a driveletter-less absolute path. If such a PathFragment is used in creating a Path object, the WindowsPath.translatePath method will translate it correctly. Fixes https://github.com/bazelbuild/bazel/issues/1994 -- MOS_MIGRATED_REVID=137283176