Replace com.facebook.buck.util.Paths.getParentPath.

Summary:
Replace com.facebook.buck.util.Paths.getParentPath with
java.nio.file.Path.getParent.

Test Plan:
Ran JUnit tests: com.facebook.buck.util.PathsTest. Ran 'ant clean
test'.
diff --git a/src/com/facebook/buck/android/AndroidBinaryRule.java b/src/com/facebook/buck/android/AndroidBinaryRule.java
index e9781fe..ce7f141 100644
--- a/src/com/facebook/buck/android/AndroidBinaryRule.java
+++ b/src/com/facebook/buck/android/AndroidBinaryRule.java
@@ -73,6 +73,7 @@
 import com.google.common.collect.ImmutableSetMultimap;
 import com.google.common.collect.ImmutableSortedSet;
 import com.google.common.collect.Sets;
+import com.google.common.io.Files;
 
 import java.io.File;
 import java.io.IOException;
@@ -793,7 +794,7 @@
     Preconditions.checkArgument(classpathEntry.charAt(0) != '/',
         "Classpath entries should be relative rather than absolute paths: %s",
         classpathEntry);
-    String obfuscatedName = Paths.getBasename(classpathEntry, ".jar") + "-obfuscated.jar";
+    String obfuscatedName = Files.getNameWithoutExtension(classpathEntry) + "-obfuscated.jar";
     String dirName = Paths.normalizePathSeparator(new File(classpathEntry).getParent());
     String outputJar = getPathForProGuardDirectory() + "/" + dirName + "/" +
         obfuscatedName;
diff --git a/src/com/facebook/buck/android/SmartDexingStep.java b/src/com/facebook/buck/android/SmartDexingStep.java
index 119e5fa..ae6d51a 100644
--- a/src/com/facebook/buck/android/SmartDexingStep.java
+++ b/src/com/facebook/buck/android/SmartDexingStep.java
@@ -248,11 +248,11 @@
   // This is a terrible shared kludge between SmartDexingCommand and SplitZipCommand.
   // SplitZipCommand writes the metadata.txt file assuming this will be the final filename
   // in the APK...
-  public static String transformInputToDexOutput(String filename, DexStore dexStore) {
+  public static String transformInputToDexOutput(File file, DexStore dexStore) {
     if (DexStore.XZ == dexStore) {
-      return Paths.getBasename(filename, ".jar") + ".dex.jar.xz";
+      return Files.getNameWithoutExtension(file.getName()) + ".dex.jar.xz";
     } else {
-      return Paths.getBasename(filename, ".jar") + ".dex.jar";
+      return Files.getNameWithoutExtension(file.getName()) + ".dex.jar";
     }
   }
 
@@ -298,7 +298,7 @@
         for (File secondaryInputFile : secondaryInputsDirFile.listFiles()) {
           // May be either directories or jar files, doesn't matter.
           File secondaryOutputFile = new File(secondaryOutputDirFile,
-              transformInputToDexOutput(secondaryInputFile.getName(), dexStore));
+              transformInputToDexOutput(secondaryInputFile, dexStore));
           map.put(secondaryOutputFile, secondaryInputFile);
         }
       }
