diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /mobile/android/base | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/base')
-rw-r--r-- | mobile/android/base/Makefile.in | 9 | ||||
-rw-r--r-- | mobile/android/base/gen_from_jinja.py | 41 | ||||
-rw-r--r-- | mobile/android/base/moz.build | 47 |
3 files changed, 97 insertions, 0 deletions
diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in new file mode 100644 index 0000000000..5db63bc000 --- /dev/null +++ b/mobile/android/base/Makefile.in @@ -0,0 +1,9 @@ +# 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/. + +# Developer builds call mach -> Make -> gradle -> mach, which races to +# find and create .mozconfig files and to generate targets. +.NOTPARALLEL: + +include $(topsrcdir)/config/rules.mk diff --git a/mobile/android/base/gen_from_jinja.py b/mobile/android/base/gen_from_jinja.py new file mode 100644 index 0000000000..29de50b9a0 --- /dev/null +++ b/mobile/android/base/gen_from_jinja.py @@ -0,0 +1,41 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +from __future__ import absolute_import, print_function + +from jinja2 import Environment, FileSystemLoader, StrictUndefined +import os + + +def main(output_fd, input_filename, *args): + # FileSystemLoader requires the path to the directory containing templates, + # not the file name of the template itself. We hang onto the leaf name + # which will shortly be passed to Environment.get_template. + (path, leaf) = os.path.split(input_filename) + + # Jinja's default value for undefined is too permissive and would allow + # omissions to slip into the generated output. We set undefined to + # StrictUndefined to force Jinja to raise an exception any time a required + # value is missing. + env = Environment( + loader=FileSystemLoader(path, encoding="utf-8"), + autoescape=True, + undefined=StrictUndefined, + ) + tpl = env.get_template(leaf) + + context = dict() + + # args should all be key=value pairs that will be added to the context. + # Note that all values are *strings*, so the Jinja template may need to + # convert them to other types during processing. + # (As in Python, the empty string is falsy, so simple boolean checks are possible) + for arg in args: + (k, v) = arg.split("=", 1) + context[k] = v + + # Now run the template and send its output directly to output_fd + tpl.stream(context).dump(output_fd, encoding="utf-8") diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build new file mode 100644 index 0000000000..e070e8e446 --- /dev/null +++ b/mobile/android/base/moz.build @@ -0,0 +1,47 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +with Files("**"): + BUG_COMPONENT = ("GeckoView", "General") + +DEFINES["ANDROID_PACKAGE_NAME"] = CONFIG["ANDROID_PACKAGE_NAME"] +# The recursive make backend treats the first output specially: it's passed as +# an open FileAvoidWrite to the invoked script. That doesn't work well with +# the Gradle task that generates all of the outputs, so we add a dummy first +# output. +t = ("android_apks",) + +GENERATED_FILES += [t] +GENERATED_FILES[t].force = True +GENERATED_FILES[t].script = "/mobile/android/gradle.py:assemble_app" + +# The Android APKs are assembled in the `export` tier, which usually occurs +# before the following files are generated. However, mechanisms in `recurse.mk` +# are used to pull the generated files into the `pre-export` tier, so do not +# require an explicit dependency here. +config_keys = ( + "MOZ_ANDROID_CONTENT_SERVICE_COUNT", + "MOZ_ANDROID_CONTENT_SERVICE_ISOLATED_PROCESS", +) +flags = ["%s=%s" % (k, CONFIG[k] if CONFIG[k] else "") for k in config_keys] + +GeneratedFile( + ("../geckoview/src/main/AndroidManifest_overlay.xml",), + script="gen_from_jinja.py", + inputs=["../geckoview/src/main/AndroidManifest_overlay.jinja"], + flags=flags, +) + +GeneratedFile( + ( + "../geckoview/src/main/java/org/mozilla/gecko/process/GeckoChildProcessServices.java", + ), + script="gen_from_jinja.py", + inputs=[ + "../geckoview/src/main/java/org/mozilla/gecko/process/GeckoChildProcessServices.jinja" + ], + flags=flags, +) |