aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/util
Commit message (Collapse)AuthorAge
* 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
* BES: Introduce PUBLISH_ERROR exit code.Gravatar buchgr2017-05-12
| | | | | | | | When uploading of the BES protocol fails, bazel exits with ExitCode.PUBLISH_ERROR. RELNOTES: None. PiperOrigin-RevId: 155856981
* Parse /showIncludes output for MSVC compilerGravatar Yun Peng2017-04-25
| | | | | | | | Instead of parsing .d file generated by wrapper script, we directly parse the output of /showIncludes option. Change-Id: Id94e20a5cb05a494a793fd6a43756d44d27cea8a PiperOrigin-RevId: 154161939
* Add explicit names to the sandboxing strategies so that they can beGravatar philwo2017-04-24
| | | | | | | | | | | selected even if they're not the preferred one on a platform. Simplify the SandboxActionContextProvider and remove the warning about sandboxing being unsupported. With the ProcessWrapperSandboxedStrategy now being reliable enough and the strategies printing their real name in the UI, this is overall a better UX. PiperOrigin-RevId: 153825986
* Add a custom single-line formatter for java.log.Gravatar schmitt2017-04-13
| | | | | | | | This logger makes it easier to parse log statements and is now enabled for Bazel's java.log. RELNOTES[INC]: Bazel now prints logs in single lines to java.log PiperOrigin-RevId: 152954337
* Allow constructing a dependency group with an initial capacity in ↵Gravatar Googler2017-04-11
| | | | | | | GroupedListHelper RELNOTES: None PiperOrigin-RevId: 152687516
* Add "aarch64" to the set of ARM CPU archsGravatar Daniel Trebbien2017-04-07
| | | | | | | | | | | | | This change, suggested by @tylerfox at https://github.com/tensorflow/tensorflow/issues/851#issuecomment-230810921 allows Bazel 0.4.5 to be built on a Jetson TX1 with JetPack 3.0. The other of @tylerfox's suggested changes was made in 7c4afb6. Refs #1264 Closes #2703. PiperOrigin-RevId: 152498304
* Fix "enums should only have immutable fields, 'Set' is mutable" in CPU.java.Gravatar philwo2017-04-07
| | | | PiperOrigin-RevId: 152491822
* Do not trample the PersistentMap journalGravatar Benjamin Peterson2017-04-07
| | | | | | | | | | | | | | | This fixes https://github.com/bazelbuild/bazel/issues/2660. Basically, if we elect to keep the journal during PersistentMap.save(), we shouldn't stomp over it the next time save() is called. In writeJournal(), we now check if the journal file exists, and open it in append mode if it does. Alternatively, we could simply not close (and thus forget about) the journal in save(), but that would leak the journal file handle if save() was never called with keepJournal() returning false. Change-Id: Id00732f161c8b5a082a6c109aee115591ace2ea7 PiperOrigin-RevId: 152480978
* 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
* Suffix fingerprint of iterable with lengthGravatar michajlo2017-03-31
| | | | | | | This should be morally equivalent to prefixing, with the benefit that we won't prematurely expand NestedSets (not cheap) to get the length. PiperOrigin-RevId: 151721361
* Add new utility function to encode options as argument list Gravatar Klaus Aehlig2017-03-23
| | | | | | | | | | | ...in a way preserving the list structure and without escaping. In other words, return the options as needed for an execve(3) call. -- Change-Id: Ifb168d2e720392fb3a97d557960e0c1f1a83f543 Reviewed-on: https://cr.bazel.build/9458 PiperOrigin-RevId: 151019830 MOS_MIGRATED_REVID=151019830
* Make the spell checker a bit more conservative.Gravatar Laurent Le Brun2017-03-21
| | | | | | | | | Reduce the max spell-checking distance for matching words. "target" will not match "range" anymore. -- PiperOrigin-RevId: 150638073 MOS_MIGRATED_REVID=150638073
* Add a new command "bazel license" that prints the license files of Bazel and ↵Gravatar Philipp Wollermann2017-03-20
| | | | | | | | all embedded open-source components. -- PiperOrigin-RevId: 150435047 MOS_MIGRATED_REVID=150435047
* Global cleanup change.Gravatar Googler2017-03-14
| | | | | | -- PiperOrigin-RevId: 150052074 MOS_MIGRATED_REVID=150052074
* Remove usage of SynchronizedBatchCallback findTargetsBeneathDirectoryAsync; ↵Gravatar Nathan Harmata2017-03-12
| | | | | | | | | | by design, the callback passed in there is thread safe. A previous change accidentally introduced this unnecessary synchronization. Also move SynchronizedBatchCallback to the file with its only current usage. -- PiperOrigin-RevId: 149809083 MOS_MIGRATED_REVID=149809083