Cleanup: Build file.cc as part of util library.
Looks like in the transition it was forgotten to be moved to the new
location.
As an effect of this change it was discovered that file.cc had an
dependency back on blaze_util.cc (from client binary for die/pdie functions).
In order to fix that dependency we have had to move die/pdie functions into
util library (added errors.(cc|h)) for this.
Tested on Linux with the following command lines:
$ ./compile.sh
$ ./output/bazel build //src/main/cpp:all
$ ./output/bazel build //src:bazel
$ ./bootstrap_test.sh all
--
Change-Id: I70fb1b6189dc5af31f816332d76efe380ef26302
MOS_MIGRATED_REVID=90987514
diff --git a/src/main/cpp/blaze_util.cc b/src/main/cpp/blaze_util.cc
index 782c87a..4f67533 100644
--- a/src/main/cpp/blaze_util.cc
+++ b/src/main/cpp/blaze_util.cc
@@ -29,33 +29,17 @@
#include <unistd.h>
#include <sstream>
+#include "util/errors.h"
#include "util/file.h"
#include "util/numbers.h"
#include "util/strings.h"
+using blaze_util::die;
+using blaze_util::pdie;
using std::vector;
namespace blaze {
-void die(const int exit_status, const char *format, ...) {
- va_list ap;
- va_start(ap, format);
- vfprintf(stderr, format, ap);
- va_end(ap);
- fputc('\n', stderr);
- exit(exit_status);
-}
-
-void pdie(const int exit_status, const char *format, ...) {
- fprintf(stderr, "Error: ");
- va_list ap;
- va_start(ap, format);
- vfprintf(stderr, format, ap);
- va_end(ap);
- fprintf(stderr, ": %s\n", strerror(errno));
- exit(exit_status);
-}
-
string GetUserName() {
const char *user = getenv("USER");
if (user && user[0] != '\0') return user;