aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/util
Commit message (Collapse)AuthorAge
* tests: add TimestampGranularityUtilsGravatar laszlocsomor2018-03-13
| | | | | | | | | | | | | | Add a new test utility class TimestampGranularityUtils which offers methods to wait for the filesystem timestamp granularity to pass. Such waiting is necessary if a test asserts changes in a file's mtime or ctime. This is a follow-up to comments on https://github.com/bazelbuild/bazel/commit/a31e035fb42aa8db9fd248ef2ebd665a411053b8. PiperOrigin-RevId: 188847729
* tests: fix flaky RecursiveFSTraversalFunctionTestGravatar Laszlo Csomor2018-03-09
| | | | | | | | | | | | | | | | | | Fix the testTraversalOfGeneratedDirectory method in RecursiveFilesystemTraversalFunctionTest that was flaky on Windows. The fix is to wait so that changes to files in the InMemoryFileSystem will have observable effects on the file ctimes. Depends on https://github.com/bazelbuild/bazel/pull/4787 Fixes https://github.com/bazelbuild/bazel/issues/4755 Closes #4788. PiperOrigin-RevId: 188470080
* tests: fix flaky SkyframeAwareActionTestGravatar Laszlo Csomor2018-03-09
| | | | | | | | | | | | | Fix testCacheBypassingActionWithMtimeChangingInput in SkyframeAwareActionTest by ensuring that enough time elapses between file updates so their effects are observable on the file's ctime. Fixes https://github.com/bazelbuild/bazel/issues/4755 Closes #4787. PiperOrigin-RevId: 188458542
* Adding async proto or text logging utility class.Gravatar olaola2018-03-06
| | | | | | | WANT_LGTM=buchgr TESTED=unit tests, 500 runs per test RELNOTES: None PiperOrigin-RevId: 188093043
* Automated rollback of commit 96145511b34a2d7be834e3eb05927674e875c813.Gravatar janakr2018-03-05
| | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Fixed issue that led to rollback. RELNOTES: None *** Original change description *** Automated rollback of commit eee53d3a33dde441f7e7adaecde81ef2d3db7c1b. *** Reason for rollback *** breaks Blaze_CorpTest *** Original change description *** @AutoCodec ConfiguredTargetValue. PiperOrigin-RevId: 187869560
* Automated rollback of commit eee53d3a33dde441f7e7adaecde81ef2d3db7c1b.Gravatar dannark2018-03-04
| | | | | | | | | | | | *** Reason for rollback *** breaks Blaze_CorpTest *** Original change description *** @AutoCodec ConfiguredTargetValue. PiperOrigin-RevId: 187783702
* Optimize GC usage of iterating over all elements of GroupedLists when we ↵Gravatar shreyax2018-03-02
| | | | | | don't care about the group structure, and simplify the logic for prefetching old deps. PiperOrigin-RevId: 187681887
* @AutoCodec ConfiguredTargetValue.Gravatar cpeyser2018-03-02
| | | | PiperOrigin-RevId: 187635570
* Deletes CODEC fields now that they are no longer needed.Gravatar shahan2018-02-28
| | | | PiperOrigin-RevId: 187397314
* Add @AutoCodec to FileType and FileTypeSet.Gravatar mjhalupka2018-02-28
| | | | | | More strictly type the arguments for creating FileTypes. PiperOrigin-RevId: 187391336
* A couple quality-of-life improvements for Bazel devs, in response to an ↵Gravatar nharmata2018-02-23
| | | | | | | | | | email from philwo@. (i) Only have TimestampGranularityMonitor log the first file of relevance. This reduces log spam, especially in tests, while still maintaining useful information in the logs. (ii) Don't have ExternalFilesHelper log the fact that it encountered an external file when we're in a unit test or an integration test. Tests, especially bazel tests that use external repositories, tend to involve lots of "external" files. RELNOTES: None PiperOrigin-RevId: 186799176
* Pass ctime to the TimestampGranularityMonitorGravatar ulfjack2018-02-05
| | | | | | | | We're now using ctime to detect file changes, so the timestamp granularity monitor should as well. Unfortunately, we currently get nanosecond ctime from Linux, but then only return millis from FileStatus, so this doesn't change the accuracy of the monitor at all. PiperOrigin-RevId: 184536539
* Allow CustomCommandLine's mapFn to expand each object into multiple items.Gravatar tomlu2018-02-01
| | | | | | This is needed to migrate JavaCompileAction away from CustomMultiArgv. PiperOrigin-RevId: 184136486
* Add memory-efficient map for storing nested set -> digest.Gravatar tomlu2018-01-31
| | | | | | | | | Instead of using ConcurrentHashMap, we use a dead-simple open addressed hash hable with a giant byte array with 16-byte slots. We then read or write fingerprints straight into and out of the array, obviating the need to generate intermediate garbage. Locking mechanism is a read-write lock. This should be faster than full synchronisation for read-heavy loads. RELNOTES: None PiperOrigin-RevId: 184019301
* Allows @AutoCodec to use factory methods.Gravatar shahan2018-01-29
| | | | | | Generalizes @AutoCodec.Constructor to @AutoCodec.Instantiator. PiperOrigin-RevId: 183702768
* Fix bug where an was-inflight-and-is-about-to-be-done NodeEntry has ↵Gravatar nharmata2018-01-18
| | | | | | | | | | | | | | | | | | | | incomplete deps that need to be removed, and these deps are currently duplicated in the NodeEntry's newly requested deps GroupedList. Also add a fast-path to GroupedListHelper#remove(List<Object> elements, Set<E> toRemove) for the incredibly common case where toRemove is empty. This saves a wasteful O(elements.size()) scan over elements. This method is unconditionally called each time a SkyFunction restart causes us to add new direct deps (with elements=<the new direct deps> and toRemove=<unfinished direct deps>); in the case where there are a ton of new direct deps, this scan entails wasted cpu and gc churn. The bug only occurs in uncommon case that there are deps to remove. The bug has existed since GroupedList was first introduced into the codebase. In Skyframe-land, this is only observable in nokeep_going mode because in keep_going mode "we do not let SkyFunctions throw errors with missing deps" (quote from comment in AbstractParallelEvaluator). A Bazel-on-Skyframe-land example how this bug could occur in practice is PackageFunction's Skyframe hybrid globbing. If an io error is encountered during legacy globbing, the PackageFunction eagerly throws a SkyFunctionException but it has already requested the Skyframe GlobValue deps. RELNOTES: None PiperOrigin-RevId: 182403943
* Adds the @AutoCodec.Constructor annotation for selecting constructors.Gravatar shahan2018-01-03
| | | | | | Uses the constructor having the @AutoCodec.Constructor annotation to generate a codec (instead of choosing the first in source code). This annotation is required when a class has more than one constructor. PiperOrigin-RevId: 180685902
* @AutoCodec: Uses sun.misc.Unsafe to retrieve fields for serialization.Gravatar shahan2018-01-02
| | | | | | | | This is fast (profiles indicate a 9% penalty vs getters) and does not require getters. * Also adds a Marshaller for java.util.regex.Pattern. * Minor fixes for codecs that were broken by this change. PiperOrigin-RevId: 180619680
* Replaces some existing codecs with @AutoCodec.Gravatar Googler2017-12-22
| | | | PiperOrigin-RevId: 179931575
* Redo FileType to reduce generated garbage.Gravatar tomlu2017-12-22
| | | | | | | | | | | | | * Change FileType to no longer assume it operates on just the base name (it can now be given a full path). * Move the responsibility to specific classes (Artifact, Path, PathFragment) to decide how they want to offer up a string that includes the file name. * Flip the order in which users are expected to check Artifact type, from FileType#matches(Artifact) to Artifact#isFileType(FileType). This looks natural and should encourage developers to use efficient file type checking methods. * Change CppCompileAction to use the new API. RELNOTES: None PiperOrigin-RevId: 179903239
* Move msys path support into DependencySet, removing it from the general Path ↵Gravatar tomlu2017-12-14
| | | | | | | | system. This is the only place that should actually need it. PiperOrigin-RevId: 179054861
* Adds a codec for RegexFilter.Gravatar Googler2017-12-13
| | | | PiperOrigin-RevId: 178942449
* Add a static method GroupedList#numElements to allow to count the number of ↵Gravatar shreyax2017-11-29
| | | | | | deps from a compressed GroupedList without uncompressing it. Also some minor GC improvements. PiperOrigin-RevId: 177338852
* Remove useless abstractions in C++ rules after internal cleanupGravatar hlopko2017-11-24
| | | | | RELNOTES: PiperOrigin-RevId: 176844836
* Delete unused preconditions library.Gravatar tomlu2017-11-09
| | | | PiperOrigin-RevId: 175092923
* 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
* Make --workspace_status_command accept relative pathGravatar Yun Peng2017-10-25
| | | | | | | Fixed https://github.com/bazelbuild/bazel/issues/3962 Change-Id: I772a409f03b9cc2c0e69e4f51d8a7b95688138a4 PiperOrigin-RevId: 173374845
* Prepare Classpath reading for Java 9Gravatar cushon2017-10-06
| | | | PiperOrigin-RevId: 171180273
* Move the canonicalization of an option value to the option value itself.Gravatar ccalvarin2017-09-27
| | | | | | | Ideally, the canonical form we output from OptionUtils would be the same as for the command canonicalize-flags, but that must wait for dependencies to be cleaned up. Still, in the meantime, keep the --foo=1 normalization of --foo, and apply it to all other boolean flag values (t,true,yes,y, and false equivalents), so that the canoncalize-flags output is more canonical, even if it isn't using the --[no]foo form yet. RELNOTES: Boolean flag values will now get normalized to 1 or 0 in canonicalize-flags output. PiperOrigin-RevId: 170084599
* 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
* Allow alternate GroupedList constructor to be public, but add warnings ↵Gravatar shreyax2017-09-25
| | | | | | regarding the integrity of the structure to various operations. PiperOrigin-RevId: 169715233
* Fix bug in NetUtil caching.Gravatar felly2017-09-20
| | | | | | | Fixes #3586. RELNOTES: None. PiperOrigin-RevId: 169303481
* Throw away the confusing UnparsedOptionValueDescription name.Gravatar ccalvarin2017-09-18
| | | | | | | | | | | | | | We get UnparsedValues after ... parsing the options. So that doesn't make sense. What was meant was that it wasn't converted to the final value. In an effort to make this distinction more clear, this change will make the terminology more consistent. The `--foo=bar` step is "parsing" and the `bar -> Object` step is "converting" (it is, in fact, done by Converters). RELNOTES: None. PiperOrigin-RevId: 168852847
* Automatic code cleanup.Gravatar cushon2017-09-15
| | | | PiperOrigin-RevId: 168802886
* Only compute hostname once per server lifetimeGravatar hlopko2017-09-14
| | | | | | | | | | | | NetUtil.getShortHostName can take seconds on mac and on windows (like, 20!), since it performs reverse dns lookup. We already cached hostname for the BazelWorkspaceStatusModule, let's cache it for entire bazel server. Also make sure that users of the method understand it's cached. Fixes #3586. RELNOTES: None. PiperOrigin-RevId: 168691615
* Consolidate the "unparsed" option value tracking.Gravatar ccalvarin2017-09-14
| | | | | | | In preparation for linking the parsed and unparsed values of options, consolidate and standardize our representation of the flag values as we received them (what is meant by "unparsed" values in this case). This was being done separately in ParseOptionResult, which, with extra context added, is being folded into UnparsedOptionValueDescription. We now track how an option was provided and where it came from for all option parsing. RELNOTES: None. PiperOrigin-RevId: 168682082
* Move option value tracking classes to their own file.Gravatar ccalvarin2017-09-13
| | | | | | | These classes are mostly used during the options parsing process itself, and are barely a part of the options parser interface, so they really don't belong in OptionsParser.java. They are also about to change significantly, so taking this opportunity to split them out. RELNOTES: None. PiperOrigin-RevId: 168400162
* 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
* Rewrite all code to use the new Java 8 java.time classes.Gravatar Philipp Wollermann2017-09-05
| | | | | | | This removes our dependency on third_party/joda_time, which can be removed in the next commit. Change-Id: Ibda131d34d0abdc2d675db4bfbd2e99480c055ee PiperOrigin-RevId: 167515260
* Rename all logger instances to "logger" (instead "LOG" or "log").Gravatar lberki2017-09-05
| | | | | RELNOTES: None. PiperOrigin-RevId: 167505493
* CommandBuilder.java: Don't quote the last argument when passing Windows ↵Gravatar pcloudy2017-08-18
| | | | | | | | | command to CMD.EXE. Fix https://github.com/bazelbuild/bazel/issues/2040#issuecomment-322980147 RELNOTES: None PiperOrigin-RevId: 165562681
* Make the print function output debug messagesGravatar vladmos2017-08-11
| | | | | RELNOTES: The `print` function now prints debug messages instead of warnings. PiperOrigin-RevId: 164880003
* Merge handleOptions into beforeCommandGravatar ulfjack2017-07-17
| | | | | | | Now that we have the options before calling beforeCommand, there's no need for a separate handleOptions method in the BlazeModule API. Remove it. PiperOrigin-RevId: 162002300
* Windows, JNI: move around sourcesGravatar Laszlo Csomor2017-07-03
| | | | | | | | | | | | | | | | | | | | | | | | Move the Java JNI sources to a separate package: c.g.devtools.build.lib.windows.jni and c.g.devtools.build.lib.windows.runfiles. Make the native method declarations private, create public wrapper methods for them that ensure that the JNI library is loaded. Split the C++ JNI source processes.cc into two parts (processes-jni.cc and file-jni.cc), extract common functionality to jni-util.{h,cc}. This change preparse the code for Android rule support on Windows, specifically it lets the Android BusyBox use the file JNI library so it can create junctions on Windows to work around long path issues when calling external tools. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: I7f1a746d73f822ae419d11b893a91f4eb45d64da PiperOrigin-RevId: 160643355
* Automated conversion to Java 8Gravatar laurentlb2017-06-30
| | | | | | | With a few manual fixes for readability. RELNOTES: None. PiperOrigin-RevId: 160582556
* Extract the ansi color escape sequences to an enumGravatar Ulf Adams2017-06-19
| | | | | | | | | | I want to make the color scheme configurable, which requires an abstraction to represent color, so it can be looked up / stored in a map / etc. Closes #2487. Change-Id: I2f8bd0dd19ecd6a243ac9b7acc7be52e59c90021 PiperOrigin-RevId: 159426774
* Rewrite StandaloneSpawnStrategy to use LocalSpawnRunnerGravatar ulfjack2017-06-19
| | | | PiperOrigin-RevId: 159221067
* Also filter stderr when parse_showincludes feature is enabledGravatar Yun Peng2017-06-13
| | | | | | | | | | On Windows, cl.exe generates include information to stdout. But when using the cuda compiler(nvcc.exe) to invoke cl.exe, it's redirected to stderr. So we need to parse the output of stderr as well. Change-Id: I9a763a6eefa531932bf1077ef4155f6bda934240 PiperOrigin-RevId: 158842448
* Internally track changes to stdout / stderr files, so we can avoid ↵Gravatar felly2017-06-07
| | | | | | filesystem operations to check whether they've been written. In the common case, they haven't, and we can avoid checking that. PiperOrigin-RevId: 158172182
* Add exit codes for remote errors to ExitCodeGravatar ulfjack2017-06-06
| | | | | | | These values are already used inside Google with specific semantics, so we have to use these exact values (for now). PiperOrigin-RevId: 158127273