2019-04-10 17:43:01 +02:00
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter ( )
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
2019-05-03 00:27:49 +02:00
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
2019-05-16 15:54:29 +02:00
classpath 'de.undercouch:gradle-download-task:3.4.3'
2019-04-10 17:43:01 +02:00
}
}
2019-05-16 00:56:00 +02:00
apply plugin: 'com.android.application'
2019-04-10 00:33:05 +02:00
apply plugin: 'kotlin-android'
2019-05-16 19:00:44 +02:00
apply plugin: 'kotlin-android-extensions'
2019-04-10 17:43:01 +02:00
apply plugin: 'com.google.gms.google-services'
2019-05-16 00:56:00 +02:00
apply plugin: 'io.fabric'
apply plugin: 'jacoco-android'
2019-04-10 17:43:01 +02:00
apply plugin: 'com.jakewharton.butterknife'
2019-05-16 15:54:29 +02:00
apply plugin: 'de.undercouch.download'
2018-01-13 21:34:38 +01:00
2019-05-16 13:57:37 +02:00
jacoco {
toolVersion = "0.8.3"
}
2019-04-10 17:43:01 +02:00
ext {
2019-05-15 23:39:11 +02:00
supportLibraryVersion = "28.0.0"
2019-04-10 17:43:01 +02:00
ormLiteVersion = "4.46"
powermockVersion = "1.7.3"
dexmakerVersion = "1.2"
2019-05-16 13:57:37 +02:00
butterknifeVersion = "10.1.0"
2019-04-10 17:43:01 +02:00
}
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter { url "https://jcenter.bintray.com/" }
2019-04-10 00:33:05 +02:00
mavenCentral ( )
2019-04-10 17:43:01 +02:00
}
def generateGitBuild = { - >
StringBuilder stringBuilder = new StringBuilder ( ) ;
try {
def stdout = new ByteArrayOutputStream ( )
exec {
commandLine 'git' , 'describe' , '--always'
standardOutput = stdout
}
String commitObject = stdout . toString ( ) . trim ( )
stringBuilder . append ( commitObject )
} catch ( ignored ) {
stringBuilder . append ( 'NoGitSystemAvailable' )
}
return stringBuilder . toString ( )
}
2019-04-11 10:16:52 +02:00
def generateGitRemote = { - >
StringBuilder stringBuilder = new StringBuilder ( ) ;
try {
def stdout = new ByteArrayOutputStream ( )
exec {
commandLine 'git' , 'remote' , 'get-url' , 'origin'
standardOutput = stdout
}
String commitObject = stdout . toString ( ) . trim ( )
stringBuilder . append ( commitObject )
} catch ( ignored ) {
stringBuilder . append ( 'NoGitSystemAvailable' )
}
return stringBuilder . toString ( )
}
2019-04-10 17:43:01 +02:00
def generateDate = { - >
StringBuilder stringBuilder = new StringBuilder ( ) ;
stringBuilder . append ( ( new Date ( ) ) . format ( 'yyyy.MM.dd-HH:mm' ) )
return stringBuilder . toString ( )
}
2019-04-16 11:15:40 +02:00
def isMaster = { - >
return ! version . contains ( '-' )
}
def allCommited = { - >
StringBuilder stringBuilder = new StringBuilder ( ) ;
try {
def stdout = new ByteArrayOutputStream ( )
exec {
2019-04-25 20:42:34 +02:00
commandLine 'git' , 'status' , '-s'
2019-04-16 11:15:40 +02:00
standardOutput = stdout
}
String commitObject = stdout . toString ( ) . trim ( )
stringBuilder . append ( commitObject )
} catch ( ignored ) {
return false ; // NoGitSystemAvailable
}
2019-04-25 20:42:34 +02:00
return stringBuilder . toString ( ) . isEmpty ( )
2019-04-25 18:59:10 +02:00
2019-04-16 11:15:40 +02:00
}
2019-04-10 17:43:01 +02:00
tasks . matching { it instanceof Test } . all {
testLogging . events = [ "failed" , "skipped" , "started" ]
testLogging . exceptionFormat = "full"
}
android {
2019-05-15 23:26:07 +02:00
compileSdkVersion 28
2019-04-10 17:43:01 +02:00
defaultConfig {
2019-06-19 16:41:20 +02:00
minSdkVersion 23
2019-05-15 23:26:07 +02:00
targetSdkVersion 28
2019-04-10 17:43:01 +02:00
multiDexEnabled true
versionCode 1500
2019-07-05 15:18:28 +02:00
version "medtronic-0.12.0-SNAPSHOT"
2019-04-10 17:43:01 +02:00
buildConfigField "String" , "VERSION" , '"' + version + '"'
buildConfigField "String" , "BUILDVERSION" , '"' + generateGitBuild ( ) + '-' + generateDate ( ) + '"'
2019-05-03 00:27:49 +02:00
buildConfigField "String" , "REMOTE" , '"' + generateGitRemote ( ) + '"'
2018-08-27 20:19:30 +02:00
buildConfigField "String" , "HEAD" , '"' + generateGitBuild ( ) + '"'
2019-07-05 15:18:28 +02:00
buildConfigField "String" , "DEV_VERSION" , '"2.4-dev"'
2019-07-05 17:04:54 +02:00
buildConfigField "String" , "DEV_DATE" , '"4.7.2019"'
buildConfigField "String" , "DEV_CHECKIN" , '"0693a599d50843999ff4e3b1312d1f3ed5d1369b"'
2019-05-16 13:57:37 +02:00
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2019-04-10 17:43:01 +02:00
// if you change minSdkVersion to less than 11, you need to change executeTask for wear
ndk {
moduleName "BleCommandUtil"
}
}
2019-04-10 00:33:05 +02:00
kotlinOptions {
jvmTarget = '1.8'
}
2019-04-10 17:43:01 +02:00
lintOptions {
// TODO remove once wear dependency com.google.android.gms:play-services-wearable:7.3.0
// has been upgraded (requiring significant code changes), which currently fails release
// build with a deprecation warning
// abortOnError false
// (disabled entirely to avoid reports on the error, which would still be displayed
// and it's easy to overlook that it's ignored)
checkReleaseBuilds false
disable 'MissingTranslation'
disable 'ExtraTranslation'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile ( 'proguard-android.txt' ) , 'proguard-rules.pro'
}
debug {
testCoverageEnabled ( project . hasProperty ( 'coverage' ) )
}
}
productFlavors {
flavorDimensions "standard"
full {
applicationId "info.nightscout.androidaps"
dimension "standard"
resValue "string" , "app_name" , "AndroidAPS"
versionName version
manifestPlaceholders = [
appIcon : "@mipmap/ic_launcher" ,
appIconRound: "@mipmap/ic_launcher_round"
]
}
pumpcontrol {
applicationId "info.nightscout.aapspumpcontrol"
dimension "standard"
resValue "string" , "app_name" , "Pumpcontrol"
versionName version + "-pumpcontrol"
manifestPlaceholders = [
appIcon : "@mipmap/ic_pumpcontrol" ,
appIconRound: "@null"
]
}
nsclient {
applicationId "info.nightscout.nsclient"
dimension "standard"
resValue "string" , "app_name" , "NSClient"
versionName version + "-nsclient"
manifestPlaceholders = [
appIcon : "@mipmap/ic_yellowowl" ,
appIconRound: "@null"
]
}
nsclient2 {
applicationId "info.nightscout.nsclient2"
dimension "standard"
resValue "string" , "app_name" , "NSClient2"
versionName version + "-nsclient"
manifestPlaceholders = [
appIcon : "@mipmap/ic_yellowowl" ,
appIconRound: "@null"
]
}
}
compileOptions {
sourceCompatibility JavaVersion . VERSION_1_8
targetCompatibility JavaVersion . VERSION_1_8
}
testOptions {
2019-05-18 09:40:06 +02:00
unitTests {
returnDefaultValues = true
includeAndroidResources = true
all {
maxParallelForks = 10
forkEvery = 20
}
}
2019-04-10 17:43:01 +02:00
}
useLibrary "org.apache.http.legacy"
}
allprojects {
repositories {
jcenter ( )
flatDir {
dirs 'libs'
}
}
}
dependencies {
wearApp project ( ':wear' )
implementation fileTree ( include: [ '*.jar' ] , dir: 'libs' )
implementation 'com.google.android.gms:play-services-wearable:16.0.1'
2019-05-15 23:33:56 +02:00
implementation 'com.google.firebase:firebase-core:16.0.9'
2019-04-10 17:43:01 +02:00
implementation ( "com.crashlytics.sdk.android:crashlytics:2.9.9@aar" ) {
transitive = true ;
}
2017-01-29 13:00:21 +01:00
2019-05-16 13:57:37 +02:00
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
2019-04-10 17:43:01 +02:00
implementation "com.wdullaer:materialdatetimepicker:2.3.0"
implementation "com.squareup:otto:1.3.7"
implementation "com.j256.ormlite:ormlite-core:${ormLiteVersion}"
implementation "com.j256.ormlite:ormlite-android:${ormLiteVersion}"
implementation ( "com.github.tony19:logback-android-classic:1.1.1-6" ) {
exclude group: "com.google.android" , module: "android"
}
implementation "org.apache.commons:commons-lang3:3.7"
implementation "org.slf4j:slf4j-api:1.7.21"
// Graphview cannot be upgraded
implementation "com.jjoe64:graphview:4.0.1"
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
2019-05-16 13:57:37 +02:00
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
2019-04-10 17:43:01 +02:00
implementation ( name: "android-edittext-validator-v1.3.4-mod" , ext: "aar" )
implementation 'com.madgag.spongycastle:core:1.58.0.0'
implementation ( "com.google.android:flexbox:0.3.0" ) {
exclude group: "com.android.support"
}
implementation ( "io.socket:socket.io-client:1.0.0" ) {
// excluding org.json which is provided by Android
exclude group: "org.json" , module: "json"
}
2019-05-15 23:33:56 +02:00
implementation "com.google.code.gson:gson:2.8.5"
2019-04-10 17:43:01 +02:00
implementation "com.google.guava:guava:24.1-jre"
implementation "net.danlew:android.joda:2.9.9.1"
implementation "uk.com.robust-it:cloning:1.9.9"
implementation 'org.mozilla:rhino:1.7.7.2'
implementation "com.jakewharton:butterknife:${butterknifeVersion}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterknifeVersion}"
testImplementation "junit:junit:4.12"
testImplementation "org.json:json:20140107"
testImplementation "org.mockito:mockito-core:2.8.47"
testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
testImplementation "joda-time:joda-time:2.9.9"
2019-06-09 17:58:23 +02:00
testImplementation ( "com.google.truth:truth:0.39" ) {
exclude group: "com.google.guava" , module: "guava"
}
2019-07-05 15:18:28 +02:00
testImplementation ( "org.robolectric:robolectric:4.2.1" ) {
2019-06-09 17:58:23 +02:00
exclude group: "com.google.guava" , module: "guava"
}
2019-04-10 17:43:01 +02:00
testImplementation "org.skyscreamer:jsonassert:1.5.0"
2019-05-04 21:34:46 +02:00
testImplementation "org.hamcrest:hamcrest-all:1.3"
2019-06-09 17:58:23 +02:00
testImplementation ( "uk.org.lidalia:slf4j-test:1.2.0" ) {
exclude group: "com.google.guava" , module: "guava"
}
2019-04-10 17:43:01 +02:00
androidTestImplementation "org.mockito:mockito-core:2.8.47"
androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
2019-04-10 00:33:05 +02:00
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
2019-04-10 17:43:01 +02:00
}
2019-05-16 15:54:29 +02:00
task downloadZipFile ( type: Download ) {
src 'https://github.com/MilosKozak/danars-support-lib/archive/master.zip'
dest new File ( buildDir , 'danars.zip' )
}
2018-01-31 21:46:30 +01:00
2019-05-16 15:54:29 +02:00
task downloadAndUnzipFile ( dependsOn: downloadZipFile , type: Copy ) {
from zipTree ( downloadZipFile . dest )
def outputDir = file ( "${buildDir}/unpacked/dist" )
2019-04-10 17:43:01 +02:00
into outputDir
}
2018-01-31 21:46:30 +01:00
2019-05-16 15:54:29 +02:00
task copyLibs ( dependsOn: downloadAndUnzipFile , type: Copy ) {
2019-04-10 17:43:01 +02:00
def src = file ( "${buildDir}/unpacked/dist/danars-support-lib-master" )
def target = file ( "src/main/jniLibs/" )
from src
into target
}
task full_clean ( type: Delete ) {
delete file ( "src/main/jniLibs" )
}
clean . dependsOn full_clean
2018-04-20 17:27:31 +02:00
preBuild . dependsOn copyLibs
2019-04-16 11:15:40 +02:00
printf ( '--------------\n' )
printf ( 'isMaster: %s\n' , isMaster ( ) . toString ( ) )
printf ( 'allCommited: %s\n' , allCommited ( ) . toString ( ) )
printf ( '--------------\n' )
if ( isMaster ( ) & & ! allCommited ( ) ) {
throw new GradleException ( 'There are uncommitted changes or git system is not available. Clone sources again as described in wiki and do not allow gradle update' )
}