aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/cmdline
Commit message (Collapse)AuthorAge
* Set the version of a computed node to the max of its child versions rather ↵Gravatar janakr2018-07-11
| | | | | | | | | | | | | | | | | than the graph version when that is feasible. * It's not feasible when the computation accesses outside state, i.e. is non-hermetic, so see below. * It's also more complicated (and not worth the trouble) when the computation is taking place just for the error status. Have SkyFunctionName declare whether the function it corresponds to is hermetic or non-hermetic. Only non-hermetically-generated SkyValues can be directly marked changed, and non-hermetic SkyFunctions have their values saved at the graph version, not the max of the child versions. All SkyFunctions are hermetic except for the ones that can be explicitly dirtied. A marked-hermetic SkyFunction that has a transient error due to filesystem access can be re-evaluated and get the correct version: if it throws an IOException at version 1 and then, when re-evaluated at version 2 with unchanged dependencies, has a value, the version will be version 1. All Skyframe unit tests that were doing non-hermetic things to nodes need to declare that those nodes are non-hermetic. I tried to make the minimal set of changes there, so that we had good incidental coverage of hermetic+non-hermetic nodes. Also did some drive-by clean-ups around that code. Artifacts are a weird case, since they're doing untracked filesystem access (for source directories). Using max(child versions) for them gives rise to the following correctness bug: 1. do a build at v1 that creates a FileStateValue for dir/ at v1. Then at v2, add a file to dir/ and do a build that consumes dir/ as a source artifact. Now the artifact for dir/ will (incorrectly) have v1. Then at v1, do that build again. We'll consume the "artifact from the future". However, this can only have an effect when using the local action cache, since the incorrect value of the artifact (the mtime) is only consumed by the action cache. Bazel is already broken in this way (incremental builds don't invalidate directories), so this change doesn't make things worse. PiperOrigin-RevId: 204210719
* Rollback of ↵Gravatar twerth2018-07-04
| | | | | | | https://github.com/bazelbuild/bazel/commit/732dc512801c32207c252a76ca8d9e5544560339. RELNOTES: Allow @ in package names. PiperOrigin-RevId: 203270369
* Make RepositoryName comparison case-insensitive on WindowsGravatar pcloudy2018-07-02
| | | | | | | Fixed https://github.com/bazelbuild/bazel/issues/5485 RELNOTES: None PiperOrigin-RevId: 202903823
* Automated refactor of Label.parseAbsolute() to always pass a repository mappingGravatar dannark2018-06-27
| | | | | RELNOTES: None PiperOrigin-RevId: 202360925
* Enforce that repository mapping is never null (it can be empty).Gravatar dannark2018-06-26
| | | | | RELNOTES: None PiperOrigin-RevId: 202167782
* Remove Label.parseAbsolute(string, boolean). The goal is to get rid of all ↵Gravatar dannark2018-06-22
| | | | | | | label methods that don't explicitly pass a repository mapping. RELNOTES: None PiperOrigin-RevId: 201717665
* Automated rollback of commit 5a9befc5602e71f7512074c303afbdcff5617cca.Gravatar twerth2018-06-22
| | | | | | | | RELNOTES: None *** Reason for rollback *** PiperOrigin-RevId: 201686843
* Take into account repository mapping when processing labels inside BUILD ↵Gravatar dannark2018-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | files within external repositories. For example: a/BUILD genrule( name = "a", srcs = ["@x//:x.txt"], outs = ["result.txt"], cmd = "echo hello > \$(location result.txt)" ) If the main workspace file references that repository with a rule: local_repository( name = "other_repo", path = "../a", repo_mapping = {"@x" : "@y"} ) Then when a/BUILD is evaluated, the string "@x//:x.txt" will be turned into a Label "@y//:x.txt" RELNOTES: None PiperOrigin-RevId: 201562148
* Automated rollback of commit 2b015c53c89815472923d8ea0c94640b7db2fa20.Gravatar twerth2018-06-21
| | | | | | RELNOTES[NEW]: Allow @ in package names. PiperOrigin-RevId: 201487916
* Automated rollback of commit 1615da781db78b7a910daf89720189c2b2e73dbe.Gravatar Googler2018-06-14
| | | | | | *** Reason for rollback *** PiperOrigin-RevId: 200605975
* Allow @ in package names.Gravatar twerth2018-06-14
| | | | | | | | | | To disambiguate: - @foo refers to the external dependency @foo//:foo (as before this change). - //@foo refers to the target //@foo:@foo (i.e. in the default workspace). RELNOTES[NEW]: Allow @ in package names. PiperOrigin-RevId: 200541716
* Remap repository names inside load statements in BUILD files if the ↵Gravatar dannark2018-06-12
| | | | | | | | | | | | | | | | | | | repository name is remapped. For example if main/WORKSPACE contains: local_repository( name = "a", path = "../a", repo_mapping = {"@x" : "@y"}, ) a/BUILD load("@x//:sample.bzl", "sample") Then the load in a/BUILD will be resolved as "@y//:sample.bzl" RELNOTES: None PiperOrigin-RevId: 200227431
* Fix bug in skyframe-based test-suite expansionGravatar ulfjack2018-06-07
| | | | | | | | | | It was tracking filtered tests and then applying the filter at the next higher level. I also added a bunch of comments - we actually have four implementations of test suite expansion, and they are not consistent. Sorry about that. PiperOrigin-RevId: 199629485
* Fast-path Label#equals by first comparing the interned PackageIdentifier.Gravatar shreyax2018-06-02
| | | | PiperOrigin-RevId: 199007753
* Change TestSuiteExpansionValue to contain Labels instead of Targets.Gravatar cpeyser2018-05-15
| | | | PiperOrigin-RevId: 196719433
* Allow more characters in labels.Gravatar twerth2018-05-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Partly addresses #374. Specifically allow !%^`"'&;<>?[]{|} in target and package names. It's actually simpler now to declare what we don't allow. In target names: 0-31 (control characters) 58 ':' (colon) 92 '\' (backslash) 127 (delete) In package names: 0-31 (control characters) 58 ':' (colon) 64 '@' (at-sign) 92 '\' (backslash) 127 (delete) - '\' is a path segment separator on Windows, and allowing it can lead to silent output file conflicts and - therefore - data corruption. We may be able to allow it in the future, but I didn't want to make that call. - ':' is a special character that Bazel interprets as the package name / target name separator. - '@' in package names can probably be allowed; at the beginning of a label it indicates a workspace name, but not within a segment. We actually have some tests that disallow it specifically, but those can probably just be deleted; however, it does require a bit of investigation, so I decided to delay that change. It is possible that we don't correctly escape filenames in all cases. Also note that the shell may require escaping for specific characters, and that Bazel treats a single '*' (star) target name specially when given on the command line. RELNOTES: Bazel now allows almost all 7-bit ASCII characters in labels. PiperOrigin-RevId: 196650651
* Automated rollback of commit ca598fb9445627e9734c2900bc6b11430250d453.Gravatar dannark2018-04-10
| | | | | | | | | | | | | *** Reason for rollback *** breaks guitar tests *** Original change description *** Disallow labels of the form ////foo. RELNOTES: Labels of the form ////foo are disallowed. PiperOrigin-RevId: 192393660
* Disallow labels of the form ////foo.Gravatar carmi2018-04-10
| | | | | RELNOTES: Labels of the form ////foo are disallowed. PiperOrigin-RevId: 192329081
* @AutoCodec RepositoryName.Gravatar janakr2018-03-05
| | | | PiperOrigin-RevId: 187956593
* Serialize Path using AutoCodec.Gravatar janakr2018-03-05
| | | | PiperOrigin-RevId: 187945746
* Deletes CODEC fields now that they are no longer needed.Gravatar shahan2018-02-28
| | | | PiperOrigin-RevId: 187397314
* Move CommandLine, CommandLineItem, and ParamFileInfo from ↵Gravatar tomlu2018-02-15
| | | | | | | | | lib.analysis.actions -> lib.actions. These are fundamental types that want to sit alongside types like Spawn. RELNOTES: None PiperOrigin-RevId: 185887971
* Don't intern PathFragments when we create PackageIdentifiers. This should be ↵Gravatar shreyax2018-02-15
| | | | | | | | a strict win: There are only two places Canonicalizer did PathFragment interning: PackageIdentifier creation and Package creation. PackageIdentifiers are always interned by a separate interner, and so the underlying PathFragment will be in 1-1 correspondence with PackageIdentifiers (per repo). Moreover, Packages are created with a PackageIdentifier already existing, so it will use the same PathFragment of the unique PackageIdentifier. PiperOrigin-RevId: 185877942
* Use AutoCodec to generate CODECs for several provider types that are exportedGravatar cpeyser2018-02-14
| | | | | | by cc_library. PiperOrigin-RevId: 185729248
* Replaces InjectingObjectCodec with dependencies threaded through ↵Gravatar shahan2018-02-13
| | | | | | (Des|S)erializationContext. PiperOrigin-RevId: 185547740
* Remove label name interning.Gravatar tomlu2018-02-12
| | | | | | | | We already intern the labels themselves. Benchmarks do not show any further gain by interning the label names. RELNOTES: None PiperOrigin-RevId: 185394812
* Add context argument to ObjectCodec.{serialize,deserialize}Gravatar michajlo2018-02-11
| | | | | | | | | | Context implementations are currently empty, just doing the plumbing in this change. Once this is in we can start passing along the ObjectCodecRegistry, which will allow runtime codec resolution for classes not known at compile time. We'll also inevitably add some memoization helpers, allowing us to optimize the serialization process further. PiperOrigin-RevId: 185305674
* Replace path implementation.Gravatar tomlu2018-02-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Path and PathFragment have been replaced with String-based implementations. They are pretty similar, but each method is dissimilar enough that I did not feel sharing code was appropriate. A summary of changes: PATH ==== * Subsumes LocalPath (deleted, its tests repurposed) * Use a simple string to back Path * Path instances are no longer interned; Reference equality will no longer work * Always normalized (same as before) * Some operations will now be slower, like instance compares (which were previously just a reference check) * Multiple identical paths will now consume more memory since they are not interned PATH FRAGMENT ============= * Use a simple string to back PathFragment * No more segment arrays with interned strings * Always normalized * Remove isNormalized * Replace some isNormalizied uses with containsUpLevelReferences() to check if path fragments try to escape their scope * To check if user input is normalized, supply static methods on PathFragment to validate the string before constructing a PathFragment * Because PathFragments are always normalized, we have to replace checks for literal "." from PathFragment#getPathString to PathFragment#getSafePathString. The latter returns "." for the empty string. * The previous implementation supported efficient segment semantics (segment count, iterating over segments). This is now expensive since we do longer have a segment array. ARTIFACT ======== * Remove Path instance. It is instead dynamically constructed on request. This is necessary to avoid this CL becoming a memory regression. RELNOTES: None PiperOrigin-RevId: 185062932
* Add CommandLineItem interface.Gravatar tomlu2018-01-25
| | | | | | | | This interface makes it clearer in the type system exactly how items that go into a CustomCommandLine are turned into strings. It is a preparatory change to allow command line fingerprints to be more cheaply calculated, but it is valuable in itself from a code quality standpoint. PiperOrigin-RevId: 183274022
* 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
* Stop memoizing Label#hashCode()Gravatar michajlo2018-01-09
| | | | | | | | | | | | Both members of Label (String & PackageIdentifier) have memoized hash codes so this should be marginally more expensive but probably not noticably so. The benefit is it makes Label objects smaller in certain vm conditions. As to why things were the way they were, I believe this is from before PackageIdentifier memoized its hashCode. RELNOTES: None PiperOrigin-RevId: 181362077
* Makes PathFragment have internal CODEC definition.Gravatar Googler2017-12-19
| | | | PiperOrigin-RevId: 179588512
* Initial @AutoCodec implementation.Gravatar Googler2017-12-13
| | | | PiperOrigin-RevId: 178994972
* Removes skyframe/serialization's dependency on cmdline and vfs. Instead, ↵Gravatar Googler2017-12-11
| | | | | | make cmdline and vfs depend on serialization. This allows a class to have a pointer to its codec, which simplifies automatic recursive composite codecs. PiperOrigin-RevId: 178683500
* 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
* Break dependency on vfs from the interface of syntax and cmdline.Gravatar tomlu2017-11-06
| | | | | | | | These libs are exposed externally, implying that the vfs is also exposed externally. We break out PathFragment from vfs to still use this in their interface. This class is a much smaller dependency than the entire vfs. PiperOrigin-RevId: 174729373
* Rename Label.EXTERNAL_PACKAGE_FILE_NAME to WORKSPACE_FILE_NAMEGravatar ulfjack2017-10-27
| | | | | | | This more clearly indicates what this is. Also change some hard-coded uses to use the constant instead. PiperOrigin-RevId: 173658659
* Remove deprecated legacy string representations of Skylark objectsGravatar vladmos2017-10-13
| | | | | | | | RELNOTES[INC]: The flag --incompatible_descriptive_string_representations is no longer available, old style string representations of objects are not supported anymore. PiperOrigin-RevId: 171952621
* 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
* Fix typo on PackageIdentifier documentation.Gravatar jcater2017-08-31
| | | | PiperOrigin-RevId: 167047092
* Fix stale comment.Gravatar nharmata2017-08-21
| | | | | RELNOTES: None PiperOrigin-RevId: 165705342
* Change WalkableGraphFactory#prepareAndGet to take multiple SkyKeys as graph ↵Gravatar Googler2017-08-17
| | | | | | | | | | roots It also changes a few accessors of utility methods in Skyframe library. It refactors the QueryExpressionMapper to use a general QueryExpressionVisitor. RELNOTES: None PiperOrigin-RevId: 165534908
* Clean up Label validation, and introduce a factory method for constructing a ↵Gravatar nharmata2017-08-08
| | | | | | | Label without validation. RELNOTES: None PiperOrigin-RevId: 164479651
* Don't unconditionally call PathFragment#normalize in the PackageIdentifier ↵Gravatar nharmata2017-08-03
| | | | | | | ctor. This is completely wasteful in the common case of the PathFragment already being normalized. RELNOTES: None PiperOrigin-RevId: 164022960
* Generalize some of methods in TargetPattern, PrepareDepsOfPatternValue, and ↵Gravatar nharmata2017-07-26
| | | | | | | RecursivePackageProvider dealing with the concept of "excluded directories". RELNOTES: None PiperOrigin-RevId: 163074794
* Make SkyKey.argument a default methodGravatar ulfjack2017-07-25
| | | | | | | Almost all implementations simply return this, all of which can be removed now. PiperOrigin-RevId: 163046912
* Make some objects SkylarkValuesGravatar vladmos2017-07-11
| | | | | | | | | Skylark's Printer.BasePrinter doesn't guarantee it will call `.toString` on objects of unknown types, and in the future that won't be the case anymore. In order to keep their current string representations objects should implement the SkylarkValue interface by providing an explicit implementation of `repr`. PiperOrigin-RevId: 161526182
* Skylark, docs: fix docs of Label.relative(name)Gravatar laszlocsomor2017-07-10
| | | | | | | | | | It appeared in the docs that the function had no argument. Fixes https://github.com/bazelbuild/bazel/issues/3339 RELNOTES: none PiperOrigin-RevId: 161388878
* Clean up string representations for labelsGravatar vladmos2017-07-05
| | | | | | | | | | | If --incompatible_descriptive_string_representations is passed, labels are converted to strings using `repr` differently: `Label("//package:name")` instead of `"//package:name"` This CL doesn't affect representations of other object types but provides the necessary infrastructure for it. PiperOrigin-RevId: 160955284
* Refactor PrinterGravatar vladmos2017-07-03
| | | | | | | It's now easier to customize Printer if in different situations objects should be printed differently. Also its API is cleaner now. Names of methods of SkylarkValue objects now reflect names of Skylark functions: SkylarkValue#repr and SkylarkPrintableValue#str. PiperOrigin-RevId: 160635154