aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/BUILD
Commit message (Collapse)AuthorAge
* Bazel client: add a simple profilerGravatar Laszlo Csomor2018-06-27
| | | | | | | | | | | | | | | | | | | | | | | | Add a simple profiler that can measure function call counts and durations, and report statistics by printing to stderr. Motivation: I recently needed a profiler for PR #5445 and PR #5448, so I'm adding the polished code now. Usage: 1. depend on //src/main/cpp/util:profiler 2. use StopWatch, Task, and ScopedTask objects as shown in profiler.h's class documentation See https://github.com/bazelbuild/bazel/issues/5444 Change-Id: I43f0afd124b486c694f451e8455a66ffca8137b6 Closes #5461. Change-Id: I43f0afd124b486c694f451e8455a66ffca8137b6 PiperOrigin-RevId: 202314319
* Make blaze_util::AsAbsoluteWindowsPath support wstring as inputGravatar Yun Peng2018-06-20
| | | | | | | | | | | | | | Now we have: bool AsAbsoluteWindowsPath(const std::wstring& path, std::wstring* result, std::string* error); This change helps making the C++ native launcher work with UTF-16. See https://github.com/bazelbuild/bazel/issues/4473 Closes #5406. Change-Id: I7eaf55f9fe5a4d41e3dd09edc2a21e9b3cc9277c PiperOrigin-RevId: 201352866
* 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
* 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
* Remove die() and replace it with BAZEL_DIE, part of the logging framework.Gravatar ccalvarin2018-04-06
| | | | | | | This will mean the messages will make it to the right output stream. RELNOTES: PiperOrigin-RevId: 191925662
* Fold in warning and error output into client logging.Gravatar ccalvarin2018-03-23
| | | | | | | To replace blaze_util::die and blaze_util::pdie as well, FATAL statements need to accept blaze exit codes. RELNOTES: None. PiperOrigin-RevId: 190285798
* 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++: 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
* 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
* 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 Windows C++ launcher support long pathGravatar Yun Peng2017-08-29
| | | | | Change-Id: I25795c748fa98b9275ae34ead17fce02a57dc8e4 PiperOrigin-RevId: 166816800
* Update Bazel BUILD file to allow def_parse depend on Bazel specific targets ↵Gravatar pcloudy2017-08-28
| | | | | | from third_party. PiperOrigin-RevId: 166475827
* Windows, JNI: move around sourcesGravatar Laszlo Csomor2017-06-29
| | | | | | | | | | | | | | | | Move the Windows JNI C++ sources to a separate package and separate namespace. This no-op refactoring allows other build rules than Bazel's client library to depend on file I/O and/or JNI functionality. A follow-up commit will split the //src/main/native/windows:processes library into :jni-processes and :jni-file. Change-Id: I33c5f8ebd8961cc440db3b4a95ff78024d7c1d74 PiperOrigin-RevId: 160404298
* Make source code of singlejar and ijar available from @bazel_tools. ,Gravatar Xin Gao2017-06-22
| | | | | | | | | | Please refer to patch set 9 and its CI run for usage and test results. In practice, users should create their own java_toolchain rule in their project's BUILD file, and set the two attributes like above instead of modifying //tools/jdk/BUILD. Change-Id: Ic880f243086b00a58d453a8139ba4c957fe54bc7 PiperOrigin-RevId: 159694649
* 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
* Bazel client: make some libraries visible to ijar Gravatar László Csomor2017-02-28
| | | | | | | | | | | | | | | | Ijar will use Bazel's file handling logic so that we don't have to maintain two implementations, and don't have to copy this code to implement the Windows/MSVC code path in third_party/ijar/platform_utils.cc. See https://github.com/bazelbuild/bazel/issues/2157 -- Change-Id: Iec327febb882aeaabae55216d0d06488f7c151ed Reviewed-on: https://cr.bazel.build/9068 PiperOrigin-RevId: 148770951 MOS_MIGRATED_REVID=148770951
* Bazel client, Windows: impl. ForEachDirectoryEntry Gravatar Laszlo Csomor2017-02-17
| | | | | | | | | | | | | | | | | | | | This is the last function we needed from file_posix for MSYS, so now we can remove that from the compilation. Fixes https://github.com/bazelbuild/bazel/issues/2386 The problem originally was that I used CloseHandle to close the HANDLE, instead of using FindClose, so we were holding on to open directory HANDLEs, so we couldn't rename the installation directory. See https://github.com/bazelbuild/bazel/issues/2107 -- Change-Id: If6c1b3c99cf386d82e829dbee2323e6bce5f6b46 Reviewed-on: https://cr.bazel.build/8952 PiperOrigin-RevId: 147734165 MOS_MIGRATED_REVID=147734165
* Bazel client: platform-dependent `strerror` Gravatar László Csomor2017-01-27
| | | | | | | | | | | | | | Move `strerror` calls into errors_<platform>. We have to get rid of direct `errno` reading too, because it doesn't work on Windows native. Fixes https://github.com/bazelbuild/bazel/issues/2411 -- Change-Id: I69ff502487d698aa9e9147f02fd0bc5253e94e64 Reviewed-on: https://cr.bazel.build/8490 PiperOrigin-RevId: 145777524 MOS_MIGRATED_REVID=145777524
* Bazel client: abstract away mtime handlingGravatar Laszlo Csomor2017-01-19
| | | | | | | | | | | | | | | | | | | | | Create an IFileMtime class and platform-specific implementations to deal with mtime handling. Since epochs and time granularity vary from platform to platform, and we only care about setting a file's/directory's mtime to the current time or to a future time plus querying whether something is in the future, we can easily create an interface for these operations and that's exactly what IFileMtime is. Implement PosixFileMtime and WindowsFileMtime. See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 144956966 MOS_MIGRATED_REVID=144956966
* Bazel client, Windows: use file_windows under MSYSGravatar Laszlo Csomor2016-12-15
| | | | | | | | | | | | | | | | | | | | | | | Use file_windows.cc and file_posix.cc when compiling for MSYS/GCC (--cpu=x64_windows). This way we can implement functions in file_windows.cc one by one, start using them with MSYS, and put #ifdef __CYGWIN__ ... #endif around these functions in file_posix.cc, until all functions are implemented in file_windows.cc. The change contains a lot of code deletion, but nothing should change because of that. The deleted code was not being used at all: neither with MSVC (it was behind #else // not COMPILER_MSVC) nor with MSYS (the file was not in the `select` of the rule's `srcs`). See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 142128611 MOS_MIGRATED_REVID=142128611
* Adds logging functionality to the bazel client, which will be activated in a ↵Gravatar Chloe Calvarin2016-11-23
| | | | | | | later change. -- MOS_MIGRATED_REVID=139951184
* Bazel client: platform-dependent GetHashedBaseDirGravatar Laszlo Csomor2016-11-16
| | | | | | | | | | Move the hashed base directory computation logic into blaze_util_<platform>.cc in order to clean up the call site and move platform-dependent code out the client's main file. -- MOS_MIGRATED_REVID=139319487
* Bazel client: implement directory tree walkingGravatar Laszlo Csomor2016-11-16
| | | | | | | | | | | | | | | | | | | | | | This change: - merges the //src/{main,test}/cpp:file and //src/{main,test}/cpp:file_platform libraries because "file" and "file_platform" need each other and this makes logical sense anyway - implements a function in file_<platform> to run a custom function on every child of a directory - implements a function in file.cc to recursively traverse a directory tree, based on the previosly mentioned function - removes the corresponding logic from the Bazel client to make it more portable -- MOS_MIGRATED_REVID=139309562
* Fix build rule visibility.Gravatar Laszlo Csomor2016-11-11
| | | | | | | | | | Introduced by commit 9c95196bf21e42bf46df9436a84d263c26e972d2. Tested: "bazel build --nobuild //src/{main,test}/cpp/...:all" -- MOS_MIGRATED_REVID=138855659
* Bazel client: wrap some POSIX functionsGravatar Laszlo Csomor2016-11-10
| | | | | | | | | | | | | | This change: - starts using blaze_util::CanAccess and blaze_util::PathExists instead of access(2) - implements and starts using blaze_util::GetCwd instead of getcwd(2) - implements and starts using blaze_util::ChangeDirectory instead of chdir(2) - adds tests for the new wrapper methods -- MOS_MIGRATED_REVID=138750297
* blaze_utils: fork file handling for platformsGravatar Laszlo Csomor2016-11-09
| | | | | | | | | | | | | | | | | | | This commit repurposes file_posix.cc to be the POSIX API file handling implementation, and adds file_windows.cc for the Win32 API implementations. Furthermore it introduces file_platform.h that declares the interface. Subsequent changes will replace POSIX API calls in the rest of the C++ code with these abstract methods. Motivation: our code is so littered with POSIX-isms that we need an abstraction layer if we hope to compile it with MSVC. -- MOS_MIGRATED_REVID=138615822
* Refactor: rename file_linux.* to file_posix.*Gravatar Laszlo Csomor2016-10-05
| | | | | | | | | | | | Subsequent commits will move methods out of src/main/cpp/blaze_util.cc and into file.h or file_<platform>.cc. Many of those methods heavily rely on the POSIX API, and we need to reimplement them against the Win32 API to compile Bazel on Windows using MSVC. -- MOS_MIGRATED_REVID=135128504
* Rollback of commit a6b4cbbd4a4bbb42eefe8fb0e646cd30780394e4.Gravatar Laszlo Csomor2016-10-04
| | | | | | | | | | | | | | | *** Reason for rollback *** Other projects may depend on Ijar without wanting to depend on Bazel. *** Original change description *** Ijar: use utilities from Bazel's source Remove a duplicate implementation of JoinPath. -- MOS_MIGRATED_REVID=135088616
* Ijar: use utilities from Bazel's sourceGravatar Laszlo Csomor2016-09-30
| | | | | | | Remove a duplicate implementation of JoinPath. -- MOS_MIGRATED_REVID=134778185
* Move blaze_util::Which to standalone library.Gravatar Laszlo Csomor2016-09-29
| | | | | | | | | | | | | | | | | | This method is only used by blaze_util_linux.cc so instead of porting it to Windows, I'm moving it to a separate library. As part of this change I'm creating separate libraries for other sources in //src/main/cpp/util as well, so their dependencies are clearly defined in the BUILD file, plus we can port them one by one. This is part of the effort of compiling Bazel on Windows with the MSVC toolchain. -- MOS_MIGRATED_REVID=134636777
* Add missing inlcudeGravatar Kristina Chodorow2016-07-22
| | | | | -- MOS_MIGRATED_REVID=128195657
* Add a bazel-srcs target to the top-level package containing all Bazel sourcesGravatar Damien Martin-Guillerez2016-02-29
| | | | | | | | This target include all non tests targets of Bazel to do integration tests of bootstrapping. -- MOS_MIGRATED_REVID=115830741
* Externalize file_test and strings_test, and fix up the BUILD files.Gravatar Ulf Adams2015-08-10
| | | | | -- MOS_MIGRATED_REVID=100109450
* Add a BUILD file to src/main/cpp/util.Gravatar Ulf Adams2015-07-23
-- MOS_MIGRATED_REVID=98918607