mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
Support multiple flavours in parse_androidmanifests
Previously only the last flavour was checked.
This commit is contained in:
parent
1ad0e7689a
commit
331b4830dd
4 changed files with 135 additions and 4 deletions
|
@ -746,6 +746,7 @@ include tests/source-files/com.nextcloud.client/src/versionDev/fastlane/metadata
|
||||||
include tests/source-files/com.nextcloud.client/src/versionDev/fastlane/metadata/android/en-US/short_description.txt
|
include tests/source-files/com.nextcloud.client/src/versionDev/fastlane/metadata/android/en-US/short_description.txt
|
||||||
include tests/source-files/com.nextcloud.client/src/versionDev/fastlane/metadata/android/en-US/title.txt
|
include tests/source-files/com.nextcloud.client/src/versionDev/fastlane/metadata/android/en-US/title.txt
|
||||||
include tests/source-files/com.seafile.seadroid2/app/build.gradle
|
include tests/source-files/com.seafile.seadroid2/app/build.gradle
|
||||||
|
include tests/source-files/de.varengold.activeTAN/build.gradle
|
||||||
include tests/source-files/dev.patrickgold.florisboard/app/build.gradle.kts
|
include tests/source-files/dev.patrickgold.florisboard/app/build.gradle.kts
|
||||||
include tests/source-files/eu.siacs.conversations/build.gradle
|
include tests/source-files/eu.siacs.conversations/build.gradle
|
||||||
include tests/source-files/eu.siacs.conversations/metadata/en-US/name.txt
|
include tests/source-files/eu.siacs.conversations/metadata/en-US/name.txt
|
||||||
|
|
|
@ -1691,11 +1691,11 @@ def parse_androidmanifests(paths, app):
|
||||||
vercode = None
|
vercode = None
|
||||||
package = None
|
package = None
|
||||||
|
|
||||||
flavour = None
|
flavours = None
|
||||||
temp_app_id = None
|
temp_app_id = None
|
||||||
temp_version_name = None
|
temp_version_name = None
|
||||||
if len(app.get('Builds', [])) > 0 and 'gradle' in app['Builds'][-1] and app['Builds'][-1].gradle:
|
if len(app.get('Builds', [])) > 0 and 'gradle' in app['Builds'][-1] and app['Builds'][-1].gradle:
|
||||||
flavour = app['Builds'][-1].gradle[-1]
|
flavours = app['Builds'][-1].gradle
|
||||||
|
|
||||||
if path.endswith('.gradle') or path.endswith('.gradle.kts'):
|
if path.endswith('.gradle') or path.endswith('.gradle.kts'):
|
||||||
with open(path, 'r', encoding='utf-8') as f:
|
with open(path, 'r', encoding='utf-8') as f:
|
||||||
|
@ -1753,12 +1753,14 @@ def parse_androidmanifests(paths, app):
|
||||||
inside_required_flavour -= 1
|
inside_required_flavour -= 1
|
||||||
if inside_required_flavour == 1:
|
if inside_required_flavour == 1:
|
||||||
inside_required_flavour -= 1
|
inside_required_flavour -= 1
|
||||||
else:
|
elif flavours:
|
||||||
if flavour:
|
for flavour in flavours:
|
||||||
if re.match(r'.*[\'"\s]{flavour}[\'"\s].*\{{.*'.format(flavour=flavour), line):
|
if re.match(r'.*[\'"\s]{flavour}[\'"\s].*\{{.*'.format(flavour=flavour), line):
|
||||||
inside_required_flavour = 2
|
inside_required_flavour = 2
|
||||||
|
break
|
||||||
elif re.match(r'.*[\'"\s]{flavour}[\'"\s].*'.format(flavour=flavour), line):
|
elif re.match(r'.*[\'"\s]{flavour}[\'"\s].*'.format(flavour=flavour), line):
|
||||||
inside_required_flavour = 1
|
inside_required_flavour = 1
|
||||||
|
break
|
||||||
|
|
||||||
if '{' in line:
|
if '{' in line:
|
||||||
inside_flavour_group += 1
|
inside_flavour_group += 1
|
||||||
|
|
|
@ -1264,6 +1264,19 @@ class CommonTest(unittest.TestCase):
|
||||||
self.assertEqual(('1.6.34-fdroid', '105', 'com.jens.automation2'),
|
self.assertEqual(('1.6.34-fdroid', '105', 'com.jens.automation2'),
|
||||||
fdroidserver.common.parse_androidmanifests(paths, app))
|
fdroidserver.common.parse_androidmanifests(paths, app))
|
||||||
|
|
||||||
|
app = fdroidserver.metadata.App()
|
||||||
|
build = fdroidserver.metadata.Build()
|
||||||
|
build.gradle = ['VAR', 'prod']
|
||||||
|
app['Builds'] = [build]
|
||||||
|
app.id = 'de.varengold.activeTAN'
|
||||||
|
paths = [
|
||||||
|
os.path.join('source-files', 'de.varengold.activeTAN', 'build.gradle'),
|
||||||
|
]
|
||||||
|
for path in paths:
|
||||||
|
self.assertTrue(os.path.isfile(path))
|
||||||
|
self.assertEqual(('2021-06-30', '34', 'de.varengold.activeTAN'),
|
||||||
|
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'))
|
||||||
|
|
115
tests/source-files/de.varengold.activeTAN/build.gradle
Normal file
115
tests/source-files/de.varengold.activeTAN/build.gradle
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion versions.compileSdk
|
||||||
|
defaultConfig {
|
||||||
|
versionCode 34
|
||||||
|
versionName "2021-06-30"
|
||||||
|
|
||||||
|
// Requires API level 23 (Android 6.0) to use Android keystore system for cryptography.
|
||||||
|
minSdkVersion 23
|
||||||
|
targetSdkVersion versions.targetSdk
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
|
javaCompileOptions {
|
||||||
|
annotationProcessorOptions {
|
||||||
|
// Export database schema history as JSON files.
|
||||||
|
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sourceSets {
|
||||||
|
// Include database schema history for migration testing.
|
||||||
|
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
// Don't mess with the release versions during debugging, so use a different appId.
|
||||||
|
applicationIdSuffix ".debug"
|
||||||
|
debuggable true
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flavorDimensions "client", "environment"
|
||||||
|
productFlavors {
|
||||||
|
prod {
|
||||||
|
dimension "environment"
|
||||||
|
}
|
||||||
|
|
||||||
|
qs {
|
||||||
|
dimension "environment"
|
||||||
|
// To be able to install a second app variant, we must change the applicationId.
|
||||||
|
// Otherwise it would not be possible to use the same device for testing and production.
|
||||||
|
applicationIdSuffix ".QS"
|
||||||
|
}
|
||||||
|
|
||||||
|
EFD {
|
||||||
|
// Demo portal efdis-online.de (extern) / dailybuild.efdis-online.de (intern)
|
||||||
|
dimension "client"
|
||||||
|
applicationId "de.efdis.activeTAN"
|
||||||
|
}
|
||||||
|
|
||||||
|
VAR {
|
||||||
|
dimension "client"
|
||||||
|
applicationId "de.varengold.activeTAN"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
// ZXing uses Java 8 language features from the core library
|
||||||
|
coreLibraryDesugaringEnabled true
|
||||||
|
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.deprecation = true
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
implementation project(':material-design-icons')
|
||||||
|
implementation project(":barcodescanner")
|
||||||
|
|
||||||
|
implementation 'com.google.android.material:material:1.3.0'
|
||||||
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||||
|
implementation 'androidx.biometric:biometric:1.1.0'
|
||||||
|
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
|
|
||||||
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
|
implementation 'com.google.zxing:core:' + versions.zxing
|
||||||
|
|
||||||
|
def room_version = '2.3.0'
|
||||||
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
|
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
|
androidTestImplementation "androidx.room:room-testing:$room_version"
|
||||||
|
|
||||||
|
testImplementation 'junit:junit:4.13.1'
|
||||||
|
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
|
androidTestImplementation 'androidx.test:runner:1.3.0'
|
||||||
|
androidTestImplementation 'androidx.test:rules:1.3.0'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue