soong_ui: Do not find a build file if targets are specified.
For mmma and mmm, the findBuildFile function in config.go is invoked every time
for specified directories and directories with targets. For directories with
targets, an Android build file must exist in the directory where mmma and mmm
was invoked. There is no need to invoke findBuildFile function as a
simple check of the build file exists in the specified directory.
This is also refactoring the code for b/118730755
Bug: b/118730755
Test: Executed unit test cases through Intellij and executed mmma
command: "mmma external/protobuf:aprotoc external/bzip2".
Change-Id: I5428e3a3c36f77ff740617564b7853705521f29f
diff --git a/ui/build/config_test.go b/ui/build/config_test.go
index 7a1ee17..18dd151 100644
--- a/ui/build/config_test.go
+++ b/ui/build/config_test.go
@@ -441,7 +441,7 @@
buildFiles: []string{},
dirs: []string{"1/2/3:t1"},
curDir: "0",
- errStr: "Build file not found for 0/1/2/3 directory",
+ errStr: "Couldn't locate a build file from 0/1/2/3 directory",
}, {
description: "one target dir specified, one target specified, build file not in target dir",
dirsInTrees: []string{"0/1/2/3"},