Updated gradle build, allow to configure from file.

This commit is contained in:
Armin Novak 2017-02-23 15:00:30 +01:00
parent ae09ab79ae
commit b938bb483a
5 changed files with 49 additions and 15 deletions

View File

@ -1,13 +1,16 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 25 compileSdkVersion = rootProject.ext.compileSdk
buildToolsVersion "25.0.2" buildToolsVersion = rootProject.ext.buildToolsVersion
defaultConfig { defaultConfig {
applicationId "com.freerdp.afreerdp" applicationId "com.freerdp.afreerdp"
minSdkVersion 14 minSdkVersion rootProject.ext.minSdk
targetSdkVersion 25 targetSdkVersion rootProject.ext.targetSdk
vectorDrawables.useSupportLibrary = true
versionCode = rootProject.ext.versionCode
versionName = rootProject.ext.versionName
} }
buildTypes { buildTypes {

View File

@ -2,9 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.freerdp.afreerdp" package="com.freerdp.afreerdp"
android:installLocation="auto" android:installLocation="auto">
android:versionCode="3"
android:versionName="e83f97b">
<application <application
android:name="com.freerdp.afreerdp.application.GlobalApp" android:name="com.freerdp.afreerdp.application.GlobalApp"

View File

@ -1,4 +1,37 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
Properties properties = new Properties()
File file = new File('release.properties')
if (file.canRead()) {
properties.load(new FileInputStream(file))
}
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
}
ext {
versionCode = properties.get('VERSION', "10").toInteger()
minSdk = properties.get('MIN_SDK', "14").toInteger()
targetSdk = properties.get('TARGET_SDK', "25").toInteger()
compileSdk = properties.get('COMPILE_SDK', "25").toInteger()
buildToolsVersion = properties.get('BUILD_TOOLS', "25.0.2")
versionName = properties.get('VERSION_NAME', getVersionName())
println '----------------- Project configuration -------------------'
println 'VERSION: ' + versionCode
println 'MIN_SDK: ' + minSdk
println 'TARGET_SDK: ' + targetSdk
println 'COMPILE_SDK: ' + compileSdk
println 'BUILD_TOOLS: ' + buildToolsVersion
println 'VERSION_NAME: ' + versionName
println '-----------------------------------------------------------'
}
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()

View File

@ -1,13 +1,15 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 25 compileSdkVersion = rootProject.ext.compileSdk
buildToolsVersion "25.0.2" buildToolsVersion = rootProject.ext.buildToolsVersion
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion rootProject.ext.minSdk
targetSdkVersion 25 targetSdkVersion rootProject.ext.targetSdk
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
versionCode = rootProject.ext.versionCode
versionName = rootProject.ext.versionName
} }
buildTypes { buildTypes {

View File

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.freerdp.freerdpcore" package="com.freerdp.freerdpcore"
android:installLocation="auto" android:installLocation="auto">
android:versionCode="3"
android:versionName="e83f97b">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />