Android minSdkVersion (#41)
* print(flutter.minSdkVersion) * println * Test global macros * Test get_value macro * Update get_value * Check cookiecutter.pyproject.tool * Fix get_value - 1 * Trim white-space * trim again * non-existsnt value * if then * Check for empty string * Chec in gradle script * fix include
This commit is contained in:
parent
af35d4aad3
commit
18de2d8503
|
|
@ -0,0 +1,16 @@
|
|||
{# _macros.jinja2 #}
|
||||
|
||||
{% macro get_value(dict, path) %}
|
||||
{# Split the path into keys #}
|
||||
{% set keys = path.split('.') %}
|
||||
{% if keys and dict is mapping and keys[0] in dict %}
|
||||
{% set next_value = dict[keys[0]] %}
|
||||
{% if keys | length == 1 %}
|
||||
{{ next_value }}
|
||||
{% else %}
|
||||
{{ get_value(next_value, keys[1:] | join('.')) }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ "" }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
{% import "_macros.jinja2" as macros %}
|
||||
plugins {
|
||||
id "com.android.application"
|
||||
id "kotlin-android"
|
||||
|
|
@ -49,13 +50,22 @@ android {
|
|||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
{% set min_sdk_version = macros.get_value(cookiecutter.pyproject, "tool.flet.android.min_sdk_version") | trim %}
|
||||
{% set target_sdk_version = macros.get_value(cookiecutter.pyproject, "tool.flet.android.target_sdk_version") | trim %}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "{{ cookiecutter.org_name_2 }}.{{ cookiecutter.package_name }}"
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
minSdkVersion {{ min_sdk_version if min_sdk_version else "flutter.minSdkVersion" }}
|
||||
targetSdkVersion {{ target_sdk_version if target_sdk_version else "flutter.targetSdkVersion" }}
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
|
||||
println("Gradle build config:")
|
||||
println(" minSdkVersion: {{ min_sdk_version if min_sdk_version else "$flutter.minSdkVersion" }}")
|
||||
println(" targetSdkVersion: {{ target_sdk_version if target_sdk_version else "$flutter.targetSdkVersion" }}")
|
||||
println(" versionCode: $flutter.versionCode")
|
||||
println(" versionName: $flutter.versionName")
|
||||
|
||||
// flet: split_per_abi {% if not cookiecutter.split_per_abi %}
|
||||
ndk {
|
||||
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
|
||||
|
|
|
|||
Loading…
Reference in New Issue