111 lines
3.1 KiB
Groovy
111 lines
3.1 KiB
Groovy
// flutter
|
|
def localProperties = new Properties()
|
|
def localPropertiesFile = rootProject.file('local.properties')
|
|
if (localPropertiesFile.exists()) {
|
|
localPropertiesFile.withInputStream { stream ->
|
|
localProperties.load(stream)
|
|
}
|
|
}
|
|
|
|
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
|
if (flutterRoot == null) {
|
|
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
|
|
flutter {
|
|
source '../..'
|
|
}
|
|
|
|
// build versioning
|
|
def currentVersionCode() {
|
|
def propsFile = file('versions.properties')
|
|
def props = new Properties()
|
|
props.load(new FileInputStream(propsFile))
|
|
return props['build.versionCode'].toInteger()
|
|
}
|
|
|
|
def incrementVersionCode() {
|
|
def propsFile = file('versions.properties')
|
|
def props = new Properties()
|
|
props.load(new FileInputStream(propsFile))
|
|
def currentCode = props['build.versionCode'].toInteger()
|
|
def nextCode = currentCode + 1
|
|
props['build.versionCode'] = nextCode.toString()
|
|
props.store(propsFile.newWriter(), null)
|
|
return nextCode
|
|
}
|
|
|
|
// increments build version code on release builds
|
|
task('incrementVersionCode') << {
|
|
incrementVersionCode()
|
|
}
|
|
|
|
tasks.whenTaskAdded { task ->
|
|
if (task.name == 'assembleRelease') {
|
|
task.dependsOn 'incrementVersionCode'
|
|
}
|
|
}
|
|
|
|
buildscript {
|
|
// application variables
|
|
ext.app_ver_name = "1.0"
|
|
|
|
// google version codes
|
|
ext.build_tools_ver = '25.0.3'
|
|
ext.support_lib_ver = '25.3.1'
|
|
ext.google_play_ver = '10.2.4'
|
|
ext.constraint_layout_ver = '1.0.2'
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 25
|
|
buildToolsVersion "$build_tools_ver"
|
|
|
|
defaultConfig {
|
|
minSdkVersion 19
|
|
targetSdkVersion 25
|
|
applicationId "com.goposse.routersample"
|
|
versionCode currentVersionCode()
|
|
versionName "$app_ver_name"
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
}
|
|
lintOptions {
|
|
disable 'InvalidPackage'
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
buildTypes {
|
|
release {
|
|
// TODO: Add your own signing config for the release build.
|
|
// Signing with the debug keys for now, so `flutter run --release` works.
|
|
signingConfig signingConfigs.debug
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
// google
|
|
compile "com.android.support:appcompat-v7:$support_lib_ver"
|
|
compile "com.android.support:support-v13:$support_lib_ver"
|
|
compile "com.android.support:support-v4:$support_lib_ver"
|
|
|
|
// testing
|
|
androidTestCompile "com.android.support:support-annotations:$support_lib_ver"
|
|
androidTestCompile 'com.android.support.test:runner:0.5'
|
|
androidTestCompile 'com.android.support.test:rules:0.5'
|
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
|
|
}
|
|
repositories {
|
|
maven {
|
|
url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1'
|
|
}
|
|
}
|