check in product Makefile that BUILD_ID is set correctly

This commit is contained in:
Dmitry Muhomor 2023-08-26 15:07:31 +03:00 committed by Daniel Micay
parent 0b0b76ef70
commit 70129836eb
2 changed files with 10 additions and 2 deletions

View file

@ -238,7 +238,7 @@ export async function writeBuildFiles(
} }
if (build.productMakefile != undefined) { if (build.productMakefile != undefined) {
let mk = serializeProductMakefile(build.productMakefile) let mk = serializeProductMakefile(build.productMakefile, config)
await fs.writeFile(`${dirs.out}/${build.productMakefile.name}.mk`, mk) await fs.writeFile(`${dirs.out}/${build.productMakefile.name}.mk`, mk)
} }

View file

@ -222,7 +222,7 @@ export function serializeDeviceMakefile(mk: DeviceMakefile) {
return finishBlocks(blocks) return finishBlocks(blocks)
} }
export function serializeProductMakefile(mk: ProductMakefile) { export function serializeProductMakefile(mk: ProductMakefile, config?: DeviceConfig) {
let blocks = startBlocks() let blocks = startBlocks()
blocks.push(`# Inherit AOSP product blocks.push(`# Inherit AOSP product
@ -238,6 +238,14 @@ PRODUCT_MANUFACTURER := ${mk.manufacturer}`)
blocks.push(`PRODUCT_ENFORCE_RRO_TARGETS := ${mk.enforceRros}`) blocks.push(`PRODUCT_ENFORCE_RRO_TARGETS := ${mk.enforceRros}`)
} }
let build_id = config?.device?.build_id
if (build_id !== undefined) {
blocks.push(`ifneq ($(BUILD_ID),${build_id})
$(error BUILD_ID: expected ${build_id}, got $(BUILD_ID))
endif`)
}
return finishBlocks(blocks) return finishBlocks(blocks)
} }