add Conversations as gradle flavor test case

This commit is contained in:
Hans-Christoph Steiner 2017-12-14 16:52:02 +01:00
parent 03f301470e
commit bec4f7d547
4 changed files with 158 additions and 3 deletions

View File

@ -582,6 +582,7 @@ class CommonTest(unittest.TestCase):
def test_parse_androidmanifests_with_flavor(self):
source_files_dir = os.path.join(os.path.dirname(__file__), 'source-files')
app = fdroidserver.metadata.App()
build = fdroidserver.metadata.Build()
build.gradle = ['devVersion']
@ -596,6 +597,19 @@ class CommonTest(unittest.TestCase):
self.assertEqual(('0.95-dev', '949', 'org.fdroid.fdroid.dev'),
fdroidserver.common.parse_androidmanifests(paths, app))
app = fdroidserver.metadata.App()
build = fdroidserver.metadata.Build()
build.gradle = ['free']
app.builds = [build]
app.id = 'eu.siacs.conversations'
paths = [
os.path.join(source_files_dir, 'eu.siacs.conversations', 'build.gradle'),
]
for path in paths:
self.assertTrue(os.path.isfile(path))
self.assertEqual(('1.23.1', '245', 'eu.siacs.conversations'),
fdroidserver.common.parse_androidmanifests(paths, app))
if __name__ == "__main__":
parser = optparse.OptionParser()

View File

@ -0,0 +1,128 @@
// Top-level build file where you can add configuration options common to all
// sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com'
}
}
configurations {
playstoreCompile
freeCompile
}
ext {
supportLibVersion = '27.0.2'
}
dependencies {
compile project(':libs:MemorizingTrustManager')
playstoreCompile 'com.google.android.gms:play-services-gcm:11.6.2'
compile 'org.sufficientlysecure:openpgp-api:10.0'
compile 'com.soundcloud.android:android-crop:1.0.1@aar'
compile "com.android.support:support-v13:$supportLibVersion"
compile "com.android.support:appcompat-v7:$supportLibVersion"
compile "com.android.support:support-emoji:$supportLibVersion"
freeCompile "com.android.support:support-emoji-bundled:$supportLibVersion"
compile 'org.bouncycastle:bcmail-jdk15on:1.52'
compile 'org.jitsi:org.otr4j:0.22'
compile 'org.gnu.inet:libidn:1.15'
compile 'com.google.zxing:core:3.2.1'
compile 'com.google.zxing:android-integration:3.2.1'
compile 'de.measite.minidns:minidns-hla:0.2.4'
compile 'de.timroes.android:EnhancedListView:0.3.4'
compile 'me.leolin:ShortcutBadger:1.1.19@aar'
compile 'com.kyleduo.switchbutton:library:1.2.8'
compile 'org.whispersystems:signal-protocol-java:2.6.2'
compile 'com.makeramen:roundedimageview:2.3.0'
compile "com.wefika:flowlayout:0.4.1"
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
}
ext {
travisBuild = System.getenv("TRAVIS") == "true"
preDexEnabled = System.getProperty("pre-dex", "true")
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 245
versionName "1.23.1"
archivesBaseName += "-$versionName"
applicationId "eu.siacs.conversations"
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
playstore
free
}
if(new File("signing.properties").exists()) {
Properties props = new Properties()
props.load(new FileInputStream(file("signing.properties")))
signingConfigs {
release {
storeFile file(props['keystore'])
storePassword props['keystore.password']
keyAlias props['keystore.alias']
keyPassword props['keystore.password']
}
}
buildTypes.release.signingConfig = signingConfigs.release
}
lintOptions {
disable 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource'
}
subprojects {
afterEvaluate {
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
disable 'AndroidGradlePluginVersion', 'MissingTranslation'
}
}
}
}
packagingOptions {
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/BCKEY.SF'
}
}

View File

@ -0,0 +1 @@
Conversations

View File

@ -43,15 +43,21 @@ class UpdateTest(unittest.TestCase):
shutil.rmtree(os.path.join('repo', 'info.guardianproject.urzip'), ignore_errors=True)
shutil.rmtree(os.path.join('build', 'com.nextcloud.client'), ignore_errors=True)
shutil.copytree(os.path.join('source-files', 'com.nextcloud.client'), os.path.join('build', 'com.nextcloud.client'))
shutil.copytree(os.path.join('source-files', 'com.nextcloud.client'),
os.path.join('build', 'com.nextcloud.client'))
shutil.rmtree(os.path.join('build', 'com.nextcloud.client.dev'), ignore_errors=True)
shutil.copytree(os.path.join('source-files', 'com.nextcloud.client.dev'),
os.path.join('build', 'com.nextcloud.client.dev'))
shutil.rmtree(os.path.join('build', 'eu.siacs.conversations'), ignore_errors=True)
shutil.copytree(os.path.join('source-files', 'eu.siacs.conversations'),
os.path.join('build', 'eu.siacs.conversations'))
apps = dict()
for packageName in ('info.guardianproject.urzip', 'org.videolan.vlc', 'obb.mainpatch.current',
'com.nextcloud.client', 'com.nextcloud.client.dev'):
'com.nextcloud.client', 'com.nextcloud.client.dev',
'eu.siacs.conversations'):
apps[packageName] = fdroidserver.metadata.App()
apps[packageName]['id'] = packageName
apps[packageName]['CurrentVersionCode'] = 0xcafebeef
@ -66,13 +72,17 @@ class UpdateTest(unittest.TestCase):
buildnextclouddevclient.gradle = ['versionDev']
apps['com.nextcloud.client.dev']['builds'] = [buildnextclouddevclient]
build_conversations = fdroidserver.metadata.Build()
build_conversations.gradle = ['free']
apps['eu.siacs.conversations']['builds'] = [build_conversations]
fdroidserver.update.insert_localized_app_metadata(apps)
appdir = os.path.join('repo', 'info.guardianproject.urzip', 'en-US')
self.assertTrue(os.path.isfile(os.path.join(appdir, 'icon.png')))
self.assertTrue(os.path.isfile(os.path.join(appdir, 'featureGraphic.png')))
self.assertEqual(5, len(apps))
self.assertEqual(6, len(apps))
for packageName, app in apps.items():
self.assertTrue('localized' in app)
self.assertTrue('en-US' in app['localized'])
@ -103,6 +113,8 @@ class UpdateTest(unittest.TestCase):
self.assertEqual('Nextcloud Dev', app['localized']['en-US']['name'])
self.assertEqual(586, len(app['localized']['en-US']['description']))
self.assertEqual(79, len(app['localized']['en-US']['summary']))
elif packageName == 'eu.siacs.conversations':
self.assertEqual('Conversations', app['localized']['en-US']['name'])
def test_insert_triple_t_metadata(self):
importer = os.path.join(localmodule, 'tests', 'tmp', 'importer')