diff --git a/fdroidserver/common.py b/fdroidserver/common.py index fb2bbdab..19a9abef 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1520,7 +1520,7 @@ def remove_debuggable_flags(root_dir): os.path.join(root, 'AndroidManifest.xml')) -vcsearch_g = re.compile(r'''\b[Vv]ersionCode\s*=?\s*["']*([0-9]+)["']*''').search +vcsearch_g = re.compile(r'''\b[Vv]ersionCode\s*=?\s*["']*([0-9_]+)["']*''').search vnsearch_g = re.compile(r'''\b[Vv]ersionName\s*=?\s*(["'])((?:(?=(\\?))\3.)*?)\1''').search vnssearch_g = re.compile(r'''\b[Vv]ersionNameSuffix\s*=?\s*(["'])((?:(?=(\\?))\3.)*?)\1''').search psearch_g = re.compile(r'''\b(packageName|applicationId)\s*=*\s*["']([^"']+)["']''').search diff --git a/tests/common.TestCase b/tests/common.TestCase index fc968c0f..158f7701 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -1042,6 +1042,19 @@ class CommonTest(unittest.TestCase): self.assertEqual(('1.0-free', '1', 'com.kunzisoft.fdroidtest.applicationidsuffix'), fdroidserver.common.parse_androidmanifests(paths, app)) + app = fdroidserver.metadata.App() + build = fdroidserver.metadata.Build() + build.gradle = ['underscore'] + app.builds = [build] + app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore' + paths = [ + os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'), + ] + for path in paths: + self.assertTrue(os.path.isfile(path)) + self.assertEqual(('20180430-underscore', '2018_04_30', 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore'), + fdroidserver.common.parse_androidmanifests(paths, app)) + def test_get_all_gradle_and_manifests(self): a = fdroidserver.common.get_all_gradle_and_manifests(os.path.join('source-files', 'cn.wildfirechat.chat')) paths = [ diff --git a/tests/source-files/com.kunzisoft.testcase/build.gradle b/tests/source-files/com.kunzisoft.testcase/build.gradle index 4319e20d..2753d058 100644 --- a/tests/source-files/com.kunzisoft.testcase/build.gradle +++ b/tests/source-files/com.kunzisoft.testcase/build.gradle @@ -49,6 +49,16 @@ android { // Version code : 1 // Version name : 1.0-free } + underscore { + applicationIdSuffix = ".underscore" + versionCode 2018_04_30 + versionName "20180430-underscore" + buildConfigField "boolean", "FULL_VERSION", "true" + buildConfigField "boolean", "CLOSED_STORE", "true" + // ApplicationId : com.kunzisoft.fdroidtest.applicationidsuffix.underscore + // Version code : 2018_04_30 + // Version name : 20180430-underscore + } } }