aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/LocationExpander.java
Commit message (Collapse)AuthorAge
* Remap labels that include a repository name that appear in $(location x).Gravatar dannark2018-06-21
| | | | | RELNOTES: None. PiperOrigin-RevId: 201588988
* Remove attribute read checks expecting a DATA transition.Gravatar gregce2018-05-25
| | | | | | | | | | | | | | This is a precursor to removing the DATA transition outright. While we could also have changed the Mode.DATA instances to Mode.TARGET (which would declare that we expect the attribute not to apply any transition), that would break existing definitions and make depot cleanup more delicate. Plus, these checks weren't being consistently applied across attributes anyway so they don't really offer much. A lot of this logic is really just leftover legacy from the pre-dynamic configuration days. PiperOrigin-RevId: 198085059
* Properly quote $(location ) expansion for the shellGravatar Klaus Aehlig2018-05-16
| | | | | | | | | | | ...by using the ShellEscaper rather than the ad-hoc "escaping" in LocationExpander. Fixes #5190. At least to the extend that a context-independent quoting can work. Change-Id: I858662861a2504139c19d773690aef2befc23948 PiperOrigin-RevId: 196832574
* Change LocationFunction to not extend Function.Gravatar dannark2018-04-30
| | | | | | | This is necessary for subsequent changes to the apply method for diamond splitting, which will require apply() to take more than one argument. But it seems like the only reason LocationFunction ever extended Function was for tests and so this is an improvement on its own. RELNOTES: None PiperOrigin-RevId: 194796136
* refactor: mv LocationExpander.Options to ExpanderGravatar L?szl? Csomor2017-11-28
| | | | | Change-Id: I4bcc7c0024646b7d4372464f5290375d41702429 PiperOrigin-RevId: 177150713
* refactor: add LocationExpander factoriesGravatar L?szl? Csomor2017-11-28
| | | | | | | | | | | | | | | | | | Stop using LocationExpander.Options in LocationExpander constructors, because the Options semantics are confusing. I also need the refactoring in order to extend the expansion semantics: to support expanding to absolute paths on Windows, where $(location) should not expand to the (non-existent) runfiles path, but to the absolute path the runfiles symlink would point to. See https://github.com/bazelbuild/bazel/issues/4171 Change-Id: Ie4d47ec3807bc3c6e39156efa1746b666f69f99c PiperOrigin-RevId: 177147372
* Add rootpath(s) and execpath(s) functions to template expansionGravatar ulfjack2017-11-03
| | | | | | | | | | | | | | | | In addition to the $(location) function, we now also support $(rootpath) and $(execpath) functions. Unfortunately, we have to do this in two places since the Skylark API for expand_location has to continue calling into LocationExpander in order to preserve its semantic contract. Progress on #2475. RELNOTES[NEW]: In addition to $(location), Bazel now also supports $(rootpath) to obtain the root-relative path (i.e., for runfiles locations), and $(execpath) to obtain the exec path (i.e., for build-time locations) PiperOrigin-RevId: 174454119
* Automated rollback of commit 8cb1d2fb460a9caf47df58d7ff051d31080a77cb.Gravatar ulfjack2017-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Roll forward again without the changes to expand_location, but with the trimming fix from https://github.com/bazelbuild/bazel/commit/19617360121635a77ffec99b84d825e7d9b260b1. *** Original change description *** Automated rollback of commit ca77f608e486bf7aa762565d25bf7b9e30f2268c. This also rolls back unknown commit. *** Reason for rollback *** Affected expand_location Skylark API semantics - it no longer accepts ${abc} or plain dollar signs, but complains. *** Original change description *** Extend TemplateExpander to handle $(func param) expansion Rewrite the Expander to use the new functionality; also rewrite the Skylark expand_location function to use it. PiperOrigin-RevId: 174384095
* Automated rollback of commit ca77f608e486bf7aa762565d25bf7b9e30f2268c.Gravatar ulfjack2017-10-26
| | | | | | | | | | | | | | | | | This also rolls back unknown commit. *** Reason for rollback *** Affected expand_location Skylark API semantics - it no longer accepts ${abc} or plain dollar signs, but complains. *** Original change description *** Extend TemplateExpander to handle $(func param) expansion Rewrite the Expander to use the new functionality; also rewrite the Skylark expand_location function to use it. PiperOrigin-RevId: 173508888
* Extend TemplateExpander to handle $(func param) expansionGravatar ulfjack2017-10-25
| | | | | | | Rewrite the Expander to use the new functionality; also rewrite the Skylark expand_location function to use it. PiperOrigin-RevId: 173280839
* Rewrite LocationExpanderGravatar ulfjack2017-10-02
| | | | | | | | | | | | | | | Split up the functionality into separate classes, and test each independently. (Keep one integration test to make sure it still works together.) This is in preparation for adding another location function for runfiles paths. Currently we have to decide ahead of time whether to expand artifacts as exec paths or root-relative (runfiles) paths, but there are cases where we can't make that decision ahead of time and / or need both to coexist, even in the same attribute. Progress on #2475. PiperOrigin-RevId: 170691666
* LocationExpander: always require options to be passed inGravatar ulfjack2017-10-02
| | | | | | | | | Also update CommandHelper to split the heuristic label expansion code path from the normal code path. Progress on #2475. PiperOrigin-RevId: 170675702
* Make JavaToolchain use the new Expander APIGravatar ulfjack2017-10-02
| | | | | | Progress on #2475. PiperOrigin-RevId: 170671644
* Move expansion functionality to a new classGravatar ulfjack2017-09-29
| | | | | | Progress on #2475. PiperOrigin-RevId: 170473111
* Move RuleConfiguredTarget to lib.analysis.configuredtargets.Gravatar gregce2017-09-19
| | | | | | This is a trivial change with a large file footprint. PiperOrigin-RevId: 169169864
* Move AliasProvider to lib.analysisGravatar ulfjack2017-08-07
| | | | | | | This is part of splitting up the build-base library into separate libraries for analysis, exec, and rules. PiperOrigin-RevId: 164438390
* Update LocationExpander to properly handle spaces in filenames.Gravatar John Cater2017-08-01
| | | | | | | Also added basic tests. Change-Id: I5861816bf116486e0ee365debd3dfbda131047f7 PiperOrigin-RevId: 163764257
* Use nested sets for configured target runfiles instead of flattened lists.Gravatar Googler2017-05-26
| | | | | RELNOTES: None PiperOrigin-RevId: 157124371
* Rollback of commit 4b73e972d909bcd533f2f9940f95a00b9b73bdde.Gravatar Dmitry Lomov2017-02-17
| | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Broke tests on CI: http://ci.bazel.io/job/bazel-tests/570/ *** Original change description *** Roll forward execroot change RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Cust... -- PiperOrigin-RevId: 147833177 MOS_MIGRATED_REVID=147833177
* Roll forward execroot changeGravatar Kristina Chodorow2017-02-16
| | | | | | | | | | | | | | | | | RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Custom crosstools that hardcode external/<repo> paths will have to be updated. Issue #1262. -- PiperOrigin-RevId: 147726370 MOS_MIGRATED_REVID=147726370
* Trim labels in location expressions before expansion.Gravatar Tobias Werth2016-10-25
| | | | | | | -- Change-Id: If626fd448ddbfbdf65b71569fda7a9b206e5f8b2 Reviewed-on: https://bazel-review.googlesource.com/c/6890/ MOS_MIGRATED_REVID=137155361
* Expand $(location :label) to string unambiguously a pathGravatar Klaus Aehlig2016-10-14
| | | | | | | | | | | | | | | | | | | In genrules, cmd strings of the form "$(location :label) ..." are used with the assumption that the executable named by the label will be called. This holds true as long as $(location :label) expands to a string that is recognizable as a path, i.e., as long as :label does not refer to a file in the top-level directory. In the latter case, however, that string will be the plain file name and the shell will search for that name in the search path. This will fail, if '.' is not in the search path; even worse, if a file with that name is in the search path before '.', then that one will be called which is not what the user intended to do. Fix this unintended behavior by expanding $(location :label) to a string that unambiguously is a path. -- Change-Id: If8681039a8befae6234fbe0cbe3a0f75eedba7aa Reviewed-on: https://bazel-review.googlesource.com/#/c/6691 MOS_MIGRATED_REVID=136151500
* Add an "alias" rule.Gravatar Lukacs Berki2016-05-10
| | | | | | | This will be used to replace RedirectChaser so that we don't need to load packages during configuration creation anymore. -- MOS_MIGRATED_REVID=121935989
* Remove all internal calls to FileProvider.getLabel.Gravatar Ulf Adams2016-04-22
| | | | | | | | The method will be removed in a subsequent change to facilitate reverting the change in case it goes bad. -- MOS_MIGRATED_REVID=120526894
* Remove FilesToRunProvider.label.Gravatar Ulf Adams2016-04-22
| | | | | | | The TransitiveInfoProvider already contains a label, use that instead. -- MOS_MIGRATED_REVID=120443298
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* Move Label from the lib.syntax to the lib.cmdline package so that:Gravatar Lukacs Berki2015-09-21
| | | | | | | | | | - Label parsing can be simplified - lib.syntax is only contains the code for Skylark and is reasonably independent from the problem domain of building things This change is mostly only changes to imports declarations. The rest is reversing the dependency between :cmdline and :syntax and moving a tiny amount of code between Printer and FilesetEntry and the addition of SkylarkPrintableValue that I couldn't be bothered to separate out into its own change. -- MOS_MIGRATED_REVID=103527877
* Separate build-specific types and types inherent to Skylark.Gravatar Lukacs Berki2015-09-21
| | | | | -- MOS_MIGRATED_REVID=103374106
* Parse the label syntax "@//a:b" so that eventually we can make that the ↵Gravatar Lukacs Berki2015-09-15
| | | | | | | | | syntax that means "refer to the main repository". There isn't an overarching plan for what we are going to do with the cmdline package, which seems to be separated from the .syntax one in all sorts of awkward ways. -- MOS_MIGRATED_REVID=103088960
* Skylark: Implemented ctx.expand_location() which expands the location(s) of ↵Gravatar Florian Weikert2015-07-10
| | | | | | | the target file(s) of labels -- MOS_MIGRATED_REVID=97949264
* Add support for $(location) with //external labelsGravatar Kristina Chodorow2015-04-09
| | | | | | | Fixes https://github.com/google/bazel/issues/90. -- MOS_MIGRATED_REVID=90717991
* RELNOTES[NEW]: The "args" attribute of *_binary and *_test rules now support ↵Gravatar Damien Martin-Guillerez2015-03-06
| | | | | | | | | expanding $(location //some/deps) *_binary and *_test rules were supporting make variables substitution but not location expansion like genrule() does. Now the $(location //some/label) where //some/label is the label of a dependency of the rule will be replaced at runtime by the actual location of that dependency. In the same manner $(locations //some/label) will be replaced by the space separated list of files of the //some/label dependency. A longer usage explanation is provided in the build encyclopedia. -- MOS_MIGRATED_REVID=87927345
* Some cleanup changes.Gravatar Ulf Adams2015-03-05
| | | | | -- MOS_MIGRATED_REVID=87821306
* Update from Google.Gravatar Han-Wen Nienhuys2015-02-25
-- MOE_MIGRATED_REVID=85702957