diff --git a/doc/source/buildoptions.rst b/doc/source/buildoptions.rst index 6497cc1d4e..dec55cddee 100644 --- a/doc/source/buildoptions.rst +++ b/doc/source/buildoptions.rst @@ -91,6 +91,17 @@ options (this list may not be exhaustive): - ``--add-source``: Add a source directory to the app's Java code. - ``--no-compile-pyo``: Do not optimise .py files to .pyo. - ``--enable-androidx``: Enable AndroidX support library. +- ``--extra-manifest-xml``: Extra xml to write directly inside the + ```` element of AndroidManifest.xml. +- ``--extra-manifest-application-arguments``: Extra arguments to be + added to the ```` tag of AndroidManifest.xml. +- ``--manifest-placeholders``: Inject build variables into the manifest + via the ``manifestPlaceholders`` property. +- ``--debug-manifest-placeholders``: Inject build variables into the + manifest via the manifestPlaceholders property in the debug buildType. +- ``--release-manifest-placeholders``: Inject build variables into the + manifest via the manifestPlaceholders property in the release + buildType. - ``--enable-google-services``: Enable the Google Services Gradle plugin. This option requires a ``google-services.json`` file in root of the project directory. @@ -160,6 +171,17 @@ ready. - ``add-source``: Add a source directory to the app's Java code. - ``--port``: The port on localhost that the WebView will access. Defaults to 5000. +- ``--extra-manifest-xml``: Extra xml to write directly inside the + ```` element of AndroidManifest.xml. +- ``--extra-manifest-application-arguments``: Extra arguments to be + added to the ```` tag of AndroidManifest.xml. +- ``--manifest-placeholders``: Inject build variables into the manifest + via the ``manifestPlaceholders`` property. +- ``--debug-manifest-placeholders``: Inject build variables into the + manifest via the manifestPlaceholders property in the debug buildType. +- ``--release-manifest-placeholders``: Inject build variables into the + manifest via the manifestPlaceholders property in the release + buildType. - ``--enable-google-services``: Enable the Google Services Gradle plugin. This option requires a ``google-services.json`` file in root of the project directory. diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index d6868083fa..1107cd000f 100755 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -876,6 +876,18 @@ def parse_args_and_make_package(args=None): ap.add_argument('--manifest-placeholders', dest='manifest_placeholders', default='[:]', help=('Inject build variables into the manifest ' 'via the manifestPlaceholders property')) + ap.add_argument('--debug-manifest-placeholders', + dest='debug_manifest_placeholders', + default='[:]', + help=('Inject build variables into the manifest ' + 'via the manifestPlaceholders property ' + 'in the debug buildType')) + ap.add_argument('--release-manifest-placeholders', + dest='release_manifest_placeholders', + default='[:]', + help=('Inject build variables into the manifest ' + 'via the manifestPlaceholders property ' + 'in the release buildType')) ap.add_argument('--service-class-name', dest='service_class_name', default=DEFAULT_PYTHON_SERVICE_JAVA_CLASS, help='Use that parameter if you need to implement your own PythonServive Java class') ap.add_argument('--activity-class-name', dest='activity_class_name', default=DEFAULT_PYTHON_ACTIVITY_JAVA_CLASS, diff --git a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle index a0b1a5fb92..ba86fe8d5d 100644 --- a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle +++ b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle @@ -94,6 +94,7 @@ android { buildTypes { debug { + manifestPlaceholders = {{ args.debug_manifest_placeholders }} {% if args.enable_crashlytics_native_symbol_upload -%} firebaseCrashlytics { nativeSymbolUploadEnabled true @@ -105,6 +106,7 @@ android { {% if args.sign -%} signingConfig signingConfigs.release {%- endif %} + manifestPlaceholders = {{ args.release_manifest_placeholders }} {% if args.enable_crashlytics_native_symbol_upload -%} firebaseCrashlytics { nativeSymbolUploadEnabled true diff --git a/pythonforandroid/bootstraps/service_only/build/templates/AndroidManifest.tmpl.xml b/pythonforandroid/bootstraps/service_only/build/templates/AndroidManifest.tmpl.xml index d19ed32931..08da63348d 100644 --- a/pythonforandroid/bootstraps/service_only/build/templates/AndroidManifest.tmpl.xml +++ b/pythonforandroid/bootstraps/service_only/build/templates/AndroidManifest.tmpl.xml @@ -35,6 +35,8 @@ {% endif %} + {{ args.extra_manifest_xml }} +