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

Commit af7c166f authored by Liz Kammer's avatar Liz Kammer Committed by Gerrit Code Review
Browse files

Merge "Handle prebuilt vs source selection in bp2build" into main

parents 8d3ea47e e1b39a52
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ var (
		"prebuilts/clang/host/linux-x86":                   Bp2BuildDefaultTrueRecursively,
		"prebuilts/gradle-plugin":                          Bp2BuildDefaultTrueRecursively,
		"prebuilts/runtime/mainline/platform/sdk":          Bp2BuildDefaultTrueRecursively,
		"prebuilts/module_sdk":                             Bp2BuildDefaultTrueRecursively,
		"prebuilts/sdk":                                    Bp2BuildDefaultTrue,
		"prebuilts/sdk/current/androidx":                   Bp2BuildDefaultTrue,
		"prebuilts/sdk/current/androidx-legacy":            Bp2BuildDefaultTrue,
+3 −0
Original line number Diff line number Diff line
@@ -487,6 +487,9 @@ func bp2buildModuleLabel(ctx BazelConversionContext, module blueprint.Module) st
	if moduleDir == Bp2BuildTopLevel {
		moduleDir = ""
	}
	if a, ok := module.(Module); ok && IsModulePrebuilt(a) {
		moduleName = RemoveOptionalPrebuiltPrefix(moduleName)
	}
	return fmt.Sprintf("//%s:%s", moduleDir, moduleName)
}

+5 −0
Original line number Diff line number Diff line
@@ -2073,6 +2073,11 @@ func (c *config) GetApiLibraries() map[string]struct{} {
	return c.apiLibraries
}

// Bp2buildMode indicates whether the config is for bp2build mode of Soong
func (c *config) Bp2buildMode() bool {
	return c.BuildMode == Bp2build
}

func (c *deviceConfig) CheckVendorSeappViolations() bool {
	return Bool(c.config.productVariables.CheckVendorSeappViolations)
}
+12 −2
Original line number Diff line number Diff line
@@ -3100,11 +3100,21 @@ func (b *baseModuleContext) ModuleFromName(name string) (blueprint.Module, bool)
	if !b.isBazelConversionMode() {
		panic("cannot call ModuleFromName if not in bazel conversion mode")
	}
	var m blueprint.Module
	var ok bool
	if moduleName, _ := SrcIsModuleWithTag(name); moduleName != "" {
		return b.bp.ModuleFromName(moduleName)
		m, ok = b.bp.ModuleFromName(moduleName)
	} else {
		return b.bp.ModuleFromName(name)
		m, ok = b.bp.ModuleFromName(name)
	}
	if !ok {
		return m, ok
	}
	// If this module is not preferred, tried to get the prebuilt version instead
	if a, aOk := m.(Module); aOk && !IsModulePrebuilt(a) && !IsModulePreferred(a) {
		return b.ModuleFromName("prebuilt_" + name)
	}
	return m, ok
}

func (b *baseModuleContext) VisitDirectDepsBlueprint(visit func(blueprint.Module)) {
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ func registerMutatorsForBazelConversion(ctx *Context, bp2buildMutators []Registe
		// TODO(b/165114590): this is required to resolve deps that are only prebuilts, but we should
		// evaluate the impact on conversion.
		RegisterPrebuiltsPreArchMutators,
		RegisterPrebuiltsPostDepsMutators,
	},
		bp2buildMutators...)

Loading