generate-full: Add support for flattening APEX modules
This commit is contained in:
parent
de09864601
commit
ec580e9957
2 changed files with 133 additions and 120 deletions
|
@ -1,6 +1,7 @@
|
|||
import { Command, flags } from '@oclif/command'
|
||||
import { promises as fs } from 'fs'
|
||||
import * as path from 'path'
|
||||
import { flattenAllApexs } from '../blobs/apex'
|
||||
|
||||
import { createVendorDirs, generateBuild, writeBuildFiles } from '../blobs/build'
|
||||
import { copyBlobs } from '../blobs/copy'
|
||||
|
@ -17,6 +18,7 @@ import { parseSystemState, SystemState } from '../config/system-state'
|
|||
import { ANDROID_INFO, extractFactoryFirmware, generateAndroidInfo, writeFirmwareImages } from '../images/firmware'
|
||||
import { diffPartContexts, parseContextsRecursive, parsePartContexts, resolvePartContextDiffs, SelinuxContexts } from '../sepolicy/contexts'
|
||||
import { startActionSpinner, stopActionSpinner } from '../util/cli'
|
||||
import { withTempDir } from '../util/fs'
|
||||
import { ALL_PARTITIONS } from '../util/partitions'
|
||||
|
||||
export default class GenerateFull extends Command {
|
||||
|
@ -100,13 +102,22 @@ export default class GenerateFull extends Command {
|
|||
})
|
||||
stopActionSpinner(spinner)
|
||||
|
||||
// 4. Extract
|
||||
// Create tmp dir in case we extract APEXs
|
||||
await withTempDir(async (tmp) => {
|
||||
// 4. Flatten APEX modules
|
||||
if (config.flatten_apex) {
|
||||
spinner = startActionSpinner('Flattening APEX modules')
|
||||
entries = await flattenAllApexs(entries, stockRoot, tmp)
|
||||
stopActionSpinner(spinner)
|
||||
}
|
||||
|
||||
// 5. Extract
|
||||
// Copy blobs (this has its own spinner)
|
||||
if (!skipCopy) {
|
||||
await copyBlobs(entries, stockRoot, dirs.proprietary)
|
||||
}
|
||||
|
||||
// 5. Props
|
||||
// 6. Props
|
||||
spinner = startActionSpinner('Extracting properties')
|
||||
let stockProps = await loadPartitionProps(stockRoot)
|
||||
let customProps = customState?.partitionProps ?? await loadPartitionProps(customRoot)
|
||||
|
@ -127,7 +138,7 @@ export default class GenerateFull extends Command {
|
|||
let missingOtaParts = stockOtaParts.filter(p => !customOtaParts.has(p))
|
||||
stopActionSpinner(spinner)
|
||||
|
||||
// 6. SELinux policies
|
||||
// 7. SELinux policies
|
||||
spinner = startActionSpinner('Adding missing SELinux policies')
|
||||
// Built contexts
|
||||
let stockContexts = await parsePartContexts(stockRoot)
|
||||
|
@ -146,7 +157,7 @@ export default class GenerateFull extends Command {
|
|||
let ctxResolutions = resolvePartContextDiffs(ctxDiffs, sourceContexts)
|
||||
stopActionSpinner(spinner)
|
||||
|
||||
// 7. Overlays
|
||||
// 8. Overlays
|
||||
spinner = startActionSpinner('Extracting overlays')
|
||||
let stockOverlays = await parsePartOverlayApks(aapt2Path, stockRoot, path => {
|
||||
spinner.text = path
|
||||
|
@ -159,7 +170,7 @@ export default class GenerateFull extends Command {
|
|||
let overlayPkgs = await serializePartOverlays(missingOverlays, dirs.overlays)
|
||||
stopActionSpinner(spinner)
|
||||
|
||||
// 8. vintf manifests
|
||||
// 9. vintf manifests
|
||||
spinner = startActionSpinner('Extracting vintf manifests')
|
||||
let customVintf = customState?.partitionVintfInfo ?? await loadPartVintfInfo(customRoot)
|
||||
let stockVintf = await loadPartVintfInfo(stockRoot)
|
||||
|
@ -167,7 +178,7 @@ export default class GenerateFull extends Command {
|
|||
let vintfManifestPaths = await writePartVintfManifests(missingHals, dirs.vintf)
|
||||
stopActionSpinner(spinner)
|
||||
|
||||
// 9. Firmware
|
||||
// 10. Firmware
|
||||
let fwPaths: Array<string> | null = null
|
||||
if (factoryZip != undefined) {
|
||||
spinner = startActionSpinner('Extracting firmware')
|
||||
|
@ -185,7 +196,7 @@ export default class GenerateFull extends Command {
|
|||
stopActionSpinner(spinner)
|
||||
}
|
||||
|
||||
// 10. Build files
|
||||
// 11. Build files
|
||||
spinner = startActionSpinner('Generating build files')
|
||||
let build = await generateBuild(entries, config.device.name, config.device.vendor, stockRoot, dirs)
|
||||
|
||||
|
@ -233,5 +244,6 @@ export default class GenerateFull extends Command {
|
|||
|
||||
await writeBuildFiles(build, dirs)
|
||||
stopActionSpinner(spinner)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ export interface DeviceConfig {
|
|||
namespaces?: Array<string>
|
||||
sepolicy_dirs: Array<string>
|
||||
product_makefile: string
|
||||
flatten_apex?: boolean
|
||||
|
||||
prop_filters?: PropFilters
|
||||
|
||||
|
|
Loading…
Reference in a new issue