I would like to access versionCode and versionName in defaultConfig from a gradle task. I am using the experimental gradle plugin. I tried model.android.defaultConfig.versionCode but it doesn't recognise android...
apply plugin: 'com.android.model.application'
apply from: "../config.gradle"
apply from: "../gitversion.gradle"
def config = ext.configuration
model {
android {
compileSdkVersion = config.compileSdkVersion
buildToolsVersion = config.buildToolsVersion
defaultConfig {
applicationId = 'eu.tss.apitest'
minSdkVersion.apiLevel = config.minimumSdkVersion
targetSdkVersion.apiLevel = config.targetSdkVersion
defaultConfig {
versionCode = 1
versionName = '1.0'
ext.printVersions(versionCode,versionName)
}
buildTypes {
release {
minifyEnabled false
proguardFiles.add(file('proguard-android.txt'))
}
}
}
android.lintOptions {
abortOnError false
}
}
dependencies {
println rootProject.getName()
compile 'com.android.support:appcompat-v7:25.0.0'
compile project(':tssapiandroid')
compile project(path: ':tssuielements')
}
task printVersions{
//I would like to access versionCode here:)
}