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

Commit 9d8d609f authored by Paul Duffin's avatar Paul Duffin
Browse files

Pass SdkMember to AddPrebuiltModule instead of the name

This is needed for a follow up change that makes sure that the
prebuilt modules have the same visibility as the source modules.

Bug: 143678475
Test: m conscrypt-module-sdk
Change-Id: I9461c8c094ab19ee9ececb5e5fd50565789f2fa2
parent 667039f4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ type SnapshotBuilder interface {
	// prefer=true. And one that is not versioned, not marked as prefer=true and
	// will only be used if the equivalently named non-prebuilt module is not
	// present.
	AddPrebuiltModule(name string, moduleType string) BpModule
	AddPrebuiltModule(member SdkMember, moduleType string) BpModule
}

// A set of properties for use in a .bp file.
+5 −5
Original line number Diff line number Diff line
@@ -1435,10 +1435,10 @@ func (mt *librarySdkMemberType) IsInstance(module android.Module) bool {
// copy exported header files and stub *.so files
func (mt *librarySdkMemberType) BuildSnapshot(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) {
	info := organizeVariants(member)
	buildSharedNativeLibSnapshot(sdkModuleContext, info, builder)
	buildSharedNativeLibSnapshot(sdkModuleContext, info, builder, member)
}

func buildSharedNativeLibSnapshot(sdkModuleContext android.ModuleContext, info *nativeLibInfo, builder android.SnapshotBuilder) {
func buildSharedNativeLibSnapshot(sdkModuleContext android.ModuleContext, info *nativeLibInfo, builder android.SnapshotBuilder, member android.SdkMember) {
	// a function for emitting include dirs
	printExportedDirCopyCommandsForNativeLibs := func(lib archSpecificNativeLibInfo) {
		includeDirs := lib.exportedIncludeDirs
@@ -1489,10 +1489,10 @@ func buildSharedNativeLibSnapshot(sdkModuleContext android.ModuleContext, info *
		}
	}

	info.generatePrebuiltLibrary(sdkModuleContext, builder)
	info.generatePrebuiltLibrary(sdkModuleContext, builder, member)
}

func (info *nativeLibInfo) generatePrebuiltLibrary(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder) {
func (info *nativeLibInfo) generatePrebuiltLibrary(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) {

	// a function for emitting include dirs
	addExportedDirsForNativeLibs := func(lib archSpecificNativeLibInfo, properties android.BpPropertySet, systemInclude bool) {
@@ -1509,7 +1509,7 @@ func (info *nativeLibInfo) generatePrebuiltLibrary(sdkModuleContext android.Modu
		properties.AddProperty(propertyName, includeDirs)
	}

	pbm := builder.AddPrebuiltModule(info.name, "cc_prebuilt_library_shared")
	pbm := builder.AddPrebuiltModule(member, "cc_prebuilt_library_shared")

	if !info.hasArchSpecificFlags {
		addExportedDirsForNativeLibs(info.archVariants[0], pbm, false /*systemInclude*/)
+1 −1
Original line number Diff line number Diff line
@@ -2000,6 +2000,6 @@ func (mt *droidStubsSdkMemberType) BuildSnapshot(sdkModuleContext android.Module
	snapshotRelativeDir := filepath.Join("java", d.Name()+"_stubs_sources")
	builder.UnzipToSnapshot(stubsSrcJar, snapshotRelativeDir)

	pbm := builder.AddPrebuiltModule(sdkModuleContext.OtherModuleName(d), "prebuilt_stubs_sources")
	pbm := builder.AddPrebuiltModule(member, "prebuilt_stubs_sources")
	pbm.AddProperty("srcs", []string{snapshotRelativeDir})
}
+1 −1
Original line number Diff line number Diff line
@@ -1760,7 +1760,7 @@ func (mt *librarySdkMemberType) buildSnapshot(
		}
	}

	module := builder.AddPrebuiltModule(sdkModuleContext.OtherModuleName(j), "java_import")
	module := builder.AddPrebuiltModule(member, "java_import")
	module.AddProperty("jars", []string{snapshotRelativeJavaLibPath})
}

+2 −1
Original line number Diff line number Diff line
@@ -368,7 +368,8 @@ func (s *snapshotBuilder) UnzipToSnapshot(zipPath android.Path, destDir string)
	s.zipsToMerge = append(s.zipsToMerge, tmpZipPath)
}

func (s *snapshotBuilder) AddPrebuiltModule(name string, moduleType string) android.BpModule {
func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType string) android.BpModule {
	name := member.Name()
	if s.prebuiltModules[name] != nil {
		panic(fmt.Sprintf("Duplicate module detected, module %s has already been added", name))
	}