Merge "Move fuzz phony to be make-defined, and add to dist."

This commit is contained in:
Treehugger Robot
2019-09-30 20:24:19 +00:00
committed by Gerrit Code Review

View File

@@ -16,8 +16,8 @@ package cc
import ( import (
"path/filepath" "path/filepath"
"strings"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools" "github.com/google/blueprint/proptools"
"android/soong/android" "android/soong/android"
@@ -161,6 +161,7 @@ func NewFuzz(hod android.HostOrDeviceSupported) *Module {
// Responsible for generating GNU Make rules that package fuzz targets into // Responsible for generating GNU Make rules that package fuzz targets into
// their architecture & target/host specific zip file. // their architecture & target/host specific zip file.
type fuzzPackager struct { type fuzzPackager struct {
packages android.Paths
} }
func fuzzPackagingFactory() android.Singleton { func fuzzPackagingFactory() android.Singleton {
@@ -220,15 +221,12 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
} }
}) })
// List of architecture + host/device specific packages to build via. 'make fuzz'.
var archDirTargets android.Paths
for archDir, filesToZip := range archDirs { for archDir, filesToZip := range archDirs {
arch := archDir.Base() arch := archDir.Base()
hostOrTarget := filepath.Base(filepath.Dir(archDir.String())) hostOrTarget := filepath.Base(filepath.Dir(archDir.String()))
builder := android.NewRuleBuilder() builder := android.NewRuleBuilder()
outputFile := android.PathForOutput(ctx, "fuzz-"+hostOrTarget+"-"+arch+".zip") outputFile := android.PathForOutput(ctx, "fuzz-"+hostOrTarget+"-"+arch+".zip")
archDirTargets = append(archDirTargets, outputFile) s.packages = append(s.packages, outputFile)
command := builder.Command().BuiltTool(ctx, "soong_zip"). command := builder.Command().BuiltTool(ctx, "soong_zip").
Flag("-j"). Flag("-j").
@@ -242,11 +240,12 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
builder.Build(pctx, ctx, "create-fuzz-package-"+arch+"-"+hostOrTarget, builder.Build(pctx, ctx, "create-fuzz-package-"+arch+"-"+hostOrTarget,
"Create fuzz target packages for "+arch+"-"+hostOrTarget) "Create fuzz target packages for "+arch+"-"+hostOrTarget)
} }
}
ctx.Build(pctx, android.BuildParams{
Rule: blueprint.Phony, func (s *fuzzPackager) MakeVars(ctx android.MakeVarsContext) {
Output: android.PathForPhony(ctx, "fuzz"), // TODO(mitchp): Migrate this to use MakeVarsContext::DistForGoal() when it's
Implicits: archDirTargets, // ready to handle phony targets created in Soong. In the meantime, this
Description: "Build all Android fuzz targets, and create packages.", // exports the phony 'fuzz' target and dependencies on packages to
}) // core/main.mk so that we can use dist-for-goals.
ctx.Strict("SOONG_FUZZ_PACKAGING_ARCH_MODULES", strings.Join(s.packages.Strings(), " "))
} }