Newer
Older
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
if (project.hasProperty("coverage")) {
apply plugin: 'jacoco'
}
// Do not use `mavenCentral()`, it prevents Dependabot from working properly
maven {
url 'https://repo1.maven.org/maven2'
}
testOptions.unitTests.includeAndroidResources = true
minSdk versions.minSdk
targetSdk versions.targetSdk
// Multidex is useful for tests
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true'
// WARNING: always restore this line after importing code from Element Android (2/2)
buildConfigField "String", "SDK_VERSION", "\"${project.getProperties().getOrDefault("VERSION_NAME", "0.0.0")}\""
buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\""
buildConfigField "String", "GIT_SDK_REVISION_DATE", "\"${gitRevisionDate()}\""
defaultConfig {
consumerProguardFiles 'proguard-rules.pro'
}
}
testOptions {
// execution 'ANDROIDX_TEST_ORCHESTRATOR'
if (project.hasProperty("coverage")) {
// Set to true to log privacy or sensible data, such as token
buildConfigField "boolean", "LOG_PRIVATE_DATA", project.property("vector.debugPrivateData")
// Set to BODY instead of NONE to enable logging
buildConfigField "okhttp3.logging.HttpLoggingInterceptor.Level", "OKHTTP_LOGGING_LEVEL", "okhttp3.logging.HttpLoggingInterceptor.Level." + project.property("vector.httpLogLevel")
}
release {
buildConfigField "boolean", "LOG_PRIVATE_DATA", "false"
buildConfigField "okhttp3.logging.HttpLoggingInterceptor.Level", "OKHTTP_LOGGING_LEVEL", "okhttp3.logging.HttpLoggingInterceptor.Level.BASIC"
sourceCompatibility versions.sourceCompat
targetCompatibility versions.targetCompat
freeCompilerArgs += [
// Disabled for now, there are too many errors. Could be handled in another dedicated PR
// '-Xexplicit-api=strict', // or warning
"-opt-in=kotlin.RequiresOptIn",
// Opt in for kotlinx.coroutines.FlowPreview
"-opt-in=kotlinx.coroutines.FlowPreview",
}
sourceSets {
androidTest {
java.srcDirs += "src/sharedTest/java"
}
test {
java.srcDirs += "src/sharedTest/java"
}
}
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
def cmd = "git rev-parse --short=8 HEAD"
return cmd.execute().text.trim()
}
static def gitRevisionUnixDate() {
def cmd = "git show -s --format=%ct HEAD^{commit}"
return cmd.execute().text.trim()
}
static def gitRevisionDate() {
def cmd = "git show -s --format=%ci HEAD^{commit}"
return cmd.execute().text.trim()
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
api libs.jetbrains.coroutinesCore
api libs.jetbrains.coroutinesAndroid
// implementation(name: 'crypto-android-release', ext: 'aar')
api libs.androidx.lifecycleCommon
api libs.androidx.lifecycleProcess
// When version of okhttp is updated (current is 4.9.3), consider removing the workaround
// to force usage of Protocol.HTTP_1_1. Check the status of:
// - https://github.com/square/okhttp/issues/3278
// - https://github.com/square/okhttp/issues/4455
// - https://github.com/square/okhttp/issues/3146
//Do not use bom for publishing
def okhttp_version = "4.12.0"
api "com.squareup.okhttp3:okhttp:$okhttp_version"
api "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
api "com.atlassian.commonmark:commonmark:0.13.0"
// olm lib is now hosted in MavenCentral
api("org.futo.gitlab.circles:circles-rust-components-kotlin:v0.3.15.6@aar") {
transitive = true
}
//rustCryptoApi project(":library:rustCrypto")
// Note: version sticks to 1.9.2 due to https://github.com/mockk/mockk/issues/281
testImplementation libs.mockk.mockk
testImplementation libs.tests.kluent
testImplementation libs.jetbrains.coroutinesTest
// Plant Timber tree for test
testImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'
// Transitively required for mocking realm as monarchy doesn't expose Rx
testImplementation libs.rx.rxKotlin
kaptAndroidTest libs.dagger.daggerCompiler
androidTestImplementation libs.androidx.testCore
androidTestImplementation libs.androidx.testRunner
androidTestImplementation libs.androidx.testRules
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.androidx.espressoCore
androidTestImplementation libs.tests.kluent
androidTestImplementation libs.mockk.mockkAndroid
androidTestImplementation libs.androidx.coreTesting
androidTestImplementation libs.jetbrains.coroutinesAndroid
androidTestImplementation libs.jetbrains.coroutinesTest
androidTestImplementation libs.tests.timberJunitRule
androidTestUtil libs.androidx.orchestrator
publishing {
publications {
release(MavenPublication) {
groupId = "org.futo.gitlab.circles"
artifactId = "matrix-android-sdk"