2023-11-25 20:11:12 +01:00
|
|
|
plugins {
|
|
|
|
id 'com.android.application' version '8.1.1'
|
|
|
|
}
|
|
|
|
|
2024-09-29 21:58:22 +02:00
|
|
|
dependencies {
|
|
|
|
testImplementation "junit:junit:4.13.2"
|
|
|
|
}
|
|
|
|
|
2023-11-25 20:11:12 +01:00
|
|
|
android {
|
|
|
|
namespace 'juloo.keyboard2'
|
2024-05-29 14:04:14 +02:00
|
|
|
compileSdk 34
|
2023-11-25 20:11:12 +01:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "juloo.keyboard2"
|
2024-02-10 17:24:15 +01:00
|
|
|
minSdk 11
|
2024-07-28 23:07:05 +02:00
|
|
|
targetSdkVersion 35
|
2024-07-27 12:35:59 +02:00
|
|
|
versionCode 42
|
|
|
|
versionName "1.29.1"
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
manifest.srcFile 'AndroidManifest.xml'
|
2024-11-18 00:13:08 +01:00
|
|
|
java.srcDirs = ['srcs/juloo.keyboard2']
|
2023-12-17 12:41:19 +01:00
|
|
|
res.srcDirs = ['res', 'build/generated-resources']
|
2023-11-25 20:11:12 +01:00
|
|
|
assets.srcDirs = ['assets']
|
|
|
|
}
|
2024-09-29 21:58:22 +02:00
|
|
|
|
|
|
|
test {
|
|
|
|
java.srcDirs = ['test']
|
|
|
|
}
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
signingConfigs {
|
|
|
|
// Debug builds will always be signed. If no environment variables are set, a default
|
|
|
|
// keystore will be initialized by the task initDebugKeystore and used. This keystore
|
|
|
|
// can be uploaded to GitHub secrets by following instructions in CONTRIBUTING.md
|
|
|
|
// in order to always receive correctly signed debug APKs from the CI.
|
|
|
|
debug {
|
|
|
|
storeFile(System.env.DEBUG_KEYSTORE ? file(System.env.DEBUG_KEYSTORE) : file("debug.keystore"))
|
|
|
|
storePassword(System.env.DEBUG_KEYSTORE_PASSWORD ? "$System.env.DEBUG_KEYSTORE_PASSWORD" : "debug0")
|
|
|
|
keyAlias(System.env.DEBUG_KEY_ALIAS ? "$System.env.DEBUG_KEY_ALIAS" : "debug")
|
|
|
|
keyPassword(System.env.DEBUG_KEY_PASSWORD ? "$System.env.DEBUG_KEY_PASSWORD" : "debug0")
|
|
|
|
}
|
2024-01-08 22:49:59 +01:00
|
|
|
|
2023-11-25 20:11:12 +01:00
|
|
|
release {
|
2024-01-10 00:31:43 +01:00
|
|
|
if (System.env.RELEASE_KEYSTORE) {
|
|
|
|
storeFile file(System.env.RELEASE_KEYSTORE)
|
|
|
|
storePassword "$System.env.RELEASE_KEYSTORE_PASSWORD"
|
|
|
|
keyAlias "$System.env.RELEASE_KEY_ALIAS"
|
|
|
|
keyPassword "$System.env.RELEASE_KEY_PASSWORD"
|
|
|
|
}
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled true
|
|
|
|
shrinkResources true
|
|
|
|
debuggable false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
|
|
|
|
resValue "string", "app_name", "@string/app_name_release"
|
2024-01-08 22:49:59 +01:00
|
|
|
signingConfig signingConfigs.release
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
2024-01-08 22:49:59 +01:00
|
|
|
|
2023-11-25 20:11:12 +01:00
|
|
|
debug {
|
|
|
|
minifyEnabled false
|
|
|
|
shrinkResources false
|
|
|
|
debuggable true
|
|
|
|
applicationIdSuffix ".debug"
|
|
|
|
resValue "string", "app_name", "@string/app_name_debug"
|
|
|
|
resValue "bool", "debug_logs", "true"
|
|
|
|
signingConfig signingConfigs.debug
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-08 22:47:21 +01:00
|
|
|
// Name outputs after the application ID.
|
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
variant.outputs.all {
|
|
|
|
outputFileName = "${applicationId}.apk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-25 20:11:12 +01:00
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_7
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_7
|
|
|
|
}
|
2024-02-10 18:03:09 +01:00
|
|
|
|
|
|
|
lintOptions {
|
|
|
|
// Translation are already checked by 'syncTranslations'
|
|
|
|
disable 'MissingTranslation'
|
|
|
|
}
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register('buildKeyboardFont') {
|
|
|
|
println "\nBuilding assets/special_font.ttf"
|
|
|
|
mkdir "$buildDir"
|
|
|
|
exec {
|
|
|
|
workingDir "$projectDir/srcs/special_font"
|
|
|
|
def svgFiles = workingDir.listFiles().findAll {
|
|
|
|
it.isFile() && it.name.endsWith(".svg")
|
|
|
|
}
|
|
|
|
commandLine("fontforge", "-lang=ff", "-script", "build.pe", "$buildDir/special_font.ttf", *svgFiles)
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$buildDir/special_font.ttf"
|
|
|
|
into "assets"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-08 13:02:19 +02:00
|
|
|
tasks.register('genEmojis') {
|
|
|
|
println "\nGenerating res/raw/emojis.txt"
|
|
|
|
exec {
|
|
|
|
workingDir = projectDir
|
|
|
|
commandLine "python", "gen_emoji.py"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-25 20:11:12 +01:00
|
|
|
tasks.withType(Test).configureEach {
|
|
|
|
dependsOn 'genLayoutsList'
|
|
|
|
dependsOn 'checkKeyboardLayouts'
|
|
|
|
dependsOn 'syncTranslations'
|
2024-02-11 20:46:36 +01:00
|
|
|
dependsOn 'compileComposeSequences'
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register('genLayoutsList') {
|
|
|
|
println "\nGenerating res/values/layouts.xml"
|
|
|
|
exec {
|
|
|
|
workingDir = projectDir
|
|
|
|
commandLine "python", "gen_layouts.py"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register('checkKeyboardLayouts') {
|
|
|
|
println "\nChecking layouts"
|
2024-01-21 16:34:49 +01:00
|
|
|
exec {
|
|
|
|
def layouts = new File(projectDir, "srcs/layouts").listFiles().findAll {
|
|
|
|
it.name.endsWith(".xml")
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
2024-01-21 16:34:49 +01:00
|
|
|
workingDir = projectDir
|
|
|
|
commandLine("python", "check_layout.py", *layouts)
|
|
|
|
standardOutput = new FileOutputStream("${projectDir}/check_layout.output")
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register('syncTranslations') {
|
|
|
|
println "\nUpdating translations"
|
|
|
|
exec {
|
|
|
|
workingDir = projectDir
|
|
|
|
commandLine "python", "sync_translations.py"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-11 20:46:36 +01:00
|
|
|
tasks.register('compileComposeSequences') {
|
|
|
|
def out = "srcs/juloo.keyboard2/ComposeKeyData.java"
|
|
|
|
println "\nGenerating ${out}"
|
|
|
|
exec {
|
|
|
|
def sequences = new File(projectDir, "srcs/compose").listFiles().findAll {
|
2024-07-21 23:37:07 +02:00
|
|
|
!it.name.endsWith(".py") && !it.name.endsWith(".md")
|
2024-02-11 20:46:36 +01:00
|
|
|
}
|
|
|
|
workingDir = projectDir
|
|
|
|
commandLine("python", "srcs/compose/compile.py", *sequences)
|
|
|
|
standardOutput = new FileOutputStream("${projectDir}/${out}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-25 20:11:12 +01:00
|
|
|
tasks.named("preBuild") {
|
|
|
|
dependsOn += "initDebugKeystore"
|
2023-12-17 12:41:19 +01:00
|
|
|
dependsOn += "copyRawQwertyUS"
|
2024-01-21 16:34:49 +01:00
|
|
|
dependsOn += "copyLayoutDefinitions"
|
2023-11-25 20:11:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register('initDebugKeystore') {
|
|
|
|
if (!file("debug.keystore").exists()) {
|
|
|
|
println "Initializing default debug keystore"
|
|
|
|
exec {
|
|
|
|
// A shell script might be needed if this line requires input from the user
|
|
|
|
commandLine "keytool", "-genkeypair", "-dname", "cn=d, ou=e, o=b, c=ug", "-alias", "debug", "-keypass", "debug0", "-keystore", "debug.keystore", "-keyalg", "rsa", "-storepass", "debug0", "-validity", "10000"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-17 12:41:19 +01:00
|
|
|
|
|
|
|
// latn_qwerty_us is used as a raw resource by the custom layout option.
|
|
|
|
tasks.register('copyRawQwertyUS')
|
|
|
|
{
|
|
|
|
copy {
|
2024-01-21 16:34:49 +01:00
|
|
|
from "srcs/layouts/latn_qwerty_us.xml"
|
2023-12-17 12:41:19 +01:00
|
|
|
into "build/generated-resources/raw"
|
|
|
|
}
|
|
|
|
}
|
2024-01-21 16:34:49 +01:00
|
|
|
|
|
|
|
tasks.register('copyLayoutDefinitions')
|
|
|
|
{
|
|
|
|
copy {
|
|
|
|
from "srcs/layouts"
|
2024-02-18 23:37:26 +01:00
|
|
|
include "*.xml"
|
2024-01-21 16:34:49 +01:00
|
|
|
into "build/generated-resources/xml"
|
|
|
|
}
|
|
|
|
}
|