aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/tools
Commit message (Collapse)AuthorAge
* Deprecate most of the targets in the JDK repositoryGravatar cushon2018-08-08
| | | | | | See #5594 PiperOrigin-RevId: 207943203
* Remove support for java_runtime_suiteGravatar cushon2018-07-05
| | | | | RELNOTES: Remove support for java_runtime_suite; use alias() together with select() instead. PiperOrigin-RevId: 203393253
* Made 'build-runfiles.cc' POSIX compatible.Gravatar Jasper Siepkes2018-04-09
| | | | | | | | | | The 'd_type' field is not part of the POSIX specification. Added a compile time check to see if we can use it. When not present fallback to a (slightly more expensive) call to 'stat'. This PR is similar to my other PR #4967. It's part of an effort to port Bazel to an POSIX compliant platform. Even though my porting effort may fail I think POSIX compliance could be beneficiary to Bazel either way. Closes #4969. PiperOrigin-RevId: 192096587
* [Windows] Don't use -lm on WindowsGravatar Loo Rong Jie2018-02-13
| | | | | Change-Id: Ib0c957de68a8a8035f2e13d7c9fe8d1549a3744d PiperOrigin-RevId: 185645675
* 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
* Update bootclasspath handling for JDK 9Gravatar cushon2017-12-20
| | | | | | | rt.jar etc. no longer exist, retrieve the default bootclasspath contents using a Java program instead. PiperOrigin-RevId: 179747945
* Make linux-sandbox output execution statistics for executed commands.Gravatar ruperts2017-12-13
| | | | | | | For example, it now outputs resource usage statistics like the amount of user time and system time used. RELNOTES: None PiperOrigin-RevId: 178948958
* 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
* Make process-wrapper output execution statistics for executed commands.Gravatar ruperts2017-11-28
| | | | | | | For example, it now outputs resource usage statistics like the amount of user time and system time used. RELNOTES: None PiperOrigin-RevId: 177263221
* Add documentation for linux-sandbox -H option.Gravatar ruperts2017-11-14
| | | | | RELNOTES: None PiperOrigin-RevId: 175697300
* Fix #2667: Grab MS_REC from linux/fs.h if not defined.Gravatar philwo2017-10-20
| | | | PiperOrigin-RevId: 172859731
* Delete unused function in process-wrapper-options.ccGravatar Benjamin Peterson2017-07-18
| | | | | Change-Id: Idbbf4662b96508c40c6f530ce5609faa079f0976 PiperOrigin-RevId: 162218592
* Use getopt to parse process-wrapper's command-line.Gravatar philwo2017-06-22
| | | | | | | | This will allow us to add new and optional flags like selecting a strategy used to spawn / wait for the child process. No one except Bazel should be calling "process-wrapper" and I couldn't find any references, so this breaking change should be fine. PiperOrigin-RevId: 159685867
* Automated g4 rollback of commit 5608765ab737ebb8a98a04a6068143d53ae7065c.Gravatar philwo2017-06-06
| | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Rollforward with fix for FreeBSD. I added the missing headers and verified that it now builds fine on FreeBSD 11, too. *** Original change description *** Automated g4 rollback of commit 7f520a8286c39c5145b6d816cd0be5a6b7b18250. *** Reason for rollback *** This broke Bazel CI on freebsd: http://ci.bazel.io/view/Dashboard/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=freebsd-11/1516/console# *** Original change description *** Refactor process-wrapper code so the spawn/wait code is pluggable. In an upcoming change I'll reintroduce the new platform-specific implementations that can kill and wait for all descendant processes spawned by the wrapped process. This has no functional changes. PiperOrigin-RevId: 158133159
* Fix sandbox to recursively bind mount the writable directories.Gravatar Googler2017-06-05
| | | | | | | | | | | If a directory that is being bind mounted has a subdirectory that is a mount point (e.g.: tmpfs on /tmp/tmp), then the MS_BIND mount() call will fail with invalid argument. Fixes #3064. RELNOTES: None. PiperOrigin-RevId: 157973469
* Small optimization to avoid allocating strings in the bind mount loop.Gravatar Googler2017-05-31
| | | | PiperOrigin-RevId: 157479936
* Make Bazel build without --cpu=x64_windows_msvcGravatar Yun Peng2017-05-30
| | | | | | | | | | | | | | | | After this change, with a Bazel having MSVC as default toolchain, the command to build a MSVC Bazel on Windows is simply: bazel build //src:bazel although bazel build --cpu=x64_windows_msvc //src:bazel is still supported. And the command to build a MSYS Bazel on Windows is: bazel build --cpu=x64_windows_msys //src:bazel Also made //src/test/cpp:blaze_util_test pass without --cpu=x64_windows_msvc Change-Id: Iaf37513c778768d06fb5700442d5229a5f348964 PiperOrigin-RevId: 157446905
* process-tools: Fail silently when we can't install a signal handler.Gravatar philwo2017-05-26
| | | | | | | | | | | | | | | | | | | | | | | linux-sandbox expects InstallSignalHandler to fail silently when called for a signal that doesn't allow one to install a signal handler. This behavior was accidentally lost and changed into a DIE() on sigaction failure when unifying the signal handling code with process-wrapper in https://github.com/bazelbuild/bazel/commit/f5900474b8bce417c3ef4c3e06af6da5ed57b929. This CL restores the previous behavior. The issue results in this failure: $ linux-sandbox -- /bin/true third_party/bazel/src/main/tools/process-tools.cc:112: "sigaction": Invalid argument We do have tests for linux-sandbox and Bazel's usage of the linux-sandbox strategy. None of these actually started failing when the linux-sandbox stopped working, due to our automatic fallback logic that we added in order to not annoy users / CI on platforms that don't support the Linux sandbox :( Bazel silently falls back to the processwrapper-sandbox strategy and disables the entire linux-sandbox test suite, but signals to CI that it passed (because we don't support a "Skipped" test status). Well, congrats. What an epic fail. I will have to rework this next week. PiperOrigin-RevId: 157021455
* Automated g4 rollback of commit 7f520a8286c39c5145b6d816cd0be5a6b7b18250.Gravatar elenairina2017-05-23
| | | | | | | | | | | | | | | | | | *** Reason for rollback *** This broke Bazel CI on freebsd: http://ci.bazel.io/view/Dashboard/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=freebsd-11/1516/console# *** Original change description *** Refactor process-wrapper code so the spawn/wait code is pluggable. In an upcoming change I'll reintroduce the new platform-specific implementations that can kill and wait for all descendant processes spawned by the wrapped process. This has no functional changes. PiperOrigin-RevId: 156884488
* Refactor process-wrapper code so the spawn/wait code is pluggable.Gravatar philwo2017-05-23
| | | | | | | | In an upcoming change I'll reintroduce the new platform-specific implementations that can kill and wait for all descendant processes spawned by the wrapped process. This has no functional changes. PiperOrigin-RevId: 156849610
* Share the signal handling code between linux-sandbox and process-wrapper.Gravatar philwo2017-05-19
| | | | PiperOrigin-RevId: 156347327
* Some fixes to process-wrapper / linux-sandbox.Gravatar philwo2017-05-19
| | | | | | | | | - Refactoring to share more code between the two programs. - Remove setuid() call in linux-sandbox. It was added due to a wrong understanding of what process-wrapper did in the beginning and unless someone installed linux-sandbox as a setuid binary, it was a no-op. - Switch to a new process group in linux-sandbox to avoid accidentally killing our parent. RELNOTES: None. PiperOrigin-RevId: 156332503
* Convert process-wrapper to C++.Gravatar Philipp Wollermann2017-05-17
| | | | | | | No functional changes. Change-Id: Ia87c19b70dd1ff8fa7465ad90c499cf351b9687b PiperOrigin-RevId: 156188343
* Remove process-tools.cc which I forgot to delete during the last rollback.Gravatar philwo2017-05-15
| | | | PiperOrigin-RevId: 156092500
* Automated g4 rollback of commit 3e5edafa2a04a71cd3596e929e83222da725f3f9.Gravatar philwo2017-05-15
| | | | | | | | | | | | | | | | | | *** Reason for rollback *** Likely cause for b/38172480 ("blaze now waits for all processes spawned by local tests to terminate") and b/38194553 ("Server terminated abruptly (error code: 14, error message: 'Endpoint read failed'"). I have a fix almost ready, but it consists of many lines of new code - we shouldn't rush that into Bazel's 0.5.0 release. Instead, let's roll this back, do a release using the known good older process-wrapper and then go forward in 0.5.1 with a better and well tested new version of this. *** Original change description *** process-wrapper: Wait for all (grand)children before exiting. This uses Linux's PR_SET_CHILD_SUBREAPER and FreeBSD's PROC_REAP_ACQUIRE features to become an init-like process for all (grand)children spawned by process-wrapper, which allows us to a) kill them reliably and then b) wait for them reliably. Before this change, we only killed the main child, waited for it, then fired off a kill -9 on the process group, without waiting for it. This led to a race condition where Bazel would try to use... *** PiperOrigin-RevId: 156068188
* Fix potential uninitialized variable usage in linux-sandbox-options.ccGravatar Peter Foley2017-05-04
| | | | | | | | | | | if (!source_specified) { ^ src/main/tools/linux-sandbox-options.cc:126:8: note: 'source_specified' was declared here bool source_specified; ^ Closes #2735. PiperOrigin-RevId: 155067584
* Check for definition of PR_SET_CHILD_SUBREAPER and don't die when it fails ↵Gravatar philwo2017-04-25
| | | | | | | | | in order to degrade gracefully on older Linux versions that don't support this feature yet. Fixes broken Bazel CI: http://ci.bazel.io/job/bazel-docker-tests/532/BAZEL_VERSION=latest,PLATFORM_NAME=docker/console PiperOrigin-RevId: 154190829
* process-wrapper: Wait for all (grand)children before exiting.Gravatar philwo2017-04-24
| | | | | | | | This uses Linux's PR_SET_CHILD_SUBREAPER and FreeBSD's PROC_REAP_ACQUIRE features to become an init-like process for all (grand)children spawned by process-wrapper, which allows us to a) kill them reliably and then b) wait for them reliably. Before this change, we only killed the main child, waited for it, then fired off a kill -9 on the process group, without waiting for it. This led to a race condition where Bazel would try to use or delete files that were still helt open by children of the main child and thus to bugs like #2371. This means we now have reliable process management on Linux, FreeBSD and Windows. Unfortunately I couldn't find any feature like this on macOS, so this is the only OS that will still have this race condition. PiperOrigin-RevId: 153817210
* Add runfiles in jdk.BUILDGravatar Stephen Twigg2017-04-06
| | | | | | | | | | | | | | | | | | | | | Add jdk as runfiles for java, jar, and javac in jdk.BUILD. Done via data attribute of filegroup. This should 'mostly' work if you handwave around the differences between default_runfiles and data_runfiles. The jdk runfiles will always be accessed via data_runfiles, and thus not platform-targeted. Therefore, my expectation is the target machine will be sent the host JDK. However, since the jdk is itself composed of binary imports anyway, it seems like the JDK already has issues being platform-targeted. To reviewers: I didn't do a thorough audit of the jdk.BUILD file. More specifically, unsure if xjc or wsimport need a jdk as well. Still investigating a good testing strategy. Change-Id: I138b95b8cee2808c89e4202b822ada6a6577acce PiperOrigin-RevId: 152290935
* sandbox: Don't mount tmpfs on /tmp by default.Gravatar Philipp Wollermann2017-03-27
| | | | | | | | | | | If needed you can restore the old behavior by passing the flag --sandbox_tmpfs_path=/tmp to bazel. Fixes #2508. -- PiperOrigin-RevId: 151127924 MOS_MIGRATED_REVID=151127924
* sandbox: Use std::string instead of char*.Gravatar Philipp Wollermann2017-03-27
| | | | | | -- PiperOrigin-RevId: 151120717 MOS_MIGRATED_REVID=151120717
* sandbox: Ignore ENOENT during remount.Gravatar Philipp Wollermann2017-03-27
| | | | | | | | | | | | Instead of trying to detect overlapping mount points, just ignore any ENOENT errors during remount. If this error happens, the mount point wouldn't be accessible anyway, so there's no harm if the remount fails. Fixes #1948. -- PiperOrigin-RevId: 151118726 MOS_MIGRATED_REVID=151118726
* sandbox: Improve the check whether the Linux sandbox is supported.Gravatar Philipp Wollermann2017-03-27
| | | | | | | | | | | | | | | | | | | Try to run /bin/true as a test of whether the Linux sandbox works, instead of just trying to create a bunch of namespaces as a proxy. This helps resolve issues on Linux distros where the earlier check worked, but then the sandbox ultimately failed due to other operations being unsupported. As an example, Debian Jessie and certain Docker versions seem to allow the creation of PID namespaces, but forbid mounting a new proc on top of /proc (see #1972). This resulted in Bazel thinking that sandboxing works fine, when it actually didn't. The improved check correctly catches this situation and disabled sandboxing. -- PiperOrigin-RevId: 151116894 MOS_MIGRATED_REVID=151116894
* sandbox: No longer change the user to 'nobody' by default.Gravatar Philipp Wollermann2017-03-24
| | | | | | | | | | | | | | | | | | | This can be reactivated by passing the --sandbox_fake_username flag to Bazel. Reasoning: 'nobody' has a non-existent home directory on many Linux distros, leading to issues when tools try to stat / read / write to the home directory. Related to #2688. RELNOTES: The Linux sandbox no longer changes the user to 'nobody' by default, instead the current user is used as is. The old behavior can be restored via the --sandbox_fake_username flag. -- PiperOrigin-RevId: 151115218 MOS_MIGRATED_REVID=151115218
* sandbox: No longer require a temporary "sandbox" directory.Gravatar Philipp Wollermann2017-03-24
| | | | | | | | | | | | | By removing the --sandbox_block_path feature in an earlier change and taking advantage of the fact that in a mount namespace we can actually "remount" mount points to be read-only without bind mounting them to some other place beforehand, this is no longer necessary. The code becomes much simpler due to this, for example we no longer need to chroot. -- PiperOrigin-RevId: 151111360 MOS_MIGRATED_REVID=151111360
* sandbox: Remove the flag --sandbox_block_path.Gravatar Philipp Wollermann2017-03-24
| | | | | | | | | | | | | | | | | | It is in the way of optimizing the performance of the sandbox, because it requires us to create two helper files (an unreadable file and an unreadable directory) which are bind-mounted on top of paths specified via this flag. These two helper files were created on a tmpfs mounted by the sandbox until now, which ensured that they were automatically deleted on exit. However, mounting tmpfs on /dev/shm or /tmp causes issues like #2686 or #1882. By removing this flag, we can get rid of the two helper files, which means we can also remove the reliance on a "sandbox temp directory" completely in the next change. -- PiperOrigin-RevId: 151107496 MOS_MIGRATED_REVID=151107496
* Make Bazel build with MSVC-default-toolchain Bazel Gravatar Yun Peng2017-03-08
| | | | | | | | | | | | | After this change, a msys bazel can be built with a MSVC-default Bazel by adding --cpu=x64_windows_msys --host=x64_windows_msys See https://github.com/bazelbuild/bazel/issues/2627 -- Change-Id: Iaa82bf4dd911c5740b98d3b2739dfccca6203f79 Reviewed-on: https://cr.bazel.build/9293 PiperOrigin-RevId: 149532274 MOS_MIGRATED_REVID=149532274
* Make MSVC CROSSTOOL default on Windows Gravatar Yun Peng2017-03-08
| | | | | | | | | | | | | | | | The default C++ CROSSTOOL on Windows now becomes MSVC, --cpu=x64_windows_msvc is still supported To use MSYS toolcahin, add --cpu=x64_windows_msys and --host_cpu=x64_windows_msys for host compilation See https://github.com/bazelbuild/bazel/issues/2627 -- Change-Id: Ie788a39cb5ffbc9fc956ccfd51a3cc816c74543a Reviewed-on: https://cr.bazel.build/9292 PiperOrigin-RevId: 149530250 MOS_MIGRATED_REVID=149530250
* Windows: Assist JNI builds with a target for jni_md.h. Gravatar Asim Shankar2017-03-08
| | | | | | | | | | | | | This rule can be used in building JNI shared libraries for Windows. For example, see TensorFlow usage of these targets in jdk.BUILD: https://github.com/tensorflow/tensorflow/blo[]a98083a6c16f263d668271889863596efbeb84/tensorflow/java/src/main/native/BUILD#L68 Closes #2599. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/2599 PiperOrigin-RevId: 149527656 MOS_MIGRATED_REVID=149527656
* 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
* Make the interface dynamic library builder a regular label instead of a ↵Gravatar Lukacs Berki2017-02-17
| | | | | | | | magic artifact. -- PiperOrigin-RevId: 147830857 MOS_MIGRATED_REVID=147830857
* Rename 'extdir' to 'extclasspath'Gravatar Liam Miller-Cushon2017-02-17
| | | | | | | | | The targets contain the entries in the extdir and are used to construct a classpath, so the label is not actually a directory. -- PiperOrigin-RevId: 147798672 MOS_MIGRATED_REVID=147798672
* Migrate to java_runtime{,_suite}Gravatar Liam Miller-Cushon2017-02-17
| | | | | | -- PiperOrigin-RevId: 147727032 MOS_MIGRATED_REVID=147727032
* 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
* Remove unused function to silence a warning when compiling bazel.Gravatar Tobias Werth2017-02-06
| | | | | | -- PiperOrigin-RevId: 146469548 MOS_MIGRATED_REVID=146469548
* Fix #2285: linux-sandbox-pid1.cc:398: remount: Operation not permittedGravatar Philipp Wollermann2017-02-02
| | | | | | | | Seems like on Ubuntu 16.04 we have to ignore EPERM on failed remounts, too. -- PiperOrigin-RevId: 146354561 MOS_MIGRATED_REVID=146354561
* Fix #2018: Can't access localhost in bazel 0.3.2.Gravatar Philipp Wollermann2017-02-01
| | | | | | | | | | | | | | The behavior of the Linux sandbox was changed to not hide the local hostname by default. It is now only hidden when the --sandbox_fake_hostname flag is specified. Also, instead of using the hostname "sandbox" in this case, it now uses "localhost", which fixes the issue of sandboxed processes not being able to resolve their local hostname. RELNOTES: For increased compatibility with environments where UTS namespaces are not available, the Linux sandbox no longer hides the hostname of the local machine by default. Use --sandbox_fake_hostname to re-enable this feature. -- PiperOrigin-RevId: 146244268 MOS_MIGRATED_REVID=146244268
* Bazel can now be built on Windows with MSVCGravatar Laszlo Csomor2017-01-31
| | | | | | | | | | | | | | | | | | | | | | | | bazel build //src:bazel --cpu=x64_windows_msvc now succeeds, hooray! This change adds empty implementations for build-runfiles and process-wrapper to make that possible. This means we can now build a bazel binary that doesn't depend on MSYS. The resulting binary is not yet functional because many methods are still to be implemented, and they just write "TODO: implement" or something similar. But still this is great news, because now we can add compile tests to the CI for MSVC! See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 146106178 MOS_MIGRATED_REVID=146106178
* Add customized path mounting in Bazel sandbox.Gravatar Xin Gao2016-12-20
| | | | | | | | | | RELNOTES: New flag --sandbox_add_mount_pair to specify customized source:target path pairs to bind mount inside the sandbox. -- Change-Id: Ifbacfc0e16bbaedcf5b6d3937799710f2cfa3d58 Reviewed-on: https://cr.bazel.build/7150 PiperOrigin-RevId: 142542381 MOS_MIGRATED_REVID=142542381
* Let the sandbox ignore ESTALE errors on remounting file systems.Gravatar Philipp Wollermann2016-11-29
| | | | | | | These may happen when a broken NFS mount is present on the user system. Ideally, that mount should just be fixed or removed, but where this is not possible, it's probably safe to ignore it. -- MOS_MIGRATED_REVID=140476478