Skip to content
Snippets Groups Projects
  • Lennart Goedhart's avatar
    1207e656
    - Store config data using Realm.io · 1207e656
    Lennart Goedhart authored
    - Refactor UI (use Material Design and new font, drop to single style.xml)
    - Do the pump comms using an IntentService in a separate thread
    - Add extra OTG check
    - General clean up and refactoring (improve naming and code).
    1207e656
    History
    - Store config data using Realm.io
    Lennart Goedhart authored
    - Refactor UI (use Material Design and new font, drop to single style.xml)
    - Do the pump comms using an IntentService in a separate thread
    - Add extra OTG check
    - General clean up and refactoring (improve naming and code).
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
build.gradle 3.50 KiB
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.21.6'
    }
}
plugins {
    id 'net.researchgate.release' version '2.3.4'
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


def gitVersion() {
    def process = ['sh', '-c', 'git tag -l | grep -c ".*" -'].execute().text.trim()
    return process.toInteger() + 1
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    // FIXME - replace with URLConnection. This is used in GetHmacAndKeyActivity.
    useLibrary 'org.apache.http.legacy'

    applicationVariants.all { variant ->
        variant.resValue "string", "versionName", variant.versionName
    }

    defaultConfig {
        applicationId "info.nightscout.android"
        minSdkVersion 14
        targetSdkVersion 23
        versionName project.properties['version']
        versionCode gitVersion()
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    lintOptions {
        // TODO - 'InvalidPackage' is here because of logback. We can remove this if we remove logback.
        disable 'InvalidPackage', 'TrulyRandom'
    }
}

task signRelease << {
    def command = [
            'jarsigner',
            '-verbose',
            '-sigalg',
            'SHA1withRSA',
            '-digestalg',
            'SHA1',
            '-keystore',
            '/Users/lgoedhart/keystores/nightscout_android.jks',
            'app/build/outputs/apk/app-release-unsigned.apk',
            'nightscoutandroidkey'
    ]

    def proc = new ProcessBuilder(command)
            .redirectOutput(ProcessBuilder.Redirect.INHERIT)
            .redirectInput(ProcessBuilder.Redirect.INHERIT)
            .redirectError(ProcessBuilder.Redirect.INHERIT)
            .start()

    proc.waitFor()

    if (0 != proc.exitValue()) {
        throw new RuntimeException("Could not sign APK.")
    }
}

task zipalignRelease << {
    def command = [
            '/Users/lgoedhart/Library/Android/sdk/build-tools/23.0.3/zipalign',
            '-v',
            '4',
            'app/build/outputs/apk/app-release-unsigned.apk',
            'app/build/outputs/apk/640g-android-uploader.apk'
    ]

    def proc = new ProcessBuilder(command)
            .redirectOutput(ProcessBuilder.Redirect.INHERIT)
            .redirectInput(ProcessBuilder.Redirect.INHERIT)
            .redirectError(ProcessBuilder.Redirect.INHERIT)
            .start()

    proc.waitFor()

    if (0 != proc.exitValue()) {
        throw new RuntimeException("Could not align APK.")
    }
}

release {
    tagTemplate = 'v${version}'
    buildTasks = ['assembleRelease']
    beforeReleaseBuild.dependsOn 'clean'
    afterReleaseBuild.dependsOn 'signRelease', 'zipalignRelease'
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile files('libs/logback-android-1.1.1-3.jar')
    compile files('libs/slf4j-api-1.7.2.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
    compile('com.mikepenz:materialdrawer:5.2.9@aar') {
        transitive = true
    }
    compile 'com.mikepenz:google-material-typeface:2.2.0.1.original@aar'
    compile 'uk.co.chrisjenx:calligraphy:2.2.0'
    compile 'com.bugfender.sdk:android:0.3.5'
}