updated build script

This commit is contained in:
Mariotaku Lee 2015-11-22 23:38:11 +08:00
parent 3bfd9fd461
commit 45980ff53d
1 changed files with 67 additions and 84 deletions

View File

@ -1,6 +1,3 @@
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.LibraryPlugin
apply plugin: 'com.github.ben-manes.versions' apply plugin: 'com.github.ben-manes.versions'
// 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.
@ -31,101 +28,87 @@ allprojects {
} }
subprojects { subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
plugins.withType(LibraryPlugin) { lintOptions {
android { abortOnError false
compileSdkVersion 23 lintConfig rootProject.file('lint.xml')
buildToolsVersion '23.0.1' }
lintOptions { packagingOptions {
abortOnError false exclude 'META-INF/DEPENDENCIES'
lintConfig rootProject.file('lint.xml') exclude 'META-INF/LICENSE'
} exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
packagingOptions { exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE' exclude 'META-INF/notice.txt'
exclude 'META-INF/LICENSE.txt' exclude 'META-INF/ASL2.0'
exclude 'META-INF/license.txt' }
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
} }
} }
}
plugins.withType(AppPlugin) { project.plugins.withId('com.android.application') {
android { android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
lintOptions { signingConfigs {
abortOnError false debug {
lintConfig rootProject.file('lint.xml') File signingPropFile = rootProject.file('signing.properties')
} if (signingPropFile.exists()) {
Properties signingProp = new Properties()
signingConfigs { signingProp.load(signingPropFile.newDataInputStream())
debug { storeFile file(signingProp.get("debug.storeFile"))
File signingPropFile = rootProject.file('signing.properties') storePassword signingProp.get("debug.storePassword")
if (signingPropFile.exists()) { keyAlias signingProp.get("debug.keyAlias")
Properties signingProp = new Properties() keyPassword signingProp.get("debug.keyPassword")
signingProp.load(signingPropFile.newDataInputStream()) } else if (System.getenv('DEBUG_KEYSTORE_BASE64') != null) {
storeFile file(signingProp.get("debug.storeFile")) storeFile decodeKeyStoreFileFromBase64Env('DEBUG_KEYSTORE_BASE64')
storePassword signingProp.get("debug.storePassword") storePassword System.getenv('DEBUG_KEYSTORE_PASSWORD')
keyAlias signingProp.get("debug.keyAlias") keyAlias System.getenv('DEBUG_KEYSTORE_KEY_ALIAS')
keyPassword signingProp.get("debug.keyPassword") keyPassword System.getenv('DEBUG_KEYSTORE_KEY_PASSWORD')
} else if (System.getenv('DEBUG_KEYSTORE_BASE64') != null) { }
storeFile decodeKeyStoreFileFromBase64Env('DEBUG_KEYSTORE_BASE64') }
storePassword System.getenv('DEBUG_KEYSTORE_PASSWORD') release {
keyAlias System.getenv('DEBUG_KEYSTORE_KEY_ALIAS') File signingPropFile = rootProject.file('signing.properties')
keyPassword System.getenv('DEBUG_KEYSTORE_KEY_PASSWORD') if (signingPropFile.exists()) {
Properties signingProp = new Properties()
signingProp.load(signingPropFile.newDataInputStream())
storeFile file(signingProp.get("release.storeFile"))
storePassword signingProp.get("release.storePassword")
keyAlias signingProp.get("release.keyAlias")
keyPassword signingProp.get("release.keyPassword")
} else if (System.getenv('RELEASE_KEYSTORE_BASE64') != null) {
storeFile decodeKeyStoreFileFromBase64Env('RELEASE_KEYSTORE_BASE64')
storePassword System.getenv('RELEASE_KEYSTORE_PASSWORD')
keyAlias System.getenv('RELEASE_KEYSTORE_KEY_ALIAS')
keyPassword System.getenv('RELEASE_KEYSTORE_KEY_PASSWORD')
}
} }
} }
release { buildTypes {
File signingPropFile = rootProject.file('signing.properties') debug {
if (signingPropFile.exists()) { if (rootProject.file('signing.properties').exists()
Properties signingProp = new Properties() || System.getenv('DEBUG_KEYSTORE_BASE64') != null) {
signingProp.load(signingPropFile.newDataInputStream()) signingConfig signingConfigs.debug
storeFile file(signingProp.get("release.storeFile")) }
storePassword signingProp.get("release.storePassword") }
keyAlias signingProp.get("release.keyAlias") release {
keyPassword signingProp.get("release.keyPassword") if (rootProject.file('signing.properties').exists()
} else if (System.getenv('RELEASE_KEYSTORE_BASE64') != null) { || System.getenv('RELEASE_KEYSTORE_BASE64') != null) {
storeFile decodeKeyStoreFileFromBase64Env('RELEASE_KEYSTORE_BASE64') signingConfig signingConfigs.release
storePassword System.getenv('RELEASE_KEYSTORE_PASSWORD') }
keyAlias System.getenv('RELEASE_KEYSTORE_KEY_ALIAS')
keyPassword System.getenv('RELEASE_KEYSTORE_KEY_PASSWORD')
} }
} }
} }
buildTypes {
debug {
if (rootProject.file('signing.properties').exists()
|| System.getenv('DEBUG_KEYSTORE_BASE64') != null) {
signingConfig signingConfigs.debug
}
}
release {
if (rootProject.file('signing.properties').exists()
|| System.getenv('RELEASE_KEYSTORE_BASE64') != null) {
signingConfig signingConfigs.release
}
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
} }
} }
} }
task clean(type: Delete) { task clean(type: Delete) {