1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2024-12-23 14:38:48 +01:00

updated build script

This commit is contained in:
Mariotaku Lee 2015-03-17 17:34:15 +08:00
parent 17dc454541
commit 6cc854ab3c
2 changed files with 44 additions and 17 deletions

View File

@ -23,3 +23,9 @@ android:
# - sys-img-x86-android-17
script: ./gradlew build
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y python2.7
after_success: ./scripts/travis_upload_release_to_github.py

View File

@ -26,10 +26,15 @@ android {
if (signingPropFile.exists()) {
Properties signingProp = new Properties()
signingProp.load(signingPropFile.newDataInputStream())
storeFile file(signingProp.get("twidere.debug.storeFile"))
storePassword signingProp.get("twidere.debug.storePassword")
keyAlias signingProp.get("twidere.debug.keyAlias")
keyPassword signingProp.get("twidere.debug.keyPassword")
storeFile file(signingProp.get("debug.storeFile"))
storePassword signingProp.get("debug.storePassword")
keyAlias signingProp.get("debug.keyAlias")
keyPassword signingProp.get("debug.keyPassword")
} else if (System.getenv('DEBUG_KEYSTORE_BASE64') != null) {
storeFile decodeKeyStoreFileFromBase64Env('DEBUG_KEYSTORE_BASE64')
storePassword System.getenv('DEBUG_KEYSTORE_PASSWORD')
keyAlias System.getenv('DEBUG_KEYSTORE_KEY_ALIAS')
keyPassword System.getenv('DEBUG_KEYSTORE_KEY_PASSWORD')
}
}
release {
@ -37,26 +42,42 @@ android {
if (signingPropFile.exists()) {
Properties signingProp = new Properties()
signingProp.load(signingPropFile.newDataInputStream())
storeFile file(signingProp.get("twidere.release.storeFile"))
storePassword signingProp.get("twidere.release.storePassword")
keyAlias signingProp.get("twidere.release.keyAlias")
keyPassword signingProp.get("twidere.release.keyPassword")
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')
}
}
}
buildTypes {
debug {
File signingPropFile = rootProject.file('signing.properties')
if (signingPropFile.exists()) {
signingConfig signingConfigs.debug
}
signingConfig signingConfigs.debug
}
release {
File signingPropFile = rootProject.file('signing.properties')
if (signingPropFile.exists()) {
signingConfig signingConfigs.release
}
signingConfig signingConfigs.release
}
}
}
}
def decodeKeyStoreFileFromBase64Env(String name) {
String keyStoreBase64 = System.getenv(name)
if (keyStoreBase64 == null) return null
File tempKeyStoreFile = File.createTempFile("tmp_ks_", ".jks", File.createTempDir())
FileOutputStream fos = null
try {
fos = new FileOutputStream(tempKeyStoreFile)
fos.write(keyStoreBase64.decodeBase64())
fos.flush()
} finally {
if (fos != null) {
fos.close()
}
}
return tempKeyStoreFile
}