Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0a5e191 authored by Mitch Phillips's avatar Mitch Phillips
Browse files

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

Add the fuzz packages to dist. This requires that the phony for 'make'
be define in make itself, rather than in Soong. See comments on other
patch in topic for more information.

Bug: 141026328
Test: m fuzz dist

Change-Id: I4cd476adcfa42e4b40911c4a32427a7b00c67cc3
parent 84dfc3d3
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@ package cc

import (
	"path/filepath"
	"strings"

	"github.com/google/blueprint"
	"github.com/google/blueprint/proptools"

	"android/soong/android"
@@ -161,6 +161,7 @@ func NewFuzz(hod android.HostOrDeviceSupported) *Module {
// Responsible for generating GNU Make rules that package fuzz targets into
// their architecture & target/host specific zip file.
type fuzzPackager struct {
	packages android.Paths
}

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 {
		arch := archDir.Base()
		hostOrTarget := filepath.Base(filepath.Dir(archDir.String()))
		builder := android.NewRuleBuilder()
		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").
			Flag("-j").
@@ -242,11 +240,12 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
		builder.Build(pctx, ctx, "create-fuzz-package-"+arch+"-"+hostOrTarget,
			"Create fuzz target packages for "+arch+"-"+hostOrTarget)
	}
}

	ctx.Build(pctx, android.BuildParams{
		Rule:        blueprint.Phony,
		Output:      android.PathForPhony(ctx, "fuzz"),
		Implicits:   archDirTargets,
		Description: "Build all Android fuzz targets, and create packages.",
	})
func (s *fuzzPackager) MakeVars(ctx android.MakeVarsContext) {
	// TODO(mitchp): Migrate this to use MakeVarsContext::DistForGoal() when it's
	// ready to handle phony targets created in Soong. In the meantime, this
	// 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(), " "))
}