Cut the dependency of singlejar on Bazel (the test still depend on it, but that's OK)
--
MOS_MIGRATED_REVID=139774407
diff --git a/src/tools/singlejar/output_jar.cc b/src/tools/singlejar/output_jar.cc
index 77880a1..47ab373 100644
--- a/src/tools/singlejar/output_jar.cc
+++ b/src/tools/singlejar/output_jar.cc
@@ -25,7 +25,6 @@
#include <time.h>
#include <unistd.h>
-#include "src/main/cpp/util/file.h"
#include "src/tools/singlejar/combiners.h"
#include "src/tools/singlejar/diag.h"
#include "src/tools/singlejar/input_jar.h"
@@ -67,6 +66,15 @@
"Created-By: singlejar\r\n");
}
+static std::string Basename(const std::string& path) {
+ size_t pos = path.rfind('/');
+ if (pos == std::string::npos) {
+ return path;
+ } else {
+ return std::string(path, pos + 1);
+ }
+}
+
int OutputJar::Doit(Options *options) {
if (nullptr != options_) {
diag_errx(1, "%s:%d: Doit() can be called only once.", __FILE__, __LINE__);
@@ -169,7 +177,7 @@
}
for (auto &rpath : options_->classpath_resources) {
- ClasspathResource(blaze_util::Basename(rpath), rpath);
+ ClasspathResource(Basename(rpath), rpath);
}
for (auto &rdesc : options_->resources) {