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

Commit fd121fcf authored by David Fu's avatar David Fu
Browse files

Added haiku presubmit packaging

Change-Id: I6cdb06fe0c2d7dd6320a1dafe859172b280dd53c
parent 253054a1
Loading
Loading
Loading
Loading
+28 −4
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import (
func init() {
	android.RegisterModuleType("cc_fuzz", LibFuzzFactory)
	android.RegisterParallelSingletonType("cc_fuzz_packaging", fuzzPackagingFactory)
	android.RegisterParallelSingletonType("cc_fuzz_presubmit_packaging", fuzzPackagingFactoryPresubmit)
}

type FuzzProperties struct {
@@ -355,6 +356,7 @@ type ccRustFuzzPackager struct {
	fuzzPackagingArchModules         			string
	fuzzTargetSharedDepsInstallPairs 			string
	allFuzzTargetsName               			string
	onlyIncludePresubmits						bool
}

func fuzzPackagingFactory() android.Singleton {
@@ -363,6 +365,18 @@ func fuzzPackagingFactory() android.Singleton {
		fuzzPackagingArchModules:         "SOONG_FUZZ_PACKAGING_ARCH_MODULES",
		fuzzTargetSharedDepsInstallPairs: "FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS",
		allFuzzTargetsName:               "ALL_FUZZ_TARGETS",
		onlyIncludePresubmits:			  false,
	}
	return fuzzPackager
}

func fuzzPackagingFactoryPresubmit() android.Singleton {

	fuzzPackager := &ccRustFuzzPackager{
		fuzzPackagingArchModules:         "SOONG_PRESUBMIT_FUZZ_PACKAGING_ARCH_MODULES",
		fuzzTargetSharedDepsInstallPairs: "PRESUBMIT_FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS",
		allFuzzTargetsName:               "ALL_PRESUBMIT_FUZZ_TARGETS",
		onlyIncludePresubmits:			  true,
	}
	return fuzzPackager
}
@@ -386,7 +400,6 @@ func (s *ccRustFuzzPackager) GenerateBuildActions(ctx android.SingletonContext)
		if !ok || ccModule.PreventInstall() {
			return
		}

		// Discard non-fuzz targets.
		if ok := fuzz.IsValid(ccModule.FuzzModuleStruct()); !ok {
			return
@@ -403,6 +416,9 @@ func (s *ccRustFuzzPackager) GenerateBuildActions(ctx android.SingletonContext)
		} else if ccModule.Host() {
			hostOrTargetString = "host"
		}
		if s.onlyIncludePresubmits == true {
			hostOrTargetString = "presubmit-" + hostOrTargetString
		}

		fpm := fuzz.FuzzPackagedModule{}
		if ok {
@@ -427,6 +443,14 @@ func (s *ccRustFuzzPackager) GenerateBuildActions(ctx android.SingletonContext)
		// The executable.
		files = append(files, fuzz.FileToZip{SourceFilePath: android.OutputFileForModule(ctx, ccModule, "unstripped")})

		if s.onlyIncludePresubmits == true {
			if fpm.FuzzProperties.Fuzz_config == nil {
				return
			}
			if !BoolDefault(fpm.FuzzProperties.Fuzz_config.Use_for_presubmit, false){
				return
			}
		}
		archDirs[archOs], ok = s.BuildZipFile(ctx, module, fpm, files, builder, archDir, archString, hostOrTargetString, archOs, archDirs)
		if !ok {
			return