Encapsulate posting to BuckEventBus in ExecutionContext...

Summary:
...where it makes sense. There's still a bunch of direct calls to
`BuckEventBus.post`, but only where `ExecutionContext` is not available.
Perhaps, I can send out a similar diff for `BuildContext`.

Test Plan: ant test
diff --git a/src/com/facebook/buck/android/CompileStringsStep.java b/src/com/facebook/buck/android/CompileStringsStep.java
index 43fd1ae..7b57688 100644
--- a/src/com/facebook/buck/android/CompileStringsStep.java
+++ b/src/com/facebook/buck/android/CompileStringsStep.java
@@ -16,7 +16,6 @@
 
 package com.facebook.buck.android;
 
-import com.facebook.buck.event.ThrowableLogEvent;
 import com.facebook.buck.step.ExecutionContext;
 import com.facebook.buck.step.Step;
 import com.facebook.buck.util.ProjectFilesystem;
@@ -130,8 +129,7 @@
       try {
         resourcesByLocale.put(locale, compileStringFiles(filesByLocale.get(locale)));
       } catch (IOException e) {
-        context.getBuckEventBus().post(ThrowableLogEvent.create(e,
-            "Error parsing string file for locale: %s", locale));
+        context.logError(e, "Error parsing string file for locale: %s", locale);
         return 1;
       }
     }
@@ -161,9 +159,7 @@
         File jsonFile = filesystem.getFileForRelativePath(destinationDir.resolve(locale + ".json"));
         objectMapper.writeValue(jsonFile, resourcesByLocale.get(locale).asMap());
       } catch (IOException e) {
-        context.getBuckEventBus().post(ThrowableLogEvent.create(e,
-            "Error creating json string file for locale: %s",
-            locale));
+        context.logError(e, "Error creating json string file for locale: %s", locale);
         return 1;
       }
     }
diff --git a/src/com/facebook/buck/android/FilterResourcesStep.java b/src/com/facebook/buck/android/FilterResourcesStep.java
index 8d336b4..966c0c2 100644
--- a/src/com/facebook/buck/android/FilterResourcesStep.java
+++ b/src/com/facebook/buck/android/FilterResourcesStep.java
@@ -16,7 +16,6 @@
 
 package com.facebook.buck.android;
 
-import com.facebook.buck.event.ThrowableLogEvent;
 import com.facebook.buck.shell.BashStep;
 import com.facebook.buck.step.ExecutionContext;
 import com.facebook.buck.step.Step;
@@ -125,8 +124,7 @@
     try {
       return doExecute(context);
     } catch (Exception e) {
-      context.getBuckEventBus().post(ThrowableLogEvent.create(e,
-          "There was an error filtering resources."));
+      context.logError(e, "There was an error filtering resources.");
       return 1;
     }
   }
diff --git a/src/com/facebook/buck/android/ProGuardObfuscateStep.java b/src/com/facebook/buck/android/ProGuardObfuscateStep.java
index ec5c682..3f3a0e7 100644
--- a/src/com/facebook/buck/android/ProGuardObfuscateStep.java
+++ b/src/com/facebook/buck/android/ProGuardObfuscateStep.java
@@ -16,7 +16,6 @@
 
 package com.facebook.buck.android;
 
-import com.facebook.buck.event.ThrowableLogEvent;
 import com.facebook.buck.shell.ShellStep;
 import com.facebook.buck.step.AbstractExecutionStep;
 import com.facebook.buck.step.CompositeStep;
@@ -134,9 +133,7 @@
         try {
           createEmptyZip(outputJarFile);
         } catch (IOException e) {
-          context.getBuckEventBus().post(ThrowableLogEvent.create(e,
-              "Error creating empty zip file at: %s.",
-              outputJarFile));
+          context.logError(e, "Error creating empty zip file at: %s.", outputJarFile);
           return 1;
         }
       }
@@ -227,9 +224,9 @@
             proGuardArguments,
             Paths.get(pathToProGuardCommandLineArgsFile));
       } catch (IOException e) {
-        context.getBuckEventBus().post(ThrowableLogEvent.create(e,
+        context.logError(e,
             "Error writing ProGuard arguments to file: %s.",
-            pathToProGuardCommandLineArgsFile));
+            pathToProGuardCommandLineArgsFile);
         return 1;
       }
 
diff --git a/src/com/facebook/buck/java/PrebuiltJarRule.java b/src/com/facebook/buck/java/PrebuiltJarRule.java
index 616ed6a..3deb3a2 100644
--- a/src/com/facebook/buck/java/PrebuiltJarRule.java
+++ b/src/com/facebook/buck/java/PrebuiltJarRule.java
@@ -18,7 +18,6 @@
 
 import static com.facebook.buck.rules.BuildableProperties.Kind.LIBRARY;
 
-import com.facebook.buck.event.ThrowableLogEvent;
 import com.facebook.buck.model.BuildTarget;
 import com.facebook.buck.model.BuildTargetPattern;
 import com.facebook.buck.rules.AbiRule;
@@ -217,9 +216,7 @@
       try {
         fileSha1 = ByteStreams.hash(inputSupplier, Hashing.sha1());
       } catch (IOException e) {
-        context.getBuckEventBus().post(ThrowableLogEvent.create(e,
-            "Failed to calculate ABI for %s.",
-            binaryJar));
+        context.logError(e, "Failed to calculate ABI for %s.", binaryJar);
         return 1;
       }
 
