From 5efd1985d165af791d21c3f002f42af128371054 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Thu, 20 Feb 2020 14:33:54 +0000 Subject: [PATCH] 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/ directory while exportedGeneratedHeaders would be treated as an arch specific property and placed in /include_gen/. Bug: 142935992 Test: m nothing Change-Id: Idf82a5ca551b44ec31971c7ff3bd957a4c38f396 --- cc/library_sdk_member.go | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go index 165901d26..dd097cf26 100644 --- a/cc/library_sdk_member.go +++ b/cc/library_sdk_member.go @@ -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 - ExportedIncludeDirs android.Paths - ExportedGeneratedIncludeDirs android.Paths - ExportedSystemIncludeDirs android.Paths - ExportedFlags []string + // The list of possibly common exported include dirs. + // + // This field is exported as its contents may not be arch specific. + ExportedIncludeDirs android.Paths - // 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 }