chiark / gitweb /
Merge branch 'fixFlavor' into 'master'
authorHans-Christoph Steiner <hans@eds.org>
Thu, 14 Dec 2017 15:56:01 +0000 (16:56 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 14 Dec 2017 15:56:01 +0000 (16:56 +0100)
Regex only for flavor blocks: flavor { ... }

See merge request fdroid/fdroidserver!407

fdroidserver/common.py
tests/common.TestCase
tests/source-files/eu.siacs.conversations/build.gradle [new file with mode: 0644]
tests/source-files/eu.siacs.conversations/metadata/en-US/name.txt [new file with mode: 0644]
tests/update.TestCase

index 5d35f3c79d053b80e905e0a8113b9b2ff3c60cb9..624e93538d9d0de01dfb2561d94154fe4d3c2c2b 100644 (file)
@@ -1338,7 +1338,7 @@ def parse_androidmanifests(paths, app):
             with open(path, 'r') as f:
                 buildfile = f.read()
 
-                regex_string = r"" + flavour + ".*?}"
+                regex_string = r"" + flavour + "[^}]*?{.*?}"
                 search = re.compile(regex_string, re.DOTALL)
                 result = search.search(buildfile)
 
index a6cc9d87827ec51376e4c40550467a8a13e6ac90..35bc01e1e253e0a645efca35dd98d43f4e7ea0ff 100755 (executable)
@@ -627,6 +627,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']
@@ -641,6 +642,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()
diff --git a/tests/source-files/eu.siacs.conversations/build.gradle b/tests/source-files/eu.siacs.conversations/build.gradle
new file mode 100644 (file)
index 0000000..1762892
--- /dev/null
@@ -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'
+    }
+}
diff --git a/tests/source-files/eu.siacs.conversations/metadata/en-US/name.txt b/tests/source-files/eu.siacs.conversations/metadata/en-US/name.txt
new file mode 100644 (file)
index 0000000..29057c1
--- /dev/null
@@ -0,0 +1 @@
+Conversations
\ No newline at end of file
index 8e4ac3196377fbf2c83c8abec643b6f872e15326..da573714e9bca22a5677005cd182719672f4f37e 100755 (executable)
@@ -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')