diff options
author | László Csomor <laszlocsomor@google.com> | 2017-06-07 04:06:44 -0400 |
---|---|---|
committer | John Cater <jcater@google.com> | 2017-06-07 09:49:19 -0400 |
commit | 41627ade988580364f185e087a6ffe15765cf617 (patch) | |
tree | b14736af8bdcd5f79fa2c41227bd7a884d2c0775 | |
parent | 340490a520a32db4b18f8a31f0aeb4217e23124f (diff) |
Bazel client: explain the name of A-server.jar
Also add a helper method to GlobalVariables to
retrieve this path, thus concentrating the
assumptions about the layout of extracted_binaries
in one place.
Change-Id: If172b6f5bf4451845ad89d3d488ef2a2c2e5d286
PiperOrigin-RevId: 158241854
-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 |