forked from AndroidIDEOfficial/AndroidIDE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·107 lines (92 loc) · 3.57 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
buildscript {
ext.kotlin_version = '1.6.10'
project.ext {
compileSdk = 31
buildTools = "31.0.0"
minSdk = 26
targetSdk = 28
versionCode = 200
versionName = "2.0.0-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
}