From 576463f730065377af31028a8d7248fbff080f95 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Fri, 19 Jan 2018 14:59:01 -0800 Subject: [PATCH] idegen fails to build a correct dependency graph if one of the submodules it identifies lacks an Android.mk file The current failure mode is for the tool to throw an Exception and stop. This commit makes it possible for the tool to continue in the face of such a missing .mk file. Test: manual Change-Id: I42991fe7cda07e0fae2eb037649d88133afde1c7 --- .../idegen/src/com/android/idegen/ModuleCache.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/idegen/src/com/android/idegen/ModuleCache.java b/tools/idegen/src/com/android/idegen/ModuleCache.java index eb1228332..a7a557cf3 100644 --- a/tools/idegen/src/com/android/idegen/ModuleCache.java +++ b/tools/idegen/src/com/android/idegen/ModuleCache.java @@ -71,12 +71,19 @@ public class ModuleCache { Preconditions.checkState(indexes != null, "You must call init() first."); Preconditions.checkNotNull(moduleName); - String makeFile = indexes.getMakeFile(moduleName); - if (makeFile == null) { + String makeFileName = indexes.getMakeFile(moduleName); + if (makeFileName == null) { logger.warning("Unable to find make file for module: " + moduleName); return null; } - return getAndCacheByDir(new File(makeFile).getParentFile()); + + File makeFile = new File(makeFileName); + if (!makeFile.exists()) { + logger.warning("Unable to find make file for module: " + moduleName); + return null; + } + + return getAndCacheByDir(makeFile.getParentFile()); } private void putModule(File moduleDir, Module module) throws IOException {