mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Fix debug/release build separation
This commit is contained in:
parent
d16b09b2a6
commit
6749b03d9a
@ -12,7 +12,7 @@ dependencies {
|
||||
compile 'com.android.support:cardview-v7:22.1.0'
|
||||
|
||||
// Local Unit tests with Robolectric
|
||||
// https://developer.android.com/training/testing/unit-testing/local-unit-tests.html#run
|
||||
// https://developer.android.com/training/testing/unit-testing/local-unit-tests.html
|
||||
// https://github.com/nenick/AndroidStudioAndRobolectric
|
||||
// http://www.vogella.com/tutorials/Robolectric/article.html
|
||||
testCompile 'junit:junit:4.12'
|
||||
@ -126,40 +126,20 @@ android {
|
||||
|
||||
// Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
|
||||
buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\""
|
||||
buildConfigField "String", "PROVIDER_AUTHORITY", "\"org.sufficientlysecure.keychain.provider\""
|
||||
buildConfigField "String", "TEMPSTORAGE_AUTHORITY", "\"org.sufficientlysecure.keychain.tempstorage\""
|
||||
|
||||
// Reference them in .xml files.
|
||||
resValue "string", "account_type", "org.sufficientlysecure.keychain.account"
|
||||
resValue "string", "provider_authority", "org.sufficientlysecure.keychain.provider"
|
||||
resValue "string", "tempstorage_authority", "org.sufficientlysecure.keychain.tempstorage"
|
||||
}
|
||||
|
||||
|
||||
debug {
|
||||
// Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
|
||||
buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\""
|
||||
buildConfigField "String", "PROVIDER_AUTHORITY", "\"org.sufficientlysecure.keychain.provider\""
|
||||
buildConfigField "String", "TEMPSTORAGE_AUTHORITY", "\"org.sufficientlysecure.keychain.tempstorage\""
|
||||
|
||||
// Reference them in .xml files.
|
||||
resValue "string", "account_type", "org.sufficientlysecure.keychain.account"
|
||||
resValue "string", "provider_authority", "org.sufficientlysecure.keychain.provider"
|
||||
resValue "string", "tempstorage_authority", "org.sufficientlysecure.keychain.tempstorage"
|
||||
}
|
||||
|
||||
/*extra {
|
||||
applicationIdSuffix ".debug"
|
||||
|
||||
// Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
|
||||
buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\""
|
||||
buildConfigField "String", "PROVIDER_AUTHORITY", "\"org.sufficientlysecure.keychain.debug.provider\""
|
||||
buildConfigField "String", "TEMPSTORAGE_AUTHORITY", "\"org.sufficientlysecure.keychain.debug.tempstorage\""
|
||||
|
||||
// Reference them in .xml files.
|
||||
resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account"
|
||||
resValue "string", "provider_authority", "org.sufficientlysecure.keychain.debug.provider"
|
||||
resValue "string", "tempstorage_authority", "org.sufficientlysecure.keychain.debug.tempstorage"
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -210,12 +190,6 @@ android {
|
||||
exclude 'LICENSE.txt'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// workaround?
|
||||
//tasks.withType(Test).whenTaskAdded {
|
||||
// project.android.defaultConfig.applicationId 'org.sufficientlysecure.keychain'
|
||||
//}
|
||||
|
||||
// NOTE: This disables Lint!
|
||||
tasks.whenTaskAdded { task ->
|
||||
|
@ -722,7 +722,7 @@
|
||||
|
||||
<provider
|
||||
android:name=".provider.KeychainProvider"
|
||||
android:authorities="org.sufficientlysecure.keychain.provider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- Internal classes of the remote APIs (not exported) -->
|
||||
@ -800,7 +800,7 @@
|
||||
<!-- Storage Provider for temporary decrypted files -->
|
||||
<provider
|
||||
android:name=".provider.TemporaryStorageProvider"
|
||||
android:authorities="@string/tempstorage_authority"
|
||||
android:authorities="${applicationId}.tempstorage"
|
||||
android:exported="true"
|
||||
android:writePermission="${applicationId}.WRITE_TEMPORARY_STORAGE" />
|
||||
|
||||
|
@ -39,8 +39,8 @@ public final class Constants {
|
||||
public static final String ACCOUNT_TYPE = BuildConfig.ACCOUNT_TYPE;
|
||||
public static final String CUSTOM_CONTACT_DATA_MIME_TYPE = "vnd.android.cursor.item/vnd.org.sufficientlysecure.keychain.key";
|
||||
|
||||
public static final String PROVIDER_AUTHORITY = BuildConfig.PROVIDER_AUTHORITY;
|
||||
public static final String TEMPSTORAGE_AUTHORITY = BuildConfig.TEMPSTORAGE_AUTHORITY;
|
||||
public static final String PROVIDER_AUTHORITY = BuildConfig.APPLICATION_ID + ".provider";
|
||||
public static final String TEMPSTORAGE_AUTHORITY = BuildConfig.APPLICATION_ID + ".tempstorage";
|
||||
|
||||
// as defined in http://tools.ietf.org/html/rfc3156, section 7
|
||||
public static final String NFC_MIME = "application/pgp-keys";
|
||||
|
@ -29,6 +29,7 @@ import org.robolectric.shadows.ShadowLog;
|
||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
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;
|
||||
@ -54,7 +55,7 @@ import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class CertifyOperationTest {
|
||||
|
||||
static UncachedKeyRing mStaticRing1, mStaticRing2;
|
||||
|
@ -31,6 +31,7 @@ import org.robolectric.shadows.ShadowLog;
|
||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.ExportResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
|
||||
@ -53,7 +54,7 @@ import java.security.Security;
|
||||
import java.util.Iterator;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class ExportTest {
|
||||
|
||||
static Passphrase mPassphrase = TestingUtils.genPassphrase(true);
|
||||
|
@ -32,6 +32,7 @@ import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.PromoteKeyResult;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
|
||||
@ -55,7 +56,7 @@ import java.security.Security;
|
||||
import java.util.Iterator;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class PromoteKeyOperationTest {
|
||||
|
||||
static UncachedKeyRing mStaticRing;
|
||||
|
@ -24,9 +24,10 @@ import org.robolectric.RobolectricGradleTestRunner;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class KeyRingTest {
|
||||
|
||||
@Test
|
||||
|
@ -31,6 +31,7 @@ import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.spongycastle.openpgp.PGPEncryptedData;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpSignEncryptResult;
|
||||
@ -55,7 +56,7 @@ import java.security.Security;
|
||||
import java.util.HashSet;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class PgpEncryptDecryptTest {
|
||||
|
||||
static Passphrase mPassphrase = TestingUtils.genPassphrase(true);
|
||||
|
@ -42,6 +42,7 @@ import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.spongycastle.openpgp.PGPSignature;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult;
|
||||
@ -73,7 +74,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class PgpKeyOperationTest {
|
||||
|
||||
static UncachedKeyRing staticRing;
|
||||
|
@ -55,6 +55,7 @@ import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder;
|
||||
import org.spongycastle.util.Strings;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
@ -82,7 +83,7 @@ import java.util.Iterator;
|
||||
*/
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class UncachedKeyringCanonicalizeTest {
|
||||
|
||||
static UncachedKeyRing staticRing;
|
||||
|
@ -35,6 +35,7 @@ import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.spongycastle.util.Strings;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
|
||||
@ -81,7 +82,7 @@ import java.util.Random;
|
||||
*
|
||||
*/
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class UncachedKeyringMergeTest {
|
||||
|
||||
static UncachedKeyRing staticRingA, staticRingB;
|
||||
|
@ -29,6 +29,7 @@ import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowLog;
|
||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult;
|
||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing.IteratorWithIOThrow;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
@ -44,7 +45,7 @@ import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class UncachedKeyringTest {
|
||||
|
||||
static UncachedKeyRing staticRing, staticPubRing;
|
||||
|
@ -28,10 +28,11 @@ 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.sufficientlysecure.keychain.support.KeyringTestingHelper;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class ProviderHelperKeyringTest {
|
||||
|
||||
@Test
|
||||
|
@ -31,6 +31,7 @@ import org.robolectric.shadows.ShadowLog;
|
||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
|
||||
@ -45,7 +46,7 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class ProviderHelperSaveTest {
|
||||
|
||||
ProviderHelper mProviderHelper = new ProviderHelper(RuntimeEnvironment.application);
|
||||
|
@ -25,10 +25,11 @@ import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowLog;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.util.Iso7816TLV.Iso7816CompositeTLV;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class Iso7816TLVTest {
|
||||
|
||||
@Before
|
||||
|
@ -31,6 +31,7 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowLog;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.WorkaroundBuildConfig;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableFileCache.IteratorWithSize;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -38,7 +39,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
@Config(constants = WorkaroundBuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml")
|
||||
public class ParcelableFileCacheTest {
|
||||
|
||||
@Before
|
||||
|
Loading…
Reference in New Issue
Block a user