PixelDroid-App-Android/app/build.gradle

294 lines
12 KiB
Groovy
Raw Normal View History

2022-07-26 15:10:14 +02:00
import com.android.build.api.dsl.ManagedVirtualDevice
plugins {
2022-10-15 20:13:29 +02:00
id "com.cookpad.android.plugin.license-tools" version "1.2.8"
}
2020-02-28 00:36:26 +01:00
apply plugin: 'com.android.application'
2020-02-28 17:08:54 +01:00
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
2020-02-28 17:08:54 +01:00
apply plugin: 'jacoco'
2022-10-30 16:24:46 +01:00
apply plugin: "kotlin-parcelize"
2020-02-28 00:36:26 +01:00
2022-10-30 20:51:09 +01:00
2021-06-29 22:57:53 +02:00
// Force latest version of Jacoco, initially done to resolve https://github.com/jacoco/jacoco/issues/1155
jacoco.toolVersion = "0.8.7"
2020-02-28 00:36:26 +01:00
android {
2020-03-07 18:13:26 +01:00
2022-08-21 00:40:15 +02:00
namespace 'org.pixeldroid.app'
compileSdkVersion 33
buildToolsVersion '33.0.0'
2020-03-07 18:13:26 +01:00
compileOptions {
2021-09-25 13:52:18 +02:00
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
}
2020-02-28 00:36:26 +01:00
defaultConfig {
2020-02-28 17:08:54 +01:00
minSdkVersion 23
targetSdkVersion 33
versionCode 19
2022-03-18 10:42:49 +01:00
versionName "1.0.beta" + versionCode
2020-02-28 00:36:26 +01:00
2022-11-25 17:00:13 +01:00
//TODO add resConfigs("en", "fr", "ja",...) ?
2022-07-26 21:52:38 +02:00
testInstrumentationRunner "org.pixeldroid.app.testUtility.TestRunner"
2020-03-07 18:13:26 +01:00
testInstrumentationRunnerArguments clearPackageData: 'true'
2020-02-28 00:36:26 +01:00
}
sourceSets {
main.java.srcDirs += 'src/main/java'
test.java.srcDirs += 'src/test/java'
staging.res.srcDirs += 'src/debug/res'
androidTest.java.srcDirs += 'src/androidTest/java'
2020-02-28 00:36:26 +01:00
}
2021-02-17 22:55:31 +01:00
testBuildType "staging"
2020-02-28 00:36:26 +01:00
buildTypes {
2022-08-02 19:07:06 +02:00
debug {
applicationIdSuffix '.debug'
versionNameSuffix "-debug"
}
2021-02-17 22:55:31 +01:00
staging {
initWith debug
2020-02-28 17:08:54 +01:00
testCoverageEnabled true
2021-02-17 22:55:31 +01:00
// These values are first looked for in the env variables, and, if not found there,
// in the local.properties file (which is not checked into version control of course!).
// If you are not running the integration tests, you can just set them to dummy values
// in local.properties or comment the buildConfigField lines
def localProperties = new Properties()
if (rootProject.file("local.properties").exists()) {
localProperties.load(new FileInputStream(rootProject.file("local.properties")))
}
2021-09-06 15:50:15 +02:00
buildConfigField "String", "USER_ID", System.getenv("USER_ID") ?: localProperties['USER_ID'] ?: '""'
buildConfigField "String", "INSTANCE_URI", System.getenv("INSTANCE_URI") ?: localProperties['INSTANCE_URI'] ?: '""'
buildConfigField "String", "ACCESS_TOKEN", System.getenv("ACCESS_TOKEN") ?: localProperties['ACCESS_TOKEN'] ?: '""'
buildConfigField "String", "REFRESH_TOKEN", System.getenv("REFRESH_TOKEN") ?: localProperties['REFRESH_TOKEN'] ?: '""'
buildConfigField "String", "CLIENT_ID", System.getenv("CLIENT_ID") ?: localProperties['CLIENT_ID'] ?: '""'
buildConfigField "String", "CLIENT_SECRET", System.getenv("CLIENT_SECRET") ?: localProperties['CLIENT_SECRET'] ?: '""'
2020-02-28 17:08:54 +01:00
}
2020-02-28 00:36:26 +01:00
release {
minifyEnabled true
shrinkResources true
proguardFiles 'proguard-rules.pro'
2020-02-28 00:36:26 +01:00
}
}
2021-06-29 22:57:53 +02:00
/**
* Make a string with the application_id (available in xml etc)
*/
android.applicationVariants.all { variant ->
variant.resValue 'string', 'application_id', variant.applicationId
}
testOptions {
animationsDisabled true
2022-07-26 15:10:14 +02:00
managedDevices {
devices {
pixel2api30 (ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 30
// To include Google services, use "google".
2022-07-26 18:40:41 +02:00
systemImageSource = "aosp-atd"
2022-07-26 15:10:14 +02:00
// Whether the image must be a 64 bit image. Defaults to false,
// in which case the managed device will use a 32 bit image.
// Not applicable to arm64 machines.
require64Bit = false
}
}
}
2020-03-07 18:13:26 +01:00
}
buildFeatures {
2021-09-06 15:50:15 +02:00
viewBinding true
dataBinding = true
}
2020-02-28 00:36:26 +01:00
apply plugin: 'kotlin-kapt'
2022-03-12 22:07:24 +01:00
lint {
//We can't expect translators to always keep up immediately:
// don't fail if a a string is untranslated
2022-03-12 22:07:24 +01:00
disable 'MissingTranslation'
// This lint indicates a wrong translation:
// Remove this exception once https://github.com/WeblateOrg/weblate/issues/7520 is solved
disable 'MissingQuantity'
2022-03-12 22:07:24 +01:00
}
2020-02-28 00:36:26 +01:00
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
2022-11-25 17:00:13 +01:00
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.0'
2021-09-25 13:52:18 +02:00
/**
* AndroidX dependencies:
*/
2022-11-25 17:00:13 +01:00
implementation 'androidx.appcompat:appcompat:1.6.0-rc01'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'androidx.core:core-ktx:1.9.0'
2022-03-12 22:07:24 +01:00
implementation 'androidx.preference:preference-ktx:1.2.0'
2022-06-07 20:46:46 +02:00
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
2022-10-29 19:07:59 +02:00
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
2021-11-26 16:54:29 +01:00
implementation "androidx.browser:browser:1.4.0"
2021-06-07 22:23:59 +02:00
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
2022-10-29 19:07:59 +02:00
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
2022-03-12 22:07:24 +01:00
implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-common-java8:2.5.1"
implementation "androidx.annotation:annotation:1.5.0"
implementation 'androidx.gridlayout:gridlayout:1.0.0'
2022-10-29 19:07:59 +02:00
implementation "androidx.activity:activity-ktx:1.6.1"
implementation 'androidx.fragment:fragment-ktx:1.5.4'
2021-11-26 16:54:29 +01:00
implementation 'androidx.work:work-runtime-ktx:2.7.1'
2022-02-14 11:33:00 +01:00
implementation 'androidx.media2:media2-widget:1.2.1'
implementation 'androidx.media2:media2-player:1.2.1'
// Use the most recent version of CameraX
2022-07-08 23:20:44 +02:00
def cameraX_version = '1.1.0'
2022-03-12 22:07:24 +01:00
implementation "androidx.camera:camera-core:$cameraX_version"
implementation "androidx.camera:camera-camera2:$cameraX_version"
// CameraX Lifecycle library
2020-12-19 21:12:56 +01:00
implementation "androidx.camera:camera-lifecycle:$cameraX_version"
// CameraX View class
2022-03-12 22:07:24 +01:00
implementation "androidx.camera:camera-view:$cameraX_version"
2020-03-07 18:13:26 +01:00
def room_version = "2.4.3"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
2022-01-23 14:08:26 +01:00
implementation "androidx.room:room-paging:$room_version"
/**
* End of AndroidX section
* ----------------------------------------------------------
*/
2022-06-10 23:41:29 +02:00
implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0'
2022-10-25 13:08:57 +02:00
implementation 'com.google.android.material:material:1.7.0'
//Dagger (dependency injection)
implementation 'com.google.dagger:dagger-android:2.44'
implementation 'com.google.dagger:dagger-android-support:2.44'
// if you use the support libraries
kapt 'com.google.dagger:dagger-android-processor:2.44'
kapt 'com.google.dagger:dagger-compiler:2.44'
2022-07-08 23:20:44 +02:00
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
2021-09-25 13:52:18 +02:00
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
2022-07-08 23:20:44 +02:00
implementation 'io.reactivex.rxjava3:rxjava:3.1.5'
2021-09-25 13:52:18 +02:00
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
2021-02-04 17:34:56 +01:00
implementation 'com.github.connyduck:sparkbutton:4.1.0'
2022-11-03 18:31:07 +01:00
implementation 'org.pixeldroid.pixeldroid:android-media-editor:1.2'
implementation project(path: ':scrambler')
implementation('com.github.bumptech.glide:glide:4.14.2') {
2020-03-05 21:59:40 +01:00
exclude group: "com.android.support"
}
implementation 'com.github.bumptech.glide:okhttp3-integration:4.14.2'
implementation('com.github.bumptech.glide:recyclerview-integration:4.14.2') {
2020-03-21 19:46:45 +01:00
// Excludes the support library because it's already included by Glide.
transitive = false
}
implementation 'com.github.bumptech.glide:annotations:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
kapt 'com.github.bumptech.glide:compiler:4.14.2'
2020-03-07 19:45:27 +01:00
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
2022-07-08 23:20:44 +02:00
implementation 'com.mikepenz:materialdrawer:9.0.1'
// Add for NavController support
2022-07-08 23:20:44 +02:00
implementation 'com.mikepenz:materialdrawer-nav:9.0.1'
//iconics
implementation 'com.mikepenz:iconics-core:5.4.0'
2022-07-08 23:20:44 +02:00
implementation 'com.mikepenz:materialdrawer-iconics:9.0.1'
implementation 'com.mikepenz:iconics-views:5.4.0'
2021-10-08 00:30:31 +02:00
implementation 'com.mikepenz:google-material-typeface:4.0.0.2-kotlin@aar'
2021-09-06 15:50:15 +02:00
implementation 'com.karumi:dexter:6.2.3'
Feature/post creation (#83) * added perm and features for cameraS, gps and external storage * added camera activity accessible from main activity * added button to redirect to camera activity * implementing callback flow to use camera * working camera * added texture view for camera display * added camera activity * implemented texture listener * camera not working, flow done, no feedback implemented * camera working * refactored code, still an activity * added private to internal function, better error function handling * deleted camera activity * added camera fragment * added camera fragment * refactored camera as fragment * necessary dependencies for fragment testing * initial camera fragment test * corrected access to activity form fragment * Added state changes and termination * added lines to test, to test coverage * Removed unsupported state STARTED state transition * Added basic tests to test code coverage * use layout for tests, to trigger permissions requirements * grant camera permission to app in camera test * replaced null handlers by proper function getter * changed layout, added takePictureButton * using expresso to get code coverage on camea * take picture flow not finished * dummy change to camera test to perform new build * added connection flow before test to reach main activity * can take a picture and put it to ImageView * replaced button text with images * smaller buttons * test camera fragment buttons * added orientation handler * changed icon to make travis happy * test new espresso config for travis * removed useless rule * deleted useless val * added layout ID's * moved swipes from Before to Tests, and thread sleep * stoped swiping, now tests from fragment directly * start post creation flow * use Uri when taking photo, can now go back from picture preview * adjusted test and flow idea * tests on displayed UI elements for the post creation fragment * refactor camera fragment into transition new post fragemnt * finished first phase: get a picture Uri * fixed lint error found by travis CI * added global timeout to test * test the new way of test * refactor new way of testing * added in-app camera view and linked everything to the final flow + started API to post * strugling on the upload media part * upload image on server implemented * post upload implemented * added API call to get max_toot_chars and correct def of a post description * fixed some tests * fix tests: clicking on tabs make the app crash because of the camera fragment * comment problematic chunk of code while samuel tries to fix it * switch minimumsdk to api 24 * Revert "switch minimumsdk to api 24" This reverts commit 24ce46dd82038b59732fd958e5e071ded39cd549. * deactivited live camera for API 23 * tests for post creation fragment UI elements * remove worthless UI testing and add gallery intent test * removed camera intent for now * some refactor * lint error and more refactor * more refactor on merge from master * refactor and test for PostCreationActivity * Revert "refactor and test for PostCreationActivity" This reverts commit a0c146bcc545cdc3792df4806e6b0c908bd18747. * Revert "Revert "refactor and test for PostCreationActivity"" This reverts commit 147a9ed80d5f9c9e3c38b5a977786bfb39eeb1b6. * permissions correction for test * updtated test * fix a test and refactor * relink correct fragment * save picture locally * test post button * requested changes * fixed required changes * Revert "fixed required changes" This reverts commit 405a9d4d1af05353e30028e60041cc1c97569c1b. * redo change request * added /media api response to mockserver Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-04-24 12:44:12 +02:00
2021-03-16 00:23:10 +01:00
implementation 'com.github.ligi:tracedroid:4.1'
Feature/post creation (#83) * added perm and features for cameraS, gps and external storage * added camera activity accessible from main activity * added button to redirect to camera activity * implementing callback flow to use camera * working camera * added texture view for camera display * added camera activity * implemented texture listener * camera not working, flow done, no feedback implemented * camera working * refactored code, still an activity * added private to internal function, better error function handling * deleted camera activity * added camera fragment * added camera fragment * refactored camera as fragment * necessary dependencies for fragment testing * initial camera fragment test * corrected access to activity form fragment * Added state changes and termination * added lines to test, to test coverage * Removed unsupported state STARTED state transition * Added basic tests to test code coverage * use layout for tests, to trigger permissions requirements * grant camera permission to app in camera test * replaced null handlers by proper function getter * changed layout, added takePictureButton * using expresso to get code coverage on camea * take picture flow not finished * dummy change to camera test to perform new build * added connection flow before test to reach main activity * can take a picture and put it to ImageView * replaced button text with images * smaller buttons * test camera fragment buttons * added orientation handler * changed icon to make travis happy * test new espresso config for travis * removed useless rule * deleted useless val * added layout ID's * moved swipes from Before to Tests, and thread sleep * stoped swiping, now tests from fragment directly * start post creation flow * use Uri when taking photo, can now go back from picture preview * adjusted test and flow idea * tests on displayed UI elements for the post creation fragment * refactor camera fragment into transition new post fragemnt * finished first phase: get a picture Uri * fixed lint error found by travis CI * added global timeout to test * test the new way of test * refactor new way of testing * added in-app camera view and linked everything to the final flow + started API to post * strugling on the upload media part * upload image on server implemented * post upload implemented * added API call to get max_toot_chars and correct def of a post description * fixed some tests * fix tests: clicking on tabs make the app crash because of the camera fragment * comment problematic chunk of code while samuel tries to fix it * switch minimumsdk to api 24 * Revert "switch minimumsdk to api 24" This reverts commit 24ce46dd82038b59732fd958e5e071ded39cd549. * deactivited live camera for API 23 * tests for post creation fragment UI elements * remove worthless UI testing and add gallery intent test * removed camera intent for now * some refactor * lint error and more refactor * more refactor on merge from master * refactor and test for PostCreationActivity * Revert "refactor and test for PostCreationActivity" This reverts commit a0c146bcc545cdc3792df4806e6b0c908bd18747. * Revert "Revert "refactor and test for PostCreationActivity"" This reverts commit 147a9ed80d5f9c9e3c38b5a977786bfb39eeb1b6. * permissions correction for test * updtated test * fix a test and refactor * relink correct fragment * save picture locally * test post button * requested changes * fixed required changes * Revert "fixed required changes" This reverts commit 405a9d4d1af05353e30028e60041cc1c97569c1b. * redo change request * added /media api response to mockserver Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-04-24 12:44:12 +02:00
2021-03-16 00:48:08 +01:00
implementation 'me.relex:circleindicator:2.1.6'
Camera tab (#149) * added CameraX depedencies * added basis of camera activity layout * basis of camera layout * declare activity and request camera permissions * request camera permissions * implemented basic viewFinder aka stream preview * added drawing of layout * linked camera activity to new post fragment * texture view now fills the entire screen * added button, call to camera activity FOR RESULT and return to New Post Fragment * can now take a photo a upload it * locked camera activity in portrait orientation * added basic test to CameraActivity * added test with device orientation * deleted orientation test as it broke the whole app * deleted occurence of orientation tool for tests * added buttons for flipping cameras and picture upload * replaced NewPostFragment and took its job * deleted cameraActivity * replaced newPostFragment by Camera Activity * revamped NewPostFragment * perform basic test on buttons * corrected retrieval of buttons * robust camera fragment * fix thumbnail permission requests * refactor, finish fragment * try to fix build not working on CI * Add dependency * Fix camera test * update tests, delete obsolete xml * Try to fix test * Stop nullpointer that happens sometimes, when it shouldn't * remove unused strings * edit the photo instead of posting directly * fix test after changing putextra name * remove useless analyzer * add test? * better tests? * add dependencies * update dependencies * try to fix build * undo change to build.gradle * try to fix tests * try to fix tests * remove useless listener * save image so that ci can go through gallery * remove extraneous permission * Any app that declares the WRITE_EXTERNAL_STORAGE permission is implicitly granted this permission. Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-05-15 12:10:28 +02:00
/**
* Not in release, so not mentioned in licenses list
*/
Camera tab (#149) * added CameraX depedencies * added basis of camera activity layout * basis of camera layout * declare activity and request camera permissions * request camera permissions * implemented basic viewFinder aka stream preview * added drawing of layout * linked camera activity to new post fragment * texture view now fills the entire screen * added button, call to camera activity FOR RESULT and return to New Post Fragment * can now take a photo a upload it * locked camera activity in portrait orientation * added basic test to CameraActivity * added test with device orientation * deleted orientation test as it broke the whole app * deleted occurence of orientation tool for tests * added buttons for flipping cameras and picture upload * replaced NewPostFragment and took its job * deleted cameraActivity * replaced newPostFragment by Camera Activity * revamped NewPostFragment * perform basic test on buttons * corrected retrieval of buttons * robust camera fragment * fix thumbnail permission requests * refactor, finish fragment * try to fix build not working on CI * Add dependency * Fix camera test * update tests, delete obsolete xml * Try to fix test * Stop nullpointer that happens sometimes, when it shouldn't * remove unused strings * edit the photo instead of posting directly * fix test after changing putextra name * remove useless analyzer * add test? * better tests? * add dependencies * update dependencies * try to fix build * undo change to build.gradle * try to fix tests * try to fix tests * remove useless listener * save image so that ci can go through gallery * remove extraneous permission * Any app that declares the WRITE_EXTERNAL_STORAGE permission is implicitly granted this permission. Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-05-15 12:10:28 +02:00
2021-05-08 20:12:05 +02:00
//stagingImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
2022-07-26 21:52:38 +02:00
androidTestImplementation 'com.android.support.test.espresso:espresso-idling-resource:3.0.2'
androidTestImplementation 'com.linkedin.testbutler:test-butler-library:2.2.1'
androidTestUtil 'com.linkedin.testbutler:test-butler-app:2.2.1'
2021-05-08 20:12:05 +02:00
2021-11-26 16:54:29 +01:00
androidTestImplementation 'androidx.work:work-testing:2.7.1'
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.34.0'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation 'junit:junit:4.13.2'
testImplementation "androidx.room:room-testing:$room_version"
2020-09-10 22:47:04 +02:00
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
2021-09-06 15:50:15 +02:00
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.4.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
2022-06-07 20:46:46 +02:00
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.9.2'
2020-03-07 18:13:26 +01:00
}
2020-02-28 17:08:54 +01:00
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
2021-02-17 22:55:31 +01:00
task jacocoTestReport(type: JacocoReport, dependsOn: ['connectedStagingAndroidTest', 'testStagingUnitTest', 'createStagingCoverageReport']) {
2020-02-28 17:08:54 +01:00
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def kotlinTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/staging", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
2020-03-06 18:24:20 +01:00
getSourceDirectories().from(files([mainSrc]))
getClassDirectories().from(files([kotlinTree]))
2020-03-06 18:24:20 +01:00
getExecutionData().from(fileTree(dir: project.buildDir, includes: [
2021-02-17 22:55:31 +01:00
'outputs/code_coverage/stagingAndroidTest/connected/*coverage.ec',
2020-03-06 18:24:20 +01:00
2021-02-17 22:55:31 +01:00
'jacoco/testStagingUnitTest.exec'
2020-03-06 18:24:20 +01:00
]))
2021-07-16 14:39:18 +02:00
}