aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/launcher
Commit message (Collapse)AuthorAge
* Windows, Bash launcher: Make sure bash bin tool directory is in PATHGravatar pcloudy2018-08-10
| | | | | | | | | | | If bash_bin_path exists, we add it's directory to PATH to make bash bin tools available. If bash_bin_path doesn't exist, there are two cases: 1. bash.exe is in PATH, and that means bash bin tools should also be in PATH. 2. bash.exe isn't in PATH, the launcher will fail with "The system cannot find the file specified." error. RELNOTES: None PiperOrigin-RevId: 208182717
* Windows,JNI: more robust nativeCreateJunctionGravatar Laszlo Csomor2018-07-09
| | | | | | | | | | | | | | | | | | | | | | | | Rewrite the CreateJunction function in the Windows JNI library. The new implementation's improvements: - succeeds if the junction already exists with the desired target; hopefully this will fix issue https://github.com/bazelbuild/bazel/issues/5433 - tolerant to concurrent filesystem modifications, e.g. if the junction's path suddenly disappears, the function reports the error correctly Fixes https://github.com/bazelbuild/bazel/issues/5433 Change-Id: I58a2314a00f6edaa7c36c35ba54616168b44eb7d Closes #5528. Change-Id: I9f5dc9237b70a433d0d8c2578a826de3d462d110 PiperOrigin-RevId: 203744515
* windows,launcher: Rlocation function now handles absolute paths correctlyGravatar pcloudy2018-07-06
| | | | | | | Fix https://github.com/bazelbuild/bazel/issues/5516 RELNOTES: None PiperOrigin-RevId: 203448188
* Add virtual destructor and override to BinaryLauncherBase and subclassesGravatar Loo Rong Jie2018-06-28
| | | | | | | | | | Class with virtual functions must have virtual destructor. Subclasses should annotate overriden functions as `override`. Found by Clang's `-Winconsistent-missing-override`. Closes #5474. PiperOrigin-RevId: 202445230
* Windows: Native launcher now works with unicode.Gravatar Yun Peng2018-06-25
| | | | | | | | | | | | | | The native launcher can now launch Java and Bash binary in directory with non-English characters. Unfortunately, python doesn't support running python zip file under directory with non-English characters. eg. python ./??/bin.zip will still fail. See https://github.com/bazelbuild/bazel/issues/4473 Change-Id: I77fe9cdaabffc2e0d25c7097da5c0c9333a9c4a3 PiperOrigin-RevId: 201939391
* [launcher] Don't pass std::string to C varargs functionGravatar Loo Rong Jie2018-06-07
| | | | | | | | | | | | | `die` passes parameters to `vfprintf`. Passing `std::string` to this function might crash the program. Found by Clang on Windows. /cc @meteorcloudy Closes #5339. Change-Id: Iff7aa766770771262f91990774ff4d8de1fbeb5c PiperOrigin-RevId: 199630717
* Move path-manipulation functions to own library file.Gravatar ccalvarin2018-06-05
| | | | | | | | | | | Leave functions that make file accesses in the file library, and general blaze utilities in the blaze_util file, but move the functions that boil down to string manipulation and path formatting to their own file. (With the exception of getCWD, since absolute path syntax is relevant here.) Doing this largely to consolidate all Windows path control into a single place, so that it's easier to notice inconsistencies. For instance, ConvertPath currently makes Windows paths absolute, but not Posix paths, and MakeAbsolute relies on this behavior. In addition, JoinPath assumes Posix path syntax, which leads to some odd looking paths. These will be fixed in a followup change. (Found these issues while working on #4502, trying to fix the windows-specific system bazelrc.) RELNOTES: None. PiperOrigin-RevId: 199368226
* Format all bzl files with buildifierGravatar vladmos2018-06-01
| | | | | | This CL aslo enables a presubmit check for correct formatting of all bzl files in //third_party/bazel. PiperOrigin-RevId: 198857055
* Windows, Java launcher: Support jar files under different drivesGravatar Yun Peng2018-05-14
| | | | | | | | | Create junctions to jar's directory when java launcher and its jar are under different drives Fixed https://github.com/bazelbuild/bazel/issues/5135 Change-Id: I21c5b28f5f36c1fe234f8b781fe40d526db846cc PiperOrigin-RevId: 196477704
* Add absolute path handling to Rlocation implementation used for remote ↵Gravatar Googler2018-05-07
| | | | | | | | | | | | | execution on Windows from Java launcher. Previously the test case would fail because it tried to run a path like this: C:/temp/build-1dad9dd4-ee96-40c5-b551-c8ae12461e45/bazel-out/x64_windows-fastbuild/bin/foo/foo_test.exe.runfiles/C:/openjdk/bin/java.exe Passing presubmit: https://buildkite.com/bazel/google-bazel-presubmit/builds/2558#b83dbc25-d9ad-4d49-8f78-cde9d6810741 RELNOTES: N/A PiperOrigin-RevId: 195675424
* 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
* windows,client: fix error reportingGravatar Laszlo Csomor2018-04-24
| | | | | | | | | | | | | | | | | | | | | | Fix error reporting in the path conversion methods of the Bazel client. Previously the error reporting logic used GetLastErrorString in places where it was not appropriate (i.e. it was not a failed Windows API call that caused an error). This cleanup prepares removing the concept of the MSYS root from the Bazel client, since MSYS paths are no longer supported and we want to cut Bazel's dependency on Bash (thus MSYS) completely. See https://github.com/bazelbuild/bazel/issues/4319 Change-Id: Ie50a20e0ee0c572592f637340a2f2948c7f53088 Closes #5072. Change-Id: Ie50a20e0ee0c572592f637340a2f2948c7f53088 PiperOrigin-RevId: 194052665
* Windows: java launcher no longer calls cmd.exeGravatar Laszlo Csomor2018-04-12
| | | | | | | | | See https://github.com/bazelbuild/bazel/issues/2190 Closes #5005. Change-Id: If665af264a23be0219c75ae087dd25db74d5e386 PiperOrigin-RevId: 192575414
* 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
* Optimize GetEscapedArgumentGravatar Loo Rong Jie2018-02-25
| | | | | | | | If `argument` does not contain `' '` and `'"'` and `escape_backslash` is false (i.e: no escaping needed), `escaped_arg` will allocate memory exactly once only. Closes #4491. PiperOrigin-RevId: 186962716
* windows,launcher: now picks up RUNFILES_* envvarsGravatar Laszlo Csomor2018-02-14
| | | | | | | | | | | | | | The Windows native {java,py,sh}_binary launcher now picks up the RUNFILES_MANIFEST_FILE and RUNFILES_DIR envvars from the environment. This enables running such binaries even when they are data-dependencies of other binaries and thus have no runfiles (manifest or directory) of their own. See https://github.com/bazelbuild/bazel/issues/4460 Change-Id: I1bc8e30f81b9932ea7c96ded2717ac9d0600403d PiperOrigin-RevId: 185656004
* Optimize GetRandomStrGravatar Loo Rong Jie2018-02-05
| | | | | | Closes #4489. PiperOrigin-RevId: 184532916
* Windows, Java launcher: Use relativize paths in classpath jarGravatar Yun Peng2018-01-11
| | | | | | | Fixed https://github.com/bazelbuild/bazel/issues/4408 Change-Id: Id62b25e675822bbed91a448e70bdcb76e722721e PiperOrigin-RevId: 181591585
* Windows Launcher: Fix argument passingGravatar Yun Peng2017-12-11
| | | | | | | | | | Make sure the actual binary recieves exactly the same argument passed to Windows exe launcher. Fixed https://github.com/bazelbuild/bazel/issues/4001 Change-Id: I5db2d7c2f78de8865abc04a2d5b65d69685d43db PiperOrigin-RevId: 178610493
* 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 bazel test src/tools/launcher/... pass on Unix platformGravatar Yun Peng2017-11-20
| | | | | | | | | Since src/tools/launcher is Windows specific, it doesn't actually work on Linux. Here we select a dummy source file for cc targets non-Windows platform. Change-Id: I9a6550ea23a3656ad72cb46b9652f154e2fbf44f PiperOrigin-RevId: 176350180
* CI,windows: create test_suites for Windows testsGravatar L?szl? Csomor2017-09-19
| | | | | | | | | | | | | | | Add recursive test_suite rules for all tests that ci.bazel.io runs for Windows, and set the top-level test_suite as the CI test target. Doing so shortens the command line and works around https://github.com/bazelbuild/bazel/issues/3742 I verified that the old set of tests are the same as the new set. Change-Id: Id8d5da3f0c03c9b8969a9f8e1e9a3096888365aa PiperOrigin-RevId: 169242858
* Java Launcher: Create classpath jar with a random nameGravatar Yun Peng2017-09-18
| | | | | | | | | | | | | | | When the classpath is too long, the launcher creates a jar file to pass the classpath value. This change makes the jar file's name random. It fixed the bug that when running multiple instances of the same java binary, they all try to create the same classpath jar file. For example, when running java_test with shard_count > 1. Also, we delete the classpath jar file after the program finishes, so that we don't leave any garbages behind. Change-Id: I67926b3ef76dcb1806797e977ecaa7c6763c5cf2 PiperOrigin-RevId: 169087032
* Windows Native Launcher: Print command line when launch failed.Gravatar pcloudy2017-09-12
| | | | | | | This will help us debug some Launcher errors. RELNOTES: None PiperOrigin-RevId: 168354216
* Make Windows C++ launcher support long pathGravatar Yun Peng2017-08-29
| | | | | Change-Id: I25795c748fa98b9275ae34ead17fce02a57dc8e4 PiperOrigin-RevId: 166816800
* Prepend workspace name when finding Jar path by RlocationGravatar pcloudy2017-08-25
| | | | | | | Fix https://github.com/bazelbuild/bazel/issues/3620 RELNOTES: None. PiperOrigin-RevId: 166472158
* Windows: Implement Java native launcherGravatar Yun Peng2017-08-25
| | | | | | | | | | | Now Bazel build a Windows exe binary to launch JVM for java_binary and java_test. The Java native launcher is implemented with the same logic and functionalities as the original java shell stub script. Change-Id: Ida40579bce82425f3506f9376b7256aa3edc265e PiperOrigin-RevId: 166346445
* Windows: Implement python native launcherGravatar Yun Peng2017-08-21
| | | | | | | | | | | | Now Bazel build a Windows exe to launch the python self-extracting zip file by default, using --windows_exe_launcher=0 to switch back to cmd wrapper. The extra zip file with shebang preprended is not built on Windows anymore, even when using cmd wrapper. Change-Id: Ic7060326f19ca6e2e73ea8d8211afd1c7618083c PiperOrigin-RevId: 165707076
* Refactor Bash LauncherGravatar Yun Peng2017-08-21
| | | | | | | | | | | | | | | | | | 1. Extract some funtions into NativeLauncherUtil.java So that they can also be used by Python and Java launcher. 2. Derive runfiles directory from mainExectuable yielding "%{name}.cmd.runfiles" or "%{name}.exe.runfiles" 3. Removed bash_main_file key, we can assume the main file is next the launcher just without .exe suffix. By doing this, we don't have to worry about passing RunfilesPath or ExecPath. RunfilesPath has ../ prefix for external file, ExecPath contians ./bazel-out/... for generated file. If main file is a generated file from external repository, neither of them are correct. Change-Id: Ie0c35f6030f6229c28d935d8fb3cb6a8af5af29c PiperOrigin-RevId: 165699975
* Windows, sh_bin. launcher: fix manifest pathGravatar Laszlo Csomor2017-08-07
| | | | | | | | | | | | Fix the path we set in the exe launcher for the RUNFILES_MANIFEST_FILE path. It now uses forward slashes because it's to be consumed by the shell script. This is a follow-up to commit 837e1b3d4859140d29aaa6bbab8fbb008e6d701e Change-Id: Id8331cdcf58adb31ed2b60ebbc57022a0bf32438 PiperOrigin-RevId: 164436539
* Windows, sh_bin. launcher: export runfiles envvarsGravatar Laszlo Csomor2017-08-03
| | | | | | | | | | | Fix the exe launcher of sh_binary rules to export the RUNFILES_MANIFEST_ONLY and RUNFILES_MANIFEST_FILE environment variables. Fixes https://github.com/bazelbuild/bazel/issues/3492 Change-Id: I8507565f44c8b59f8218570306375cc083a41e03 PiperOrigin-RevId: 164095286
* Windows: Implement native binary launcherGravatar Yun Peng2017-07-24
The native launcher is implemented based on this design doc: https://docs.google.com/document/d/1z6Xv95CJYNYNYylcRklA6xBeesNLc54dqXfri0z0e14/edit?usp=sharing Change-Id: I83bae844f792a587ce0e342a3c0f238b760afeaa PiperOrigin-RevId: 162736269