mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
This requires an account to exist before as we can't restart our lifecycle. So we don't automatically clear app data after each test, but rather need to delete an existing account manually before each test.
203 lines
6.9 KiB
Groovy
203 lines
6.9 KiB
Groovy
apply plugin: 'com.android.application'
|
|
apply plugin: 'witness'
|
|
apply from: 'witness.gradle'
|
|
|
|
def getStdout = { command, defaultValue ->
|
|
def stdout = new ByteArrayOutputStream()
|
|
try {
|
|
exec {
|
|
commandLine = command
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim()
|
|
} catch (Exception ignored) {
|
|
return defaultValue
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 30
|
|
buildToolsVersion '30.0.2'
|
|
|
|
packagingOptions {
|
|
doNotStrip '**/*.so'
|
|
}
|
|
|
|
defaultConfig {
|
|
minSdkVersion 16
|
|
targetSdkVersion 29
|
|
versionCode 10219
|
|
versionName "1.2.19"
|
|
applicationId "org.briarproject.briar.android"
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
|
buildConfigField "String", "GitHash",
|
|
"\"${getStdout(['git', 'rev-parse', '--short=7', 'HEAD'], 'No commit hash')}\""
|
|
def now = (long) (System.currentTimeMillis() / 1000)
|
|
buildConfigField "Long", "BuildTimestamp",
|
|
"${getStdout(['git', 'log', '-n', '1', '--format=%ct'], now)}000L"
|
|
testInstrumentationRunner 'org.briarproject.briar.android.BriarTestRunner'
|
|
testInstrumentationRunnerArguments disableAnalytics: 'true'
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
applicationIdSuffix ".debug"
|
|
shrinkResources false
|
|
minifyEnabled true
|
|
crunchPngs false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
|
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard-test.txt'
|
|
}
|
|
release {
|
|
shrinkResources false
|
|
minifyEnabled true
|
|
crunchPngs false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
|
}
|
|
}
|
|
|
|
flavorDimensions "version"
|
|
productFlavors {
|
|
screenshot {
|
|
dimension "version"
|
|
minSdkVersion 18
|
|
applicationIdSuffix ".screenshot" // = org.briarproject.briar.android.screenshot.debug
|
|
}
|
|
official {
|
|
dimension "version"
|
|
}
|
|
}
|
|
variantFilter { variant ->
|
|
if (variant.flavors*.name.contains("screenshot") && variant.buildType.name == "release") {
|
|
setIgnore(true)
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
testOptions {
|
|
execution 'ANDROIDX_TEST_ORCHESTRATOR'
|
|
unitTests {
|
|
includeAndroidResources = true
|
|
}
|
|
}
|
|
|
|
lintOptions {
|
|
warning 'MissingTranslation'
|
|
warning 'ImpliedQuantity'
|
|
warning 'ExtraTranslation'
|
|
// FIXME
|
|
warning 'InvalidPackage'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(path: ':briar-core', configuration: 'default')
|
|
implementation project(path: ':bramble-core', configuration: 'default')
|
|
implementation project(':bramble-android')
|
|
|
|
implementation 'androidx.fragment:fragment:1.3.0'
|
|
implementation 'androidx.preference:preference:1.1.1'
|
|
implementation 'androidx.exifinterface:exifinterface:1.3.1'
|
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
|
implementation 'com.google.android.material:material:1.2.1'
|
|
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0-rc03'
|
|
|
|
implementation 'info.guardianproject.panic:panic:1.0'
|
|
implementation 'info.guardianproject.trustedintents:trustedintents:0.2'
|
|
implementation 'de.hdodenhof:circleimageview:3.0.1'
|
|
implementation 'com.google.zxing:core:3.3.3' // newer version need minSdk 24
|
|
implementation 'uk.co.samuelwall:material-tap-target-prompt:3.0.0'
|
|
implementation 'com.vanniktech:emoji-google:0.6.0' // newer versions need minSdk 21
|
|
implementation 'com.github.kobakei:MaterialFabSpeedDial:1.2.1'
|
|
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
|
|
def glideVersion = '4.11.0'
|
|
implementation("com.github.bumptech.glide:glide:$glideVersion") {
|
|
exclude group: 'com.android.support'
|
|
exclude module: 'disklrucache' // when there's no disk cache, we can't accidentally use it
|
|
}
|
|
|
|
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'
|
|
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
|
|
|
|
compileOnly 'javax.annotation:jsr250-api:1.0'
|
|
|
|
def espressoVersion = '3.3.0'
|
|
def jmockVersion = '2.8.2'
|
|
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
|
testImplementation project(path: ':bramble-core', configuration: 'testOutput')
|
|
testImplementation 'androidx.test:runner:1.3.0'
|
|
testImplementation 'androidx.test.ext:junit:1.1.2'
|
|
testImplementation 'androidx.fragment:fragment-testing:1.2.5'
|
|
testImplementation "androidx.arch.core:core-testing:2.1.0"
|
|
testImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
|
|
testImplementation 'org.robolectric:robolectric:4.3.1'
|
|
testImplementation 'org.mockito:mockito-core:3.1.0'
|
|
testImplementation 'junit:junit:4.13.1'
|
|
testImplementation "org.jmock:jmock:$jmockVersion"
|
|
testImplementation "org.jmock:jmock-junit4:$jmockVersion"
|
|
testImplementation "org.jmock:jmock-legacy:$jmockVersion"
|
|
testAnnotationProcessor "com.google.dagger:dagger-compiler:2.24"
|
|
|
|
androidTestImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
|
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
|
|
androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoVersion"
|
|
androidTestImplementation "androidx.test.espresso:espresso-intents:$espressoVersion"
|
|
androidTestImplementation 'androidx.test:runner:1.3.0'
|
|
androidTestUtil 'androidx.test:orchestrator:1.3.0'
|
|
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:2.24"
|
|
androidTestCompileOnly 'javax.annotation:jsr250-api:1.0'
|
|
androidTestImplementation 'junit:junit:4.13.1'
|
|
androidTestScreenshotImplementation 'tools.fastlane:screengrab:2.0.0'
|
|
androidTestScreenshotImplementation 'com.jraska:falcon:2.1.1'
|
|
androidTestScreenshotImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
|
|
}
|
|
|
|
task verifyTranslations {
|
|
doLast {
|
|
def file = project.file("src/main/res/values/arrays.xml")
|
|
def arrays = new XmlParser().parse(file)
|
|
def lc = arrays.children().find { it.@name == "pref_language_values" }
|
|
def translations = []
|
|
lc.children().each { value -> translations.add(value.text()) }
|
|
|
|
def folders = ["default", "en-US"]
|
|
def exceptions = ["values-night", "values-v21", "values-ldrtl"]
|
|
project.file("src/main/res").eachDir { dir ->
|
|
if (dir.name.startsWith("values-") && !exceptions.contains(dir.name)) {
|
|
folders.add(dir.name.substring(7).replace("-r", "-"))
|
|
}
|
|
}
|
|
folders.each { n ->
|
|
if (!translations.remove(n) && n != 'iw') {
|
|
throw new GradleException("Translation " + n + " is missing in $file")
|
|
}
|
|
}
|
|
if (translations.size() != 0)
|
|
throw new GradleException("Translations\n" + translations.join("\n")
|
|
+ "\nhave no matching value folder")
|
|
|
|
// Some devices use iw instead of he for hebrew
|
|
def hebrew_legacy = project.file("src/main/res/values-iw")
|
|
def hebrew = project.file("src/main/res/values-he")
|
|
// Copy values-he to values-iw
|
|
if (hebrew.exists()) {
|
|
hebrew_legacy.mkdir()
|
|
copy {
|
|
from hebrew.getAbsolutePath()
|
|
into hebrew_legacy.getAbsolutePath()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
project.afterEvaluate {
|
|
preBuild.dependsOn.add(verifyTranslations)
|
|
}
|