mirror of https://github.com/qt/qtbase.git
qt-android-runner.py: handle all possible Gradle namespace formats
Handle all supported formats to set the namespace under build.gradle, this include cases where the name is using single or double quotes, and when using an equal sign or space separator. Fixes: QTBUG-138864 Pick-to: 6.8 Change-Id: Ib1381525ef85ab112cde5f4086065cf2af72b670 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commite21b5c140e
) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commitccfd1155b5
)
This commit is contained in:
parent
2b85ac86ae
commit
c57362efea
|
@ -9,6 +9,7 @@ import base64
|
||||||
import time
|
import time
|
||||||
import signal
|
import signal
|
||||||
import argparse
|
import argparse
|
||||||
|
import re
|
||||||
|
|
||||||
def status(msg):
|
def status(msg):
|
||||||
print(f"\n-- {msg}")
|
print(f"\n-- {msg}")
|
||||||
|
@ -103,10 +104,16 @@ def get_package_name(build_path):
|
||||||
with open(gradle_file) as f:
|
with open(gradle_file) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
if line.strip().startswith("namespace"):
|
if line.strip().startswith("namespace"):
|
||||||
potentialPackageName = line.split('=')[1].strip().strip('"')
|
# Match the following cases:
|
||||||
if (potentialPackageName == "androidPackageName"):
|
# namespace "org.qtproject.example.app"
|
||||||
break;
|
# namespace 'org.qtproject.example.app'
|
||||||
return potentialPackageName
|
# namespace = "org.qtproject.example.app"
|
||||||
|
# namespace = 'org.qtproject.example.app'
|
||||||
|
match = re.search(r"namespace\s*=?\s*['\"]([^'\"]+)['\"]", line)
|
||||||
|
if match:
|
||||||
|
potentialPackageName = match.group(1)
|
||||||
|
if (potentialPackageName != "androidPackageName"):
|
||||||
|
return potentialPackageName
|
||||||
|
|
||||||
properties_file = os.path.join(args.build_path, "gradle.properties")
|
properties_file = os.path.join(args.build_path, "gradle.properties")
|
||||||
if os.path.isfile(properties_file):
|
if os.path.isfile(properties_file):
|
||||||
|
|
Loading…
Reference in New Issue