mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
Merge branch 'fix_flavour' into 'master'
Fix matching substring flavour detection Closes #899 and #912 See merge request fdroid/fdroidserver!957
This commit is contained in:
commit
89762f4d48
@ -715,6 +715,7 @@ include tests/source-files/com.anpmech.launcher/app/build.gradle
|
||||
include tests/source-files/com.anpmech.launcher/app/src/main/AndroidManifest.xml
|
||||
include tests/source-files/com.anpmech.launcher/build.gradle
|
||||
include tests/source-files/com.anpmech.launcher/settings.gradle
|
||||
include tests/source-files/com.github.jameshnsears.quoteunquote/build.gradle
|
||||
include tests/source-files/com.integreight.onesheeld/build.gradle
|
||||
include tests/source-files/com.integreight.onesheeld/gradle/wrapper/gradle-wrapper.properties
|
||||
include tests/source-files/com.integreight.onesheeld/localeapi/build.gradle
|
||||
@ -728,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/src/main/AndroidManifest.xml
|
||||
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.nextcloud.client/build.gradle
|
||||
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)
|
||||
|
||||
if inside_flavour_group > 0:
|
||||
if inside_required_flavour > 0:
|
||||
if inside_required_flavour > 1:
|
||||
matches = psearch_g(line)
|
||||
if matches:
|
||||
s = matches.group(2)
|
||||
@ -1678,13 +1678,19 @@ def parse_androidmanifests(paths, app):
|
||||
if matches:
|
||||
vercode = matches.group(1)
|
||||
|
||||
if inside_required_flavour > 0:
|
||||
if '{' in line:
|
||||
inside_required_flavour += 1
|
||||
if '}' in line:
|
||||
inside_required_flavour -= 1
|
||||
if inside_required_flavour == 1:
|
||||
inside_required_flavour -= 1
|
||||
else:
|
||||
if flavour and (flavour in line):
|
||||
inside_required_flavour = 1
|
||||
if flavour:
|
||||
if re.match(r'.*[\'"\s]{flavour}[\'"\s].*\{{.*'.format(flavour=flavour), line):
|
||||
inside_required_flavour = 2
|
||||
elif re.match(r'.*[\'"\s]{flavour}[\'"\s].*'.format(flavour=flavour), line):
|
||||
inside_required_flavour = 1
|
||||
|
||||
if '{' in line:
|
||||
inside_flavour_group += 1
|
||||
|
@ -1235,6 +1235,32 @@ class CommonTest(unittest.TestCase):
|
||||
self.assertEqual(('1.0', '1', 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore_first'),
|
||||
fdroidserver.common.parse_androidmanifests(paths, app))
|
||||
|
||||
app = fdroidserver.metadata.App()
|
||||
build = fdroidserver.metadata.Build()
|
||||
build.gradle = ['fdroid']
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.github.jameshnsears.quoteunquote'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.github.jameshnsears.quoteunquote', 'build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
self.assertEqual(('2.5.2-fdroid', '73', 'com.github.jameshnsears.quoteunquote'),
|
||||
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):
|
||||
"""Test whether the function works with relative and absolute paths"""
|
||||
a = fdroidserver.common.get_all_gradle_and_manifests(Path('source-files/cn.wildfirechat.chat'))
|
||||
|
@ -0,0 +1,232 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
apply from: '../jacoco.gradle'
|
||||
apply from: '../ktlint.gradle'
|
||||
apply from: '../detekt.gradle'
|
||||
apply from: '../checkstyle.gradle'
|
||||
apply from: '../sonarcube.gradle'
|
||||
|
||||
def localPropertiesFile = rootProject.file("local.properties")
|
||||
def localProperties = new Properties()
|
||||
|
||||
if (!localPropertiesFile.exists()) {
|
||||
localProperties.setProperty("RELEASE_STORE_PASSWORD", "")
|
||||
localProperties.setProperty("RELEASE_KEY_PASSWORD", "")
|
||||
localProperties.setProperty("RELEASE_KEY_ALIAS", "")
|
||||
localProperties.setProperty("RELEASE_STORE_FILE", "keystore.jks")
|
||||
Writer writer = new FileWriter(localPropertiesFile, false)
|
||||
localProperties.store(writer, "empty, as creating the file is done manually via gpg")
|
||||
writer.close()
|
||||
|
||||
file(project(':app').projectDir.path + "/keystore.jks").text = ""
|
||||
}
|
||||
|
||||
localProperties.load(new FileInputStream(localPropertiesFile))
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
// compileSdkVersion "android-S"
|
||||
|
||||
signingConfigs {
|
||||
googleplay {
|
||||
keyAlias localProperties['RELEASE_KEY_ALIAS']
|
||||
keyPassword localProperties['RELEASE_KEY_PASSWORD']
|
||||
storeFile file(localProperties['RELEASE_STORE_FILE'])
|
||||
storePassword localProperties['RELEASE_STORE_PASSWORD']
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
// minSdkVersion "S"
|
||||
// targetSdkVersion "S"
|
||||
|
||||
applicationId "com.github.jameshnsears.quoteunquote"
|
||||
|
||||
versionCode 73
|
||||
versionName "2.5.2"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
testInstrumentationRunnerArguments clearPackageData: 'true'
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments += ["room.schemaLocation":
|
||||
"$projectDir/schemas".toString()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude "**/module-info.class"
|
||||
exclude 'LICENSE'
|
||||
exclude 'README.md'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError true
|
||||
warningsAsErrors false
|
||||
checkAllWarnings = true
|
||||
xmlReport false
|
||||
htmlReport true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
def gitHash = { ->
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'rev-parse', '--short=8', 'HEAD'
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString().trim()
|
||||
}
|
||||
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
|
||||
buildConfigField("String", "GIT_HASH", "\"$gitHash\"")
|
||||
buildConfigField("String", "DATABASE_QUOTATIONS", "\"quotations.db.prod\"")
|
||||
}
|
||||
debug {
|
||||
testCoverageEnabled true
|
||||
buildConfigField("String", "GIT_HASH", "\"$gitHash\"")
|
||||
buildConfigField("String", "DATABASE_QUOTATIONS", "\"quotations.db.dev\"")
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
}
|
||||
|
||||
flavorDimensions 'Version'
|
||||
productFlavors {
|
||||
'googleplay' {
|
||||
dimension 'Version'
|
||||
versionNameSuffix "-googleplay"
|
||||
signingConfig signingConfigs.googleplay
|
||||
}
|
||||
'googleplayS' {
|
||||
dimension 'Version'
|
||||
versionNameSuffix "-googleplay-S"
|
||||
signingConfig signingConfigs.googleplay
|
||||
}
|
||||
'fdroid' {
|
||||
dimension 'Version'
|
||||
versionNameSuffix "-fdroid"
|
||||
isDefault true
|
||||
}
|
||||
'fdroidS' {
|
||||
dimension 'Version'
|
||||
versionNameSuffix "-fdroid-S"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
androidTest {
|
||||
assets.srcDirs += files("$projectDir/schemas".toString())
|
||||
}
|
||||
fdroid {
|
||||
assets.srcDirs = ['src/main/assets']
|
||||
java.srcDirs = ['src/main/java', 'src/fdroid/java']
|
||||
}
|
||||
fdroidS {
|
||||
assets.srcDirs = ['src/main/assets']
|
||||
java.srcDirs = ['src/main/java', 'src/fdroid/java']
|
||||
}
|
||||
googleplay {
|
||||
assets.srcDirs = ['src/main/assets']
|
||||
java.srcDirs = ['src/main/java']
|
||||
}
|
||||
googleplayS {
|
||||
assets.srcDirs = ['src/main/assets']
|
||||
java.srcDirs = ['src/main/java']
|
||||
}
|
||||
}
|
||||
|
||||
testOptions {
|
||||
// will make tests run very slowly on the emulator/device + affects coverage #
|
||||
// execution 'ANDROIDX_TEST_ORCHESTRATOR'
|
||||
|
||||
animationsDisabled true
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
returnDefaultValues = true
|
||||
all {
|
||||
maxHeapSize = "1024m"
|
||||
jacoco {
|
||||
includeNoLocationClasses = true
|
||||
excludes = ['jdk.internal.*']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
|
||||
androidTestImplementation 'androidx.room:room-testing:2.3.0'
|
||||
androidTestImplementation 'androidx.test:core:1.4.0-beta01'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test:rules:1.3.0'
|
||||
androidTestImplementation 'androidx.test:runner:1.3.0'
|
||||
androidTestImplementation 'io.mockk:mockk-android:1.11.0'
|
||||
|
||||
annotationProcessor 'androidx.room:room-compiler:2.3.0'
|
||||
|
||||
debugImplementation 'androidx.fragment:fragment-testing:1.3.4'
|
||||
debugImplementation 'androidx.test:core:1.4.0-beta01'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
|
||||
|
||||
implementation 'androidx.activity:activity:1.2.3'
|
||||
implementation 'androidx.fragment:fragment:1.3.4'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.core:core-ktx:1.5.0'
|
||||
fdroidSImplementation 'androidx.core:core-ktx:1.6.0-beta02'
|
||||
googleplaySImplementation 'androidx.core:core-ktx:1.6.0-beta02'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.room:room-guava:2.3.0'
|
||||
implementation 'androidx.room:room-runtime:2.3.0'
|
||||
implementation 'androidx.room:room-rxjava2:2.3.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'com.jakewharton.rxbinding2:rxbinding:2.2.0'
|
||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.10'
|
||||
|
||||
implementation project(path: ':cloudLib')
|
||||
implementation project(path: ':utilsLib')
|
||||
|
||||
testImplementation 'androidx.arch.core:core-testing:2.1.0'
|
||||
testImplementation 'androidx.room:room-testing:2.3.0'
|
||||
testImplementation 'androidx.test:core-ktx:1.3.0'
|
||||
testImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
testImplementation 'androidx.test:rules:1.3.0'
|
||||
testImplementation 'com.google.guava:guava:30.1.1-jre'
|
||||
testImplementation 'io.mockk:mockk:1.11.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.robolectric:robolectric:4.5.1'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
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…
Reference in New Issue
Block a user