diff options
-rw-r--r-- | src/main/cpp/blaze.cc | 12 | ||||
-rw-r--r-- | src/main/cpp/global_variables.h | 6 | ||||
-rwxr-xr-x | src/package-bazel.sh | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index 0b22226aac..38a92d9a9e 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc @@ -397,8 +397,8 @@ static vector<string> GetArgumentArray() { } result.insert(result.end(), user_options.begin(), user_options.end()); - globals->options->AddJVMArgumentSuffix( - real_install_dir, globals->extracted_binaries[0], &result); + globals->options->AddJVMArgumentSuffix(real_install_dir, + globals->ServerJarPath(), &result); // JVM arguments are complete. Now pass in Blaze startup options. // Note that we always use the --flag=ARG form (instead of the --flag ARG one) @@ -611,8 +611,8 @@ static void StartServer(const WorkspaceLayout *workspace_layout, globals->restart_reason = NO_DAEMON; } - string exe = globals->options->GetExe(globals->jvm_path, - globals->extracted_binaries[0]); + string exe = + globals->options->GetExe(globals->jvm_path, globals->ServerJarPath()); // Go to the workspace before we daemonize, so // we can still print errors to the terminal. GoToWorkspace(workspace_layout); @@ -665,8 +665,8 @@ static void StartStandalone(const WorkspaceLayout *workspace_layout, GoToWorkspace(workspace_layout); - string exe = globals->options->GetExe(globals->jvm_path, - globals->extracted_binaries[0]); + string exe = + globals->options->GetExe(globals->jvm_path, globals->ServerJarPath()); ExecuteProgram(exe, jvm_args_vector); pdie(blaze_exit_code::INTERNAL_ERROR, "execv of '%s' failed", exe.c_str()); } diff --git a/src/main/cpp/global_variables.h b/src/main/cpp/global_variables.h index 4774f29e86..061e2837a9 100644 --- a/src/main/cpp/global_variables.h +++ b/src/main/cpp/global_variables.h @@ -44,6 +44,12 @@ enum RestartReason { struct GlobalVariables { GlobalVariables(OptionProcessor *option_processor); + std::string ServerJarPath() const { + // The server jar is called "A-server.jar" so it's the first binary we + // extracted. + return extracted_binaries.empty() ? "" : extracted_binaries[0]; + } + // Used to make concurrent invocations of this program safe. std::string lockfile; // = <output_base>/lock diff --git a/src/package-bazel.sh b/src/package-bazel.sh index 19cda686cd..7851751ada 100755 --- a/src/package-bazel.sh +++ b/src/package-bazel.sh @@ -34,6 +34,8 @@ mkdir -p "${PACKAGE_DIR}" trap "rm -fr ${PACKAGE_DIR}" EXIT cp $* ${PACKAGE_DIR} +# The server jar needs to be the first binary we extract. This is how the Bazel +# client knows what .jar to pass to the JVM. cp ${DEPLOY_JAR} ${PACKAGE_DIR}/A-server.jar cp ${INSTALL_BASE_KEY} ${PACKAGE_DIR}/install_base_key # The timestamp of embedded tools should already be zeroed out in the input zip |