|
| 1 | +import org.gradle.api.tasks.compile.JavaCompile |
| 2 | +import org.gradle.api.tasks.testing.Test |
| 3 | +import org.gradle.api.tasks.testing.logging.TestExceptionFormat |
| 4 | + |
| 5 | +plugins { |
| 6 | + id("com.diffplug.spotless") |
| 7 | + id("com.android.application") |
| 8 | +} |
| 9 | + |
| 10 | +spotless { |
| 11 | + format("misc") { |
| 12 | + target("*.md", ".gitignore") |
| 13 | + trimTrailingWhitespace() |
| 14 | + endWithNewline() |
| 15 | + } |
| 16 | + |
| 17 | + kotlinGradle { |
| 18 | + target("*.gradle.kts", "**/*.gradle.kts") |
| 19 | + ktfmt().kotlinlangStyle() |
| 20 | + } |
| 21 | + |
| 22 | + kotlin { |
| 23 | + target("**/*.kt") |
| 24 | + ktfmt().kotlinlangStyle() |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +android { |
| 29 | + namespace = "com.boringdroid.systemui" |
| 30 | + compileSdk = 33 |
| 31 | + |
| 32 | + defaultConfig { |
| 33 | + applicationId = "com.boringdroid.systemui" |
| 34 | + minSdk = 28 |
| 35 | + targetSdk = 33 |
| 36 | + versionCode = 130 |
| 37 | + versionName = "130" |
| 38 | + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
| 39 | + } |
| 40 | + |
| 41 | + sourceSets { getByName("main").resources.directories.add("src/main/SystemUISharedRes") } |
| 42 | + |
| 43 | + buildTypes { |
| 44 | + getByName("release") { |
| 45 | + isMinifyEnabled = false |
| 46 | + proguardFiles( |
| 47 | + getDefaultProguardFile("proguard-android-optimize.txt"), |
| 48 | + "proguard-rules.pro", |
| 49 | + ) |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + signingConfigs { |
| 54 | + getByName("debug") { |
| 55 | + keyAlias = "androiddebugkey" |
| 56 | + keyPassword = "android" |
| 57 | + storeFile = file("plugin.keystore") |
| 58 | + storePassword = "android" |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + testOptions { unitTests.isIncludeAndroidResources = true } |
| 63 | + |
| 64 | + compileOptions { |
| 65 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 66 | + targetCompatibility = JavaVersion.VERSION_17 |
| 67 | + } |
| 68 | + |
| 69 | + lint { abortOnError = false } |
| 70 | +} |
| 71 | + |
| 72 | +configurations.named("implementation") { |
| 73 | + exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib") |
| 74 | + exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common") |
| 75 | + exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8") |
| 76 | + exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7") |
| 77 | + exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect") |
| 78 | + exclude(group = "org.jetbrains.kotlin", module = "kotlin-io") |
| 79 | + exclude(group = "org.jetbrains", module = "annotations") |
| 80 | + exclude(group = "androidx.core") |
| 81 | + exclude(group = "androidx.annotation") |
| 82 | + exclude(group = "androidx.collection") |
| 83 | +} |
| 84 | + |
| 85 | +dependencies { |
| 86 | + implementation(files("libs/SystemUISharedLib.jar")) |
| 87 | + |
| 88 | + testImplementation("androidx.test:core:1.6.1") |
| 89 | + testImplementation("junit:junit:4.13.2") |
| 90 | + testImplementation("org.robolectric:robolectric:4.16.1") |
| 91 | + testImplementation("com.google.truth:truth:1.4.4") |
| 92 | + androidTestImplementation("androidx.test:runner:1.6.2") |
| 93 | + androidTestImplementation("androidx.test:rules:1.6.1") |
| 94 | + androidTestImplementation("com.google.truth:truth:1.4.4") |
| 95 | + androidTestImplementation("com.google.truth.extensions:truth-java8-extension:1.4.4") |
| 96 | + androidTestImplementation("androidx.test.ext:junit:1.2.1") |
| 97 | + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") |
| 98 | + androidTestImplementation("androidx.test.uiautomator:uiautomator:2.3.0") |
| 99 | +} |
| 100 | + |
| 101 | +tasks.withType<Test>().configureEach { |
| 102 | + systemProperty("robolectric.enabledSdks", "33") |
| 103 | + |
| 104 | + testLogging { |
| 105 | + events("passed", "skipped", "failed", "standardOut", "standardError") |
| 106 | + showStandardStreams = false |
| 107 | + exceptionFormat = TestExceptionFormat.FULL |
| 108 | + } |
| 109 | + |
| 110 | + outputs.upToDateWhen { false } |
| 111 | +} |
| 112 | + |
| 113 | +tasks.withType<JavaCompile>().configureEach { |
| 114 | + javaCompiler.set(javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion.of(21)) }) |
| 115 | +} |
0 commit comments