aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools
diff options
context:
space:
mode:
authorGravatar Yun Peng <pcloudy@google.com>2017-08-18 15:40:54 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-08-21 14:15:37 +0200
commite6d2077cab9eef14afc25e54ab6b0e583e0b3bf0 (patch)
tree8456584f7ebff48bfe6ab4eb9724fed2e842aac1 /src/tools
parentc08f67975272a6b40d1fa5c444718efc0b59194a (diff)
Refactor Bash Launcher
1. Extract some funtions into NativeLauncherUtil.java So that they can also be used by Python and Java launcher. 2. Derive runfiles directory from mainExectuable yielding "%{name}.cmd.runfiles" or "%{name}.exe.runfiles" 3. Removed bash_main_file key, we can assume the main file is next the launcher just without .exe suffix. By doing this, we don't have to worry about passing RunfilesPath or ExecPath. RunfilesPath has ../ prefix for external file, ExecPath contians ./bazel-out/... for generated file. If main file is a generated file from external repository, neither of them are correct. Change-Id: Ie0c35f6030f6229c28d935d8fb3cb6a8af5af29c PiperOrigin-RevId: 165699975
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/launcher/bash_launcher.cc3
-rw-r--r--src/tools/launcher/bash_launcher.h1
-rw-r--r--src/tools/launcher/launcher.cc4
3 files changed, 3 insertions, 5 deletions
diff --git a/src/tools/launcher/bash_launcher.cc b/src/tools/launcher/bash_launcher.cc
index af0047d45a..3e41ac152a 100644
--- a/src/tools/launcher/bash_launcher.cc
+++ b/src/tools/launcher/bash_launcher.cc
@@ -36,8 +36,7 @@ ExitCode BashBinaryLauncher::Launch() {
vector<string> origin_args = this->GetCommandlineArguments();
ostringstream bash_command;
- string bash_main_file =
- this->Rlocation(this->GetLaunchInfoByKey(BASH_MAIN_FILE));
+ string bash_main_file = GetBinaryPathWithoutExtension(origin_args[0]);
bash_command << GetEscapedArgument(bash_main_file);
for (int i = 1; i < origin_args.size(); i++) {
bash_command << ' ';
diff --git a/src/tools/launcher/bash_launcher.h b/src/tools/launcher/bash_launcher.h
index 8070016800..659c144c39 100644
--- a/src/tools/launcher/bash_launcher.h
+++ b/src/tools/launcher/bash_launcher.h
@@ -21,7 +21,6 @@ namespace bazel {
namespace launcher {
static constexpr const char* BASH_BIN_PATH = "bash_bin_path";
-static constexpr const char* BASH_MAIN_FILE = "bash_main_file";
class BashBinaryLauncher : public BinaryLauncherBase {
public:
diff --git a/src/tools/launcher/launcher.cc b/src/tools/launcher/launcher.cc
index 9aaa8a5924..8e82542fb4 100644
--- a/src/tools/launcher/launcher.cc
+++ b/src/tools/launcher/launcher.cc
@@ -46,7 +46,7 @@ BinaryLauncherBase::BinaryLauncherBase(
string BinaryLauncherBase::FindManifestFile(const char* argv0) {
// Get the name of the binary
- string binary = GetBinaryPathWithoutExtension(argv0);
+ string binary = GetBinaryPathWithExtension(argv0);
// The path will be set as the RUNFILES_MANIFEST_FILE envvar and used by the
// shell script, so let's convert backslashes to forward slashes.
@@ -64,7 +64,7 @@ string BinaryLauncherBase::FindManifestFile(const char* argv0) {
return manifest_file;
}
- die("Couldn't find MANIFEST file %s.runfiles\\", binary.c_str());
+ die("Couldn't find MANIFEST file under %s.runfiles\\", binary.c_str());
}
void BinaryLauncherBase::ParseManifestFile(ManifestFileMap* manifest_file_map,