Bug 1945648 - Remove MOZ_BUILDID from the mozbuild crate r=pehrsons,glandium

This was causing dependents of mozbuild to be rebuilt often and
unnecessarily.

Differential Revision: https://phabricator.services.mozilla.com/D237105
This commit is contained in:
Alex Franchuk
2025-02-07 14:35:58 +00:00
parent 5ae7163fc4
commit 25b3af062c
4 changed files with 2 additions and 24 deletions

View File

@@ -36,11 +36,6 @@ source-repo.h: $(MDDEPDIR)/source-repo.h.stub
buildid.h: $(MDDEPDIR)/buildid.h.stub buildid.h: $(MDDEPDIR)/buildid.h.stub
# Add explicit dependencies that moz.build can't declare yet. # Add explicit dependencies that moz.build can't declare yet.
build/$(MDDEPDIR)/application.ini.stub: source-repo.h buildid.h build/$(MDDEPDIR)/application.ini.stub: source-repo.h buildid.h
# The mozbuild crate includes the buildid (via `variables.py:get_buildid()`),
# so it can only be generated after the buildid file is generated.
ifeq ($(and $(JS_STANDALONE),$(MOZ_BUILD_APP)),)
build/rust/mozbuild/$(MDDEPDIR)/buildconfig.rs.stub: buildid.h
endif
BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS))) BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS)))

View File

@@ -6,7 +6,6 @@ import string
import textwrap import textwrap
import buildconfig import buildconfig
from variables import get_buildid
def generate_bool(name): def generate_bool(name):
@@ -80,20 +79,6 @@ def generate(output):
) )
) )
# buildid.h is only available in these conditions (see the top-level moz.build)
if not buildconfig.substs.get("JS_STANDALONE") or not buildconfig.substs.get(
"MOZ_BUILD_APP"
):
output.write(
textwrap.dedent(
f"""
/// The build id of the current build.
pub const MOZ_BUILDID: &str = {escape_rust_string(get_buildid())};
"""
)
)
windows_rs_dir = buildconfig.substs.get("MOZ_WINDOWS_RS_DIR") windows_rs_dir = buildconfig.substs.get("MOZ_WINDOWS_RS_DIR")
if windows_rs_dir: if windows_rs_dir:
output.write( output.write(

View File

@@ -93,6 +93,3 @@ $(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(addprefix $(TOPOBJDIR)/
# that are not supported by data in moz.build. # that are not supported by data in moz.build.
$(TOPOBJDIR)/build/.deps/application.ini.stub: $(TOPOBJDIR)/buildid.h $(TOPOBJDIR)/source-repo.h $(TOPOBJDIR)/build/.deps/application.ini.stub: $(TOPOBJDIR)/buildid.h $(TOPOBJDIR)/source-repo.h
ifeq ($(and $(JS_STANDALONE),$(MOZ_BUILD_APP)),)
$(TOPOBJDIR)/build/rust/mozbuild/.deps/buildconfig.rs.stub: $(TOPOBJDIR)/buildid.h
endif

View File

@@ -54,7 +54,8 @@ fn glean_data_dir(_cfg: &Config) -> ::std::path::PathBuf {
fn client_info_metrics(cfg: &Config) -> ClientInfoMetrics { fn client_info_metrics(cfg: &Config) -> ClientInfoMetrics {
glean::ClientInfoMetrics { glean::ClientInfoMetrics {
app_build: mozbuild::config::MOZ_BUILDID.into(), // We can't get the build id at compile time; see bug 1945648.
app_build: env!("CARGO_PKG_VERSION").into(),
app_display_version: env!("CARGO_PKG_VERSION").into(), app_display_version: env!("CARGO_PKG_VERSION").into(),
channel: None, channel: None,
locale: cfg.strings.as_ref().map(|s| s.locale()), locale: cfg.strings.as_ref().map(|s| s.locale()),