mirror of
https://github.com/TrianguloY/UrlChecker.git
synced 2024-09-19 20:02:16 +02:00
381f598293
- Improve: Input Text module display - Improve: Hosts module will check for subdomains too - Fix: Avoid crashes when decoding invalid text - Fix: Avoid crashes with malformed queries - Fix: Updated invalid lastUpdate of ClearUrl catalog - Fix: Module enable switches was sometimes reset when the app was sent to the background - Fix: Double decoding of url parts
123 lines
4.2 KiB
Groovy
123 lines
4.2 KiB
Groovy
plugins {
|
|
id 'com.android.application'
|
|
id 'com.github.triplet.play' version '3.8.3'
|
|
}
|
|
|
|
android {
|
|
namespace 'com.trianguloy.urlchecker'
|
|
defaultConfig {
|
|
applicationId "com.trianguloy.urlchecker"
|
|
compileSdk 34
|
|
minSdkVersion 19
|
|
targetSdkVersion 34
|
|
versionCode 35
|
|
versionName "2.17"
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
alpha {
|
|
initWith(buildTypes.debug)
|
|
applicationIdSuffix '.alpha'
|
|
versionNameSuffix '-ALPHA'
|
|
}
|
|
evaluation {
|
|
initWith(buildTypes.debug)
|
|
applicationIdSuffix '.test'
|
|
versionNameSuffix '-TEST'
|
|
}
|
|
}
|
|
|
|
// rename output apks
|
|
applicationVariants.configureEach {
|
|
outputs.configureEach {
|
|
outputFileName = "URLCheck-$versionName${name == "release" ? "" : "-$name"}.apk"
|
|
}
|
|
}
|
|
|
|
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_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
buildFeatures {
|
|
buildConfig true
|
|
}
|
|
}
|
|
|
|
play {
|
|
track.set("beta")
|
|
releaseName.set(android.defaultConfig.versionName + " (" + android.defaultConfig.versionCode + ")")
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
}
|
|
|
|
// configure signing for release
|
|
private String secret(String name) { project.hasProperty(name) ? project.property(name) : System.getenv(name) }
|
|
|
|
if (secret('RELEASE_STORE_FILE')) {
|
|
println("Secrets provided, release will be signed")
|
|
android {
|
|
signingConfigs {
|
|
release {
|
|
storeFile file(secret('RELEASE_STORE_FILE'))
|
|
storePassword secret('RELEASE_STORE_PASSWORD')
|
|
keyAlias secret('RELEASE_KEY_ALIAS')
|
|
keyPassword secret('RELEASE_KEY_PASSWORD')
|
|
}
|
|
}
|
|
buildTypes {
|
|
release {
|
|
signingConfig signingConfigs.release
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
println("No secrets provided, release will not be signed")
|
|
}
|
|
|
|
// Generate translation related fields
|
|
android {
|
|
defaultConfig {
|
|
// get translations names
|
|
def folder = file("src/main/res") // from this folder
|
|
def translations = Arrays.stream(folder.list()) // from all files in the folder
|
|
.filter { file("$folder.path/$it/strings.xml").exists() } // and containing a strings translation
|
|
.collect { it }
|
|
|
|
// generate buildconfig field with all locales
|
|
def locales = translations.stream()
|
|
.map { it.replace('values-', '').replace('-r', '-').replace('values', 'en') } // extract the locale code
|
|
.distinct().sorted() // keep distinct and sort them
|
|
.collect { '"' + it + '"' } // convert as 'string'
|
|
.join(',') // and concatenate with commas
|
|
println "Found locales: $locales"
|
|
buildConfigField "java.util.List<String>", 'LOCALES', "java.util.List.of($locales)" // create field
|
|
|
|
// generate string resource with all translators
|
|
def translators = translations.stream() // for all translations
|
|
.map { file("$folder.path/$it/strings.xml") } // get the xml file
|
|
.map { new XmlParser().parse(it).find { it.@name == "translators" }?.text() ?: "" } // extract translators
|
|
.filter { it != "" } // filter empty
|
|
.flatMap { it.split(';').stream() } // split multiple
|
|
.map { it.strip() } // trim
|
|
.filter { it != "TrianguloY" } // remove myself
|
|
.distinct().sorted() // keep distinct and sort them
|
|
.collect { it }.join(', ') // join with commas
|
|
println "Extracted translators: $translators"
|
|
resValue "string", "all_translators", translators // create resource
|
|
}
|
|
} |