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

Commit a12594a4 authored by Inseob Kim's avatar Inseob Kim Committed by Gerrit Code Review
Browse files

Merge "Add overrides support for snapshots"

parents 8f9ae520 a1888ce7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -546,7 +546,7 @@ func (c *snapshotLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entrie

	entries.SubName += c.baseProperties.Androidmk_suffix

	entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
	entries.ExtraEntries = append(entries.ExtraEntries, func(_ android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
		c.libraryDecorator.androidMkWriteExportedFlags(entries)

		if c.shared() || c.static() {
@@ -567,6 +567,10 @@ func (c *snapshotLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entrie
			if c.tocFile.Valid() {
				entries.SetString("LOCAL_SOONG_TOC", c.tocFile.String())
			}

			if c.shared() && len(c.Properties.Overrides) > 0 {
				entries.SetString("LOCAL_OVERRIDES_MODULES", strings.Join(makeOverrideModuleNames(ctx, c.Properties.Overrides), " "))
			}
		}

		if !c.shared() { // static or header
+6 −0
Original line number Diff line number Diff line
@@ -540,6 +540,12 @@ func (binary *binaryDecorator) hostToolPath() android.OptionalPath {
	return binary.toolPath
}

func (binary *binaryDecorator) overriddenModules() []string {
	return binary.Properties.Overrides
}

var _ overridable = (*binaryDecorator)(nil)

func init() {
	pctx.HostBinToolVariable("verifyHostBionicCmd", "host_bionic_verify")
}
+11 −0
Original line number Diff line number Diff line
@@ -616,6 +616,10 @@ type xref interface {
	XrefCcFiles() android.Paths
}

type overridable interface {
	overriddenModules() []string
}

type libraryDependencyKind int

const (
@@ -3642,6 +3646,13 @@ func (c *Module) UniqueApexVariations() bool {
	return c.UseVndk() && c.IsVndk()
}

func (c *Module) overriddenModules() []string {
	if o, ok := c.linker.(overridable); ok {
		return o.overriddenModules()
	}
	return nil
}

var _ snapshot.RelativeInstallPath = (*Module)(nil)

type moduleType int
+6 −0
Original line number Diff line number Diff line
@@ -2241,6 +2241,12 @@ func (library *libraryDecorator) getAPIListCoverageXMLPath() android.ModuleOutPa
	return library.apiListCoverageXmlPath
}

func (library *libraryDecorator) overriddenModules() []string {
	return library.Properties.Overrides
}

var _ overridable = (*libraryDecorator)(nil)

var versioningMacroNamesListKey = android.NewOnceKey("versioningMacroNamesList")

// versioningMacroNamesList returns a singleton map, where keys are "version macro names",
+19 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package cc

import (
	"encoding/json"
	"path/filepath"
	"testing"

@@ -736,3 +737,21 @@ func AssertExcludeFromRecoverySnapshotIs(t *testing.T, ctx *android.TestContext,
		t.Errorf("expected %q ExcludeFromRecoverySnapshot to be %t", m.String(), expected)
	}
}

func checkOverrides(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, jsonPath string, expected []string) {
	out := singleton.MaybeOutput(jsonPath)
	content := android.ContentFromFileRuleForTests(t, out)

	var flags snapshotJsonFlags
	if err := json.Unmarshal([]byte(content), &flags); err != nil {
		t.Errorf("Error while unmarshalling json %q: %w", jsonPath, err)
		return
	}

	for _, moduleName := range expected {
		if !android.InList(moduleName, flags.Overrides) {
			t.Errorf("expected %q to be in %q: %q", moduleName, flags.Overrides, content)
			return
		}
	}
}
Loading