Skip to content

Commit

Permalink
Bug 1417264 - Write .mozconfig.json from Python; r=nalexander
Browse files Browse the repository at this point in the history
In order to determine if we need to re-run configure, we write
a JSON file representing the evaluated mozconfig. If this JSON
file changes, configure (and config.status for that matter) is
out of data and it is re-executed.

This commit moves the generation of that JSON file to Python.

MozReview-Commit-ID: 636rpSY7gOm
  • Loading branch information
indygreg committed Nov 14, 2017
1 parent 7a0d8dc commit 0ba6387
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 1 addition & 10 deletions client.mk
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,6 @@ configure-preqs = \
$(OBJDIR)/.mozconfig.json \
$(NULL)

CREATE_MOZCONFIG_JSON = $(shell $(TOPSRCDIR)/mach environment --format=json -o $(OBJDIR)/.mozconfig.json)
# Force CREATE_MOZCONFIG_JSON above to be resolved, without side effects in
# case the result is non empty, and allowing an override on the make command
# line not running the command (using := $(shell) still runs the shell command).
ifneq (,$(CREATE_MOZCONFIG_JSON))
endif

$(OBJDIR)/.mozconfig.json: ;

configure:: $(configure-preqs)
$(call BUILDSTATUS,TIERS configure)
$(call BUILDSTATUS,TIER_START configure)
Expand All @@ -168,7 +159,7 @@ $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
else
$(OBJDIR)/Makefile: $(CONFIG_STATUS_DEPS)
endif
@$(MAKE) -f $(TOPSRCDIR)/client.mk configure CREATE_MOZCONFIG_JSON=
@$(MAKE) -f $(TOPSRCDIR)/client.mk configure

####################################
# Build it
Expand Down
8 changes: 8 additions & 0 deletions python/mozbuild/mozbuild/controller/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,14 @@ def _run_client_mk(self, target=None, line_handler=None, jobs=0,
with FileAvoidWrite(mozconfig_mk) as fh:
fh.write(b'\n'.join(mozconfig_filtered_lines))

mozconfig_json = os.path.join(self.topobjdir, '.mozconfig.json')
with FileAvoidWrite(mozconfig_json) as fh:
json.dump({
'topsrcdir': self.topsrcdir,
'topobjdir': self.topobjdir,
'mozconfig': mozconfig,
}, fh, sort_keys=True, indent=2)

# Copy the original mozconfig to the objdir.
mozconfig_objdir = os.path.join(self.topobjdir, '.mozconfig')
if mozconfig['path']:
Expand Down

0 comments on commit 0ba6387

Please sign in to comment.