use jruby for android

This commit is contained in:
tobilarscheid 2018-05-04 13:04:27 +02:00 committed by GitHub
parent b52de34ce9
commit b610e30065
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -174,14 +174,33 @@ Now, whenever you build your application, Xcode will automatically invoke Twine
### Android Studio/Gradle
Add the following task at the top level in app/build.gradle:
Add the following code at the top level in app/build.gradle:
```
task generateLocalizations {
String script = 'if hash twine 2>/dev/null; then twine generate-localization-file twine.txt ./src/main/res/values/generated_strings.xml; fi'
exec {
executable "sh"
args '-c', script
}
buildscript {
repositories { jcenter() }
dependencies {
/* check jruby-gradle.org for the latest release */
classpath "com.github.jruby-gradle:jruby-gradle-plugin:1.5.0"
}
}
apply plugin: 'com.github.jruby-gradle.base'
dependencies {
jrubyExec 'rubygems:twine:1.0.3'
}
task generateLocalizations (type: JRubyExec) {
dependsOn jrubyPrepare
jrubyArgs '-S'
script "twine"
scriptArgs 'generate-localization-file', 'twine.txt', './src/main/res/values/generated_strings.xml'
}
preBuild {
dependsOn generateLocalizations
}
```
@ -224,4 +243,4 @@ Many thanks to all of the contributors to the Twine project, including:
[djangopo]: https://docs.djangoproject.com/en/dev/topics/i18n/translation/
[tizen]: https://developer.tizen.org/documentation/articles/localization
[flash]: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/resources/IResourceManager.html#getString()
[printf]: https://en.wikipedia.org/wiki/Printf_format_string
[printf]: https://en.wikipedia.org/wiki/Printf_format_string