Bug 1269787 - Move appini_header.py rule to moz.build; r?glandium draft
authorMike Shal <mshal@mozilla.com>
Fri, 29 Apr 2016 13:45:07 -0400
changeset 362963 edb37110a26f1f824665eadc75f4561b40a7da74
parent 362962 566f5c6fa2c9ae13addbf90b13d8f15a02b410f7
child 519911 1090177e75cb23086d1a00c890aea7dfb5dd3a27
push id17070
push userbmo:mshal@mozilla.com
push dateTue, 03 May 2016 16:57:06 +0000
reviewersglandium
bugs1269787
milestone49.0a1
Bug 1269787 - Move appini_header.py rule to moz.build; r?glandium MozReview-Commit-ID: 5tly7JYA2f7
build/Makefile.in
build/appini_header.py
build/moz.build
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -1,37 +1,20 @@
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-ifdef MOZ_APP_BASENAME
-APP_INI_DEPS = $(topsrcdir)/config/milestone.txt
-
-APP_INI_DEPS += $(DEPTH)/config/autoconf.mk
-endif
-
 ifdef MOZTTDIR
 # Install the Firefox OS fonts.
 include $(MOZTTDIR)/fonts.mk
 MOZTT_DEST = $(FINAL_TARGET)/fonts
 MOZTT_FILES = $(patsubst external/moztt/%,$(MOZTTDIR)/%,$(filter external/moztt/%,$(subst :, ,$(PRODUCT_COPY_FILES))))
 INSTALL_TARGETS += MOZTT
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 TARGET_DEPTH = ..
 include $(srcdir)/automation-build.mk
 
-ifdef MOZ_APP_BASENAME
-$(FINAL_TARGET)/application.ini: $(APP_INI_DEPS)
-
-ifdef MOZ_APP_STATIC_INI
-application.ini.h: appini_header.py $(FINAL_TARGET)/application.ini
-	$(PYTHON) $^ > $@
-export:: application.ini.h
-GARBAGE += application.ini.h
-endif
-endif
-
 libs:: automation.py
 
--- a/build/appini_header.py
+++ b/build/appini_header.py
@@ -3,17 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 '''Parses a given application.ini file and outputs the corresponding
    XULAppData structure as a C++ header file'''
 
 import ConfigParser
 import sys
 
-def main(file):
+def main(output, file):
     config = ConfigParser.RawConfigParser()
     config.read(file)
     flags = set()
     try:
         if config.getint('XRE', 'EnableProfileMigrator') == 1:
             flags.add('NS_XRE_ENABLE_PROFILE_MIGRATOR')
     except: pass
     try:
@@ -29,32 +29,32 @@ def main(file):
     if missing:
         print >>sys.stderr, \
             "Missing values in %s: %s" % (file, ', '.join(missing))
         sys.exit(1)
 
     if not 'Crash Reporter:serverurl' in appdata:
         appdata['Crash Reporter:serverurl'] = ''
 
-    print '''#include "nsXREAppData.h"
+    output.write('''#include "nsXREAppData.h"
              static const nsXREAppData sAppData = {
                  sizeof(nsXREAppData),
                  NULL, // directory
                  "%(App:vendor)s",
                  "%(App:name)s",
                  "%(App:remotingname)s",
                  "%(App:version)s",
                  "%(App:buildid)s",
                  "%(App:id)s",
                  NULL, // copyright
                  %(flags)s,
                  NULL, // xreDirectory
                  "%(Gecko:minversion)s",
                  "%(Gecko:maxversion)s",
                  "%(Crash Reporter:serverurl)s",
                  %(App:profile)s
-             };''' % appdata
+             };''' % appdata)
 
 if __name__ == '__main__':
     if len(sys.argv) != 1:
-        main(sys.argv[1])
+        main(sys.stdout, sys.argv[1])
     else:
         print >>sys.stderr, "Usage: %s /path/to/application.ini" % sys.argv[0]
--- a/build/moz.build
+++ b/build/moz.build
@@ -65,16 +65,22 @@ FINAL_TARGET_FILES += ['/.gdbinit']
 if CONFIG['MOZ_ASAN'] and CONFIG['CLANG_CL']:
     FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']]
 
 if CONFIG['MOZ_APP_BASENAME']:
     FINAL_TARGET_PP_FILES += ['application.ini']
     if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' and CONFIG['MOZ_UPDATER']:
         FINAL_TARGET_PP_FILES += ['update-settings.ini']
 
+    if CONFIG['MOZ_APP_STATIC_INI']:
+        GENERATED_FILES += ['application.ini.h']
+        appini = GENERATED_FILES['application.ini.h']
+        appini.script = 'appini_header.py'
+        appini.inputs = ['!/dist/bin/application.ini']
+
 DEFINES['TOPOBJDIR'] = TOPOBJDIR
 
 # NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir.
 OBJDIR_FILES += ['/.gdbinit']
 
 # Put a .lldbinit in the bin directory and the objdir, to be picked up
 # automatically by LLDB when we debug executables using either of those two
 # directories as the current working directory.  The .lldbinit file will