From 70129836ebdb390359aca6a3f56d760110998496 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Sat, 26 Aug 2023 15:07:31 +0300 Subject: [PATCH] check in product Makefile that BUILD_ID is set correctly --- src/blobs/build.ts | 2 +- src/build/make.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/blobs/build.ts b/src/blobs/build.ts index 420f086..b9ecef0 100644 --- a/src/blobs/build.ts +++ b/src/blobs/build.ts @@ -238,7 +238,7 @@ export async function writeBuildFiles( } 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) } diff --git a/src/build/make.ts b/src/build/make.ts index f50ae1b..a960296 100644 --- a/src/build/make.ts +++ b/src/build/make.ts @@ -222,7 +222,7 @@ export function serializeDeviceMakefile(mk: DeviceMakefile) { return finishBlocks(blocks) } -export function serializeProductMakefile(mk: ProductMakefile) { +export function serializeProductMakefile(mk: ProductMakefile, config?: DeviceConfig) { let blocks = startBlocks() blocks.push(`# Inherit AOSP product @@ -238,6 +238,14 @@ PRODUCT_MANUFACTURER := ${mk.manufacturer}`) 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) }