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
This commit is contained in:
Patrice Arruda
2019-07-08 11:06:46 -07:00
parent ae11318633
commit 9450d0b226
2 changed files with 30 additions and 22 deletions

View File

@@ -441,7 +441,7 @@ func TestConfigGetTargets(t *testing.T) {
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"},