* Updated gradle * Composed text now changes on selection change * Added content description for smileys and trimmed smiley list * Added localization for symbol/smiley dialog
159 lines
3.6 KiB
Groovy
159 lines
3.6 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:0.9.0'
|
|
}
|
|
}
|
|
apply plugin: 'android'
|
|
|
|
ext {
|
|
keyStorePass = ''
|
|
keyPass = ''
|
|
}
|
|
|
|
dependencies {
|
|
compile fileTree(dir: 'libs', include: '*.jar')
|
|
}
|
|
|
|
def execThing ( String cmdStr ) {
|
|
def stdout = new ByteArrayOutputStream()
|
|
String prefix = System.getenv("GITCMDPREFIX")
|
|
if (prefix != null) {
|
|
String cmd = prefix + cmdStr
|
|
exec {
|
|
commandLine cmd.tokenize()
|
|
standardOutput = stdout
|
|
}
|
|
} else {
|
|
exec {
|
|
commandLine cmdStr.tokenize()
|
|
standardOutput = stdout
|
|
}
|
|
}
|
|
return stdout
|
|
}
|
|
|
|
def computeVersionName = { ->
|
|
|
|
String ver = "git-source"
|
|
try {
|
|
if (execThing(" git status -z").toString().trim().equals("")) {
|
|
return "git-" + execThing(' git log -1 --format="%h"').toString().trim()
|
|
} else {
|
|
return ver
|
|
}
|
|
} catch (all) {
|
|
ant.echo("Cannot run git (not in path?), using default versioning")
|
|
}
|
|
|
|
return ver
|
|
}
|
|
|
|
def getProps() {
|
|
Properties props = new Properties()
|
|
File f = new File("t9build.properties")
|
|
if (!f.exists()) {
|
|
f.createNewFile()
|
|
}
|
|
props.load(new FileInputStream(f))
|
|
return props
|
|
}
|
|
|
|
def saveProps(Properties props) {
|
|
props.store(new FileOutputStream(new File("t9build.properties")), null)
|
|
}
|
|
|
|
def computeVersionNumber = { ->
|
|
Properties props = getProps()
|
|
int verNum = Integer.valueOf(props.getProperty("verNum", "0"))
|
|
if (project.hasProperty('incrementBuildNumber')) {
|
|
verNum++
|
|
props.setProperty("verNum", String.valueOf(verNum))
|
|
saveProps(props)
|
|
}
|
|
return verNum
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 10
|
|
buildToolsVersion "19.0.0"
|
|
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src']
|
|
resources.srcDirs = ['src']
|
|
aidl.srcDirs = ['src']
|
|
renderscript.srcDirs = ['src']
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
}
|
|
|
|
// Move the tests to tests/java, tests/res, etc...
|
|
instrumentTest.setRoot('tests')
|
|
|
|
// Move the build types to build-types/<type>
|
|
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
|
|
// This moves them out of them default location under src/<type>/... which would
|
|
// conflict with src/ being used by the main source set.
|
|
// Adding new build types or product flavors should be accompanied
|
|
// by a similar customization.
|
|
debug.setRoot('build-types/debug')
|
|
release.setRoot('build-types/release')
|
|
|
|
}
|
|
|
|
defaultConfig {
|
|
versionCode computeVersionNumber()
|
|
versionName computeVersionName()
|
|
}
|
|
|
|
// http://stackoverflow.com/a/19130098
|
|
signingConfigs {
|
|
release {
|
|
storeFile file(System.getenv("KEYSTORE"))
|
|
storePassword project.ext.keyStorePass
|
|
keyAlias System.getenv("KEYALIAS")
|
|
keyPassword project.ext.keyPass
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
signingConfig android.signingConfigs.release
|
|
}
|
|
}
|
|
}
|
|
|
|
task getDictSizes {
|
|
inputs.files 'assets/en-utf8.txt', 'assets/ru-utf8.txt'
|
|
outputs.file "t9build.properties"
|
|
doLast {
|
|
ant.echo("Calculating dict size...")
|
|
|
|
FileCollection dicts = files("assets/en-utf8.txt", "assets/ru-utf8.txt")
|
|
|
|
dicts.each {File file ->
|
|
ant.propertyfile(file:"assets/dict.properties") {
|
|
entry(key: "size."+ file.name, value: file.length())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task readPasswordFromInput << {
|
|
android.signingConfigs.release.storePassword = String.valueOf(System.console().readPassword("\nKeyStore Password: "))
|
|
android.signingConfigs.release.keyPassword = String.valueOf(System.console().readPassword("\nKey Password: "))
|
|
}
|
|
|
|
//http://stackoverflow.com/a/17484331
|
|
tasks.whenTaskAdded { task ->
|
|
if (task.name == 'packageRelease') {
|
|
task.dependsOn readPasswordFromInput
|
|
}
|
|
}
|
|
|
|
preBuild.dependsOn getDictSizes
|
|
preBuild.mustRunAfter getDictSizes
|