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) }