apply plugin: 'com.android.library' apply plugin: 'witness' apply from: 'witness.gradle' android { compileSdkVersion 33 buildToolsVersion '33.0.0' packagingOptions { doNotStrip '**/*.so' } defaultConfig { // FIXME: sqlite-jdbc-crypt uses __register_atfork which is only available on API >= 23. // We might be able to solve this by recompiling (or asking upstream to recompile) minSdkVersion 21 targetSdkVersion 33 versionCode 10506 versionName "1.5.6" consumerProguardFiles 'proguard-rules.txt' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments disableAnalytics: 'true' } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } lintOptions { // FIXME warning "LintError" warning "InvalidPackage" warning "MissingPermission" warning "InlinedApi", "ObsoleteSdkInt", "Override", "NewApi", "UnusedAttribute" } } configurations { tor sqliteJdbcCrypt } dependencies { api 'org.briarproject:dont-kill-me-lib:0.2.7' // In theory this dependency shouldn't be needed, but without it Android Studio's linter will // complain about unresolved symbols for bramble-api test classes in bramble-android tests, // even though the bramble-api test classes are provided by the testImplementation dependency // below and the compiler can find them implementation project(':bramble-api') implementation project(':bramble-core') implementation 'androidx.annotation:annotation:1.5.0' implementation "org.briarproject:onionwrapper-android:$onionwrapper_version" tor "org.briarproject:tor-android:$tor_version" tor "org.briarproject:obfs4proxy-android:$obfs4proxy_version" tor "org.briarproject:snowflake-android:$snowflake_version" sqliteJdbcCrypt "io.github.willena:sqlite-jdbc:$sqlite_jdbc_crypt_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" compileOnly 'javax.annotation:jsr250-api:1.0' testImplementation project(path: ':bramble-api', configuration: 'testOutput') testImplementation "junit:junit:$junit_version" testImplementation "org.jmock:jmock:$jmock_version" testImplementation "org.jmock:jmock-junit4:$jmock_version" testImplementation "org.jmock:jmock-imposters:$jmock_version" } def jniLibsDir = 'src/main/jniLibs' task cleanJniLibs { inputs.dir jniLibsDir outputs.dir jniLibsDir doLast { delete fileTree(jniLibsDir).filter { it.name.endsWith('.so') } } } clean.dependsOn cleanJniLibs task unpackJniLibs { outputs.dir jniLibsDir doLast { // Tor copy { from configurations.tor.collect { zipTree(it) } into jniLibsDir } // sqlite-jdbc-crypt def archMap = [ aarch64: 'arm64-v8a', arm : 'armeabi-v7a', x86 : 'x86', x86_64 : 'x86_64' ] configurations.sqliteJdbcCrypt.collect { File artifact -> zipTree(artifact).each { File f -> for (String arch : archMap.keySet()) { if (f.absolutePath.endsWith("/Linux-Android/$arch/libsqlitejdbc.so")) { def archDir = new File(jniLibsDir, archMap.get(arch)) archDir.mkdirs() copy { from f into archDir } break } } } } } dependsOn cleanJniLibs } preBuild.dependsOn unpackJniLibs