Removed duplicate methods
@@ -883,8 +883,8 @@ public final class Compiler {
File deployDir = createDir(buildDir, "deploy");
String tmpPackageName = deployDir.getAbsolutePath() + SLASH +
project.getProjectName() + ".ap_";
- File srcJavaDir = createDirectory(buildDir, "generated/src");
- File rJavaDir = createDirectory(buildDir, "generated/symbols");
+ File srcJavaDir = createDir(buildDir, "generated/src");
+ File rJavaDir = createDir(buildDir, "generated/symbols");
if (!compiler.runAaptPackage(manifestFile, resDir, tmpPackageName, srcJavaDir, rJavaDir)) {
return false;
}
@@ -918,7 +918,7 @@ public final class Compiler {
// method of identifying via a hash of the path won't work when files
// are copied into temporary storage) and processed via a hacked up version of
// Android SDK's Dex Ant task
- File tmpDir = createDirectory(buildDir, "tmp");
+ File tmpDir = createDir(buildDir, "tmp");
String dexedClassesDir = tmpDir.getAbsolutePath();
if (!compiler.runDx(classesDir, dexedClassesDir, false)) {
return false;
@@ -1586,9 +1586,9 @@ public final class Compiler {
* @return true on success, otherwise false
*/
private boolean attachAarLibraries(File buildDir) {
- final File explodedBaseDir = createDirectory(buildDir, "exploded-aars");
- final File generatedDir = createDirectory(buildDir, "generated");
- final File genSrcDir = createDirectory(generatedDir, "src");
+ final File explodedBaseDir = createDir(buildDir, "exploded-aars");
+ final File generatedDir = createDir(buildDir, "generated");
+ final File genSrcDir = createDir(generatedDir, "src");
explodedAarLibs = new AARLibraries(genSrcDir);
final Set<String> processedLibs = new HashSet<>();
@@ -1664,9 +1664,9 @@ public final class Compiler {
*/
private boolean mergeResources(File mainResDir, File buildDir, String aaptTool) {
// these should exist from earlier build steps
- File intermediates = createDirectory(buildDir, "intermediates");
- File resDir = createDirectory(intermediates, "res");
- mergedResDir = createDirectory(resDir, "merged");
+ File intermediates = createDir(buildDir, "intermediates");
+ File resDir = createDir(intermediates, "res");
+ mergedResDir = createDir(resDir, "merged");
PngCruncher cruncher = new AaptCruncher(getResource(aaptTool), null, null);
return explodedAarLibs.mergeResources(mergedResDir, mainResDir, cruncher);
}
@@ -1837,21 +1837,6 @@ public final class Compiler {
return dir;
}
- /**
- * Creates a new directory (if it doesn't exist already).
- *
- * @param parentDirectory parent directory of new directory
- * @param name name of new directory
- * @return new directory
- */
- private static File createDirectory(File parentDirectory, String name) {
- File dir = new File(parentDirectory, name);
- if (!dir.exists()) {
- dir.mkdir();
- }
- return dir;
- }
-
private static int setProgress(int increments) {
Compiler.currentProgress = increments;
LOG.info("The current progress is "
