diff --git a/.gitmodules b/.gitmodules index a3337f219..fdc6dddb3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,10 +2,6 @@ path = extern/openpgp-api-lib url = https://github.com/open-keychain/openpgp-api.git ignore = dirty -[submodule "extern/openkeychain-api-lib"] - path = extern/openkeychain-api-lib - url = https://github.com/open-keychain/openkeychain-intents.git - ignore = dirty [submodule "extern/KeybaseLib"] path = extern/KeybaseLib url = https://github.com/open-keychain/KeybaseLib.git diff --git a/.travis.yml b/.travis.yml index 6bbe01d9a..fc684fceb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,12 +17,9 @@ before_install: android: components: - tools - - android-22 - - android-23 - - android-24 + - android-25 - platform-tools - - build-tools-23.0.2 - - build-tools-24.0.1 + - build-tools-25.0.2 - extra-android-support - extra-android-m2repository - sys-img-armeabi-v7a-android-21 diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index ac4563ab1..af54cf831 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -53,7 +53,6 @@ dependencies { // libs as submodules compile project(':openpgp-api-lib') - compile project(':openkeychain-api-lib') compile project(':extern:bouncycastle:core') compile project(':extern:bouncycastle:pg') compile project(':extern:bouncycastle:prov') @@ -66,7 +65,7 @@ dependencies { // http://robolectric.org/getting-started/ // http://www.vogella.com/tutorials/Robolectric/article.html testCompile 'junit:junit:4.12' - testCompile ('org.robolectric:robolectric:3.1.2') { + testCompile ('org.robolectric:robolectric:3.2.2') { exclude group: 'org.bouncycastle', module: 'bcprov-jdk16' } testCompile 'org.mockito:mockito-core:1.10.19' @@ -149,8 +148,6 @@ dependencyVerification { ] } - - android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion @@ -185,7 +182,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-release.pro' // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\"" @@ -201,9 +198,8 @@ android { } debug { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - testProguardFile('proguard-rules.pro') + // disable ProGuard for faster compile times for debug builds + minifyEnabled false applicationIdSuffix ".debug" @@ -289,13 +285,17 @@ android { } dexOptions { - preDexLibraries = true + preDexLibraries true // dexInProcess requires much RAM, which is not available on all dev systems - dexInProcess = false - jumboMode = true + dexInProcess false + jumboMode true javaMaxHeapSize "2g" } + dataBinding { + enabled true + } + packagingOptions { exclude 'LICENSE.txt' exclude 'META-INF/LICENSE.txt' @@ -305,10 +305,6 @@ android { exclude 'META-INF/NOTICE' exclude '.readme' } - - dataBinding { - enabled = true - } } task jacocoTestReport(type:JacocoReport, dependsOn: "testFdroidDebugWithTestCoverageUnitTest") { @@ -334,8 +330,8 @@ task jacocoTestReport(type:JacocoReport, dependsOn: "testFdroidDebugWithTestCove executionData = fileTree(dir: "${buildDir}/jacoco", include: "**/*.exec") reports { - xml.enabled = true - html.enabled = true + xml.enabled true + html.enabled true } } diff --git a/OpenKeychain/proguard-rules.pro b/OpenKeychain/proguard-rules-release.pro similarity index 100% rename from OpenKeychain/proguard-rules.pro rename to OpenKeychain/proguard-rules-release.pro diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/intents/OpenKeychainIntents.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/intents/OpenKeychainIntents.java new file mode 100644 index 000000000..37f7c307c --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/intents/OpenKeychainIntents.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2014-2017 Dominik Schürmann + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.sufficientlysecure.keychain.intents; + +public class OpenKeychainIntents { + private static final String PACKAGE_NAME = "org.sufficientlysecure.keychain"; + + // prefix packagename for exported Intents + // as described in http://developer.android.com/guide/components/intents-filters.html + private static final String INTENT_PREFIX = PACKAGE_NAME + ".action."; + private static final String EXTRA_PREFIX = PACKAGE_NAME + "."; + + public static final String ENCRYPT_TEXT = INTENT_PREFIX + "ENCRYPT_TEXT"; + public static final String ENCRYPT_EXTRA_TEXT = EXTRA_PREFIX + "EXTRA_TEXT"; // String + + public static final String ENCRYPT_DATA = INTENT_PREFIX + "ENCRYPT_DATA"; + public static final String ENCRYPT_EXTRA_ASCII_ARMOR = EXTRA_PREFIX + "EXTRA_ASCII_ARMOR"; // boolean + + public static final String DECRYPT_DATA = INTENT_PREFIX + "DECRYPT_DATA"; + + public static final String IMPORT_KEY = INTENT_PREFIX + "IMPORT_KEY"; + public static final String IMPORT_EXTRA_KEY_EXTRA_KEY_BYTES = EXTRA_PREFIX + "EXTRA_KEY_BYTES"; // byte[] + + public static final String IMPORT_KEY_FROM_KEYSERVER = INTENT_PREFIX + "IMPORT_KEY_FROM_KEYSERVER"; + public static final String IMPORT_KEY_FROM_KEYSERVER_EXTRA_QUERY = EXTRA_PREFIX + "EXTRA_QUERY"; // String + public static final String IMPORT_KEY_FROM_KEYSERVER_EXTRA_FINGERPRINT = EXTRA_PREFIX + "EXTRA_FINGERPRINT"; // String + + public static final String IMPORT_KEY_FROM_QR_CODE = INTENT_PREFIX + "IMPORT_KEY_FROM_QR_CODE"; + +} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java index 136787984..d6b7d43bb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java @@ -23,7 +23,6 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; -import android.view.View; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.intents.OpenKeychainIntents; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/KeychainTestRunner.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/KeychainTestRunner.java new file mode 100644 index 000000000..3d4b14b2d --- /dev/null +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/KeychainTestRunner.java @@ -0,0 +1,20 @@ +package org.sufficientlysecure.keychain; + +import org.junit.runners.model.InitializationError; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +public class KeychainTestRunner extends RobolectricTestRunner { + + public KeychainTestRunner(Class testClass) throws InitializationError { + super(testClass); + } + + @Override + protected Config buildGlobalConfig() { + return new Config.Builder() + .setSdk(25) + .setConstants(WorkaroundBuildConfig.class) + .build(); + } +} diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/BackupOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/BackupOperationTest.java index f06e3bd96..16345333d 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/BackupOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/BackupOperationTest.java @@ -30,11 +30,9 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult; import org.sufficientlysecure.keychain.operations.results.ExportResult; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; @@ -77,8 +75,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class BackupOperationTest { static Passphrase mPassphrase = TestingUtils.genPassphrase(true); diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/BenchmarkOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/BenchmarkOperationTest.java index b6e0d2cd4..d5c55cf07 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/BenchmarkOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/BenchmarkOperationTest.java @@ -18,46 +18,21 @@ package org.sufficientlysecure.keychain.operations; -import java.io.PrintStream; -import java.security.Security; -import java.util.ArrayList; -import java.util.Date; -import java.util.Random; - -import org.junit.Assert; -import org.junit.Before; +import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.bouncycastle.bcpg.sig.KeyFlags; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; -import org.sufficientlysecure.keychain.operations.results.CertifyResult; -import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; -import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; -import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing; -import org.sufficientlysecure.keychain.pgp.PgpKeyOperation; -import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; -import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute; -import org.sufficientlysecure.keychain.provider.KeychainContract.Certs; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.BenchmarkInputParcel; -import org.sufficientlysecure.keychain.service.CertifyActionsParcel; -import org.sufficientlysecure.keychain.service.CertifyActionsParcel.CertifyAction; -import org.sufficientlysecure.keychain.service.SaveKeyringParcel; -import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm; -import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; -import org.sufficientlysecure.keychain.util.Passphrase; -import org.sufficientlysecure.keychain.util.ProgressScaler; -import org.sufficientlysecure.keychain.util.TestingUtils; + +import java.io.PrintStream; +import java.security.Security; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class BenchmarkOperationTest { static PrintStream oldShadowStream; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java index 6be13ec8e..8d6c94bba 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java @@ -17,19 +17,16 @@ package org.sufficientlysecure.keychain.operations; +import org.bouncycastle.bcpg.sig.KeyFlags; +import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.bouncycastle.bcpg.sig.KeyFlags; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.sufficientlysecure.keychain.BuildConfig; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.CertifyResult; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; @@ -55,8 +52,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.Random; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class CertifyOperationTest { static UncachedKeyRing mStaticRing1, mStaticRing2; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/PromoteKeyOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/PromoteKeyOperationTest.java index 7b1d8df3c..b8c3e2860 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/PromoteKeyOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/PromoteKeyOperationTest.java @@ -18,23 +18,17 @@ package org.sufficientlysecure.keychain.operations; -import java.io.PrintStream; -import java.security.Security; -import java.util.Iterator; - +import org.bouncycastle.bcpg.sig.KeyFlags; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.util.encoders.Hex; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.bouncycastle.bcpg.sig.KeyFlags; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.util.encoders.Hex; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; import org.sufficientlysecure.keychain.operations.results.PromoteKeyResult; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey; @@ -54,8 +48,11 @@ import org.sufficientlysecure.keychain.util.Passphrase; import org.sufficientlysecure.keychain.util.ProgressScaler; import org.sufficientlysecure.keychain.util.TestingUtils; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +import java.io.PrintStream; +import java.security.Security; +import java.util.Iterator; + +@RunWith(KeychainTestRunner.class) public class PromoteKeyOperationTest { static UncachedKeyRing mStaticRing; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java index b586e9618..2d518eaa6 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java @@ -18,30 +18,22 @@ package org.sufficientlysecure.keychain.pgp; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; -import java.io.PrintStream; -import java.security.Security; -import java.util.ArrayList; - import android.app.Application; import android.content.ContentResolver; import android.content.ContentValues; import android.net.Uri; import junit.framework.Assert; + import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.openintents.openpgp.OpenPgpMetadata; -import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.InputDataOperation; import org.sufficientlysecure.keychain.operations.results.InputDataResult; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; @@ -50,6 +42,13 @@ import org.sufficientlysecure.keychain.provider.TemporaryFileProvider; import org.sufficientlysecure.keychain.service.InputDataParcel; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileNotFoundException; +import java.io.PrintStream; +import java.security.Security; +import java.util.ArrayList; + import static org.mockito.Mockito.any; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; @@ -57,9 +56,7 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; - -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class InputDataOperationTest { public static final Uri FAKE_CONTENT_INPUT_URI_1 = Uri.parse("content://fake/1"); diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java index c22e1f6b0..575cc33cc 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java @@ -18,15 +18,6 @@ package org.sufficientlysecure.keychain.pgp; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import java.security.Security; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; - import org.apache.tools.ant.util.StringUtils; import org.bouncycastle.bcpg.BCPGInputStream; import org.bouncycastle.bcpg.Packet; @@ -42,11 +33,9 @@ import org.junit.runner.RunWith; import org.openintents.openpgp.OpenPgpDecryptionResult; import org.openintents.openpgp.OpenPgpMetadata; import org.openintents.openpgp.OpenPgpSignatureResult; -import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; @@ -66,12 +55,20 @@ import org.sufficientlysecure.keychain.util.Passphrase; import org.sufficientlysecure.keychain.util.ProgressScaler; import org.sufficientlysecure.keychain.util.TestingUtils; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.security.Security; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; + import static org.hamcrest.core.AnyOf.anyOf; import static org.hamcrest.core.Is.is; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class PgpEncryptDecryptTest { static Passphrase mSymmetricPassphrase = TestingUtils.genPassphrase(true); diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java index 9266d8a40..9cfc90544 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java @@ -20,14 +20,6 @@ package org.sufficientlysecure.keychain.pgp; import junit.framework.AssertionFailedError; -import org.junit.Assert; -import org.junit.Test; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; -import org.robolectric.*; -import org.robolectric.annotation.Config; -import org.robolectric.shadows.ShadowLog; import org.bouncycastle.bcpg.BCPGInputStream; import org.bouncycastle.bcpg.Packet; import org.bouncycastle.bcpg.PacketTags; @@ -41,7 +33,13 @@ import org.bouncycastle.bcpg.UserIDPacket; import org.bouncycastle.bcpg.sig.KeyFlags; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.openpgp.PGPSignature; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.shadows.ShadowLog; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; @@ -71,8 +69,7 @@ import java.util.Iterator; import java.util.List; import java.util.Random; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class PgpKeyOperationTest { static UncachedKeyRing staticRing; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/SplitUserIdTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/SplitUserIdTest.java index 3eb474c1d..8f8ca1337 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/SplitUserIdTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/SplitUserIdTest.java @@ -21,14 +21,9 @@ import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.openintents.openpgp.util.OpenPgpUtils; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; -import org.sufficientlysecure.keychain.BuildConfig; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class SplitUserIdTest { @Test diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringCanonicalizeTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringCanonicalizeTest.java index 5d32fd9dd..7265282ef 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringCanonicalizeTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringCanonicalizeTest.java @@ -18,15 +18,6 @@ package org.sufficientlysecure.keychain.pgp; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; -import org.junit.Assert; -import org.junit.Test; -import org.junit.Before; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; -import org.robolectric.shadows.ShadowLog; import org.bouncycastle.bcpg.BCPGInputStream; import org.bouncycastle.bcpg.HashAlgorithmTags; import org.bouncycastle.bcpg.Packet; @@ -53,16 +44,21 @@ import org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBu import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder; import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder; import org.bouncycastle.util.Strings; -import org.sufficientlysecure.keychain.BuildConfig; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.shadows.ShadowLog; import org.sufficientlysecure.keychain.Constants; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.OperationResult; +import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; +import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; import org.sufficientlysecure.keychain.service.ChangeUnlockParcel; import org.sufficientlysecure.keychain.service.SaveKeyringParcel; import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm; -import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; -import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.support.KeyringTestingHelper; import org.sufficientlysecure.keychain.support.KeyringTestingHelper.RawPacket; @@ -82,8 +78,7 @@ import java.util.Iterator; * Test cases are made for all its assertions. */ -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class UncachedKeyringCanonicalizeTest { static UncachedKeyRing staticRing; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringMergeTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringMergeTest.java index 784af2bcc..07aa18d6a 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringMergeTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringMergeTest.java @@ -18,15 +18,6 @@ package org.sufficientlysecure.keychain.pgp; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; -import org.robolectric.shadows.ShadowLog; import org.bouncycastle.bcpg.BCPGInputStream; import org.bouncycastle.bcpg.PacketTags; import org.bouncycastle.bcpg.S2K; @@ -34,11 +25,16 @@ import org.bouncycastle.bcpg.SecretKeyPacket; import org.bouncycastle.bcpg.sig.KeyFlags; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.util.Strings; -import org.sufficientlysecure.keychain.BuildConfig; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.shadows.ShadowLog; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.OperationResult; -import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog; +import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; import org.sufficientlysecure.keychain.pgp.PgpCertifyOperation.PgpCertifyResult; import org.sufficientlysecure.keychain.service.CertifyActionsParcel.CertifyAction; import org.sufficientlysecure.keychain.service.ChangeUnlockParcel; @@ -81,8 +77,7 @@ import java.util.Random; * packet will be copied regardless. Filtering out bad packets is done with canonicalization. * */ -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class UncachedKeyringMergeTest { static UncachedKeyRing staticRingA, staticRingB; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringTest.java index f4f089d0d..486b1f95a 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringTest.java @@ -18,19 +18,15 @@ package org.sufficientlysecure.keychain.pgp; +import org.bouncycastle.bcpg.sig.KeyFlags; +import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.bouncycastle.bcpg.sig.KeyFlags; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.sufficientlysecure.keychain.BuildConfig; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; import org.sufficientlysecure.keychain.pgp.UncachedKeyRing.IteratorWithIOThrow; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; @@ -46,8 +42,7 @@ import java.security.Security; import java.util.Iterator; import java.util.Random; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class UncachedKeyringTest { static UncachedKeyRing staticRing, staticPubRing; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/InteropTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/InteropTest.java index 114501d83..f0bd955e1 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/InteropTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/InteropTest.java @@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.provider; import android.net.Uri; +import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.json.JSONArray; import org.json.JSONObject; import org.junit.Assert; @@ -27,12 +28,9 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.openintents.openpgp.OpenPgpMetadata; import org.openintents.openpgp.OpenPgpSignatureResult; -import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult; import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing; @@ -60,8 +58,7 @@ import java.net.URL; import java.security.Security; import java.util.ArrayList; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class InteropTest { @BeforeClass diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperKeyringTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperKeyringTest.java index 8c042fb6d..62358d848 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperKeyringTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperKeyringTest.java @@ -17,22 +17,19 @@ package org.sufficientlysecure.keychain.provider; -import java.util.Collections; -import java.util.Arrays; -import java.util.Collection; -import java.util.ArrayList; - import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.*; -import org.robolectric.annotation.Config; -import org.sufficientlysecure.keychain.BuildConfig; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.robolectric.RuntimeEnvironment; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.support.KeyringTestingHelper; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + +@RunWith(KeychainTestRunner.class) public class ProviderHelperKeyringTest { @Test diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java index 47c08aff2..f22464185 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java @@ -18,35 +18,29 @@ package org.sufficientlysecure.keychain.provider; +import org.bouncycastle.bcpg.sig.KeyFlags; +import org.bouncycastle.util.encoders.Hex; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.Robolectric; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.bouncycastle.bcpg.sig.KeyFlags; -import org.bouncycastle.util.encoders.Hex; -import org.sufficientlysecure.keychain.BuildConfig; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; +import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog; +import org.sufficientlysecure.keychain.operations.results.SaveKeyringResult; import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing; import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; -import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog; -import org.sufficientlysecure.keychain.operations.results.SaveKeyringResult; import org.sufficientlysecure.keychain.util.IterableIterator; import org.sufficientlysecure.keychain.util.ProgressScaler; import java.util.Arrays; import java.util.Iterator; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class ProviderHelperSaveTest { ProviderHelper mProviderHelper = new ProviderHelper(RuntimeEnvironment.application); diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceKeyIdExtractorTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceKeyIdExtractorTest.java index 23732d227..3198f3e44 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceKeyIdExtractorTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceKeyIdExtractorTest.java @@ -1,9 +1,6 @@ package org.sufficientlysecure.keychain.remote; -import java.util.ArrayList; -import java.util.Arrays; - import android.app.PendingIntent; import android.content.ContentResolver; import android.content.Intent; @@ -16,11 +13,12 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.openintents.openpgp.OpenPgpError; import org.openintents.openpgp.util.OpenPgpApi; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.remote.OpenPgpServiceKeyIdExtractor.KeyIdResult; +import java.util.ArrayList; +import java.util.Arrays; + import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -29,10 +27,8 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; - @SuppressWarnings("unchecked") -@RunWith(RobolectricTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class OpenPgpServiceKeyIdExtractorTest { private static final long[] KEY_IDS = new long[] { 123L, 234L }; diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/securitytoken/Iso7816TLVTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/securitytoken/Iso7816TLVTest.java index 7e8c2d37a..dfab970a9 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/securitytoken/Iso7816TLVTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/securitytoken/Iso7816TLVTest.java @@ -15,20 +15,16 @@ package org.sufficientlysecure.keychain.securitytoken; +import org.bouncycastle.util.encoders.Hex; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.bouncycastle.util.encoders.Hex; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; -import org.sufficientlysecure.keychain.securitytoken.Iso7816TLV; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.securitytoken.Iso7816TLV.Iso7816CompositeTLV; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class Iso7816TLVTest { @Before diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenUtilsTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenUtilsTest.java index 6ac175994..826300fb5 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenUtilsTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenUtilsTest.java @@ -25,10 +25,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.securitytoken.usb.UsbTransportException; import java.io.ByteArrayOutputStream; @@ -37,8 +35,7 @@ import java.math.BigInteger; import java.security.interfaces.RSAPrivateCrtKey; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class SecurityTokenUtilsTest extends Mockito { @Before public void setUp() { diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java index 606040e4b..8cc944f4e 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java @@ -3,17 +3,14 @@ package org.sufficientlysecure.keychain.util; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.annotation.Config; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class CharsetVerifierTest { @Test diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/KeyFormattingUtilsTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/KeyFormattingUtilsTest.java index 30cfb0f14..eec924c67 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/KeyFormattingUtilsTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/KeyFormattingUtilsTest.java @@ -4,14 +4,11 @@ package org.sufficientlysecure.keychain.util; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; -import org.robolectric.annotation.Config; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class KeyFormattingUtilsTest { static final byte[] fp = new byte[] { diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java index aeea457f7..3bda809d4 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/ParcelableFileCacheTest.java @@ -24,16 +24,13 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; -import org.sufficientlysecure.keychain.WorkaroundBuildConfig; +import org.sufficientlysecure.keychain.KeychainTestRunner; import java.util.ArrayList; -@RunWith(RobolectricGradleTestRunner.class) -@Config(constants = WorkaroundBuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") +@RunWith(KeychainTestRunner.class) public class ParcelableFileCacheTest { @Before diff --git a/build.gradle b/build.gradle index 91cd0023c..e1c3772a6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { dependencies { // NOTE: Always use fixed version codes not dynamic ones, e.g. 0.7.3 instead of 0.7.+, see README for more information - classpath 'com.android.tools.build:gradle:2.2.2' + classpath 'com.android.tools.build:gradle:2.2.3' classpath files('gradle-witness.jar') // bintray dependency to satisfy dependency of openpgp-api lib classpath 'com.novoda:bintray-release:0.2.7' @@ -26,7 +26,7 @@ allprojects { } task wrapper(type: Wrapper) { - gradleVersion = '3.1' + gradleVersion = '3.3' } subprojects { @@ -47,6 +47,6 @@ project(':extern:bouncycastle') { // SDK Version and Build Tools used by all subprojects // See http://tools.android.com/tech-docs/new-build-system/tips#TOC-Controlling-Android-properties-of-all-your-modules-from-the-main-project. ext { - compileSdkVersion = 24 - buildToolsVersion = '24.0.1' + compileSdkVersion = 25 + buildToolsVersion = '25.0.2' } diff --git a/extern/KeybaseLib b/extern/KeybaseLib index 051ed509f..fdad9ac1b 160000 --- a/extern/KeybaseLib +++ b/extern/KeybaseLib @@ -1 +1 @@ -Subproject commit 051ed509f4ada5d6a69611088daddc640539fd49 +Subproject commit fdad9ac1b8cfbe0c6a4f3a0194656464cef1785f diff --git a/extern/bouncycastle b/extern/bouncycastle index 9b11b73f6..25df6cb25 160000 --- a/extern/bouncycastle +++ b/extern/bouncycastle @@ -1 +1 @@ -Subproject commit 9b11b73f6eb1476e2f7c2b066b2130d32e3b72f7 +Subproject commit 25df6cb254ae64dcd6505807b14193437d004a62 diff --git a/extern/openkeychain-api-lib b/extern/openkeychain-api-lib deleted file mode 160000 index 9b5b0b9ca..000000000 --- a/extern/openkeychain-api-lib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9b5b0b9ca32e80f3dadebe57d27e1422889d8254 diff --git a/extern/openpgp-api-lib b/extern/openpgp-api-lib index f953ca8cd..9603bc282 160000 --- a/extern/openpgp-api-lib +++ b/extern/openpgp-api-lib @@ -1 +1 @@ -Subproject commit f953ca8cdb7fbab0f8877589d9578d74005f8d1f +Subproject commit 9603bc282c62e26009a4bcca2e118e9ed4a0d006 diff --git a/extern/safeslinger-exchange b/extern/safeslinger-exchange index 5bc65b9cf..1104bb592 160000 --- a/extern/safeslinger-exchange +++ b/extern/safeslinger-exchange @@ -1 +1 @@ -Subproject commit 5bc65b9cf8d333c44fae4403bc5181c895abd74f +Subproject commit 1104bb592652ecfc9eef08ab66a5562b4af41b15 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 6ffa23784..384aba4a7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae2abab78..301737337 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Oct 28 14:50:17 CEST 2016 +#Wed Feb 01 18:53:00 CET 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip diff --git a/gradlew b/gradlew index 9aa616c27..4453ccea3 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,16 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then cd "$(dirname "$0")" fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/settings.gradle b/settings.gradle index 2244f1c3d..69ddb206a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,9 +8,6 @@ include ':extern:minidns' //include ':extern:safeslinger-exchange:safeslinger-exchange' include ':safeslinger-exchange' project(':safeslinger-exchange').projectDir = new File('extern/safeslinger-exchange/safeslinger-exchange') -//include ':extern:openkeychain-api-lib:openkeychain-intents' -include ':openkeychain-api-lib' -project(':openkeychain-api-lib').projectDir = new File('extern/openkeychain-api-lib/openkeychain-intents') //include ':extern:openpgp-api-lib:openpgp-api' include ':openpgp-api-lib' project(':openpgp-api-lib').projectDir = new File('extern/openpgp-api-lib/openpgp-api')