Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
155 lines (132 sloc) 5.87 KB
// The MIT License (MIT)
//
// Copyright (c) 2016 Christian Pötzsch
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
apply plugin: 'com.android.application'
apply plugin: 'com.github.ben-manes.versions'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0'
}
}
// Version number
def versionMajor = 0
def versionMinor = 1
def versionPatch = 0
// Auto version info
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"))
android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
defaultConfig {
minSdkVersion 10
targetSdkVersion 24
// Build version information
applicationId "de.sixtyfourktec.mirrorhub"
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"${buildTime}\""
// Import keys for the various public APIs we use
buildConfigField "String", "MAPS_API_KEY", maps_api_key
buildConfigField "String", "METOFFICE_API_KEY", metoffice_api_key
buildConfigField "String", "NATIONALRAIL_API_KEY", nationalrail_api_key
buildConfigField "String", "TFL_API_ID", tfl_api_id
buildConfigField "String", "TFL_API_KEY", tfl_api_key
// SunTimes configuration
buildConfigField "String", "SUNTIMES_LATITUDE", suntimes_latitude
buildConfigField "String", "SUNTIMES_LONGITUTE", suntimes_longitute
buildConfigField "String", "SUNTIMES_TIMEZONE", suntimes_timezone
// TimeToWork configuration
buildConfigField "String", "TIMETOWORK_ORIGIN", timetowork_origin
buildConfigField "String", "TIMETOWORK_DESTINATION", timetowork_destination
// Forecast configuration
buildConfigField "String", "FORECAST_LOCATION_ID", forecast_location_id
// National Rail configuration
buildConfigField "String", "NATIONALRAIL_CRS", nationalrail_crs
buildConfigField "String", "NATIONALRAIL_FILTER_CRS", nationalrail_filter_crs
buildConfigField "String", "NATIONALRAIL_FILTER_TYPE", nationalrail_filter_type
// Tfl configuration
buildConfigField "String", "TFL_FROM_ID", tfl_from_id
buildConfigField "String", "TFL_TO_ID", tfl_to_id
// Calendar configuration
buildConfigField "String", "CALENDAR_BIRTHDAY_CAL", calendar_birthday_cal
// Music configuration
buildConfigField "String", "MUSIC_HOST", music_host
// Global configuration
buildConfigField "boolean", "ENABLE_PROXIMITY_SENSOR", "false"
// Additional debug switches
buildConfigField "boolean", "TIMETOWORK_SHOW_ALWAYS", "false"
}
lintOptions {
abortOnError false
}
buildTypes {
release {
//minifyEnabled true
//proguardFiles getDefaultProguardFile('proguard-android.txt')
}
debug {
buildConfigField "boolean", "TIMETOWORK_SHOW_ALWAYS", "true"
}
}
signingConfigs {
release {
storeFile file("${System.env.MIRRORHUB_PRIVATE_KEY}")
keyAlias "${System.env.MIRRORHUB_ALIAS}"
storePassword "${System.env.MIRRORHUB_STORE_PW}"
keyPassword "${System.env.MIRRORHUB_PW}"
}
}
// Task to run the app on the target device
android.applicationVariants.all { buildType ->
task ("run"+buildType.name.capitalize()) {
group = "Run"
description = "Runs the "+buildType.name.capitalize()+" build on the connected device."
doLast {
def adb = android.getAdbExe().toString()
def aapt = android.getSdkDirectory().toString()+"/build-tools/$project.android.buildToolsRevision/aapt"
def s = [aapt, 'dump', 'badging', buildType.outputs.outputFile[0]].execute().text.readLines()
String pgk = (s.find { it.startsWith("package:") } =~ /name='(.*?)'/)[0][1]
String act = (s.find { it.startsWith("launchable-activity:") } =~ /name='(.*?)'/)[0][1]
exec { commandLine adb, 'shell', 'am', 'start', '-n', "$pgk/$act" }
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile "com.android.support:support-v4:24.2.1"
// Extended annotation support
compile 'com.android.support:support-annotations:24.2.1'
// Third party
compile 'com.squareup.okhttp3:okhttp:3.4.2'
compile 'org.jdom:jdom2:2.0.6'
compile 'com.luckycatlabs:SunriseSunsetCalculator:1.2'
}
// ex: set tabstop=4 shiftwidth=4 expandtab: