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

Commit 5efd1985 authored by Paul Duffin's avatar Paul Duffin
Browse files

Ensure consistent handling of generated headers/dirs

The list of exported generated headers are all expected to be within
one of the exported generated include dirs. Previously, that was not
the case as ExportedGeneratedIncludeDirs was suitable for extracting
to common properties (which changes the output location) and
exportedGeneratedHeaders was not.

This would cause a problem if there was only one variant. In that case
the ExportedGeneratedIncludeDirs would be treated as a common property
and placed in include_gen/<x> directory while exportedGeneratedHeaders
would be treated as an arch specific property and placed in
<arch>/include_gen/<x>.

Bug: 142935992
Test: m nothing
Change-Id: Idf82a5ca551b44ec31971c7ff3bd957a4c38f396
parent 583bf7eb
Loading
Loading
Loading
Loading
+25 −8
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ func (mt *librarySdkMemberType) organizeVariants(member android.SdkMember) *nati
			name:                         memberName,
			archType:                     ccModule.Target().Arch.ArchType.String(),
			ExportedIncludeDirs:          exportedIncludeDirs,
			ExportedGeneratedIncludeDirs: exportedGeneratedIncludeDirs,
			exportedGeneratedIncludeDirs: exportedGeneratedIncludeDirs,
			ExportedSystemIncludeDirs:    ccModule.ExportedSystemIncludeDirs(),
			ExportedFlags:                ccModule.ExportedFlags(),
			exportedGeneratedHeaders:     ccModule.ExportedGeneratedHeaders(),
@@ -200,7 +200,7 @@ func extractCommonProperties(commonProperties interface{}, inputPropertiesSlice
func buildSharedNativeLibSnapshot(sdkModuleContext android.ModuleContext, info *nativeLibInfo, builder android.SnapshotBuilder, member android.SdkMember) {
	// a function for emitting include dirs
	addExportedDirCopyCommandsForNativeLibs := func(lib nativeLibInfoProperties) {
		// Do not include ExportedGeneratedIncludeDirs in the list of directories whose
		// Do not include exportedGeneratedIncludeDirs in the list of directories whose
		// contents are copied as they are copied from exportedGeneratedHeaders below.
		includeDirs := lib.ExportedIncludeDirs
		includeDirs = append(includeDirs, lib.ExportedSystemIncludeDirs...)
@@ -296,7 +296,7 @@ func nativeIncludeDirPathsFor(lib nativeLibInfoProperties, systemInclude bool) [
	var includeDirs []android.Path
	if !systemInclude {
		// Include the generated include dirs in the exported include dirs.
		includeDirs = append(lib.ExportedIncludeDirs, lib.ExportedGeneratedIncludeDirs...)
		includeDirs = append(lib.ExportedIncludeDirs, lib.exportedGeneratedIncludeDirs...)
	} else {
		includeDirs = lib.ExportedSystemIncludeDirs
	}
@@ -327,14 +327,31 @@ type nativeLibInfoProperties struct {
	// This is "" for common properties.
	archType string

	// The list of possibly common exported include dirs.
	//
	// This field is exported as its contents may not be arch specific.
	ExportedIncludeDirs android.Paths
	ExportedGeneratedIncludeDirs android.Paths
	ExportedSystemIncludeDirs    android.Paths
	ExportedFlags                []string

	// exportedGeneratedHeaders is not exported as if set it is always arch specific.
	// The list of arch specific exported generated include dirs.
	//
	// This field is not exported as its contents are always arch specific.
	exportedGeneratedIncludeDirs android.Paths

	// The list of arch specific exported generated header files.
	//
	// This field is not exported as its contents are is always arch specific.
	exportedGeneratedHeaders android.Paths

	// The list of possibly common exported system include dirs.
	//
	// This field is exported as its contents may not be arch specific.
	ExportedSystemIncludeDirs android.Paths

	// The list of possibly common exported flags.
	//
	// This field is exported as its contents may not be arch specific.
	ExportedFlags []string

	// outputFile is not exported as it is always arch specific.
	outputFile android.Path
}