diff --git a/src/com/facebook/buck/shell/SymlinkFilesIntoDirectoryStep.java b/src/com/facebook/buck/shell/SymlinkFilesIntoDirectoryStep.java
index 3f13685..e35fb26 100644
--- a/src/com/facebook/buck/shell/SymlinkFilesIntoDirectoryStep.java
+++ b/src/com/facebook/buck/shell/SymlinkFilesIntoDirectoryStep.java
@@ -16,7 +16,6 @@
 
 package com.facebook.buck.shell;
 
-import com.facebook.buck.event.ThrowableLogEvent;
 import com.facebook.buck.step.AbstractExecutionStep;
 import com.facebook.buck.step.ExecutionContext;
 import com.facebook.buck.step.Step;
@@ -66,10 +65,7 @@
         Files.createDirectories(link.getParent());
         Files.createSymbolicLink(link, target);
       } catch (IOException e) {
-        context.getBuckEventBus().post(ThrowableLogEvent.create(e,
-            "Failed to create symlink from %s to %s.",
-            link,
-            target));
+        context.logError(e, "Failed to create symlink from %s to %s.", link, target);
         return 1;
       }
     }
diff --git a/src/com/facebook/buck/step/DefaultStepRunner.java b/src/com/facebook/buck/step/DefaultStepRunner.java
index 5413b2b..a1826bd 100644
--- a/src/com/facebook/buck/step/DefaultStepRunner.java
+++ b/src/com/facebook/buck/step/DefaultStepRunner.java
@@ -16,7 +16,6 @@
 
 package com.facebook.buck.step;
 
-import com.facebook.buck.event.BuckEventBus;
 import com.facebook.buck.model.BuildTarget;
 import com.facebook.buck.util.concurrent.MoreFutures;
 import com.google.common.base.Function;
@@ -74,11 +73,9 @@
       context.getStdErr().println(step.getDescription(context));
     }
 
-    BuckEventBus buckEventBus = context.getBuckEventBus();
-
-    buckEventBus.post(StepEvent.started(step, step.getDescription(context)));
+    context.postEvent(StepEvent.started(step, step.getDescription(context)));
     int exitCode = step.execute(context);
-    buckEventBus.post(StepEvent.finished(step, step.getDescription(context), exitCode));
+    context.postEvent(StepEvent.finished(step, step.getDescription(context), exitCode));
     if (exitCode != 0) {
       throw StepFailedException.createForFailingStep(step, context, exitCode, buildTarget);
     }
diff --git a/src/com/facebook/buck/step/ExecutionContext.java b/src/com/facebook/buck/step/ExecutionContext.java
index a9f4f8d..57eb2da 100644
--- a/src/com/facebook/buck/step/ExecutionContext.java
+++ b/src/com/facebook/buck/step/ExecutionContext.java
@@ -17,7 +17,9 @@
 package com.facebook.buck.step;
 
 import com.facebook.buck.android.NoAndroidSdkException;
+import com.facebook.buck.event.BuckEvent;
 import com.facebook.buck.event.BuckEventBus;
+import com.facebook.buck.event.ThrowableLogEvent;
 import com.facebook.buck.util.AndroidPlatformTarget;
 import com.facebook.buck.util.Ansi;
 import com.facebook.buck.util.Console;
@@ -89,6 +91,14 @@
         platform);
   }
 
+  public void logError(Throwable error, String msg, Object... formatArgs) {
+    eventBus.post(ThrowableLogEvent.create(error, msg, formatArgs));
+  }
+
+  public void postEvent(BuckEvent event) {
+    eventBus.post(event);
+  }
+
   public Verbosity getVerbosity() {
     return verbosity;
   }
diff --git a/src/com/facebook/buck/step/fs/MkdirStep.java b/src/com/facebook/buck/step/fs/MkdirStep.java
index 0a439c4..25149d1 100644
--- a/src/com/facebook/buck/step/fs/MkdirStep.java
+++ b/src/com/facebook/buck/step/fs/MkdirStep.java
@@ -16,7 +16,6 @@
 
 package com.facebook.buck.step.fs;
 
-import com.facebook.buck.event.ThrowableLogEvent;
 import com.facebook.buck.step.ExecutionContext;
 import com.facebook.buck.step.Step;
 import com.facebook.buck.util.Escaper;
@@ -46,9 +45,7 @@
     try {
       context.getProjectFilesystem().mkdirs(pathRelativeToProjectRoot);
     } catch (IOException e) {
-      context.getBuckEventBus().post(ThrowableLogEvent.create(e,
-          "Cannot make directories: %s",
-          pathRelativeToProjectRoot));
+      context.logError(e, "Cannot make directories: %s", pathRelativeToProjectRoot);
       return 1;
     }
     return 0;
diff --git a/src/com/facebook/buck/zip/RepackZipEntriesStep.java b/src/com/facebook/buck/zip/RepackZipEntriesStep.java
index 06e9bc6..a138d57 100644
--- a/src/com/facebook/buck/zip/RepackZipEntriesStep.java
+++ b/src/com/facebook/buck/zip/RepackZipEntriesStep.java
@@ -16,10 +16,8 @@
 
 package com.facebook.buck.zip;
 
-import com.facebook.buck.event.LogEvent;
 import com.facebook.buck.step.ExecutionContext;
 import com.facebook.buck.step.Step;
-import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.hash.Hashing;
 import com.google.common.io.ByteStreams;
@@ -33,7 +31,6 @@
 import java.io.InputStream;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.logging.Level;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
@@ -116,8 +113,7 @@
 
       return 0;
     } catch (IOException e) {
-      context.getBuckEventBus().post(LogEvent.create(
-          Level.SEVERE, "Unable to repack zip: %s", Throwables.getStackTraceAsString(e)));
+      context.logError(e, "Unable to repack zip");
       return 1;
     }
   }