mirror of
https://github.com/TrianguloY/UrlChecker.git
synced 2024-09-20 04:12:14 +02:00
b179b20bb3
- New tutorial screen - New module: Unshortener - New features and improvements to status module - New shortcut & tile to open clipboard links - New chinese translation. Many thanks to Seviche CC! - Visual fixes
78 lines
2.9 KiB
Groovy
78 lines
2.9 KiB
Groovy
plugins {
|
|
id 'com.android.application'
|
|
id 'com.github.triplet.play' version '3.7.0'
|
|
}
|
|
|
|
android {
|
|
namespace 'com.trianguloy.urlchecker'
|
|
compileSdkVersion 32
|
|
defaultConfig {
|
|
applicationId "com.trianguloy.urlchecker"
|
|
minSdkVersion 14
|
|
targetSdkVersion 32
|
|
versionCode 22
|
|
versionName "2.10"
|
|
|
|
|
|
// generate buildconfig field with all locales
|
|
def folder = file("src/main/res") // from this folder
|
|
def prefix = "values-" // with this prefix
|
|
def translations = folder.list().toList().stream() // from all files in the folder
|
|
.filter { it.startsWith(prefix) } // keep those starting with the prefix
|
|
.filter { file("$folder.path/$it/strings.xml").exists() } // and containing a strings translation
|
|
.collect { it }
|
|
def constructor = translations.stream()
|
|
.map { it.substring(prefix.length()).replace('-r', '-') } // extract the locale code
|
|
.collect { '"' + it + '"' } // convert as 'string'
|
|
.join(',') // and concatenate with commas
|
|
buildConfigField "java.util.List<String>", 'LOCALES', "java.util.List.of(\"en\",$constructor)" // create field
|
|
|
|
// generate string resource with all translators
|
|
def translators = translations.stream()
|
|
.map { file("$folder.path/$it/strings.xml") } // get translation files
|
|
.flatMap { it.readLines().stream() } // extract all lines
|
|
.filter { it.matches("[ \t]*Translator:.*") } // keep only the translators ones
|
|
.map { it.split(":", 2)[1].trim() } // extract the name
|
|
.filter { !it.startsWith("<") } // remove 'internal' ones
|
|
.distinct().sorted() // keep distinct and sort them
|
|
.collect { it }
|
|
.join(', ') // join with commas
|
|
resValue "string", "translators", translators // create resource
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
alpha {
|
|
initWith(buildTypes.debug)
|
|
applicationIdSuffix '.alpha'
|
|
versionNameSuffix '-ALPHA'
|
|
}
|
|
}
|
|
|
|
lint {
|
|
// users are free to update translations whenever
|
|
// this mean that they are not usually up to date
|
|
// and that there are usually lots of missing translations
|
|
// so we ignore missing strings
|
|
disable 'MissingTranslation'
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_11
|
|
targetCompatibility JavaVersion.VERSION_11
|
|
}
|
|
}
|
|
|
|
play {
|
|
track.set("beta")
|
|
releaseName.set(android.defaultConfig.versionName + " (" + android.defaultConfig.versionCode + ")")
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
}
|