Skip to content

Commit e7b544c

Browse files
committed
Support debug and release specific manifestPlaceholders
This allows having separate placeholders for debug and release builds. That can be useful for changing manifest features based on the build type.
1 parent f5b0ed5 commit e7b544c

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

doc/source/buildoptions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ options (this list may not be exhaustive):
9797
added to the ``<manifest><application>`` tag of AndroidManifest.xml.
9898
- ``--manifest-placeholders``: Inject build variables into the manifest
9999
via the ``manifestPlaceholders`` property.
100+
- ``--debug-manifest-placeholders``: Inject build variables into the
101+
manifest via the manifestPlaceholders property in the debug buildType.
102+
- ``--release-manifest-placeholders``: Inject build variables into the
103+
manifest via the manifestPlaceholders property in the release
104+
buildType.
100105
- ``--enable-google-services``: Enable the Google Services Gradle plugin.
101106
This option requires a ``google-services.json`` file in root of the
102107
project directory.
@@ -172,6 +177,11 @@ ready.
172177
added to the ``<manifest><application>`` tag of AndroidManifest.xml.
173178
- ``--manifest-placeholders``: Inject build variables into the manifest
174179
via the ``manifestPlaceholders`` property.
180+
- ``--debug-manifest-placeholders``: Inject build variables into the
181+
manifest via the manifestPlaceholders property in the debug buildType.
182+
- ``--release-manifest-placeholders``: Inject build variables into the
183+
manifest via the manifestPlaceholders property in the release
184+
buildType.
175185
- ``--enable-google-services``: Enable the Google Services Gradle plugin.
176186
This option requires a ``google-services.json`` file in root of the
177187
project directory.

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,18 @@ def parse_args_and_make_package(args=None):
876876
ap.add_argument('--manifest-placeholders', dest='manifest_placeholders',
877877
default='[:]', help=('Inject build variables into the manifest '
878878
'via the manifestPlaceholders property'))
879+
ap.add_argument('--debug-manifest-placeholders',
880+
dest='debug_manifest_placeholders',
881+
default='[:]',
882+
help=('Inject build variables into the manifest '
883+
'via the manifestPlaceholders property '
884+
'in the debug buildType'))
885+
ap.add_argument('--release-manifest-placeholders',
886+
dest='release_manifest_placeholders',
887+
default='[:]',
888+
help=('Inject build variables into the manifest '
889+
'via the manifestPlaceholders property '
890+
'in the release buildType'))
879891
ap.add_argument('--service-class-name', dest='service_class_name', default=DEFAULT_PYTHON_SERVICE_JAVA_CLASS,
880892
help='Use that parameter if you need to implement your own PythonServive Java class')
881893
ap.add_argument('--activity-class-name', dest='activity_class_name', default=DEFAULT_PYTHON_ACTIVITY_JAVA_CLASS,

pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ android {
9494

9595
buildTypes {
9696
debug {
97+
manifestPlaceholders = {{ args.debug_manifest_placeholders }}
9798
{% if args.enable_crashlytics_native_symbol_upload -%}
9899
firebaseCrashlytics {
99100
nativeSymbolUploadEnabled true
@@ -105,6 +106,7 @@ android {
105106
{% if args.sign -%}
106107
signingConfig signingConfigs.release
107108
{%- endif %}
109+
manifestPlaceholders = {{ args.release_manifest_placeholders }}
108110
{% if args.enable_crashlytics_native_symbol_upload -%}
109111
firebaseCrashlytics {
110112
nativeSymbolUploadEnabled true

0 commit comments

Comments
 (0)