diff --git a/src/com/facebook/buck/android/SplitZipStep.java b/src/com/facebook/buck/android/SplitZipStep.java
index cb1b877..e1141fc 100644
--- a/src/com/facebook/buck/android/SplitZipStep.java
+++ b/src/com/facebook/buck/android/SplitZipStep.java
@@ -222,8 +222,7 @@
       Collection<File> jarFiles,
       DexStore dexStore) throws IOException {
     for (File secondary : jarFiles) {
-      String filename = SmartDexingStep.transformInputToDexOutput(
-           secondary.getName(), dexStore);
+      String filename = SmartDexingStep.transformInputToDexOutput(secondary, dexStore);
       String jarHash = hexSha1(secondary);
       String containedClass = findAnyClass(secondary);
       writer.write(String.format("%s %s %s",
diff --git a/src/com/facebook/buck/command/Project.java b/src/com/facebook/buck/command/Project.java
index 98d1dee..f7abbab 100644
--- a/src/com/facebook/buck/command/Project.java
+++ b/src/com/facebook/buck/command/Project.java
@@ -28,11 +28,11 @@
 import com.facebook.buck.android.NdkLibrary;
 import com.facebook.buck.java.JavaLibraryRule;
 import com.facebook.buck.java.PrebuiltJarRule;
-import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.model.BuildFileTree;
 import com.facebook.buck.model.BuildTarget;
 import com.facebook.buck.parser.PartialGraph;
 import com.facebook.buck.rules.AbstractDependencyVisitor;
+import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.rules.BuildRule;
 import com.facebook.buck.rules.Buildable;
 import com.facebook.buck.rules.DependencyGraph;
@@ -76,6 +76,7 @@
 import java.io.PrintStream;
 import java.io.Writer;
 import java.nio.charset.Charset;
+import java.nio.file.Path;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -246,7 +247,6 @@
   @Nullable
   File writeProjectDotPropertiesFile(Module module, Map<String, Module> nameToModuleIndex)
       throws IOException {
-    String pathToImlFile = module.pathToImlFile;
     SortedSet<String> references = Sets.newTreeSet();
     for (DependentModule dependency : module.dependencies) {
       if (!dependency.isModule()) {
@@ -265,9 +265,13 @@
         continue;
       }
 
+      Path pathToImlFile = java.nio.file.Paths.get(module.pathToImlFile);
+      Path depPathToImlFile = java.nio.file.Paths.get(dep.pathToImlFile);
+
       String relativePath = Paths.computeRelativePath(
-          Paths.getParentPath(pathToImlFile),
-          Paths.getParentPath(dep.pathToImlFile));
+          pathToImlFile.getParent().toString(),
+          depPathToImlFile.getParent().toString()
+       );
 
       // Drop the trailing slash from the path, since that's what the Android tools appear to do
       // when generating project.properties.
diff --git a/src/com/facebook/buck/util/Paths.java b/src/com/facebook/buck/util/Paths.java
index 87df20d..9a568d3 100644
--- a/src/com/facebook/buck/util/Paths.java
+++ b/src/com/facebook/buck/util/Paths.java
@@ -22,8 +22,6 @@
 
 import java.io.File;
 
-import javax.annotation.Nullable;
-
 public class Paths {
 
   private Paths() {}
@@ -75,43 +73,6 @@
     return Strings.repeat("../", directoryDepth) + to.substring(samePrefixIndex);
   }
 
-  /**
-   * @return the path to the parent
-   */
-  public static String getParentPath(String pathToFile) {
-    Preconditions.checkNotNull(pathToFile);
-    Preconditions.checkArgument(!pathToFile.isEmpty(), "path cannot be the empty string");
-
-    if (pathToFile.endsWith("/")) {
-      pathToFile = pathToFile.substring(0, pathToFile.length() - 1);
-    }
-
-    int lastSlashIndex = pathToFile.lastIndexOf('/');
-    if (lastSlashIndex < 0) {
-      return "";
-    } else {
-      return pathToFile.substring(0, lastSlashIndex + 1);
-    }
-  }
-
-  /**
-   * Mimic the UNIX command basename.
-   * @param path Filesystem path
-   * @param suffix Optional suffix (use null to exclude) that will be stripped from the basename if
-   *     it is found.
-   * @return The file's name, with suffix removed if provided.
-   */
-  public static String getBasename(String path, @Nullable String suffix) {
-    Preconditions.checkNotNull(path);
-
-    String name = new File(path).getName();
-    if (suffix != null && name.endsWith(suffix)) {
-      return name.substring(0, name.length() - suffix.length());
-    } else {
-      return name;
-    }
-  }
-
   public static Iterable<File> transformPathToFile(Iterable<String> paths) {
     return Iterables.transform(paths, Functions.PATH_TO_FILE);
   }
diff --git a/test/com/facebook/buck/android/SmartDexingStepTest.java b/test/com/facebook/buck/android/SmartDexingStepTest.java
index 6db66b5..f7810f6 100644
--- a/test/com/facebook/buck/android/SmartDexingStepTest.java
+++ b/test/com/facebook/buck/android/SmartDexingStepTest.java
@@ -79,7 +79,7 @@
 
     // Make sure that secondary-out/2.dex.jar came from secondary-in/2.jar.
     File secondaryOutFile = new File(secondaryOutDir,
-        SmartDexingStep.transformInputToDexOutput(secondaryInFile.getName(), DexStore.JAR));
+        SmartDexingStep.transformInputToDexOutput(secondaryInFile, DexStore.JAR));
     MoreAsserts.assertIterablesEquals(
         "Detected inconsistency with secondary output arguments",
         ImmutableSet.of(secondaryInFile),
diff --git a/test/com/facebook/buck/android/SplitZipStepTest.java b/test/com/facebook/buck/android/SplitZipStepTest.java
index 1e917ad..a5d4050 100644
--- a/test/com/facebook/buck/android/SplitZipStepTest.java
+++ b/test/com/facebook/buck/android/SplitZipStepTest.java
@@ -87,7 +87,7 @@
 
     // Note that we cannot test data[1] (the hash) because zip files change their hash each
     // time they are written due to timestamps written into the file.
-    assertEquals(SmartDexingStep.transformInputToDexOutput(outJar.getName(), DexStore.JAR), data[0]);
+    assertEquals(SmartDexingStep.transformInputToDexOutput(outJar, DexStore.JAR), data[0]);
     assertTrue(String.format("Unexpected class: %s", data[2]),
         fileToClassName.values().contains(data[2]));
   }
diff --git a/test/com/facebook/buck/util/PathsTest.java b/test/com/facebook/buck/util/PathsTest.java
index 6bd388d..d64d867 100644
--- a/test/com/facebook/buck/util/PathsTest.java
+++ b/test/com/facebook/buck/util/PathsTest.java
@@ -44,36 +44,6 @@
   }
 
   @Test
-  public void testGetParentPath() {
-    assertEquals("", Paths.getParentPath("project.properties"));
-    assertEquals("foo/", Paths.getParentPath("foo/bar"));
-    assertEquals("foo/", Paths.getParentPath("foo/bar/"));
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testGetParentPathThrows() {
-    Paths.getParentPath("");
-  }
-
-  @Test(expected = NullPointerException.class)
-  public void testGetBasenameThrows() {
-    Paths.getBasename(null, ".json");
-  }
-
-  @Test
-  public void testGetBasenameWithSuffix() {
-    assertEquals("bar", Paths.getBasename("bar.json", ".json"));
-    assertEquals("bar", Paths.getBasename("/foo/bar.json", ".json"));
-    assertEquals("bar.simple", Paths.getBasename("/foo/bar.simple", ".json"));
-  }
-
-  @Test
-  public void testGetBasenameWithoutSuffix() {
-    assertEquals("bar.json", Paths.getBasename("/foo/bar.json", null));
-    assertEquals("bar", Paths.getBasename("/foo/bar", ""));
-  }
-
-  @Test
   public void testNormalizePathSeparator() {
     assertEquals("C:/Windows/System32/drivers.dll",
         Paths.normalizePathSeparator("C:\\Windows\\System32\\drivers.dll"));