aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java
Commit message (Collapse)AuthorAge
* Automated rollback of commit 10b0d8aa6b73a024cc007c5e075cb329add878ef.Gravatar lberki2017-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks Google-internal targets, sadly. *** Original change description *** Ban middlemen from runfiles artifacts. Previous changes have removed all middlemen from runfiles artifacts. This CL locks it down and removes various now-redundant *WithoutMiddlemen() methods from Runfiles. I put a check for middlemen in ConflictChecker.put, which should be a chokepoint for runfiles artifacts. It's unfortunate we can't detect middlemen earlier than execution, but I can't see a way to efficiently check every runfiles artifact earlier. Cha... *** RELNOTES: None. PiperOrigin-RevId: 175650018
* Ban middlemen from runfiles artifacts.Gravatar Benjamin Peterson2017-11-10
| | | | | | | | | | | | | | Previous changes have removed all middlemen from runfiles artifacts. This CL locks it down and removes various now-redundant *WithoutMiddlemen() methods from Runfiles. I put a check for middlemen in ConflictChecker.put, which should be a chokepoint for runfiles artifacts. It's unfortunate we can't detect middlemen earlier than execution, but I can't see a way to efficiently check every runfiles artifact earlier. Change-Id: I57fcb51b02e40adf3ebc4591c26bf5492c89352f PiperOrigin-RevId: 175206157
* 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
* Remove the runfiles middleman from py_binary's data runfiles.Gravatar Benjamin Peterson2017-10-26
| | | | | | | | | | | | | | This requires polluting Runfiles and RuleConfiguredTargetBuilder with some custom infrastructure to lift a py_binary runfiles middleman into the FilesToRunProviders and output groups of its reverse dependency. That can all go away when the --experimental_build_transitive_python_runfiles transition is complete. This is another step towards https://bazel-review.googlesource.com/c/bazel/+/14010. Change-Id: Ib750d72d4be42324c8edec485707480690b9fc9c PiperOrigin-RevId: 173514090
* Wrap runtime jars and proto sources going into runfiles in a stable order ↵Gravatar tomlu2017-09-19
| | | | | | | | nested set. This saves memory, as the nested set would otherwise become flattened. Assuming the jars don't have duplicates files with the same root relative path in the same runfiles tree this won't make any semantic difference. PiperOrigin-RevId: 169234428
* Move RuleConfiguredTarget to lib.analysis.configuredtargets.Gravatar gregce2017-09-19
| | | | | | This is a trivial change with a large file footprint. PiperOrigin-RevId: 169169864
* Merging a RunfilesSupport object into Runfiles.Builder no longer adds the ↵Gravatar Benjamin Peterson2017-09-12
| | | | | | | | | | | | | | | | | | | | | | runfiles middleman to the artifacts. Runfiles.Builder.merge(RunfilesSupport) would add the runfiles middleman of the RunfilesSupport object being merged into the artifacts of the nascent Runfiles object. This effectively made the construction of one runfiles tree depend on that of another. Instead of putting the runfiles middleman into the runfiles artifacts, we can put it into the FilesToRunProvider, which should have the same effect. To facilitate this, RuleConfiguredTargetBuilder gains a addFilesToRun method. Note that not every caller of merge(RunfilesSupport) has to be modified because some were already adding the runfiles middleman to their FilesProvider (e.g., AndroidHostServiceFixture), which is a subset of FilesToRunProvider. This is split out from https://bazel-review.googlesource.com/c/14010 Change-Id: Icfca5262a32619e1e351477f3ff641350b6798dc PiperOrigin-RevId: 168358030
* 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
* 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
* Rationalize null-ness checks in RunfilesGravatar Ulf Adams2017-03-21
| | | | | | | | | | | This now also checks symlink maps for null pointers, which it previously did not. Unfortunately, there's still one case where we add a null target to Runfiles (to represent an empty file) - this happens in Runfiles itself, and this change prevents any callers from doing so. -- PiperOrigin-RevId: 150634481 MOS_MIGRATED_REVID=150634481
* Fix a bug whereupon a String was compared to a PathFragment.Gravatar Lukacs Berki2017-03-21
| | | | | | -- PiperOrigin-RevId: 150623623 MOS_MIGRATED_REVID=150623623
* Rollback of commit 59180a4ea66b1395b5b85defd732859ecae919ea.Gravatar Yue Gan2017-03-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Break bazel-tests and many other jobs on CI. http://ci.bazel.io/job/bazel-tests/BAZEL_VERSION=HEAD,PLATFORM_NAME=linux-x86_64/651/console *** Original change description *** Add SpawnInputExpander helper class to arrange runfiles for spawn strategies This new class is a combination of SpawnHelper and our internal code; the plan is to migrate all spawn strategies to the new class. The strict flag should be enabled by default, but that's a breaking change, so we need to do it later. - Use it in SandboxStrategy. - Add ActionInput.getExecPath to return a PathFragment; this avoids lots of back and forth between path fragments and strings. This is a step towards #159... *** -- PiperOrigin-RevId: 150610616 MOS_MIGRATED_REVID=150610616
* Add SpawnInputExpander helper class to arrange runfiles for spawn strategiesGravatar Ulf Adams2017-03-17
| | | | | | | | | | | | | | | | | This new class is a combination of SpawnHelper and our internal code; the plan is to migrate all spawn strategies to the new class. The strict flag should be enabled by default, but that's a breaking change, so we need to do it later. - Use it in SandboxStrategy. - Add ActionInput.getExecPath to return a PathFragment; this avoids lots of back and forth between path fragments and strings. This is a step towards #1593. -- PiperOrigin-RevId: 150427021 MOS_MIGRATED_REVID=150427021
* Type strip Python sources when building a target incompatible with inlineGravatar Googler2017-03-14
| | | | | | | | annotations. -- PiperOrigin-RevId: 150088575 MOS_MIGRATED_REVID=150088575
* 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
* Manually add periods to documentation strings where needed.Gravatar John Cater2017-01-03
| | | | | | | | -- Change-Id: I9ec3209a69ba5a51943b334f278ba93d67d4f9f4 Reviewed-on: https://cr.bazel.build/8090 PiperOrigin-RevId: 143470915 MOS_MIGRATED_REVID=143470915
* Expose to Skylark a merge() method for runfiles objectsGravatar Jon Brandvein2016-12-28
| | | | | | | | | This is a quick way to make it possible for Skylark rules to aggregate and pass on symlinks from their dependencies. -- PiperOrigin-RevId: 143111353 MOS_MIGRATED_REVID=143111353
* Make Runfiles.SymlinkEntry implement SkylarkValue.Gravatar Eric Dobson2016-11-28
| | | | | | | | | | Fixes #1109 Closes #2126. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/2126 MOS_MIGRATED_REVID=140217086
* Rollback of commit 82d43279f93d95e4c41b4bc598a3cc05ddd1ae1a.Gravatar Laszlo Csomor2016-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks TensorFlow and other Bazel jobs on ci.bazel.io *** Original change description *** Change execution root for external repositories to be ../repo Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. 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. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133709658
* Change execution root for external repositories to be ../repoGravatar Kristina Chodorow2016-09-20
| | | | | | | | | | | | | | | | | | | | | | | Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. 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. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133606309
* Reorganize Skylark Reference documentation.Gravatar Dmitry Lomov2016-06-29
| | | | | -- MOS_MIGRATED_REVID=126081020
* Rollback of commit bdfd58a8ca2ed5735d6aaa5b238fb0f689515724.Gravatar Laurent Le Brun2016-06-20
| | | | | -- MOS_MIGRATED_REVID=125160288
* Make the execution root match the runfiles tree structure for external ↵Gravatar Kristina Chodorow2016-06-17
| | | | | | | | | | | | | | | | | | | | | repositories One interesting side effect of how this is implemented is that for external repositories, bin/ and genfiles/ are combined. External repo output is under bazel-out/local-fastbuild/repo_name for each repo. Fixes #1262. 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. -- MOS_MIGRATED_REVID=125095799
* Create runfiles at both .runfiles/ws/external/repo and .runfiles/repoGravatar Kristina Chodorow2016-04-26
| | | | | | | | | The major piece of #848. RELNOTES[INC]: All repositories are now directly under the x.runfiles directory in the runfiles tree (previously, external repositories were at x.runfiles/main-repo/external/other-repo. This simplifies handling remote repository runfiles considerably, but will break existing references to external repository runfiles. -- MOS_MIGRATED_REVID=120722312
* Add a --legacy_external_runfiles optionGravatar Kristina Chodorow2016-04-25
| | | | | | | | This isn't hooked up to anything yet, but is another piece of getting #848 rolled forward. -- MOS_MIGRATED_REVID=120582973
* Make suffix a PathFragmentGravatar Kristina Chodorow2016-04-22
| | | | | | | | | Breaking up the runfiles tree change into some smaller changes this time around. First step of rolling forward #848. -- MOS_MIGRATED_REVID=120553288
* Automated [] rollback of commit 857cda2c45a5cc68c3fa398311c48c571a64915d and ↵Gravatar Damien Martin-Guillerez2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | commit 790d2f6009d47fe92cf0cd92a1473bbf0141f32e. *** Reason for rollback *** Broke non-Bazel projects on ci.bazel.io Fixes #1168 *** Original change description *** Move the runfiles for external repositories to under the x.runfiles/ directory This also sets the Bazel workspace name to io_bazel_source. Fixes #848. Relevant to #1116, #1124, RELNOTES[INC]: All repositories are now directly under the x.runfiles directory in the runfiles tree (previously, external repositories were at x.runfiles/main-repo/external/other-repo. This simplifies handling remote repository runfiles considerably, but will break existing references to external repository runfiles.... *** -- MOS_MIGRATED_REVID=120535721
* Make source manifest caching catch external runfile changesGravatar Kristina Chodorow2016-04-21
| | | | | -- MOS_MIGRATED_REVID=120442698
* Clean up the runfiles / files-to-run related code a bit.Gravatar Ulf Adams2016-04-21
| | | | | -- MOS_MIGRATED_REVID=120433463
* Refactor the Event class; always construct through static methods.Gravatar Ulf Adams2016-04-21
| | | | | -- MOS_MIGRATED_REVID=120418505
* Move the runfiles for external repositories to under the x.runfiles/ directoryGravatar Kristina Chodorow2016-04-20
| | | | | | | | | | | | | | | This also sets the Bazel workspace name to io_bazel_source. Fixes #848. Relevant to #1116, #1124, RELNOTES[INC]: All repositories are now directly under the x.runfiles directory in the runfiles tree (previously, external repositories were at x.runfiles/main-repo/external/other-repo. This simplifies handling remote repository runfiles considerably, but will break existing references to external repository runfiles. --- Furthermore, if a Bazel project does not provide a workspace name in the WORKSPACE file, Bazel will now default to using __main__ as the workspace name (instead of "", as previously). The repository's runfiles will appear under x.runfiles/__main__/. -- MOS_MIGRATED_REVID=120224534
* Expose __init__.py filenames to SkylarkGravatar Brian Silverman2016-04-15
| | | | | | | | | | | | This is important for packaging Python code in a way which is compatible with the way Bazel builds its standard runfiles directory. Refs #671 -- Change-Id: Ica2adab481cfecabb84b608cd952b0cae5a8653c Reviewed-on: https://bazel-review.googlesource.com/#/c/2900/ MOS_MIGRATED_REVID=119945845
* Expose runfiles symlink functionality in SkylarkGravatar Googler2016-03-11
| | | | | | | | | | | | | | | | | | | | | The Skylark rule context object has a runfiles method. This adds two optional parameters to that method, "symlinks" and "root_symlinks", that expose functionality from the underlying Runfiles java class. With this functionality, one can construct links in the runfiles tree where the source and destination of the link have different names and/or relative directories. This might be useful for things like AppEngine rules where a file in a subdirectory of the source tree needs to appear in the root directory of the runfiles tree. If either new parameter is used, the runfiles is subject to stricter validity checking. This checking propagates to other runfiles that depend on it. RELNOTES: Added "root_symlinks" and "symlinks" parameters to Skylark runfiles() method. -- MOS_MIGRATED_REVID=116879064
* Detect and warn about runfiles conflicts.Gravatar Googler2016-03-08
| | | | | | | | | A runfile conflict is when two different artifacts have been added to a Runfiles object under the same relative path. Conflict resolution is unchanged (last artifact wins). -- MOS_MIGRATED_REVID=116584195
* Move annotation classes used for referencing framework Java classes from ↵Gravatar John Field2015-12-16
| | | | | | | | | | | | | | Skylark into their own package. This allows, e.g., classes in the syntax package to access classes in the cmdline package without creating circular dependencies. While we're here: - Removed a couple of unused BUILD deps flagged in []. - Updated SkylarkRuleImplementationFunctionsTest to remove non-ASCII characters and clarify the intent of the test. -- MOS_MIGRATED_REVID=110360763
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* Close some streams that we didn'tGravatar Miguel Alcon Pinto2015-11-05
| | | | | -- MOS_MIGRATED_REVID=107048547
* Add ctor commentGravatar Kristina Chodorow2015-10-27
| | | | | -- MOS_MIGRATED_REVID=106410161
* 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
* Separate build-specific types and types inherent to Skylark.Gravatar Lukacs Berki2015-09-21
| | | | | -- MOS_MIGRATED_REVID=103374106
* Always inject the runfiles prefix into the Runfiles.Builder.Gravatar Ulf Adams2015-09-03
| | | | | | | The other constructor is now private. -- MOS_MIGRATED_REVID=102252544
* Add a @deprecated annotation to Runfiles#addArtifacts.Gravatar Carmi Grushko2015-08-28
| | | | | -- MOS_MIGRATED_REVID=101730178
* Set the workspace suffix for runfilesGravatar Kristina Chodorow2015-08-13
| | | | | | | This CL covers the "easy" cases. Followup CLs will take care of couple dozen remaining gnarly ones. -- MOS_MIGRATED_REVID=100479410
* Skylark documentation fixesGravatar Laurent Le Brun2015-07-29
| | | | | -- MOS_MIGRATED_REVID=99283744
* Allow Skylark to access information about runfiles.Gravatar Brian Silverman2015-06-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is important to build packages of bazel-built code, especially python. Simple example usage: def _runfiles_test_impl(ctx): runfiles_provider = provider(ctx.attr.src, 'analysis.RunfilesProvider') runfiles = runfiles_provider.default_runfiles.artifacts commands = [] for f in runfiles: commands += [ 'mkdir -p $(dirname %s/%s)' % (ctx.outputs.outdir.path, f.short_path), 'cp %s %s/%s' % (f.path, ctx.outputs.outdir.path, f.short_path), ] ctx.action( outputs = [ ctx.outputs.outdir ], inputs = list(runfiles), command = ' && '.join(commands) ) '''A simple rule which copies all the runfiles from src into outdir.''' runfiles_buildtest = rule( implementation = _runfiles_test_impl, attrs = { 'src': attr.label(allow_files=False, mandatory=True), 'outdir': attr.output(mandatory=True), }, ) -- Change-Id: I8fbd4c6ea462685142cf199dfe3348bc4436cdcb Reviewed-on: https://bazel-review.googlesource.com/1530 MOS_MIGRATED_REVID=96576360
* Add runfiles to metadata caches and make them isFile awareGravatar Michajlo Matijkiw2015-05-26
| | | | | -- MOS_MIGRATED_REVID=94318260
* Return all mappings in one Map from Runfiles#getRunfilesInputs(...)Gravatar Michajlo Matijkiw2015-05-08
| | | | | | | | | We wind up combining them anyway in the manifest file and it seems that this is consistent with how we read them back. Return them all at once to avoid tedious duplication in handling of them. -- MOS_MIGRATED_REVID=93058482
* Become more restrictive around Runfiles#manifestExpanderGravatar Michajlo Matijkiw2015-04-16
| | | | | | | | | | | | Previously the contract was pretty liberal and could allow addition of extra Artifacts. Create a more restrictive interface allowing the bare minimum- adding empty files to the tree. This makes the contract of Runfiles#getAllArtifacts() more sound, since arbitrary artifacts can't be added, and it makes it easier to figure out what implementations of manifest expansion exist out there. -- MOS_MIGRATED_REVID=91233821
* VisibleForTesting cleanup in RunfilesGravatar Michajlo Matijkiw2015-04-16
| | | | | | | | | Many of the @VisibleForTesting annotations didn't actually apply. Remove them, apply the annotation to places where it applies, and change visibility of mttehods to be more restrictive. -- MOS_MIGRATED_REVID=91208297