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

Commit a3529488 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I0668ff5a,Iff2d7063,I6f8b1e2d,I126db49d,Ic6582260

* changes:
  Exclude source->prebuilt deps from visibility enforcement
  Dedup package build components registration
  Support registering hard coded pre arch mutators
  Added java_system_modules_import
  Document java_system_modules
parents 0b3a5781 78ac5b96
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -22,7 +22,19 @@ import (
)

func init() {
	RegisterModuleType("package", PackageFactory)
	RegisterPackageBuildComponents(InitRegistrationContext)
}

// Register the package module type and supporting mutators.
//
// This must be called in the correct order (relative to other methods that also
// register mutators) to match the order of mutator registration in mutator.go.
// Failing to do so will result in an unrealistic test environment.
func RegisterPackageBuildComponents(ctx RegistrationContext) {
	ctx.RegisterModuleType("package", PackageFactory)

	// Register mutators that are hard coded in to mutator.go.
	ctx.HardCodedPreArchMutators(RegisterPackageRenamer)
}

// The information maintained about each package.
+1 −2
Original line number Diff line number Diff line
@@ -87,8 +87,7 @@ func testPackage(fs map[string][]byte) (*TestContext, []error) {
	config := TestArchConfig(buildDir, nil, "", fs)

	ctx := NewTestArchContext()
	ctx.RegisterModuleType("package", PackageFactory)
	ctx.PreArchMutators(RegisterPackageRenamer)
	RegisterPackageBuildComponents(ctx)
	ctx.Register(config)

	_, errs := ctx.ParseBlueprintsFiles(".")
+3 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ type prebuiltDependencyTag struct {

var PrebuiltDepTag prebuiltDependencyTag

// Mark this tag so dependencies that use it are excluded from visibility enforcement.
func (t prebuiltDependencyTag) ExcludeFromVisibilityEnforcement() {}

type PrebuiltProperties struct {
	// When prefer is set to true the prebuilt will be used instead of any source module with
	// a matching name.
+8 −3
Original line number Diff line number Diff line
@@ -141,10 +141,8 @@ func TestPrebuilts(t *testing.T) {
			config := TestConfig(buildDir, nil, bp, fs)

			ctx := NewTestContext()
			RegisterPrebuiltMutators(ctx)
			registerTestPrebuiltBuildComponents(ctx)
			ctx.RegisterModuleType("filegroup", FileGroupFactory)
			ctx.RegisterModuleType("prebuilt", newPrebuiltModule)
			ctx.RegisterModuleType("source", newSourceModule)
			ctx.Register(config)

			_, errs := ctx.ParseBlueprintsFiles("Android.bp")
@@ -212,6 +210,13 @@ func TestPrebuilts(t *testing.T) {
	}
}

func registerTestPrebuiltBuildComponents(ctx RegistrationContext) {
	ctx.RegisterModuleType("prebuilt", newPrebuiltModule)
	ctx.RegisterModuleType("source", newSourceModule)

	RegisterPrebuiltMutators(ctx)
}

type prebuiltModule struct {
	ModuleBase
	prebuilt   Prebuilt
+10 −0
Original line number Diff line number Diff line
@@ -127,6 +127,12 @@ type RegistrationContext interface {
	RegisterModuleType(name string, factory ModuleFactory)
	RegisterSingletonType(name string, factory SingletonFactory)
	PreArchMutators(f RegisterMutatorFunc)

	// Register pre arch mutators that are hard coded into mutator.go.
	//
	// Only registers mutators for testing, is a noop on the InitRegistrationContext.
	HardCodedPreArchMutators(f RegisterMutatorFunc)

	PreDepsMutators(f RegisterMutatorFunc)
	PostDepsMutators(f RegisterMutatorFunc)
}
@@ -180,6 +186,10 @@ func (ctx *initRegistrationContext) PreArchMutators(f RegisterMutatorFunc) {
	PreArchMutators(f)
}

func (ctx *initRegistrationContext) HardCodedPreArchMutators(f RegisterMutatorFunc) {
	// Nothing to do as the mutators are hard code in preArch in mutator.go
}

func (ctx *initRegistrationContext) PreDepsMutators(f RegisterMutatorFunc) {
	PreDepsMutators(f)
}
Loading