1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

Merge branch 'fixFlavor' into 'master'

Regex only for flavor blocks: flavor { ... }

See merge request fdroid/fdroidserver!407
This commit is contained in:
Hans-Christoph Steiner 2017-12-14 16:56:01 +01:00
commit 61aac0503a
5 changed files with 159 additions and 4 deletions

View File

@ -1338,7 +1338,7 @@ def parse_androidmanifests(paths, app):
with open(path, 'r') as f: with open(path, 'r') as f:
buildfile = f.read() buildfile = f.read()
regex_string = r"" + flavour + ".*?}" regex_string = r"" + flavour + "[^}]*?{.*?}"
search = re.compile(regex_string, re.DOTALL) search = re.compile(regex_string, re.DOTALL)
result = search.search(buildfile) result = search.search(buildfile)

View File

@ -627,6 +627,7 @@ class CommonTest(unittest.TestCase):
def test_parse_androidmanifests_with_flavor(self): def test_parse_androidmanifests_with_flavor(self):
source_files_dir = os.path.join(os.path.dirname(__file__), 'source-files') source_files_dir = os.path.join(os.path.dirname(__file__), 'source-files')
app = fdroidserver.metadata.App() app = fdroidserver.metadata.App()
build = fdroidserver.metadata.Build() build = fdroidserver.metadata.Build()
build.gradle = ['devVersion'] build.gradle = ['devVersion']
@ -641,6 +642,19 @@ class CommonTest(unittest.TestCase):
self.assertEqual(('0.95-dev', '949', 'org.fdroid.fdroid.dev'), self.assertEqual(('0.95-dev', '949', 'org.fdroid.fdroid.dev'),
fdroidserver.common.parse_androidmanifests(paths, app)) 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__": if __name__ == "__main__":
parser = optparse.OptionParser() 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('repo', 'info.guardianproject.urzip'), ignore_errors=True)
shutil.rmtree(os.path.join('build', 'com.nextcloud.client'), 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.rmtree(os.path.join('build', 'com.nextcloud.client.dev'), ignore_errors=True)
shutil.copytree(os.path.join('source-files', 'com.nextcloud.client.dev'), shutil.copytree(os.path.join('source-files', 'com.nextcloud.client.dev'),
os.path.join('build', '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() apps = dict()
for packageName in ('info.guardianproject.urzip', 'org.videolan.vlc', 'obb.mainpatch.current', 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] = fdroidserver.metadata.App()
apps[packageName]['id'] = packageName apps[packageName]['id'] = packageName
apps[packageName]['CurrentVersionCode'] = 0xcafebeef apps[packageName]['CurrentVersionCode'] = 0xcafebeef
@ -66,13 +72,17 @@ class UpdateTest(unittest.TestCase):
buildnextclouddevclient.gradle = ['versionDev'] buildnextclouddevclient.gradle = ['versionDev']
apps['com.nextcloud.client.dev']['builds'] = [buildnextclouddevclient] 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) fdroidserver.update.insert_localized_app_metadata(apps)
appdir = os.path.join('repo', 'info.guardianproject.urzip', 'en-US') 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, 'icon.png')))
self.assertTrue(os.path.isfile(os.path.join(appdir, 'featureGraphic.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(): for packageName, app in apps.items():
self.assertTrue('localized' in app) self.assertTrue('localized' in app)
self.assertTrue('en-US' in app['localized']) 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('Nextcloud Dev', app['localized']['en-US']['name'])
self.assertEqual(586, len(app['localized']['en-US']['description'])) self.assertEqual(586, len(app['localized']['en-US']['description']))
self.assertEqual(79, len(app['localized']['en-US']['summary'])) 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): def test_insert_triple_t_metadata(self):
importer = os.path.join(localmodule, 'tests', 'tmp', 'importer') importer = os.path.join(localmodule, 'tests', 'tmp', 'importer')