Bug 969925 - Generate an empty fennec_ids.txt. r=gbrown

Automation and some third-party tooling expects fennec_ids.txt, but an
empty file should suffice.
This commit is contained in:
Nick Alexander 2015-06-15 11:34:51 -07:00
parent 3d9db4bb41
commit d257109ed7
3 changed files with 4 additions and 68 deletions

View File

@ -44,7 +44,6 @@ GARBAGE += \
res/raw/browsersearch.json \
res/raw/suggestedsites.json \
.aapt.deps \
fennec_ids.txt \
javah.out \
jni-stubs.inc \
GeneratedJNIWrappers.cpp \
@ -236,6 +235,7 @@ GeneratedJNIWrappers.cpp: $(ALL_JARS)
manifest := \
AndroidManifest.xml.in \
WebappManifestFragment.xml.frag.in \
fennec_ids.txt.in \
$(NULL)
PP_TARGETS += manifest
@ -449,9 +449,6 @@ $(eval $(call aapt_command,.aapt.deps,$(all_resources),gecko.ap_,generated/,./))
# .aapt.nodeps: $(CURDIR)/AndroidManifest.xml FORCE
$(eval $(call aapt_command,.aapt.nodeps,$(CURDIR)/AndroidManifest.xml FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/))
fennec_ids.txt: generated/org/mozilla/gecko/R.java fennec-ids-generator.py
$(PYTHON) $(topsrcdir)/mobile/android/base/fennec-ids-generator.py -i $< -o $@
# Override the Java settings with some specific android settings
include $(topsrcdir)/config/android-common.mk
@ -488,7 +485,7 @@ gradle-omnijar: $(abspath $(DIST)/fennec/$(OMNIJAR_NAME))
.PHONY: gradle-targets gradle-omnijar
libs:: geckoview_resources.zip classes.dex jni-stubs.inc GeneratedJNIWrappers.cpp fennec_ids.txt
libs:: geckoview_resources.zip classes.dex jni-stubs.inc GeneratedJNIWrappers.cpp $(CURDIR)/fennec_ids.txt
$(INSTALL) geckoview_resources.zip $(FINAL_TARGET)
$(INSTALL) classes.dex $(FINAL_TARGET)
@(diff jni-stubs.inc $(topsrcdir)/mozglue/android/jni-stubs.inc >/dev/null && diff GeneratedJNIWrappers.cpp $(topsrcdir)/widget/android/GeneratedJNIWrappers.cpp >/dev/null) || \

View File

@ -1,63 +0,0 @@
# 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/.
import re
import os
import sys
import optparse
def getFile(filename):
fHandle = open(filename, 'r')
data = fHandle.read()
fHandle.close()
return data
def findIDs(data):
start_function = False
reID = re.compile('.*public static final class id {.*')
reEnd = re.compile('.*}.*')
idlist = []
for line in data.split('\n'):
if reEnd.match(line):
start_function = False
if start_function:
id_value = line.split(' ')[-1]
idlist.append(id_value.split(';')[0].split('='))
if reID.match(line):
start_function = True
return idlist
def printIDs(outputFile, idlist):
fOutput = open(outputFile, 'w')
for item in idlist:
fOutput.write("%s=%s\n" % (item[0], item[1]))
fOutput.close()
def main(args=sys.argv[1:]):
parser = optparse.OptionParser()
parser.add_option('-o', '--output', dest='outputFile', default='',
help="output file with the id=value pairs")
parser.add_option('-i', '--input', dest='inputFile', default='',
help="filename of the input R.java file")
options, args = parser.parse_args(args)
if options.inputFile == '':
print "Error: please provide input file: -i <filename>"
sys.exit(1)
if options.outputFile == '':
print "Error: please provide output file: -o <filename>"
sys.exit(1)
data = getFile(os.path.abspath(options.inputFile));
idlist = findIDs(data)
printIDs(os.path.abspath(options.outputFile), idlist)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,2 @@
#filter slashslash
// fennec_ids.txt needs to exist (for automation) but contains no content.