aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/runfiles
Commit message (Collapse)AuthorAge
* c++,runfiles: move runfiles libraryGravatar Laszlo Csomor2018-04-30
| | | | | | | | | | | | | | | | Move the half-done C++ runfiles library to `//tools/cpp/runfiles`. (The Python and Bash runfiles libraries are already under `//tools/<language>/runfiles`.) See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I1006f7f81462ea0e4b1de1adcdba89e386d4f9e7 Closes #5107. Change-Id: I1006f7f81462ea0e4b1de1adcdba89e386d4f9e7 PiperOrigin-RevId: 194763392
* java,runfiles: merge classesGravatar Laszlo Csomor2018-04-25
| | | | | | | | | | | | | | | | | | | | | | This commit prepares simplifying the Java runfiles library, which itself prepares mergint the manifest-based and directory-based logic so that the Runfiles class could handle both at the same time. This commit only moves classes around: - moves the ManifestBased and DirectoryBased classes into Runfiles, as nested classes - adds a createManifestBasedForTesting and createDirectoryBasedForTesting method to create the classes for testing - moves the ManifestBasedTest and DirectoryBasedTest into RunfilesTest Otherwise this commit has no functional change. Change-Id: I56b582c1a95793b0a871748697673b53a780f0fb PiperOrigin-RevId: 194227675
* runfiles: rlocation() checks if arg is normalizedGravatar Laszlo Csomor2018-04-24
| | | | | | | | | | | | | | | | | | | rlocation() now validates that the path argument is normalized, i.e. contains none of: - current directory references (".") - uplevel references ("..") - double slash ("//") This helps avoiding a bug similar to https://github.com/bazelbuild/bazel/pull/5083. See https://github.com/bazelbuild/bazel/pull/4460 Change-Id: Ia73fa2df1eae86fc7084162c24e144129672742d Closes #5085. Change-Id: Ia73fa2df1eae86fc7084162c24e144129672742d PiperOrigin-RevId: 194074072
* Java,runfiles: add Runfiles.getEnvVars()Gravatar Laszlo Csomor2018-04-16
| | | | | | | | | | | | | | | | The new method lets Java programs export the RUNFILES_* environment variables for subprocesses, in case those subprocesses are other Bazel-built binaries that also need runfiles. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I05c0b84db357128bc15f21a167a0d92e8d17599c Closes #5016. Change-Id: I66ca5c44067a7353b8de180a64f20c8352e3c9ec PiperOrigin-RevId: 193013289
* Bash,runfiles: delete from //src/tools/runfilesGravatar Laszlo Csomor2018-04-13
| | | | | | | | | | | | I need to rewrite the Bash runfiles library and move it to //tools/bash/runfiles. See https://github.com/bazelbuild/bazel/issues/4460 Closes #5012. Change-Id: I422f04735dc05a0c4a7e80e1dd276d61583b5e88 PiperOrigin-RevId: 192754869
* python,runfiles: move to different packageGravatar Laszlo Csomor2018-04-10
| | | | | | | | | | | | | | | | | | | | Move the Python runfiles library from `@bazel_tools//tools/runfiles:py-runfiles` to `@bazel_tools//tools/python/runfiles:runfiles` Also rename the testdata runfiles.py to foo.py. This file was not a mock runfiles library, just a client file using the runfiles library that was also called runfiles.py Fixes https://github.com/bazelbuild/bazel/issues/4878 Change-Id: I874b230c93679d4454ac91e816932c8272ecc5c7 Closes #4981. Change-Id: I908e0ab7ec61225e82f70793b1a05432e7f0b07e PiperOrigin-RevId: 192256481
* Add dependency on googletest, so we can use gmock along with gtest.Gravatar ccalvarin2018-03-23
| | | | | | | third_party/gtest can go away after this. RELNOTES: None. PiperOrigin-RevId: 190221581
* Automated rollback of commit 8a5a0a3ed1e19768b6ee024189307bb4ac27460d.Gravatar laszlocsomor2018-03-21
| | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** breaks building //src:bazel *** Original change description *** runfiles,C++: move to //tools/cpp/runfiles Move the C++ runfiles library to the location of the rest of the C++ tools. Also change the C++ namespace to reflect the directory hierarchy. We have not yet announced nor released the C++ runfiles library so these refactorings are fine. See https://github.com/bazelbuild/bazel/issues/4460 Closes #4873. PiperOrigin-RevId: 189883066
* runfiles,C++: move to //tools/cpp/runfilesGravatar Laszlo Csomor2018-03-21
| | | | | | | | | | | | | | | | | | Move the C++ runfiles library to the location of the rest of the C++ tools. Also change the C++ namespace to reflect the directory hierarchy. We have not yet announced nor released the C++ runfiles library so these refactorings are fine. See https://github.com/bazelbuild/bazel/issues/4460 Closes #4873. Change-Id: I1732ef1eaff880cae05b7d218a3b1c0461a6b029 PiperOrigin-RevId: 189874201
* runfiles,C++: add a Runfiles* factory methodGravatar Laszlo Csomor2018-03-19
| | | | | | | | | | | | | | | | Implement Runfiles::Create method, which inspects the RUNFILES_* envvars as well as the availability of a runfiles manifest or -directory near argv[0], and creates a Runfiles* object based on that. Also add documentation and usage examples. Subsequent commit will add integration tests. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I2aa433d460826999e698597205ae7663b0e84dd3 PiperOrigin-RevId: 189555342
* runfiles,py,java: rlocation accepts absolute pathGravatar Laszlo Csomor2018-03-09
| | | | | | | | | | | | | | | | | | | | | The rlocation functions in the Python and Java runfiles libraries (under @bazel_tools//tools/runfiles) now consistently return the argument itself if it is an absolute path. If the argument is a driveless absolute Windows path (e.g. "\\windows\\system32") then rlocation reports an error. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I80474f7cc4736a571bf113438a916f71c36a344d Closes #4806. Change-Id: I80474f7cc4736a571bf113438a916f71c36a344d PiperOrigin-RevId: 188453982
* runfiles,C++: create envvar list for subprocessesGravatar Laszlo Csomor2018-03-05
| | | | | | | | | | | | | | | | Implement Runfiles::EnvVars so it's now possible to propagate runfiles to subprocesses via environment variables (RUNFILES_MANIFEST_FILE and RUNFILES_DIR). Subsequent commits will add more feataures: - automatic Runfiles creation based on argv[0] and the envvars of this process See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: If9a37b1be13b9cbacf21a496305d60444fd660b2 PiperOrigin-RevId: 187858830
* runfiles,C++: implement manifest-based runfilesGravatar Laszlo Csomor2018-02-28
| | | | | | | | | | | | | | | | Implement a manifest-based Runfiles object, add tests and test utils (MockFile). Subsequent commits will add more feataures: - creating list of envvars to pass to child processes - automatic Runfiles creation based on argv[0] and the envvars of this process See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I4376ede3ac00241688ff16a36ed596fb08f13a72 PiperOrigin-RevId: 187318502
* runfiles,C++: implement runfiles lib foundationsGravatar Laszlo Csomor2018-02-26
| | | | | | | | | | | | | | | | | | Implement the foundation of the C++ runfiles library, along with a directory-based Runfiles implementation. Subsequent commits will add more feataures: - manifest-based runfiles handling - creating list of envvars to pass to child processes - automatic Runfiles creation based on argv[0] and the envvars of this process See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: Id5a38619a1ae874499f04523863081559360410c PiperOrigin-RevId: 187031518
* runfiles library: py_binary can run java_binaryGravatar Laszlo Csomor2018-02-15
| | | | | | | | | | | | | | Add "JAVA_RUNFILES" (and "RUNFILES_DIR") to the dict that Runfiles.EnvVars() returns in the Python runfiles library, so Python programs that use the Python runfiles library in @bazel_tools can now run java_binary data-dependencies as subprocesses and the latter will find the runfiles. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I0566f6d3c68631a1d99e67964fbe8019ee82324b PiperOrigin-RevId: 185812948
* python,runfiles library,refactor: rename EnvVar()Gravatar Laszlo Csomor2018-02-09
| | | | | | | | | | | | | | | | Rename the runfiles library's Runfiles.EnvVar() method to EnvVars(), indicating that it may return multiple entries in the dict. In the future this method will return multiple keys, but I want to update the interface ASAP so that it is stable after it's released in Bazel 0.12.0. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I8ab3a2a64736ff746dd96fea80ba2f5356dcfcc3 PiperOrigin-RevId: 185118832
* python,runfiles library: don't pick up TEST_SRCDIRGravatar Laszlo Csomor2018-02-08
| | | | | | | | | | | | | | | | | | | | The Python runfiles library will no longer pick up the runfiles directory from $TEST_SRCDIR. This is in accordance with the Java runfiles library, see the motivation in https://github.com/bazelbuild/bazel/issues/4598 The commit also adds a test for this functionality as well as exercising that the runfiles library can find the runfiles directory even if no RUNFILES_* envvars are exported. See https://github.com/bazelbuild/bazel/issues/4598 See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I6e4d154cdca66b29d7c6e77743cf8109638238b5 PiperOrigin-RevId: 185009819
* java,runfiles: fix bugs in runfiles libraryGravatar Laszlo Csomor2018-02-08
| | | | | | | | | | | | | | | | | | | | Bazel 0.11.0 releases a new Java runfiles library in @bazel_tools. This commit fixes some bugs in 0.11.0rc1: - The library no longer respects TEST_SRCDIR, so now it's possible to run Bazel inside of a test and build and run a mock java_binary, and that java_binary will *not* pick up the test's TEST_SRCDIR. - The library now allows calling rlocation for absolute paths, and just returns the path itself. This is in accordance with how our Bash rlocation() implementation works. Change-Id: I471247d7538a76ea8162d2192add3f9733f844a8 PiperOrigin-RevId: 184990272
* python,runfiles: runfiles library in @bazel_toolsGravatar Laszlo Csomor2018-02-05
| | | | | | | | | | | | | Also update the Python stub script template to set $RUNFILES_MANIFEST_FILE or $RUNFILES_DIR so the runfiles library only needs to look for those. See https://github.com/bazelbuild/bazel/issues/4460 RELNOTES[NEW]: python,runfiles: You can now depend on `@bazel_tools//tools/runfiles:py-runfiles` to get a platform-independent runfiles library for Python. See DocString of https://github.com/bazelbuild/bazel/blob/master/src/tools/runfiles/runfiles.py for usage information. Change-Id: I4f68a11cb59f2782e5203e39fe60cc66b46023a2 PiperOrigin-RevId: 184515490
* java,runfiles: runfiles library in @bazel_toolsGravatar Laszlo Csomor2018-01-16
| | | | | | | | | | | | | | Also make most targets in `//src/tools/runfiles` private. The user should depend on `@bazel_tools//tools/runfiles:$LANG-runfiles` instead. See https://github.com/bazelbuild/bazel/issues/4460 RELNOTES[NEW]: java,runfiles: You can now depend on `@bazel_tools//tools/runfiles:java-runfiles` to get a platform-independent runfiles library for Java. See JavaDoc of https://github.com/bazelbuild/bazel/blob/master/src/tools/runfiles/java/com/google/devtools/build/runfiles/Runfiles.java for usage information. Change-Id: Iba9113453222ae74ce42a324272711f613104891 PiperOrigin-RevId: 182022851
* java,runfiles: cut all third-party dependenciesGravatar Laszlo Csomor2018-01-15
| | | | | | | | | | | | | Cut all dependencies of the Java runfiles library, so we can include its sources in @bazel_tools, and any Java project can safely depend on it without worrying about pulling in an incompatible version of Guava for example. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I4a9314c56a2c9dc3afdf53669429750d8fb81e3b PiperOrigin-RevId: 181968558
* Clean up Windows config_settingsGravatar Yun Peng2018-01-12
| | | | | | | | | | | | | | 1.Deleted config_setting for --cpu=x64_windows_msys, because we don't build Bazel with MSYS gcc anymore. 2.Deleted config_setting for --cpu=x64_windows_msvc, because it uses exactly the same toolchain as --cpu=x64_windows, it'll be removed in the future. This change reduces the complexity of our BUILD files and make them less confusing. Change-Id: I939831a6861413b0f745fb1be98aacd4fb780e0a PiperOrigin-RevId: 181751853
* java,runfiles: add Java library to handle runfilesGravatar Laszlo Csomor2018-01-12
| | | | | | | | | | | | | | This is a prerequisite to port all tests to run on Windows. It is also part of the effort to provide platform-independent, language-specific runfiles-handling libraries. See: - https://github.com/bazelbuild/bazel/issues/4292 - https://github.com/bazelbuild/bazel/issues/3839 Change-Id: Ic64aadcf3f97885de3151da9f921d6351687dce9 PiperOrigin-RevId: 181727511
* Shell code cleanupGravatar Androbin2017-12-14
| | | | | | | | | | | | - Argument mixes string and array. Use * or separate argument. - Quote the grep pattern so the shell won't interpret it. - Use "${var:?}" to ensure this never expands to /* . - > is for string comparisons. Use -gt instead. - Quote the parameter to -name so the shell won't interpret it. Closes #4163. PiperOrigin-RevId: 179042046
* Fix some broken targets and failing tests.Gravatar ajmichael2017-12-06
| | | | | RELNOTES: None PiperOrigin-RevId: 178099410
* Move bazel conditions into src/conditions.Gravatar tomlu2017-11-30
| | | | | | | This will enable an easier transition from checked-in BUILD files to ones generated by copybara. RELNOTES: None PiperOrigin-RevId: 177514519
* shell,runfiles: add runfiles libraryGravatar Laszlo Csomor2017-10-11
Create sourceable runfiles.sh that implements rlocation and a couple other helper functions for shell scripts. Change-Id: Ifcf9ee86ed63afe2ce655be596ac781494660398 RELNOTES[NEW]: runfiles, sh: Shell scripts may now depend on //src/tools/runfiles:runfiles_sh_lib and source runfiles.sh. The script defines the `rlocation` function which returns runfile paths on every platform. PiperOrigin-RevId: 171816037