Skip to content

Commit d087d98

Browse files
committed
Fix build and update toolchains
1. Migrate to build.gradle.kts. 2. Fix building after updating share lib. 3. Update AGP and Gradle. 4. Use JDK 21 to build. Signed-off-by: utzcoz <utzcoz@outlook.com>
1 parent 6585c00 commit d087d98

14 files changed

Lines changed: 231 additions & 228 deletions

File tree

.github/workflows/gradle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v6
18-
- name: Set up JDK 17
18+
- name: Set up JDK 21
1919
uses: actions/setup-java@v5
2020
with:
21-
java-version: 17
21+
java-version: 21
2222
distribution: zulu
2323
- name: Setup Gradle
2424
uses: gradle/actions/setup-gradle@v5

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ to receive the task changed events from system.
1111
We provide gradle build script to build app with gradle, and develop it with Android Studio. It uses the keystore
1212
generated from AOSP debug key, and it will help to install debug app from Android Studio to Android.
1313

14-
`build.gradle` use jars of above library to remove system API dependency, and
14+
`build.gradle.kts` uses jars of above library to remove system API dependency, and
1515
built this project directly and separately. The jars are built from system, so we should update them
1616
when we upgrade AOSP.
1717

@@ -27,7 +27,7 @@ m SystemUISharedLib
2727

2828
Copy `out/target/product/boringdroid_x86_64/obj/JAVA_LIBRARIES/SystemUISharedLib_intermediates/javalib.jar`
2929
to replace `SystemUIPluginLib.jar`. And then updating `src/main/SystemUISharedRes` based on
30-
[SystemUI SharedLib's Android.bp](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/packages/SystemUI/shared/Android.bp).
30+
[SystemUI SharedLib's Android.bp](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/packages/SystemUI/shared/Android.bp).
3131

3232

3333
The `SystemUISharedLib` is a new all-in-one library.

app/build.gradle

Lines changed: 0 additions & 127 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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

Comments
 (0)