Fix mma/mmma when soong is not embedded in make

Now `mma --skip-make` works.

Test: mmma --skip-make external/googletest
Change-Id: I86cccefc3c5174773d185c6e16bc52fe2c2010b3
This commit is contained in:
Dan Willemsen
2017-09-20 14:30:50 -07:00
parent 691ad1490c
commit d2e95fb295

View File

@@ -926,7 +926,7 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx blueprint.SingletonConte
checkbuildDeps := []string{} checkbuildDeps := []string{}
mmTarget := func(dir string) string { mmTarget := func(dir string) string {
return filepath.Join("mm", dir) return "MODULES-IN-" + strings.Replace(filepath.Clean(dir), "/", "-", -1)
} }
modulesInDir := make(map[string][]string) modulesInDir := make(map[string][]string)
@@ -961,6 +961,11 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx blueprint.SingletonConte
Optional: true, Optional: true,
}) })
// Make will generate the MODULES-IN-* targets
if ctx.Config().(Config).EmbeddedInMake() {
return
}
// Ensure ancestor directories are in modulesInDir // Ensure ancestor directories are in modulesInDir
dirs := sortedKeys(modulesInDir) dirs := sortedKeys(modulesInDir)
for _, dir := range dirs { for _, dir := range dirs {
@@ -983,8 +988,9 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx blueprint.SingletonConte
} }
} }
// Create a mm/<directory> target that depends on all modules in a directory, and depends // Create a MODULES-IN-<directory> target that depends on all modules in a directory, and
// on the mm/* targets of all of its subdirectories that contain Android.bp files. // depends on the MODULES-IN-* targets of all of its subdirectories that contain Android.bp
// files.
for _, dir := range dirs { for _, dir := range dirs {
ctx.Build(pctx, blueprint.BuildParams{ ctx.Build(pctx, blueprint.BuildParams{
Rule: blueprint.Phony, Rule: blueprint.Phony,