Fix Android Manifest hack for new AGP versions (#10076)

* Fix Android Manifest hack for new AGP versions

* Minor changes
This commit is contained in:
stevenyomi 2025-08-11 02:14:04 +00:00 committed by Draff
parent 95e98fd5f1
commit 45f31c3b75
Signed by: Draff
GPG Key ID: E8A89F3211677653

View File

@ -17,7 +17,7 @@ android {
namespace "eu.kanade.tachiyomi.extension"
sourceSets {
main {
manifest.srcFile "AndroidManifest.xml"
manifest.srcFile layout.buildDirectory.file('tempAndroidManifest.xml')
java.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
@ -105,17 +105,20 @@ dependencies {
compileOnly(libs.bundles.common)
}
tasks.register("copyManifestFile", Copy) {
from 'AndroidManifest.xml'
rename { 'tempAndroidManifest.xml' }
into layout.buildDirectory
}
tasks.register("writeManifestFile") {
dependsOn(copyManifestFile)
doLast {
def manifest = android.sourceSets.getByName("main").manifest
if (!manifest.srcFile.exists()) {
File tempFile = layout.buildDirectory.get().file("tempAndroidManifest.xml").getAsFile()
if (!tempFile.exists()) {
tempFile.withWriter {
it.write('<?xml version="1.0" encoding="utf-8"?>\n<manifest />\n')
}
File tempFile = android.sourceSets.getByName('main').manifest.srcFile
if (!tempFile.exists()) {
tempFile.withWriter {
it.write('<?xml version="1.0" encoding="utf-8"?>\n<manifest />\n')
}
manifest.srcFile(tempFile.path)
}
}
}