aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
Commit message (Collapse)AuthorAge
* Use pipes.quote() rather than manual quoting, and do so consistently ↵Gravatar diamondm2018-05-24
| | | | | | | wherever shell=True is set. RELNOTES: None PiperOrigin-RevId: 197939143
* shallow_since tests and doc improvementsGravatar Ed Baunton2018-05-24
| | | | | | | | | | | | This changeset introduces tests for the `shallow_since` functionality that was introduced in 6496b1d1d25025f33406b1eaf9949cab126f08bd. We test that if the user specifies a tag as well as a `shallow_since` that it fails since they are incompatible. We also verify that specifying a commit before the `shallow_since` date causes the clone to fail (albeit currently with a non-useful error message; perhaps that could be improved at a later date). It also documents more clearly how to use the feature by explaining the format of the 'since' string. Closes #5183. PiperOrigin-RevId: 197875727
* runfiles,cc: merge strategies into RunfilesGravatar Laszlo Csomor2018-05-24
| | | | | | | | | | | | | | Merge the manifest- and directory-based runfiles strategies into the Runfiles class. The resulting Runfiles object can look up runfiles from the manifest or from the filesystem, as needed. Change-Id: Ifff4b76849ce67248bb9152901024e241aaea800 Closes #5251. Change-Id: Ifff4b76849ce67248bb9152901024e241aaea800 PiperOrigin-RevId: 197863872
* git.bzl: fall back to full clone if shallow options are not supportedGravatar Klaus Aehlig2018-05-24
| | | | | | | | | | The `--shallow-since` option of git was introduced only in version 2.11 of git. However, some widely used distributions ship older versions of git. So fall back to fully cloning or fetching a repository if the respective shallow option is not know to the ambient git command used. Change-Id: I8f0aa0a12e294ff9cc8325975bd9333f6bf50939 PiperOrigin-RevId: 197863797
* runfiles,cc: Runfiles uses manifest AND directoryGravatar Laszlo Csomor2018-05-23
| | | | | | | | | | | | | | | | | | | | | | | | Change the C++ runfiles library so it can use the runfiles manifest (if present) and the runfiles directory (if present) simultaneously. If the Runfiles object fails to look up a runfile from the manifest (or the manifest didn't exist or wasn't found) then it looks it up from the runfiles directory. This change allows using the same binary with and without a runfiles tree, which is often what sets local and remote runs apart. https://github.com/bazelbuild/bazel/issues/4460 Change-Id: Iae879ff084ba084fcd7c111638ddeae4c6754f4f Closes #5235. Change-Id: Iae879ff084ba084fcd7c111638ddeae4c6754f4f PiperOrigin-RevId: 197726412
* http.bzl: add http_jarGravatar Klaus Aehlig2018-05-23
| | | | | | | | http_jar is another version of the native http_archive. So add it to the Skylark-implementation as well. Change-Id: Icbaafe18d4836e14b0f5eb09dc3ab0607f9e391d PiperOrigin-RevId: 197719717
* CROSSTOOL: Make C++ compiled and linked artifact name pattern configurableGravatar Yun Peng2018-05-22
| | | | | | | | | | | | This change makes Bazel respect artifact name patterns specified in CROSSTOOL. Users cannot specify any arbitrary name pattern, it must ends with allowed extensions. For example, for dynamic library, it can only ends with .so, .dylib or .dll, otherwise Bazel throws an error. Change-Id: I21d9e6fa7c3a282e1a9b8ff29679b00925cddb33 PiperOrigin-RevId: 197553413
* runfiles,python: add a method to discover runfilesGravatar Laszlo Csomor2018-05-22
| | | | | | | | | | | | | | | | | | | | The new method discovers the runfiles manifest and runfiles directory using the values of the RUNFILES_MANIFEST_FILE and RUNFILES_DIR envvars (if specified), and if needed, also looks for them next to sys.argv[0]. This commit is a copy of https://github.com/bazelbuild/bazel/commit/9f2b052d93bfd188687f28fe6771f390d3626936 ported from C++ to Python. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I6916366ca73575703fe39ce69020eec3b54457bf Closes #5233. Change-Id: I6916366ca73575703fe39ce69020eec3b54457bf PiperOrigin-RevId: 197544480
* cpp runfiles library: precompute envvars mapGravatar Laszlo Csomor2018-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compute the list of environment variables when creating the runfiles library instead of computing it on-demand. Since we already have the manifest and directory path from Runfiles::PathsFrom, creating the vector is cheap, though we have to store it even if we don't use it later. In a subsequent change I'll merge the manifest- and directory-based implementations into RunfilesImpl, and collapse RunfilesImpl into the Runfiles base class. The point of that is to make the runfiles library be able to handle both the directory-based and the manifest-based case simultaneously, dependening on what is available to it in the filesystem. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I56310423528df2d0f7494f45904150193368e2d6 Closes #5218. Change-Id: I73d1f44611c4b0a73c41162319d0ba7a8a4ae6d7 PiperOrigin-RevId: 197543865
* cpp runfiles library: compute manifest/dir pathsGravatar Laszlo Csomor2018-05-18
| | | | | | | | | | | | | | | | | | | Use the new codepath (Runfiles::PathsFrom) to compute the paths of the runfiles manifest file and runfiles directory. This method considers the RUNFILES_* envvars but also the argv0 value, and tries hard to discover where the runfiles manifest or directory is. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I041b9d12f5c4138853fac1c2bf48873af8e2bd93 Closes #5216. Change-Id: I041b9d12f5c4138853fac1c2bf48873af8e2bd93 PiperOrigin-RevId: 197146764
* Portability with BSD stat in collect_coverage.shGravatar Siddhartha Bagaria2018-05-17
| | | | | | | | BSD stat does not have --printf option. Closes #5162. PiperOrigin-RevId: 196965302
* Split user_link_flags from legacy_link_flagsGravatar hlopko2018-05-16
| | | | | | | | The difference between them is that user_link_flags will stay after we remove legacy fields from the crosstool. RELNOTES: None. PiperOrigin-RevId: 196940832
* Replace use of output_object_file with output_file in CROSSTOOLS.Gravatar hlopko2018-05-16
| | | | | RELNOTES: None. PiperOrigin-RevId: 196870840
* Enable proguarded Android builds with --experimental_desugar_java8_libs in BazelGravatar kmb2018-05-16
| | | | | | RELNOTES: Bazel supports including select Java 8 APIs into Android apps targeting pre-Nougat Android devices with --experimental_desugar_java8_libs PiperOrigin-RevId: 196833987
* Remove unneeded exec_compatible_with from local_sh_toolchainGravatar Klaus Aehlig2018-05-16
| | | | | | | | | | Since that restriction is not necessary at the moment, we can as well not compute it in the first place. Potentially to be cherry-picked for 0.14.0, see #5056. Change-Id: Ic2d4ec1b037ce464e85e243b69bedd483bc515ac PiperOrigin-RevId: 196819791
* Rewrite lcov path munging to make the paths all relativeGravatar Ulf Adams2018-05-16
| | | | | | | | | | | | | This makes coverage work with sandboxing, and gets rid of a previous workaround. The only downside is that it requires running genhtml in the exec root in order to be able to resolve relative pahts to source files, like so: (GENHTML_CMD="genhtml -o $(pwd)/report/ -p "$(readlink -f bazel-project)" $(readlink -f bazel-testlogs)/path/to/coverage.dat" && cd bazel-project && $GENHTML_CMD) Closes #5043. PiperOrigin-RevId: 196814568
* http_archive: Support workspace_file and workspace_file_contentsGravatar Klaus Aehlig2018-05-16
| | | | | | | ...to be fully compatible with the native rules. Change-Id: Ie340f73ec530ef0c8f50215a331f28f523398db8 PiperOrigin-RevId: 196801227
* Do not autodetect C++ toolchain when BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 is ↵Gravatar hlopko2018-05-16
| | | | | | | | | | | | present This is useful e.g. when all C++ builds happen remotely and there's no C++ toolchain installed on the host machine. Fixes #5133. RELNOTES: None. PiperOrigin-RevId: 196798471
* Replace --experimental_android_enforce_strict_deps_for_binaries_under_test ↵Gravatar cushon2018-05-15
| | | | | | with a package whitelist PiperOrigin-RevId: 196688645
* sh_configure.bzl: FreeBSD is also a known platformGravatar Klaus Aehlig2018-05-15
| | | | | Change-Id: I51ffe838d8c0e067f8e5ab3a6aef18e1ad063638 PiperOrigin-RevId: 196666303
* http.bzl: drop outdated commentGravatar Klaus Aehlig2018-05-15
| | | | | | | | Since cdc99afc1a03ff8fbbbae088d358b7c029e0d232 label arguments are prefetched. So it is no longer necessary to access them early. Change-Id: I6d30bae3ac655387641ffd98f9b9aa95d2f1ece7 PiperOrigin-RevId: 196632853
* Don't default to --release 9 when running on a JDK 9 host_javabaseGravatar cushon2018-05-14
| | | | PiperOrigin-RevId: 196518906
* Use the local JDK as the default target javabaseGravatar cushon2018-05-14
| | | | | | and continue to use the embedded JDK as the default host_javabase. PiperOrigin-RevId: 196471714
* Allow conditional keep rules in proguard_whitelister.Gravatar Googler2018-05-07
| | | | PiperOrigin-RevId: 195757274
* Explicitly assign --buildroot in the rpmbuild invocationGravatar mmikitka2018-05-03
| | | | | | | | | | | | | | | Occasionally, I see the following error messages when running a pkg_rpm target: ` INFO: Analysed target //foo/deploy:pkgs (1 packages loaded). INFO: Found 1 target... INFO: From Executing genrule //foo/deploy:pkgs: error: cannot open Packages database in /home/mmikitka/.rpmdb ` This PR explicitly sets the --buildroot to address this error message. Closes #5102. PiperOrigin-RevId: 195254300
* AddFiles will recursively add files when a directory is encounteredGravatar mmikitka2018-05-03
| | | | | | | | This PR provides support for directories as inputs to pkg_rpm, which is useful for RPMs that contain a lot of files, and one doesn't want to exceed the shell argument buffer size. Files are recursively added from the top-level parent directory. Closes #5097. PiperOrigin-RevId: 195211382
* runfiles,cc: add a method to discover runfilesGravatar Laszlo Csomor2018-05-02
| | | | | | | | | | | | | | | | | The new method discovers the runfiles manifest and runfiles directory using the values of the RUNFILES_MANIFEST_FILE and RUNFILES_DIR envvars (if specified), and if needed, also looks for them next to argv[0]. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: Ie9af0a92aa6879b1d9afdee2789f625de1b0d595 Closes #5140. Change-Id: Ie9af0a92aa6879b1d9afdee2789f625de1b0d595 PiperOrigin-RevId: 195093387
* Change -lgcov with --coverageGravatar Irina Iancu2018-05-02
| | | | | | | | `-lgcov` is not supported on macOS. Closes #5138. PiperOrigin-RevId: 195081921
* Make runfiles usage on Windows more flexible to support remote execution.Gravatar Googler2018-04-30
| | | | | | | | | | | | | | | When trying to find a runfile on Windows: 1. First look for the runfiles MANIFEST and find runfile locations using this if it exists (current behavior). 2. If no MANIFEST file exists, look for runfiles in the runfiles directory (new behavior). As part of this, remove setting RUNFILES_MANIFEST_ONLY for the benefit of test-setup.sh. Instead of telling it what to do, it decides what to do based on the observed state of the world. Launchers still set RUNFILES_MANIFEST_ONLY for the benefit of launched programs, since some may depend on this. Fixes https://github.com/bazelbuild/bazel/issues/4962. RELNOTES: Remote execution works for Windows binaries with launchers. PiperOrigin-RevId: 194785440
* Fix targets broken by ↵Gravatar laszlocsomor2018-04-30
| | | | | | | https://github.com/bazelbuild/bazel/commit/819bf38d97e6eef3c823bdae3ffcdb013d6d83e3. RELNOTES: none PiperOrigin-RevId: 194770938
* 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
* runfiles,Bash: bugfix in absolute path checkingGravatar Laszlo Csomor2018-04-30
| | | | | | | | | | | | Export the variable which stores the regex pattern that matches absolute paths, otherwise this variable won't exist when we call rlocation from other scripts (that are executed, not sourced). See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: Idb35ef1bc8489ee53b36b4fe21e1242ea85eeb4c PiperOrigin-RevId: 194761352
* tests,shell: enable some shell tests on WindowsGravatar Laszlo Csomor2018-04-26
| | | | | | | | | | | | | | | | In this commit: - split //src/test/shell:shell_utils_test into a symlink-specific part and the rest - use the Bash runfiles library - add "windows_tests" and "all_windows_tests" targets as we do in other platforms (e.g. in //src:BUILD) See https://github.com/bazelbuild/bazel/issues/4930 See https://github.com/bazelbuild/bazel/issues/4292 Change-Id: I111a7fed223f1f9b767dc6411389465f8da3e043 PiperOrigin-RevId: 194395011
* Bash,runfiles: ignore RUNFILES_MANIFEST_ONLYGravatar Laszlo Csomor2018-04-26
| | | | | | | | | | | | | | | | | | The Bash runfiles library now ignores $RUNFILES_MANIFEST_ONLY, instead it checks if the requested runfile exists either under $RUNFILES_DIR or under the path that $RUNFILES_MANIFEST_FILE associates it with. In this sense, the library now reflects "reality" (returns the file if it exists) rather than a "promise" (returns paths based on faith in envvars). See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: Idbcfede0757e4b8217313b234c94c88bfd780691 PiperOrigin-RevId: 194388639
* Prototype support for llvm coverageGravatar Ulf Adams2018-04-26
| | | | | | | | | | | | | | | https://clang.llvm.org/docs/SourceBasedCodeCoverage.html Closes #5036. Usage with statically linked tests (works with clang 3.9 or later): BAZEL_USE_LLVM_NATIVE_COVERAGE=1 GCOV=llvm-profdata-3.9 CC=clang-3.9 /tmp/bazel coverage --instrumentation_filter=src/main/cpp --dynamic_mode=off src/test/cpp:option_processor_test (LLVM_COV_CMD="llvm-cov-3.9 show -format=html -output-dir=$(pwd)/report/ -instr-profile bazel-out/k8-fastbuild/testlogs/src/test/cpp/option_processor_test/coverage.dat bazel-out/k8-fastbuild/bin/src/test/cpp/option_processor_test" && cd bazel-os-bazel && $LLVM_COV_CMD) Usage with dynamically linked tests (requires clang 4.0 or later): BAZEL_USE_LLVM_NATIVE_COVERAGE=1 GCOV=llvm-profdata-4.0 CC=clang-4.0 bazel coverage --instrumentation_filter=src/main/cpp src/test/cpp:option_processor_test (LLVM_COV_CMD="llvm-cov-4.0 show -format=html -output-dir=$(pwd)/report/ -instr-profile bazel-out/k8-fastbuild/testlogs/src/test/cpp/option_processor_test/coverage.dat bazel-out/k8-fastbuild/bin/src/test/cpp/option_processor_test $(cat bazel-out/k8-fastbuild/bin/src/test/cpp/option_processor_test.runfiles_manifest | cut -d' ' -f 2 | egrep "\.so$" | xargs -n 1 -I xxx echo -n "-object xxx ")" && cd bazel-os-bazel && $LLVM_COV_CMD) PiperOrigin-RevId: 194357292
* Consolidate compatible_javacopts definitionGravatar cushon2018-04-25
| | | | | | | The jdk8/jdk9 difference was a work-around for: https://github.com/bazelbuild/bazel/commit/9666ecc4c6e27467515e362dc25a785dec69fc1b PiperOrigin-RevId: 194253194
* Only print a warning if gcov cannot be found, not an errorGravatar ulfjack2018-04-25
| | | | | | | | We have some cases where clang is installed, but not gcc, and there is no convenience symlink for gcov to point to the corresponding clang tool. In this case, coverage won't work, but let's not error out. We can't tell here whether coverage is enabled or not. Fixes #5066. PiperOrigin-RevId: 194245346
* Detect build-in include directories for C and C++, not only for C++Gravatar hlopko2018-04-25
| | | | | | | Ping #3977 RELNOTES: None PiperOrigin-RevId: 194240625
* send Android desugar tool invocations through wrapper script with additional ↵Gravatar kmb2018-04-24
| | | | | | configuration flags. PiperOrigin-RevId: 194153158
* 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
* test-setup: remove leading "./" from test nameGravatar Laszlo Csomor2018-04-24
| | | | | | | | | | | Fixes release-blocking regression https://github.com/bazelbuild/bazel/issues/5079 Change-Id: I26202d571d53cd843d559b86d849d29173df4015 Closes #5083. Change-Id: I26202d571d53cd843d559b86d849d29173df4015 PiperOrigin-RevId: 194068956
* Bash,runfiles: add testsGravatar Laszlo Csomor2018-04-23
| | | | | | | | | | | | | | | | | | The runfiles library can now discover where the runfiles are. Also remove the shebang line from the runfiles library. This script should never by executed on its own but be sourced by other Bash scripts. See https://github.com/bazelbuild/bazel/issues/4460 RELNOTES[NEW]: Bash,runfiles: use the new platform-independent library in `@bazel_tools//tools/bash/runfiles` to access runfiles (data-dependencies). See https://github.com/bazelbuild/bazel/blob/master/tools/bash/runfiles/runfiles.bash for usage information. Closes #5071. Change-Id: I94557133e76ecc927646d109e2611d711c363cdc PiperOrigin-RevId: 193923870
* Add a workaround for gcov-based coverage with clangGravatar Ulf Adams2018-04-19
| | | | | | | | | | | | | | | | | | - Allow overriding the gcov tool with the GCOV env variable in cc_configure - Symlink the GCOV tool in collect-coverage.sh to a temporary location with the name "gcov" This allows the user to specify GCOV=llvm-cov in the environment of a bazel build, which then leads to cc_configure picking up llvm-cov in the crosstool, which the collect-coverage.sh script then uses as "gcov". On linux distributions, the gcov tool does not generally work with clang coverage output, so this provides at least a workaround for running coverage with clang (by setting the GCOV env variable). Closes #5040. PiperOrigin-RevId: 193487773
* fix @bazel_tools to actually include currently missing artifact from a genrule.Gravatar kmb2018-04-18
| | | | | | RELNOTES: None. PiperOrigin-RevId: 193421179
* Expose debug parameter to suppress informative print statementsGravatar mmikitka2018-04-18
| | | | | | | | I like to have clean output on successful builds, and this PR suppresses informative print statements, by default, with the option of exposing them, if desired. Closes #5037. PiperOrigin-RevId: 193375345
* Pass --coverage to all compile and link stepsGravatar Ulf Adams2018-04-17
| | | | | | | | | | | | | | I get failing tests without this flag in coverage mode. Workaround is to pass --linkopt=-fprofile-arcs in Bazel. Here are the steps that work at this time (with this change): bazel coverage --strategy=TestRunner=standalone //my/funky:test genhtml -o report-output-directory/ path/to/coverage.dat Some progress on #1118. PiperOrigin-RevId: 193193164
* Bump @desugar_jdk_libs dependency, which pulls in build file changes and a ↵Gravatar kmb2018-04-17
| | | | | | | | new class, and adjust its build accordingly. RELNOTES: None. PiperOrigin-RevId: 193177895
* Ignore missing .gcno files in coverage collectionGravatar Ulf Adams2018-04-16
| | | | | | | | | | Bazel uses an instrumentation filter to collect coverage from a subset of source files. Without this flag, lcov fails if the instrumentation filter does not cover everything in the source tree (i.e., --instrumentation_filter=.*). Some progress on #1118. PiperOrigin-RevId: 193023189
* bash: Add a toolchain for local Bash.Gravatar Laszlo Csomor2018-04-16
| | | | | | | | | | | | | | | | | | | Bazel automatically detects the local Bash and creates a custom toolchain rule for it. Later, rules that use Bash will require this toolchain and retrieve Bash's path from it instead of relying on hardcoded paths or the `--shell_executable` flag. See https://github.com/bazelbuild/bazel/issues/4319 Change-Id: Idd8242a20d202b1f5a56cddac95b625c6c08ede9 Closes #4980. Change-Id: Ic2406a4da260b284e15852070d58472ca18340af PiperOrigin-RevId: 193022708
* Bash,runfiles: add runfiles libraryGravatar Laszlo Csomor2018-04-16
| | | | | | | | | | | See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I35a0b12ac17fe8bfdce3c7ba8c0dfddb35df7e28 Closes #5014. Change-Id: I35a0b12ac17fe8bfdce3c7ba8c0dfddb35df7e28 PiperOrigin-RevId: 193010997