mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
Support '{' in extra line in parse_androidmanifests
If the flavour group starts in a separate line don't count it as a second group. Closes: #899
This commit is contained in:
parent
0fefecde1e
commit
1e6de7eb34
4 changed files with 100 additions and 4 deletions
|
@ -729,6 +729,7 @@ include tests/source-files/com.integreight.onesheeld/pullToRefreshlibrary/src/ma
|
||||||
include tests/source-files/com.integreight.onesheeld/quickReturnHeader/build.gradle
|
include tests/source-files/com.integreight.onesheeld/quickReturnHeader/build.gradle
|
||||||
include tests/source-files/com.integreight.onesheeld/quickReturnHeader/src/main/AndroidManifest.xml
|
include tests/source-files/com.integreight.onesheeld/quickReturnHeader/src/main/AndroidManifest.xml
|
||||||
include tests/source-files/com.integreight.onesheeld/settings.gradle
|
include tests/source-files/com.integreight.onesheeld/settings.gradle
|
||||||
|
include tests/source-files/com.jens.automation2/build.gradle
|
||||||
include tests/source-files/com.kunzisoft.testcase/build.gradle
|
include tests/source-files/com.kunzisoft.testcase/build.gradle
|
||||||
include tests/source-files/com.nextcloud.client/build.gradle
|
include tests/source-files/com.nextcloud.client/build.gradle
|
||||||
include tests/source-files/com.nextcloud.client.dev/src/generic/fastlane/metadata/android/en-US/full_description.txt
|
include tests/source-files/com.nextcloud.client.dev/src/generic/fastlane/metadata/android/en-US/full_description.txt
|
||||||
|
|
|
@ -1649,7 +1649,7 @@ def parse_androidmanifests(paths, app):
|
||||||
temp_version_name = matches.group(2)
|
temp_version_name = matches.group(2)
|
||||||
|
|
||||||
if inside_flavour_group > 0:
|
if inside_flavour_group > 0:
|
||||||
if inside_required_flavour > 0:
|
if inside_required_flavour > 1:
|
||||||
matches = psearch_g(line)
|
matches = psearch_g(line)
|
||||||
if matches:
|
if matches:
|
||||||
s = matches.group(2)
|
s = matches.group(2)
|
||||||
|
@ -1678,14 +1678,19 @@ def parse_androidmanifests(paths, app):
|
||||||
if matches:
|
if matches:
|
||||||
vercode = matches.group(1)
|
vercode = matches.group(1)
|
||||||
|
|
||||||
|
if inside_required_flavour > 0:
|
||||||
if '{' in line:
|
if '{' in line:
|
||||||
inside_required_flavour += 1
|
inside_required_flavour += 1
|
||||||
if '}' in line:
|
if '}' in line:
|
||||||
inside_required_flavour -= 1
|
inside_required_flavour -= 1
|
||||||
|
if inside_required_flavour == 1:
|
||||||
|
inside_required_flavour -= 1
|
||||||
else:
|
else:
|
||||||
if flavour and re.match(
|
if flavour:
|
||||||
r'.*[\'"\s]{flavour}[\'"\s].*'.format(flavour=flavour), line):
|
if re.match(r'.*[\'"\s]{flavour}[\'"\s].*\{{.*'.format(flavour=flavour), line):
|
||||||
inside_required_flavour = 1
|
inside_required_flavour = 2
|
||||||
|
elif re.match(r'.*[\'"\s]{flavour}[\'"\s].*'.format(flavour=flavour), line):
|
||||||
|
inside_required_flavour = 1
|
||||||
|
|
||||||
if '{' in line:
|
if '{' in line:
|
||||||
inside_flavour_group += 1
|
inside_flavour_group += 1
|
||||||
|
|
|
@ -1248,6 +1248,19 @@ class CommonTest(unittest.TestCase):
|
||||||
self.assertEqual(('2.5.2-fdroid', '73', 'com.github.jameshnsears.quoteunquote'),
|
self.assertEqual(('2.5.2-fdroid', '73', 'com.github.jameshnsears.quoteunquote'),
|
||||||
fdroidserver.common.parse_androidmanifests(paths, app))
|
fdroidserver.common.parse_androidmanifests(paths, app))
|
||||||
|
|
||||||
|
app = fdroidserver.metadata.App()
|
||||||
|
build = fdroidserver.metadata.Build()
|
||||||
|
build.gradle = ['fdroidFlavor']
|
||||||
|
app['Builds'] = [build]
|
||||||
|
app.id = 'com.jens.automation2'
|
||||||
|
paths = [
|
||||||
|
os.path.join('source-files', 'com.jens.automation2', 'build.gradle'),
|
||||||
|
]
|
||||||
|
for path in paths:
|
||||||
|
self.assertTrue(os.path.isfile(path))
|
||||||
|
self.assertEqual(('1.6.34-fdroid', '105', 'com.jens.automation2'),
|
||||||
|
fdroidserver.common.parse_androidmanifests(paths, app))
|
||||||
|
|
||||||
def test_get_all_gradle_and_manifests(self):
|
def test_get_all_gradle_and_manifests(self):
|
||||||
"""Test whether the function works with relative and absolute paths"""
|
"""Test whether the function works with relative and absolute paths"""
|
||||||
a = fdroidserver.common.get_all_gradle_and_manifests(Path('source-files/cn.wildfirechat.chat'))
|
a = fdroidserver.common.get_all_gradle_and_manifests(Path('source-files/cn.wildfirechat.chat'))
|
||||||
|
|
77
tests/source-files/com.jens.automation2/build.gradle
Normal file
77
tests/source-files/com.jens.automation2/build.gradle
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 29
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.jens.automation2"
|
||||||
|
minSdkVersion 16
|
||||||
|
compileSdkVersion 29
|
||||||
|
buildToolsVersion '29.0.2'
|
||||||
|
useLibrary 'org.apache.http.legacy'
|
||||||
|
versionCode 105
|
||||||
|
versionName "1.6.34"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
checkReleaseBuilds false
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
flavorDimensions "version"
|
||||||
|
|
||||||
|
productFlavors
|
||||||
|
{
|
||||||
|
googlePlayFlavor
|
||||||
|
{
|
||||||
|
dimension "version"
|
||||||
|
// applicationIdSuffix ".googlePlay"
|
||||||
|
versionNameSuffix "-googlePlay"
|
||||||
|
targetSdkVersion 29
|
||||||
|
}
|
||||||
|
|
||||||
|
fdroidFlavor
|
||||||
|
{
|
||||||
|
dimension "version"
|
||||||
|
// applicationIdSuffix ".fdroid"
|
||||||
|
versionNameSuffix "-fdroid"
|
||||||
|
targetSdkVersion 28
|
||||||
|
}
|
||||||
|
|
||||||
|
apkFlavor
|
||||||
|
{
|
||||||
|
dimension "version"
|
||||||
|
// applicationIdSuffix ".apk"
|
||||||
|
versionNameSuffix "-apk"
|
||||||
|
targetSdkVersion 28
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
implementation 'com.linkedin.dexmaker:dexmaker:2.25.0'
|
||||||
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
|
implementation 'com.google.android.material:material:1.3.0'
|
||||||
|
testImplementation 'junit:junit:4.+'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue