aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp
Commit message (Collapse)AuthorAge
* Bazel client: reduce dependency on <unistd.h>Gravatar Laszlo Csomor2016-11-18
| | | | | | | | | | | | | | | | | | In this change: - rename WriteFileToStreamOrDie to WriteFileToStderrOrDie (since we only ever used it for stderr) - replace open/write/read/close operations with blaze_util::ReadFile/WriteFile - wrap ToString(getpid()) in a utility function - move SyncFile to file_<platform> -- MOS_MIGRATED_REVID=139560397
* Bazel client: no longer needs <utime.h>Gravatar Laszlo Csomor2016-11-17
| | | | | | | | | | | | Also remove a lot of unused header files. The only remaining header file not available on Windows is <unistd.h>, but cutting that dependency will be more complicated because we use read/write and similar I/O functions from it. -- MOS_MIGRATED_REVID=139439791
* Bazel client: no more `stat` usageGravatar Laszlo Csomor2016-11-17
| | | | | -- MOS_MIGRATED_REVID=139436876
* Windows: respect --output_user_rootGravatar Laszlo Csomor2016-11-16
| | | | | | | Fixes https://github.com/bazelbuild/bazel/issues/2096 -- MOS_MIGRATED_REVID=139322001
* 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
* Refactor the logic that is used to retry client timeouts a bit so that the ↵Gravatar Lukacs Berki2016-11-15
| | | | | | | attempts take into account the fact that failed connection attempts can take a long time. -- MOS_MIGRATED_REVID=139199883
* 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
* Global cleanup change.Gravatar Googler2016-11-11
| | | | | -- MOS_MIGRATED_REVID=138816624
* 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
* Windows, bazel client: compile more with MSVCGravatar Laszlo Csomor2016-11-09
| | | | | | | | | | | | In this commit: - update GetOutputRoot with a MSVC-specific code path, plus add more env vars to check for the temp directory path in the MSYS-specific code path - add error handling to GetSelfPath -- MOS_MIGRATED_REVID=138611621
* Bazel, Windows: implement a precise clockGravatar Laszlo Csomor2016-11-08
| | | | | | | | | | | | | | | | | The simplest clock on Windows is timeGetTime(), but its precision is ~15ms, which is not good enough. This commit implements blaze_util::WindowsClock that wraps a more precise clock, accessible through QueryPerformanceCounter. This change also deletes blaze_util_msvc.cc which was recently forked off blaze_util_mingw.cc, because forking didn't turn out to be necessary. As part of this merging, I also renamed the file to blaze_util_windows.cc -- MOS_MIGRATED_REVID=138506308
* Add two startup options:Gravatar Lukacs Berki2016-11-08
| | | | | | | | - --client_debug that turns out debug logging from the client - --connect_timeout_secs that controls the timeout of the initial Ping() RPC from the client to the server -- MOS_MIGRATED_REVID=138491791
* C++ refactor: time getters now return millisecondsGravatar Laszlo Csomor2016-11-08
| | | | | | | | | | | | | | Previously they returned nanoseconds but all call sites converted those to milliseconds. This is not only a simplification of the semantics and renaming of the methods to make the returned units and the purpose clear, but also preparation for the Windows/MSVC implementations of these methods. -- MOS_MIGRATED_REVID=138383956
* Description redacted.Gravatar Luis Fernando Pino Duque2016-11-02
| | | | | -- MOS_MIGRATED_REVID=137944374
* remove other AF_UNIX referencesGravatar Thiago Farina2016-11-02
| | | | | | | | | | | Now this time in the client documentation, since they are not true anymore as the gRPC mechanism is always the default and there is no other mechanism to choose. -- Change-Id: I59d2cf9276764c32b9b28bf5dc2c0ff6777cec40 Reviewed-on: https://bazel-review.googlesource.com/#/c/7031/ MOS_MIGRATED_REVID=137925682
* remove references to "server.socket" fileGravatar Thiago Farina2016-10-31
| | | | | | | | | | | | The C++ client now talks to the Java server through protobuf messages using the RPC mechanism provided by grpc, so this AF_UNIX socket file is not used anymore for the communication between them since commit a3c4833dc24b: ("Remove support for using AF_UNIX..."). -- Change-Id: Ic71e4c65ebb6bb2e661128635c2440007feaf5f6 Reviewed-on: https://bazel-review.googlesource.com/#/c/7030/ MOS_MIGRATED_REVID=137679905
* Add the IsNullary(arg) and IsUnary(arg, next_arg) functionsGravatar Luis Fernando Pino Duque2016-10-28
| | | | | | | to detect whether arg is a valid startup option. -- MOS_MIGRATED_REVID=137512954
* extract a function to return the embedded binaries root directoryGravatar Thiago Farina2016-10-28
| | | | | | | | | | This allow us to keep this logic in one place and add a documentation for what it means (making it more in sync with its Java counterpart). -- Change-Id: I20ecfa6ea2cd3129a2f7a920c3bffe532f664a90 Reviewed-on: https://bazel-review.googlesource.com/#/c/6990/ MOS_MIGRATED_REVID=137504319
* Reap the direct child process when double-forking to daemonize.Gravatar Lukacs Berki2016-10-28
| | | | | | | Otherwise, it'd only be reaped by init when the client terminates. -- MOS_MIGRATED_REVID=137502970
* Clarify how startup options are conveyed between the client and the server.Gravatar Lukacs Berki2016-10-27
| | | | | -- MOS_MIGRATED_REVID=137266505
* Ignore the environment variable "http_proxy" so that it doesn't interfere ↵Gravatar Lukacs Berki2016-10-25
| | | | | | | with the gRPC-based communication between the Bazel client and server. -- MOS_MIGRATED_REVID=137138408
* cpp: remove unused functions after AF_UNIX refactoringGravatar Thiago Farina2016-10-24
| | | | | | | | | | With the removal of AF_UNIX code by commit a3c4833dc24b: ("Remove support for using AF_UNIX...") these function were left unused. -- Change-Id: I84b03bb7e168c22969d7fd1f35decccbc4a54b52 Reviewed-on: https://bazel-review.googlesource.com/#/c/6790/ MOS_MIGRATED_REVID=137002014
* Fix build on FreeBSD (again).Gravatar Piotr Sikora2016-10-19
| | | | | -- MOS_MIGRATED_REVID=136574107
* cpp: header hygienizationGravatar Thiago Farina2016-10-18
| | | | | | | | | | | * remove "using std::" declarations from header files * add missing "std::" to some string declarations at some header files * add "using std::string;" to some source files where necessary -- Change-Id: Ib64f62b5add499d6171fa922227194ac992fa542 Reviewed-on: https://bazel-review.googlesource.com/#/c/6630/ MOS_MIGRATED_REVID=136355671
* Remove support for using AF_UNIX to communicate between the Bazel cient and ↵Gravatar Lukacs Berki2016-10-07
| | | | | | | | | the Bazel server. RELNOTES[INC]: --command_port=-1 to use AF_UNIX for client/server communications is not supported anymore. -- MOS_MIGRATED_REVID=135355673
* cpp: refactoring blaze_globals.hGravatar Thiago Farina2016-10-07
| | | | | | | | | | | * drop "blaze_" prefix (like it was done with statup_options.h) * add a constructor to initalize the data members * rename the header file to global_variables.h to match the struct in there. -- Change-Id: I8c9f89f5d07c9a064bf1999c7bfb6d617d72818a Reviewed-on: https://bazel-review.googlesource.com/6370 MOS_MIGRATED_REVID=135342354
* 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
* cpp: integrate Init() into the StartupOptions constructorGravatar Thiago Farina2016-09-30
| | | | | | | | | | | This patch integrates the code of Init() function into StartupOptions's constuctor and thus fixing the TODO in startup_options.cc. -- Change-Id: Ic041306387f5ef82fa80d8511c3e9b7be706754a Reviewed-on: https://bazel-review.googlesource.com/#/c/6332/2 MOS_MIGRATED_REVID=134759417
* Windows: make the port library compile with MSVCGravatar Laszlo Csomor2016-09-30
| | | | | -- MOS_MIGRATED_REVID=134657410
* 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
* Windows: make the md5 library compilable with MSVCGravatar Laszlo Csomor2016-09-29
| | | | | -- MOS_MIGRATED_REVID=134630535
* Windows, native: add windows_msvc config_settingGravatar Laszlo Csomor2016-09-28
| | | | | | | | | | | | | | | Update `select` statements in BUILD files with the new config_setting. This is a first step on a long path that leads to us being able to compile bazel on Windows with --cpu=x64_windows_msvc. Needless to say, we're not there yet. Tested: on Linux, Darwin, Windows/MSYS -- MOS_MIGRATED_REVID=134534613
* cpp: reuse InWorkspace() function in GetWorkspace()Gravatar Thiago Farina2016-09-28
| | | | | | | | | | | | The access() check in the do-while loop is basically doing the same thing that the InWorkspace() function provides. So lets just call that function instead. It also has the effect of making the code easier to read and understand. -- Change-Id: I02495775a9c9aa262396261824359538ca650e36 Reviewed-on: https://bazel-review.googlesource.com/#/c/6230 MOS_MIGRATED_REVID=134509465
* --Gravatar Googler2016-09-27
| | | | MOS_MIGRATED_REVID=134334656
* Remove a comment that says we can remove some obsolete code.Gravatar Lukacs Berki2016-09-21
| | | | | | | | | Spurred by Thiago's change in the area, I figured I'll try removing the PID symlink, but then I realized that this won't work, because the code currently gives precedence to the symlink, which means that if a server that writes both is replaced with a server that only writes the text file, the contents of the text file will not be read. Also note that in Bazel, long jumps between server versions are much more possible than internally, so the cleanup is just not worth the risk, which is sad. -- MOS_MIGRATED_REVID=133820484
* Use nanosleep(2) instead of poll(2) to sleep.Gravatar Chongyu Zhu2016-09-21
| | | | | | | | | | | | | Starting with macOS Sierra developer beta 4, the behavior of poll(2) was changed, such that poll(2) will return immediately regardless the timeout if there is no file descriptor. This fixes #1767. And, this should be a better solution for Homebrew/homebrew-core#5041. Closes #1803. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/1803 MOS_MIGRATED_REVID=133816294
* cpp: convert ServerPidFile() and ServerPidSymlink() into constantsGravatar Thiago Farina2016-09-21
| | | | | | | | | | | These two functions have no logic inside it, they just return a string, and a string that does not change, so they might be better expressed as real C/C++ constants. This might as well generate some better (and less) code anyway. -- Change-Id: I78673c537c17c2665a74c5778e45a4d41a5f7b50 Reviewed-on: https://bazel-review.googlesource.com/#/c/6114 MOS_MIGRATED_REVID=133805201
* Description redacted.Gravatar Laurent Le Brun2016-09-21
| | | | | -- MOS_MIGRATED_REVID=133693782
* Allow configuring writing of command.logGravatar Michajlo Matijkiw2016-09-19
| | | | | | | | Sometimes, especially in the case of a lot of output, one may not want to write everything twice. -- MOS_MIGRATED_REVID=133388416
* Bake in the product name into the StartupOptions classes.Gravatar Julio Merino2016-09-15
| | | | | | | | | | Now that we have gotten a StartupOptions class for each of the products we support, we can bake in the product name in each instance instead of passing it to the constructor. Helps with encapsulation and simplifies various instantiations of these classes. -- MOS_MIGRATED_REVID=133255854
* Roll-forward of the startup options refactoring.Gravatar Julio Merino2016-09-15
| | | | | | | | | | | | | | | This CL is a verbatim reproduction of the following CLs, modulo adjustments to cope with changes at HEAD: * commit 4a45d92130a6b1306a3840d006df165b8040a6cf: Use inheritance to support site-specific options. * commit dfb2c73eda3d2dd8787ea9b2d0a03b49dfa2acc5: Inject the product name via the per-product main.cc files. * unknown commit: Remove the internal/external startup_options duality. The cause that triggered the rollbacks was fixed separately in commit 69a8d7205287bedf3a6140ec9327e2fad1758c22 as prepartory work for this roll-forward, so things should work now. -- MOS_MIGRATED_REVID=133139218
* Roll back commit a34c4febbbdfba6c045598101ca9a491cfde7dd9 in favor of not ↵Gravatar Lukacs Berki2016-09-14
| | | | | | | | | verifying the identity of the process killed on interrupt. When the server dies, the client follows soon after, so this is kind of OK. -- MOS_MIGRATED_REVID=133110872
* Move the GetOutputRoot function to the WorkspaceLayout module.Gravatar Julio Merino2016-09-14
| | | | | | | | | | | | | | | | | | | | | | The result value of GetOutputRoot does not depend on the startup options: it only depends on the environment and/or the hardcoded values for Bazel and Blaze. Therefore, put it in the WorkspaceLayout module just as we did for all other similar functions. The fact that GetOutputRoot was part of BlazeStartupOptions was the root cause behind the rollback of commit 4a45d92130a6b1306a3840d006df165b8040a6cf: in particular, that CL silently added a virtual call to the GetOutputRoot method from the constructor of the superclass, and this invokes undefined behavior because the class has not yet been fully constructed. This caused Blaze to have incorrect values for the output_root. By moving the function out, we'll be able to roll that CL forward as it originally was. As part of this change, add unit tests for the value of output_root under various scenarios. These would have caught the discrepancy introduced by that CL. -- MOS_MIGRATED_REVID=133056251
* More client fixes:Gravatar Lukacs Berki2016-09-13
| | | | | | | | - Use an explicit cast to void to tell the compiler that we are intentionally ignoring return values. - Delete the unused function GetPeerProcessId() -- MOS_MIGRATED_REVID=132970162
* Rollback of startup options changes.Gravatar Greg Estren2016-09-13
| | | | | -- MOS_MIGRATED_REVID=132940326
* Automated [] rollback of commit dfb2c73eda3d2dd8787ea9b2d0a03b49dfa2acc5.Gravatar Greg Estren2016-09-13
| | | | | | | | | | | | | | | | | *** Reason for rollback *** commit 4a45d92130a6b1306a3840d006df165b8040a6cf and everything after in [] breaks the Blaze nightlies *** Original change description *** Inject the product name via the per-product main.cc files. Instead of using a compile-time PRODUCT_NAME constant and complex Build rules to set the correct product name for Blaze and Bazel, use the new main.cc files to inject the appropriate value. -- MOS_MIGRATED_REVID=132934596