extract: Force Soong for APKs, framework JARs, and vintf XMLs

These files don't work without Soong.
This commit is contained in:
Danny Lin 2021-11-07 06:05:01 -08:00
parent 9c5ac945fb
commit 99c984f6e2
2 changed files with 26 additions and 4 deletions

View file

@ -1,4 +1,6 @@
import { EXT_PARTITIONS } from "../partitions";
import * as path from 'path'
import { EXT_PARTITIONS } from '../partitions';
export interface BlobEntry {
partition: string
@ -16,3 +18,24 @@ export function partPathToSrcPath(partition: string, path: string) {
return path
}
}
export function blobNeedsSoong(entry: BlobEntry, ext: string) {
// Explicit named dependency = Soong
if (entry.isNamedDependency) {
return true
}
// On Android 12, Soong is required for ELF files (executables and libraries)
if (entry.path.startsWith('bin/') || ext == '.so') {
return true
}
// Soong is also required for APKs, framework JARs, and vintf XMLs
if (ext == '.apk' || ext == '.jar' ||
(entry.path.startsWith('etc/vintf/') && ext == '.xml')) {
return true
}
// Otherwise, just copy the file
return false
}

View file

@ -4,7 +4,7 @@ import * as path from 'path'
import * as chalk from 'chalk'
import { blobToSoongModule, serializeBlueprint, SharedLibraryModule, SoongModule } from '../build/soong'
import { BlobEntry } from '../blobs/entry'
import { BlobEntry, blobNeedsSoong } from '../blobs/entry'
import { parseFileList } from '../blobs/file_list'
import { copyBlobs } from '../blobs/copy'
import { blobToFileCopy, serializeProductMakefile } from '../build/make'
@ -26,8 +26,7 @@ async function generateBuild(
for (let entry of entries) {
let ext = path.extname(entry.path)
// On Android 12, Soong is required for ELF files (executables and libraries)
if (entry.isNamedDependency || entry.path.startsWith('bin/') || ext == '.so') {
if (blobNeedsSoong(entry, ext)) {
// Named dependencies -> Soong blueprint
// Module name = file name