Skip to content

Commit f8364ec

Browse files
committed
build(gradle): upgrade Gradle to v9.3.1, AGP to v9.1.0, and Kotlin to v2.2.10
- Upgrade Java toolchain and bytecode target to JDK 17. - Implement conditional manifest merging for camera, location, and audio features based on Gradle properties. - Add `kotlin-compose` plugin and remove deprecated `composeOptions`. - Configure fallback to debug keystore in `build.gradle.kts` if release signing properties are missing. - Add Foojay toolchain resolver convention and generate `gradle-daemon-jvm.properties`. - Refactor `AndroidManifest.xml` to extract hardware-specific permissions into feature-linked manifests.
1 parent 33d5048 commit f8364ec

15 files changed

+119
-33
lines changed

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/material_theme_project_new.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/audio/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
4+
</manifest>

app/build.gradle.kts

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import java.util.Locale
55
plugins {
66
alias(libs.plugins.android.application)
77
alias(libs.plugins.kotlin.android)
8+
alias(libs.plugins.kotlin.compose)
89
}
910

1011
val dateFormat = SimpleDateFormat("yyyyMMdd", Locale.getDefault())
@@ -18,16 +19,30 @@ val shortcuts = mapOf(
1819
"/contact-me" to "Contact Me",
1920
)
2021

22+
fun featureEnabled(name: String): Boolean {
23+
return (project.findProperty(name) as String?)?.toBoolean() ?: false
24+
}
25+
2126
android {
2227
namespace = "com.mrepol742.webappp"
2328
compileSdk = 36
2429

2530
signingConfigs {
2631
create("release") {
27-
storeFile = file(project.findProperty("STORE_FILE") as String)
28-
storePassword = project.findProperty("STORE_PASSWORD") as String
29-
keyAlias = project.findProperty("KEY_ALIAS") as String
30-
keyPassword = project.findProperty("KEY_PASSWORD") as String
32+
val storeFileProp = project.findProperty("STORE_FILE") as String?
33+
34+
if (storeFileProp != null) {
35+
storeFile = file(storeFileProp)
36+
storePassword = project.findProperty("STORE_PASSWORD") as String
37+
keyAlias = project.findProperty("KEY_ALIAS") as String
38+
keyPassword = project.findProperty("KEY_PASSWORD") as String
39+
} else {
40+
// fallback to debug keystore
41+
storeFile = file("${System.getProperty("user.home")}/.android/debug.keystore")
42+
storePassword = "android"
43+
keyAlias = "androiddebugkey"
44+
keyPassword = "android"
45+
}
3146
}
3247
}
3348

@@ -69,28 +84,38 @@ android {
6984
}
7085

7186
compileOptions {
72-
sourceCompatibility = JavaVersion.VERSION_1_8
73-
targetCompatibility = JavaVersion.VERSION_1_8
74-
}
75-
76-
kotlinOptions {
77-
jvmTarget = "1.8"
87+
sourceCompatibility = JavaVersion.VERSION_17
88+
targetCompatibility = JavaVersion.VERSION_17
7889
}
7990

8091
buildFeatures {
8192
compose = true
8293
buildConfig = true
8394
}
8495

85-
composeOptions {
86-
kotlinCompilerExtensionVersion = "1.5.1"
87-
}
88-
8996
packaging {
9097
resources {
9198
excludes += "/META-INF/{AL2.0,LGPL2.1}"
9299
}
93100
}
101+
102+
sourceSets {
103+
if ((project.findProperty("feature.camera") as String?) == "true") {
104+
getByName("main").manifest.srcFile("src/camera/AndroidManifest.xml")
105+
}
106+
107+
if ((project.findProperty("feature.location") as String?) == "true") {
108+
getByName("main").manifest.srcFile("src/location/AndroidManifest.xml")
109+
}
110+
111+
if ((project.findProperty("feature.audio") as String?) == "true") {
112+
getByName("main").manifest.srcFile("src/audio/AndroidManifest.xml")
113+
}
114+
}
115+
}
116+
117+
kotlin {
118+
jvmToolchain(17)
94119
}
95120

96121
dependencies {

app/camera/AndroidManifest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<uses-feature
5+
android:name="android.hardware.camera"
6+
android:required="false" />
7+
<uses-permission android:name="android.permission.CAMERA" />
8+
</manifest>

app/location/AndroidManifest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<uses-feature
4+
android:name="android.hardware.location"
5+
android:required="false" />
6+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
7+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
8+
</manifest>

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,9 @@
55
<uses-feature
66
android:glEsVersion="0x00020000"
77
android:required="true" />
8-
<uses-feature
9-
android:name="android.hardware.camera"
10-
android:required="false" />
118

129
<uses-permission android:name="android.permission.INTERNET" />
1310

14-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
15-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
16-
17-
<uses-permission android:name="android.permission.CAMERA" />
18-
<uses-permission android:name="android.permission.RECORD_AUDIO" />
19-
2011
<application
2112
android:allowBackup="true"
2213
android:dataExtractionRules="@xml/data_extraction_rules"
@@ -38,8 +29,8 @@
3829
android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
3930
android:exported="true"
4031
android:launchMode="singleTask"
41-
android:windowSoftInputMode="adjustResize"
42-
android:theme="@style/Theme.WebAppp">
32+
android:theme="@style/Theme.WebAppp"
33+
android:windowSoftInputMode="adjustResize">
4334
<intent-filter>
4435
<action android:name="android.intent.action.MAIN" />
4536

@@ -52,7 +43,9 @@
5243
<category android:name="android.intent.category.DEFAULT" />
5344
<category android:name="android.intent.category.BROWSABLE" />
5445

55-
<data android:host="www.melvinjonesrepol.com" android:scheme="https" />
46+
<data
47+
android:host="www.melvinjonesrepol.com"
48+
android:scheme="https" />
5649
</intent-filter>
5750
</activity>
5851
</application>

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
plugins {
33
alias(libs.plugins.android.application) apply false
44
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.kotlin.compose) apply false
56
}

0 commit comments

Comments
 (0)