ODP-AppVehOwn/app/build.gradle

210 lines
7.8 KiB
Groovy

plugins {
id 'com.android.application'
}
def environmentExtractor = { File path ->
def rawJson = path.text
def escapedJson = rawJson.replace("\"", "\\\"").replace("\n", "").replace("\r", "")
return "\"${escapedJson}\""
}
def Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
defaultConfig {
applicationId "eu.csc.vehown"
minSdkVersion 26
targetSdkVersion 31
versionCode 1
versionName "1.0"
multiDexEnabled true
resValue "string", "default_account_iccid", properties.getProperty("default.account.iccid", "")
resValue "string", "default_webserver_url", properties.getProperty("default.webserver.url", "http://10.0.2.2:8081")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments += [
"room.schemaLocation":"$projectDir/schemas".toString(),
//The following options were not recognized by any processor
// "room.incremental":"true",
// "room.expandProjection":"true"
]
}
}
def devEnvironmentFile = file("../test_environments.json")
if (devEnvironmentFile.exists()) {
def devEnvJson = environmentExtractor(devEnvironmentFile)
buildConfigField "String", "ENVIRONMENT_JSONDATA", devEnvJson
}
}
testOptions {
// Encapsulates options for local unit tests.
unitTests {
// By default, local unit tests throw an exception any time the code you are testing tries to access
// Android platform APIs (unless you mock Android dependencies yourself or with a testing
// framework like Mockito). However, you can enable the following property so that the test
// returns either null or zero when accessing platform APIs, rather than throwing an exception.
returnDefaultValues true
// Encapsulates options for controlling how Gradle executes local unit tests. For a list
// of all the options you can specify, read Gradle's reference documentation.
all {
// Sets JVM argument(s) for the test JVM(s).
jvmArgs '-XX:MaxPermSize=256m'
// You can also check the task name to apply options to only the tests you specify.
if (it.name == 'testDebugUnitTest') {
systemProperty 'debug', 'true'
}
}
}
}
testOptions {
unitTests.includeAndroidResources = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
repositories {
mavenLocal()
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.preference:preference:1.2.0'
compileOnly "org.projectlombok:lombok:$lombok_Version"
//implementation 'eu.csc.odpconfigurationserver:dto:1.0-SNAPSHOT'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//Lombok
implementation "org.projectlombok:lombok:$lombok_Version"
annotationProcessor "org.projectlombok:lombok:$lombok_Version"
androidTestImplementation "org.projectlombok:lombok:$lombok_Version"
testAnnotationProcessor "org.projectlombok:lombok:$lombok_Version"
//room
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
//implementation project(":module:EventReportModule")
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
//MQTT
implementation 'com.rabbitmq:amqp-client:5.12.0'
//compile files('libs/org.eclipse.paho.android.service-1.1.1.jar')
// compile files('libs/org.eclipse.paho.client.mqttv3-1.1.1.jar')
implementation 'com.android.support:multidex:1.0.3'
//implementation fileTree(dir: 'libs', include: '*.jar')
implementation "eu.csc.core:coregtdm:$coregtdm_version" //was 1.0-SNAPSHOT
implementation files('../libs/log4j-1.2.17.jar')
implementation files('../libs/AppVehOwnServerClient.jar')
implementation files('../libs/AppVehOwnServerDto.jar')
implementation project(":services:core")
implementation project(":services:localstorage")
// https://mvnrepository.com/artifact/com.squareup.okhttp3/logging-interceptor
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
}
task copyServerClientFromLocalDisc{
doLast{
println('START copyServerClientFromLocalDisc:')
println('END copyServerClientFromLocalDisc:')
}
}
task uploadPersonalConfigsBundle {
doLast {
println('uploadPersonalConfigBundle:')
def id = '12345679'
def personalization = 'none'
def customization = 'none'
def locales = 'en_GB,de_DE'
def device = 'R58MC0YPL0B' // Smartphone-PCTL
def andDest = '/sdcard/Android/data/eu.csc.vehown/files/1';
def adb = 'D:/Dev/Android/sdk/platform-tools/adb.exe'
def localMavenRepo = new File(System.getProperty('user.home'), '.m2/repository').absolutePath
//copy configuration files
def openxavaConfigDir = "D:/Dev/Tools/openxava/data/config/"
def dest = 'D:/Dev/project/VehicleOwner/app/config'
delete fileTree(dir: dest, include: '*')
println(' from ' + openxavaConfigDir)
println(' to ' + dest)
copy { from openxavaConfigDir into dest include 'obd-ii*.*gtdfsys' }
copy { from openxavaConfigDir into dest include 'itsstation*.*gtdfsys' }
//create configBundle file
dest = projectDir.getAbsolutePath() + '/config/configBundle'
def jarfile = localMavenRepo + '/eu/csc/core/coregtdm/1.0/coregtdm-1.0.jar'
println(' create ConfigBundle(' + id + ', ' + personalization + ', ' + customization + ', ' + locales + ')')
println(' in ' + dest)
exec {
commandLine 'java', '-cp', jarfile, 'eu.csc.gtdm.ConfigBundle', id, personalization, customization, locales, dest
}
//upload
def source = projectDir.getAbsolutePath() + '/config'
println(' to ' + andDest)
exec {
executable adb
args('-s', device, 'shell', 'rm', '-f', andDest + '/config/*')
}
exec {
executable adb
args('-s', device, 'push', source, andDest)
}
}
}