extract: Fix cross-partition multi-arch library conflicts

This commit is contained in:
Danny Lin 2021-11-07 06:48:02 -08:00
parent c65b5d1fbb
commit 248f1ec96d
2 changed files with 15 additions and 7 deletions

View file

@ -72,7 +72,7 @@ export interface DspModule {
}
export type SoongModuleSpecific = {
// Type is mandatory initially, but this is deleted for serialization
// This is used initially, but deleted before serialization
_type?: string
} & (
SharedLibraryModule |
@ -91,6 +91,9 @@ export type SoongModule = {
system_ext_specific?: boolean
product_specific?: boolean
soc_specific?: boolean
// This is used initially, but deleted before serialization
_entry?: BlobEntry
} & SoongModuleSpecific
function getRelativeInstallPath(entry: BlobEntry, pathParts: Array<string>, installDir: string) {
@ -237,6 +240,7 @@ export function blobToSoongModule(
name: name,
owner: vendor,
...moduleSpecific,
_entry: entry,
// Partition flag
...(entry.partition == 'system_ext' && { system_ext_specific: true }),
@ -247,9 +251,12 @@ export function blobToSoongModule(
}
export function serializeModule(module: SoongModule) {
// Type prepended to Soong module props, so remove it from the object
let type = module._type;
delete module._type;
// Type is prepended to Soong module props, so remove it from the object
let type = module._type
delete module._type
// Delete internal blob entry reference as well
delete module._entry
// Initial serialization pass. Node.js util.inspect happens to be identical to Soong format.
let serialized = util.inspect(module, {

View file

@ -41,12 +41,13 @@ async function generateBuild(
let baseExt = SPECIAL_FILE_EXTENSIONS.has(ext) ? ext : undefined
let name = path.basename(entry.path, baseExt)
// If already exists: skip if it's the other arch variant of a library,
// otherwise rename the module to avoid conflict
// If already exists: skip if it's the other arch variant of a library in
// the same partition, otherwise rename the module to avoid conflict
if (namedModules.has(name)) {
let conflictModule = namedModules.get(name)!
if (conflictModule._type == 'cc_prebuilt_library_shared' &&
(conflictModule as SharedLibraryModule).compile_multilib == 'both') {
(conflictModule as SharedLibraryModule).compile_multilib == 'both' &&
conflictModule._entry?.partition == entry.partition) {
continue
}