/*
 * Copyright (c) 2020 Ubique Innovation AG <https://www.ubique.ch>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 *
 * SPDX-License-Identifier: MPL-2.0
 */

apply plugin: 'com.android.application'

ext.readProperty = { paramName ->
	if (project.hasProperty(paramName)) {
		return project.getProperties().get(paramName)
	} else {
		Properties properties = new Properties()
		if (project.rootProject.file('local.properties').exists()) {
			properties.load(project.rootProject.file('local.properties').newDataInputStream())
		}
		return properties.getProperty(paramName)
	}
}

android {
	compileSdkVersion 30
	buildToolsVersion "29.0.3"

	defaultConfig {
		applicationId "org.dpppt.android.calibration"
		minSdkVersion 23
		targetSdkVersion 30
		versionCode 3
		versionName "0.3 (EN1.5)"

		missingDimensionStrategy 'version', 'calibration'

		testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
	}

	signingConfigs {
		release {
			storeFile file('../testKeystore')
			storePassword readProperty('keystorePassword')
			keyAlias 'keyAlias'
			keyPassword readProperty('keyAliasPassword')
		}
	}
	buildTypes {
		release {
			signingConfig signingConfigs.release
		}
	}

	compileOptions {
		sourceCompatibility JavaVersion.VERSION_1_8
		targetCompatibility JavaVersion.VERSION_1_8
	}

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

}

dependencies {
	implementation fileTree(dir: 'libs', include: ['*.jar'])
	implementation fileTree(dir: '../../dp3t-sdk/sdk/libs', include: ['*.aar'])

	implementation project(':dp3t-sdk')

	implementation 'com.google.android.gms:play-services-tasks:17.2.1'
	implementation 'androidx.appcompat:appcompat:1.2.0'
	implementation 'androidx.core:core:1.3.2'
	implementation 'androidx.fragment:fragment:1.3.3'
	implementation 'androidx.work:work-runtime:2.5.0'

	implementation 'com.squareup.retrofit2:retrofit:2.9.0'
	implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

	implementation 'com.google.android.material:material:1.3.0'
}
