mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
107 lines
3.6 KiB
Groovy
Executable File
107 lines
3.6 KiB
Groovy
Executable File
buildscript {
|
|
ext.kotlin_version = '1.6.10'
|
|
project.ext {
|
|
compileSdk = 31
|
|
buildTools = "31.0.0"
|
|
minSdk = 26
|
|
targetSdk = 28
|
|
versionCode = 201
|
|
versionName = "2.0.1-beta"
|
|
packageName = "com.itsaky.androidide"
|
|
|
|
javaSourceVersion = JavaVersion.VERSION_11
|
|
javaTargetVersion = JavaVersion.VERSION_11
|
|
}
|
|
|
|
repositories {
|
|
google()
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
|
maven { url 'https://jitpack.io' }
|
|
}
|
|
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:7.1.2'
|
|
classpath 'com.google.gms:google-services:4.3.10'
|
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
classpath 'com.github.sherter.googlejavaformatgradleplugin:google-java-format-gradle-plugin:0.9-SNAPSHOT'
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
apply from: "${rootDir}/gradle/dependencies.gradle"
|
|
apply plugin: 'com.github.sherter.google-java-format'
|
|
|
|
googleJavaFormat {
|
|
toolVersion = '1.15.0'
|
|
options style: 'AOSP'
|
|
}
|
|
|
|
task checkTranslations() {
|
|
|
|
def php = new File ("/usr/bin/php")
|
|
if (!php.exists()) {
|
|
project.logger.lifecycle("'${php.absolutePath}' not found. Skipping translation check.")
|
|
return
|
|
}
|
|
|
|
def resDir = project.file("src/main/res")
|
|
def strings = new File(resDir, "values/strings.xml")
|
|
def reportDir = new File(project.rootProject.buildDir, "translation-reports")
|
|
reportDir.delete()
|
|
|
|
if (resDir.exists() && strings.exists()) {
|
|
def translationDirs = resDir.listFiles((FileFilter) (file -> {
|
|
return file.isDirectory() && file.getName().startsWith("values-") }))
|
|
for (def dir : translationDirs) {
|
|
final var translation = new File(dir, "strings.xml")
|
|
if (translation.exists()) {
|
|
def out = new File(reportDir, "${project.path.replace(':', '/')}/${dir.name}.txt")
|
|
if (!out.parentFile.exists()) {
|
|
out.parentFile.mkdirs()
|
|
}
|
|
|
|
if (out.exists()) {
|
|
out.delete()
|
|
}
|
|
out.createNewFile()
|
|
|
|
def result = exec {
|
|
ignoreExitValue true
|
|
standardOutput new FileOutputStream(out)
|
|
commandLine "${php.absolutePath}",
|
|
"${project.rootProject.file(".tools/strings-check.php")}",
|
|
"${strings.absolutePath}",
|
|
"${translation.absolutePath}"
|
|
}
|
|
|
|
if (result.getExitValue() == 0) {
|
|
out.delete()
|
|
} else {
|
|
project.logger.lifecycle("Translation report for '${project.path}/${dir.name}' is written to '${out.absolutePath}'")
|
|
}
|
|
|
|
} else {
|
|
project.logger.info("No translation file specifed for '${dir.name}'. Skipping..")
|
|
}
|
|
}
|
|
} else {
|
|
project.logger.info("Default strings.xml file does not exist for project '${project.name}'")
|
|
}
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
google()
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven { url 'https://jitpack.io' }
|
|
}
|
|
}
|
|
|
|
task clean(type: Delete) {
|
|
delete rootProject.buildDir
|
|
} |