| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
| |
The master bazelrc is now defined by preprocessor macro at (Bazel's) compile time. The default is still /etc/bazel.bazelrc for most platforms, but windows now has a %ProgramData% relative default value as well. Users wishing to change this default when building Bazel for a new platform should edit BAZEL_SYSTEM_BAZELRC_PATH in src/main/cpp/BUILD.
Part of https://github.com/bazelbuild/bazel/issues/4502, relevant to the duplicate issue #4809.
TESTED: default settings were tested manually, since they cannot be tested in a sandbox
RELNOTES: Windows default system bazelrc is read from the user's ProgramData if present.
PiperOrigin-RevId: 201423446
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Convert most `COMPILER_MSVC` to `_WIN32` (as they apply to Windows platform, not MSVC compiler). Only `src/tools/singlejar/zip_headers.h` and `src/main/cpp/util/md5.h` actually need `_MSC_VER`.
`COMPILER_MSVC` in `third_party/protobuf` are not removed. They can be fixed by updating dependency to newer version.
/cc @meteorcloudy
Closes #5350.
Change-Id: Ibc131abfaf34a0cb2bd338549983ea9d28eaabfe
PiperOrigin-RevId: 200019793
|
|
|
|
|
|
|
|
|
| |
It does not claim to, and this was already true for posix platforms. Windows platforms, however, always made the path absolute, which was a hard-to-diagnose difference between the two.
Similarly, MakeAbsolute was relying on this to be correct for windows, so this change splits the implementation and keeps the behavior consistent. While we're here, also remove the empty-string behavior from MakeAbsolute, and instead make it clear at all sites that this behavior is present and affects accepted flag syntax. We may want to remove this later.
RELNOTES: None.
PiperOrigin-RevId: 199663395
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This overrides --bazelrc and --[no]master_bazelrc regardless of order. Like --bazelrc and --[no]master_bazelrc, it cannot be mentioned in an rc file, this would be a contradiction. This flag is useful for testing, and for having a version-agnostic way to turn off all rc files, such as in the canonical command line reporting. Now that blazerc and bazelrc are separate, this is necessary.
If explicit values for --bazelrc or --master_bazelrc are provided which are now ignored, Bazel will warn the user.
#4502
Alternatives considered - We could avoid this flag but would need to have some well-documented, reusable list of the startup flags that effectively come to the same effect. This would be necessary in our integration tests and in the CommandLineEvent and other places where rc files need to be completely disabled for correctness. We decided that this startup option was more straightforward and usable for both users and Bazel devs: it shouldn't be used when more fine-grained control is needed, but provides warnings if users are likely to be confused by the outcome.
RELNOTES: None.
PiperOrigin-RevId: 196750704
|
|
|
|
|
|
|
| |
It's better for testing, while keeping it clear that these functions should not be used outside of option_processor.cc.
RELNOTES: None.
PiperOrigin-RevId: 193947022
|
|
|
|
|
|
|
|
| |
Bazel now has its own subclass of StartupOptions to specify bazel-only options. This is needed for https://github.com/bazelbuild/bazel/issues/4502.
RELNOTES(INC): No longer accepts --blazerc or --[no]master_blazerc, accepts bazelrc name only.
PiperOrigin-RevId: 193718297
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make the list of rc files a local variable as it need not be a class
attribute, and drop the unused rcoptions_ field.
This is a trivial refactoring and the remaining code is still too
confusing. It'd be worth splitting OptionProcessor in two pieces:
OptionProcessor to exclusively keep the virtual ParseOptions method
and no state, and a new ParsedOptions type to act as the immutable
return value of ParseOptions. This would decouple all state
mutations.
RELNOTES: None.
PiperOrigin-RevId: 193557347
|
|
|
|
|
|
|
| |
In preparation for https://github.com/bazelbuild/bazel/issues/4502, make OptionProcessor::GetRcFiles contain the logic for both the user bazelrcs and the master bazelrcs.
RELNOTES: None
PiperOrigin-RevId: 193521683
|
|
|
|
|
|
|
|
|
| |
We are still unable to turn this on to write to files, but there are currently 2 logging systems in use in the client: the inactive one, and the print-to-stderr option triggered by --client_debug. Combine these, so we can use the same logging format for both.
Also combine it with the VerboseLogging functionality - it was not documented anywhere and seems redundant.
RELNOTES: None.
PiperOrigin-RevId: 189979051
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Google C++ Style Guide disallows static variable with non-trivial
destructor. Use constexpr for static variable whenever possible.
std::array would make the code cleaner, but MSVC's implementation
of constexpr std::array is buggy.
Side-benefit: linear search is faster when array is small (<20).
Change-Id: Ic8244dcb868e27d02ceb5298ccec482e7d4254b7
PiperOrigin-RevId: 187451495
|
|
|
|
| |
PiperOrigin-RevId: 185528799
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In MSVC, `environ` is a macro (from `stdlib.h`):
```cpp
extern char*** __p__environ(void);
#define _environ (*__p__environ())
#define environ _environ
```
So `extern char **environ;` will be expanded as `extern char **(*__p_environ());` which is invalid. This causes compile warning on MSVC.
Closes #4487.
PiperOrigin-RevId: 185354631
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 184865343
|
|
|
|
|
|
|
| |
no-op behavior-wise.
RELNOTES: None
PiperOrigin-RevId: 184843442
|
|
|
|
|
|
| |
Closes #4494.
PiperOrigin-RevId: 183380779
|
|
|
|
|
|
|
| |
`blaze --nomaster_bazelrc --master_bazelrc` now uses the master bazelrc.
RELNOTES: None
PiperOrigin-RevId: 183083839
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 178641317
|
|
|
|
|
|
|
|
|
|
|
| |
On Windows, Bazel client will try to find python.exe in $PATH.
If succeed, then we pretend to add a --python_path option in the least
important bazelrc file.
Fixed https://github.com/bazelbuild/bazel/issues/3717
Change-Id: I8d97b0895f024d8d236f3b4b39f91c41d947a5fa
PiperOrigin-RevId: 168659085
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also adds some extra debug logging.
Also removes some msys-only code paths.
Fixes #3498.
This is a reland of commit 2f38404.
Change-Id: I1690a64f427070cc3f127b857650e6a32d1aab35
PiperOrigin-RevId: 166049222
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #3584
*** Reason for rollback ***
Broke bazel_windows_test fails on windows.
*** Original change description ***
Propagate detected value of BAZEL_SH to --client_env.
Also make debug_log available as soon as possible on startup.
Also adds some extra debug logging.
Also removes some msys-only code paths.
Fixes #3498.
Change-Id: I5b769f2c5a728106e5252869745ec79e555cbaf2
PiperOrigin-RevId: 165692468
|
|
|
|
|
|
|
|
|
|
|
| |
Also make debug_log available as soon as possible on startup.
Also adds some extra debug logging.
Also removes some msys-only code paths.
Fixes #3498.
Change-Id: I5b769f2c5a728106e5252869745ec79e555cbaf2
PiperOrigin-RevId: 165574022
|
|
|
|
|
|
|
|
|
|
|
| |
Send the startup options tagged with their origin so that the server has correct information about the command line as the client received it.
Removes the unconditional stderr printing of all bazelrc startup options in the bazel client. Instead, the startup options are sent to the server and the same informational printing is gated on the --announce_rc option. This avoids unconditional log spam to stderr early in startup. If the server is unreachable or there are errors parsing startup options, the message is still printed to stderr.
Fixes https://github.com/bazelbuild/bazel/issues/2530.
RELNOTES: --announce_rc now controls whether bazelrc startup options are printed to stderr.
PiperOrigin-RevId: 165211007
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
Breaks Bazel CI (https://github.com/bazelbuild/bazel/issues/3501)
*** Original change description ***
Android BusyBox: actions use the default shell env
SpawnActions that run the Android BusyBox now use
the default shell environment.
This has the following benefits:
- Bazel propagates the PATH, TMPDIR envvars to the
action
- Bazel propagates the --action_env envvars to the
action
This allows the Bazel client to pass
--action_env=TMP or --action_env=TEMP (whichever
of the envvars is defined) to the server, so the
BusyBox actions will have TMP/TEMP set...
***
PiperOrigin-RevId: 164126020
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SpawnActions that run the Android BusyBox now use
the default shell environment.
This has the following benefits:
- Bazel propagates the PATH, TMPDIR envvars to the
action
- Bazel propagates the --action_env envvars to the
action
This allows the Bazel client to pass
--action_env=TMP or --action_env=TEMP (whichever
of the envvars is defined) to the server, so the
BusyBox actions will have TMP/TEMP set (to the
same value as the clientenv), so they can create
temp directories using
java.nio.file.Files.createTempDirectory.
This method seems to be calling the GetTempPath
WinAPI function, which needs the TMP or TEMP
envvar, otherwise it falls back to returning
c:\windows which is non-writable.
There's one drawback of using the default shell
environment, although @ulfjack is working on it:
- PATH is now also part of the action's cache key.
However in a single-machine environment (no
remote execution) and assuming PATH isn't likely
to change between builds, this probably doesn't
poision the action cache in practice.
This change is a short-term solution. Propagating
the client env's TMP/TEMP means we make that part
of the action's cache key.
The ideal long-term solution will be to not
propagate this envvar, and instead let the
execution strategy set it to some
client-env-independent value.
See https://github.com/bazelbuild/bazel/issues/3264
Change-Id: I756a4203b5d86c881bc36cc089e35cde0d419914
PiperOrigin-RevId: 164114502
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a bit more idiomatic and fixes these GCC complaints:
src/main/cpp/option_processor.cc: In static member function 'static blaze_exit_code::ExitCode blaze::OptionProcessor::RcFile::Parse(const string&, const string&, int, const blaze::WorkspaceLayout*, std::vector<blaze::OptionProcessor::RcFile*>*, std::map<std::__cxx11::basic_string<char>, std::vector<blaze::OptionProcessor::RcOption> >*, std::__cxx11::list<std::__cxx11::basic_string<char> >*, std::__cxx11::string*)':
src/main/cpp/option_processor.cc:92:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int line = 0; line < lines.size(); ++line) {
~~~~~^~~~~~~~~~~~~~
src/main/cpp/option_processor.cc:151:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int word = 1; word < words.size(); ++word) {
~~~~~^~~~~~~~~~~~~~
Change-Id: Ieb0e8f89194fe802f79c729eb7a851ea2dfad665
PiperOrigin-RevId: 162477025
|
|
|
|
| |
PiperOrigin-RevId: 161523047
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
A backwards incompatible change for CLI.
RELNOTES: Rollback of https://github.com/bazelbuild/bazel/commit/458990b0c155130e242117e2bfc5ebfdf787d2e2
PiperOrigin-RevId: 161457646
|
|
|
|
|
|
|
|
| |
OptionProcessor.
This replaces the startup_args_, command_ and command_argument members to allow a more consistent representation of the command line throughout the class.
PiperOrigin-RevId: 161408010
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bazel prints all the progress to stderr, yet the decision to switch between
"smart" and "dumb" output modes is done based on the stdout and stderr
connected terminals. That breaks for a command like this:
bazel query 'something' | wc -l
Even though all the progress is still output to the terminal through stderr,
bazel switches to "dumb" mode, printing progress messages one per line.
It seems reasonable to make the "smart"/"dumb" output mode decision based on
the stderr only.
Tested:
With the change "bazel query '...' | wc -l" prints "smart" progress messages.
RELNOTES: Check stderr to detect if connected to a terminal. Deprecate --isatty.
PiperOrigin-RevId: 161243017
|
|
|
|
|
|
| |
Additionally rewrite the option_processor_test to make it more flexible.
PiperOrigin-RevId: 160958736
|
|
|
|
|
|
|
| |
Fixes https://github.com/bazelbuild/bazel/issues/3077
Change-Id: I5f29fdec1f69bdda51fa62be695b8791a45240e9
PiperOrigin-RevId: 157559455
|
|
|
|
| |
PiperOrigin-RevId: 155491277
|
|
|
|
|
|
|
| |
Write a new function that dedupes a set of paths using its canonical
form and use it to remove possible duplicates in the set of rc files
that will be parsed.
PiperOrigin-RevId: 152489149
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Create a method in blaze_util_<platform> to
retrieve the path to the home dir ($HOME on
Linux/macOS, %USERPROFILE% on Windows), where we
look for the user's bazelrc file (".bazelrc").
--
Change-Id: I86be1dbe1f992ad55eb09b496024754099d54912
Reviewed-on: https://cr.bazel.build/9513
PiperOrigin-RevId: 151004759
MOS_MIGRATED_REVID=151004759
|
|
|
|
|
|
|
|
| |
--
Change-Id: Ie1f3be6258f024d352ff4571a5355660f409f70d
Reviewed-on: https://cr.bazel.build/9291
PiperOrigin-RevId: 149470780
MOS_MIGRATED_REVID=149470780
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make the --ignore_client_env flag a no-op.
The client will pass --client_env flags to the
server even in --batch mode. This simplifies the
code as well as ensuring that the server always
uses the up-do-date client environment.
We'll gradually get rid of all System.getenv calls
in the server, because the server should always
respect the client env.
Roll forward of 149403129 with fixes.
--
PiperOrigin-RevId: 149435060
MOS_MIGRATED_REVID=149435060
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
broke //src/test/shell/bazel:bazel_bootstrap_distfile_test
*** Original change description ***
Env.vars: server won't ignore the client env
Make the --ignore_client_env flag a no-op.
The client will pass --client_env flags to the
server even in --batch mode. This simplifies the
code as well as ensuring that the server always
uses the up-do-date client environment.
We'll gradually get rid of all System.getenv calls
in the server, because the server should always
respect the client env.
--
PiperOrigin-RevId: 149416602
MOS_MIGRATED_REVID=149416602
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make the --ignore_client_env flag a no-op.
The client will pass --client_env flags to the
server even in --batch mode. This simplifies the
code as well as ensuring that the server always
uses the up-do-date client environment.
We'll gradually get rid of all System.getenv calls
in the server, because the server should always
respect the client env.
--
PiperOrigin-RevId: 149403129
MOS_MIGRATED_REVID=149403129
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a platform-specific file handle type
(HANDLE on Windows, int on Linux/Darwin/FreeBSD)
so we can get rid of the read_func and write_func
functions, since they are always the same
everywhere.
Also include file_platform.h in file.h, since they
are logically the same file (file_platform.h is
just the platform-specific part of file.h).
--
PiperOrigin-RevId: 148892736
MOS_MIGRATED_REVID=148892736
|
|
|
|
|
|
|
|
| |
found.
--
PiperOrigin-RevId: 148199034
MOS_MIGRATED_REVID=148199034
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When looking up the .bazelrc file in the workspace or the home directory,
construct its name using the built-in product name instead of hardcoding
the name in the WorkspaceLayout class.
This removes an additional hardcoded value and changes the code to do the
right thing based on the product name.
--
PiperOrigin-RevId: 145077783
MOS_MIGRATED_REVID=145077783
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new methods (CanReadFile, CanExecuteFile,
CanAccessDirectory) are a lot easier to implement
on Windows than a generic CanAccess. On POSIX
these methods are just a wrapper around the now
static-visible CanAccess().
See https://github.com/bazelbuild/bazel/issues/2107
--
PiperOrigin-RevId: 144176710
MOS_MIGRATED_REVID=144176710
|
|
|
|
|
|
| |
--
PiperOrigin-RevId: 141483567
MOS_MIGRATED_REVID=141483567
|
|
|
|
|
|
|
|
|
|
|
|
| |
of the startup options.
This allows us to do the following:
- Avoid using the product name when reporting startup option parsing errors.
- Passing --bazelrc as a command argument throws an error (fix for issue #1659).
--
PiperOrigin-RevId: 141445030
MOS_MIGRATED_REVID=141445030
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move blaze::ReadFile and blaze::WriteFile to
file.h and file_platform.h (thus into the
blaze_util namespace), and update references.
This allows us to implement these methods in a
platform-specific way.
Also move UnlinkPath.
See https://github.com/bazelbuild/bazel/issues/2107
--
MOS_MIGRATED_REVID=140328273
|
|
|
|
|
|
|
| |
later change.
--
MOS_MIGRATED_REVID=139951184
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can now compile blaze_util_windows.cc with
MSVC, yay! (when building //src:bazel
--cpu=x64_windows_msvc -k).
There are a lot of #ifdef's and TODOs so this
is a modest victory for now.
In this change:
- change blaze::MakeDirectories to return bool
instead of int, since that's how it was used
anyway, and to expect the permission mask as
unsigned int instead of mode_t, since the
former is good enough and compatible with
mode_t on POSIX while mode_t is not defined on
Windows
- move blaze::MakeDirectories into
blaze_util_<platform>
- implement envvar-handling in
blaze_util_<platform> and use it everywhere
See https://github.com/bazelbuild/bazel/issues/2107
--
MOS_MIGRATED_REVID=139887503
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that takes a given command line args and splits it into the corresponding
{binary, startup_args, command, command_args}.
The purpose of this function is to help split the responsibilities
of the ParseOptions function by processing the startup options independently
(i.e. rc files detection and processing) from the command options.
This will be combined with ParseOptions in a subsequent CL.
--
MOS_MIGRATED_REVID=139773786
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|