Move remaining global variables into ServerProcessInfo
The remaining variables were related to a server process and its configuration,
so move to a new class that reflects that, and make it a member of BlazeServer
so that it's not mutated in random places.
I left ServerProcessInfo in its own file since I think the next step would be
to lift all server process management out of BlazeServer and into this class.
Note that the global BlazeServer is still a thing, and the way we pass
ServerProcessInfo through to signal handlers kind of relies on it. I don't
think this is much worse than the status quo, and it shouldn't be so bad to
clean up.
RELNOTES: None
PiperOrigin-RevId: 258677286
diff --git a/src/main/cpp/server_process_info.h b/src/main/cpp/server_process_info.h
new file mode 100644
index 0000000..1a1813a
--- /dev/null
+++ b/src/main/cpp/server_process_info.h
@@ -0,0 +1,48 @@
+// Copyright 2016 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef BAZEL_SRC_MAIN_CPP_SERVER_PROCESS_INFO_H_
+#define BAZEL_SRC_MAIN_CPP_SERVER_PROCESS_INFO_H_
+
+#include <sys/types.h>
+#include <string>
+#include <vector>
+
+#include "src/main/cpp/util/port.h" // pid_t on Windows/MSVC
+
+namespace blaze {
+
+// Encapsulates information around the blaze server process and its
+// configuration.
+class ServerProcessInfo final {
+ public:
+ ServerProcessInfo(
+ const std::string &output_base, const std::string &server_jvm_out);
+
+ // When running as a daemon, where the deamonized server's stdout and stderr
+ // should be written.
+ const std::string jvm_log_file_;
+
+ // Whether or not the jvm_log_file should be opened with O_APPEND.
+ const bool jvm_log_file_append_;
+
+ // TODO(laszlocsomor) 2016-11-28: move pid_t usage out of here and wherever
+ // else it appears. Find some way to not have to declare a pid_t here, either
+ // by making PID handling platform-independent or some other idea.
+ pid_t server_pid_;
+};
+
+} // namespace blaze
+
+#endif // BAZEL_SRC_MAIN_CPP_SERVER_PROCESS_INFO_H_