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

Commit 41326c1f authored by Wen-yi Chu's avatar Wen-yi Chu
Browse files

Revert "support sandboxed rust rules"

Revert submission 2629131-sandbox-rust-inputs

Reason for revert: Fail on android build.

Reverted changes: /q/submissionid:2629131-sandbox-rust-inputs

Change-Id: Ifd9aa46e80a12d8f4ffa0a2daa74b96727cbb7e6
parent df0ed707
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -95,12 +95,6 @@ func NewDepSet[T depSettableType](order DepSetOrder, direct []T, transitive []*D
	}
}

// AddDirectToDepSet returns a new DepSet with additional elements added to its direct set.
// The transitive sets remain untouched.
func AddDirectToDepSet[T depSettableType](d *DepSet[T], direct ...T) *DepSet[T] {
	return NewDepSet[T](d.order, Concat(d.direct, direct), d.transitive)
}

// DepSetBuilder is used to create an immutable DepSet.
type DepSetBuilder[T depSettableType] struct {
	order      DepSetOrder
@@ -194,14 +188,3 @@ func (d *DepSet[T]) ToList() []T {
	}
	return list
}

// ToListDirect returns the direct elements of a DepSet flattened to a list.
func (d *DepSet[T]) ToListDirect() []T {
	if d == nil {
		return nil
	}
	list := make([]T, len(d.direct))
	copy(list, d.direct)
	list = firstUniqueInPlace(list)
	return list
}
+0 −60
Original line number Diff line number Diff line
@@ -171,9 +171,6 @@ type Path interface {
	// Base returns the last element of the path
	Base() string

	// Dir returns a path pointing the directory containing the path
	Dir() Path

	// Rel returns the portion of the path relative to the directory it was created from.  For
	// example, Rel on a PathsForModuleSrc would return the path relative to the module source
	// directory, and OutputPath.Join("foo").Rel() would return "foo".
@@ -1015,12 +1012,6 @@ func (p basePath) Base() string {
	return filepath.Base(p.path)
}

func (p basePath) Dir() Path {
	p.path = filepath.Dir(p.path)
	p.rel = filepath.Dir(p.rel)
	return p
}

func (p basePath) Rel() string {
	if p.rel != "" {
		return p.rel
@@ -1055,11 +1046,6 @@ func (p SourcePath) withRel(rel string) SourcePath {
	return p
}

func (p SourcePath) Dir() Path {
	p.basePath = p.basePath.Dir().(basePath)
	return p
}

// safePathForSource is for paths that we expect are safe -- only for use by go
// code that is embedding ninja variables in paths
func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) {
@@ -1262,12 +1248,6 @@ func (p OutputPath) withRel(rel string) OutputPath {
	return p
}

func (p OutputPath) Dir() Path {
	p.basePath = p.basePath.Dir().(basePath)
	p.fullPath = filepath.Dir(p.fullPath)
	return p
}

func (p OutputPath) WithoutRel() OutputPath {
	p.basePath.rel = filepath.Base(p.basePath.path)
	return p
@@ -1300,11 +1280,6 @@ type toolDepPath struct {
	basePath
}

func (p toolDepPath) Dir() Path {
	p.basePath = p.basePath.Dir().(basePath)
	return p
}

func (t toolDepPath) RelativeToTop() Path {
	ensureTestOnly()
	return t
@@ -1488,11 +1463,6 @@ type ModuleOutPath struct {
	OutputPath
}

func (p ModuleOutPath) Dir() Path {
	p.OutputPath = p.OutputPath.Dir().(OutputPath)
	return p
}

func (p ModuleOutPath) RelativeToTop() Path {
	p.OutputPath = p.outputPathRelativeToTop()
	return p
@@ -1537,11 +1507,6 @@ type ModuleGenPath struct {
	ModuleOutPath
}

func (p ModuleGenPath) Dir() Path {
	p.ModuleOutPath = p.ModuleOutPath.Dir().(ModuleOutPath)
	return p
}

func (p ModuleGenPath) RelativeToTop() Path {
	p.OutputPath = p.outputPathRelativeToTop()
	return p
@@ -1581,11 +1546,6 @@ type ModuleObjPath struct {
	ModuleOutPath
}

func (p ModuleObjPath) Dir() Path {
	p.ModuleOutPath = p.ModuleOutPath.Dir().(ModuleOutPath)
	return p
}

func (p ModuleObjPath) RelativeToTop() Path {
	p.OutputPath = p.outputPathRelativeToTop()
	return p
@@ -1610,11 +1570,6 @@ type ModuleResPath struct {
	ModuleOutPath
}

func (p ModuleResPath) Dir() Path {
	p.ModuleOutPath = p.ModuleOutPath.Dir().(ModuleOutPath)
	return p
}

func (p ModuleResPath) RelativeToTop() Path {
	p.OutputPath = p.outputPathRelativeToTop()
	return p
@@ -1651,11 +1606,6 @@ type InstallPath struct {
	makePath bool
}

func (p InstallPath) Dir() Path {
	p.basePath = p.basePath.Dir().(basePath)
	return p
}

// Will panic if called from outside a test environment.
func ensureTestOnly() {
	if PrefixInList(os.Args, "-test.") {
@@ -1972,11 +1922,6 @@ type PhonyPath struct {
	basePath
}

func (p PhonyPath) Dir() Path {
	p.basePath = p.basePath.Dir().(basePath)
	return p
}

func (p PhonyPath) writablePath() {}

func (p PhonyPath) getSoongOutDir() string {
@@ -2002,11 +1947,6 @@ type testPath struct {
	basePath
}

func (p testPath) Dir() Path {
	p.basePath = p.basePath.Dir().(basePath)
	return p
}

func (p testPath) RelativeToTop() Path {
	ensureTestOnly()
	return p
+1 −17
Original line number Diff line number Diff line
@@ -14,11 +14,7 @@

package android

import (
	"path/filepath"

	"github.com/google/blueprint"
)
import "path/filepath"

func init() {
	RegisterModuleType("prebuilt_build_tool", NewPrebuiltBuildTool)
@@ -59,13 +55,6 @@ func (t *prebuiltBuildTool) DepsMutator(ctx BottomUpMutatorContext) {
	}
}

type PrebuiltBuildToolInfo struct {
	Src  Path
	Deps Paths
}

var PrebuiltBuildToolInfoProvider = blueprint.NewProvider(PrebuiltBuildToolInfo{})

func (t *prebuiltBuildTool) GenerateAndroidBuildActions(ctx ModuleContext) {
	sourcePath := t.prebuilt.SingleSourcePath(ctx)
	installedPath := PathForModuleOut(ctx, t.BaseModuleName())
@@ -93,11 +82,6 @@ func (t *prebuiltBuildTool) GenerateAndroidBuildActions(ctx ModuleContext) {
	}

	t.toolPath = OptionalPathForPath(installedPath)

	ctx.SetProvider(PrebuiltBuildToolInfoProvider, PrebuiltBuildToolInfo{
		Src:  sourcePath,
		Deps: deps,
	})
}

func (t *prebuiltBuildTool) MakeVars(ctx MakeVarsModuleContext) {
+5 −10
Original line number Diff line number Diff line
@@ -33,17 +33,12 @@ func CopyOf[T any](s []T) []T {
	return append([]T{}, s...)
}

// Concat returns a new slice concatenated from the input slices. It does not change the input
// Concat returns a new slice concatenated from the two input slices. It does not change the input
// slices.
func Concat[T any](slices ...[]T) []T {
	newLength := 0
	for _, s := range slices {
		newLength += len(s)
	}
	res := make([]T, 0, newLength)
	for _, s := range slices {
		res = append(res, s...)
	}
func Concat[T any](s1, s2 []T) []T {
	res := make([]T, 0, len(s1)+len(s2))
	res = append(res, s1...)
	res = append(res, s2...)
	return res
}

+2 −2
Original line number Diff line number Diff line
@@ -948,7 +948,7 @@ func TestApexWithStubs(t *testing.T) {
	// Ensure that stub dependency from a rust module is not included
	ensureNotContains(t, copyCmds, "image.apex/lib64/libfoo.shared_from_rust.so")
	// The rust module is linked to the stub cc library
	rustDeps := ctx.ModuleForTests("foo.rust", "android_arm64_armv8-a_apex10000").Rule("rustc").RuleParams.Command
	rustDeps := ctx.ModuleForTests("foo.rust", "android_arm64_armv8-a_apex10000").Rule("rustLink").Args["linkFlags"]
	ensureContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared_current/libfoo.shared_from_rust.so")
	ensureNotContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared/libfoo.shared_from_rust.so")

@@ -1024,7 +1024,7 @@ func TestApexCanUsePrivateApis(t *testing.T) {
	mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
	ensureNotContains(t, mylibLdFlags, "mylib2/android_arm64_armv8-a_shared_current/mylib2.so")
	ensureContains(t, mylibLdFlags, "mylib2/android_arm64_armv8-a_shared/mylib2.so")
	rustDeps := ctx.ModuleForTests("foo.rust", "android_arm64_armv8-a_apex10000").Rule("rustc").RuleParams.Command
	rustDeps := ctx.ModuleForTests("foo.rust", "android_arm64_armv8-a_apex10000").Rule("rustLink").Args["linkFlags"]
	ensureNotContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared_current/libfoo.shared_from_rust.so")
	ensureContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared/libfoo.shared_from_rust.so")
}
Loading