The Makefile determines how the assembly number (concatenated) is created for the assembly.
custom builds
For the user to create (build target, as indicated in the tape), the build number will simply be $(BUILD_ID) $(BUILD_KEYS) , unless DISPLAY_BUILD_NUMBER set to true.
eng / userdebug builds
For other builds (i.e. eng / userdebug) much more information is added:
build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS)
The Makefile source is available here: https://android.googlesource.com/platform/build/+/android-4.4.2_r1/core/Makefile#106
Configure build options in the make file
As @eldarerathis mentioned, the BUILD_ID value in build/core/build_id.mk is determined by what part of the assembly line is defined, however this can be overridden in another make ( *.mk ).
When lunch starts, the BUILD_ID value will be printed for verification. If this value is different from the value found in the build_id.mk file, then find where to install it and reconfigure it. For example, if as part of lunch output includes "4.4.2_1.0.0-ga":
============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=4.4.2 ... HOST_BUILD_TYPE=release BUILD_ID=4.4.2_1.0.0-ga OUT_DIR=out ============================================
... then search for "4.4.2_1.0.0-ga" to find it:
me@mybox :~/AOSP$find . -name "*.mk" | xargs grep "4.4.2_1.0.0-ga"
Then update the .mk file containing the BUILD_ID . Set other build options.
BUILD_NUMBER , PLATFORM_VERSION and BUILD_ID are located at: build/core/version_defaults.mk . Values ββare set only if the assembly is initiated without setting them.
Setting assembly parameters as a parameter during assembly
Alternatively (and, in my opinion, desirable), these parameters can be set as part of the build command line as follows:
me@mybox :~/AOSP$ time m BUILD_ID="MyBuildv1.2" BUILD_NUMBER=12345 2>&1 | tee build.out