From: Twaik Yont <9674930+twaik@users.noreply.github.com> The wineandroid Gradle project no longer builds with recent Android build tools. Replace jcenter() with google() and mavenCentral(), update the Android Gradle plugin, and add the required namespace and android:exported attributes. The archivesBaseName property is no longer supported and is replaced with the current mechanism for setting the APK output name. Update task wiring to use configureEach so icon generation and asset checksums continue to run correctly with the modern task graph. This allows wineandroid to build with recent Gradle and Android SDK versions. Signed-off-by: Twaik Yont <9674930+twaik@users.noreply.github.com> --- dlls/wineandroid.drv/AndroidManifest.xml | 1 + dlls/wineandroid.drv/build.gradle.in | 81 +++++++++++++++++------- 2 files changed, 58 insertions(+), 24 deletions(-) diff --git a/dlls/wineandroid.drv/AndroidManifest.xml b/dlls/wineandroid.drv/AndroidManifest.xml index 574b98e3820..7f0a5e6ce64 100644 --- a/dlls/wineandroid.drv/AndroidManifest.xml +++ b/dlls/wineandroid.drv/AndroidManifest.xml @@ -9,6 +9,7 @@ android:icon="@drawable/wine" android:label="Wine" > <activity + android:exported="true" android:label="Wine" android:name=".WineActivity" android:launchMode="singleInstance" diff --git a/dlls/wineandroid.drv/build.gradle.in b/dlls/wineandroid.drv/build.gradle.in index 662e8b7ea22..8d0e138c9a2 100644 --- a/dlls/wineandroid.drv/build.gradle.in +++ b/dlls/wineandroid.drv/build.gradle.in @@ -18,20 +18,31 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +if (GradleVersion.current() < GradleVersion.version("9.4.0")) { + throw new GradleException("Gradle 9.4.0+ required") +} + apply plugin: 'com.android.application' buildscript { repositories { - jcenter() + google() + mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:2.2.1" + classpath "com.android.tools.build:gradle:9.1.0" } } +repositories +{ + google() + mavenCentral() +} + def get_srcdir() { if (srcdir.equals(".")) { return "."; } @@ -52,32 +63,39 @@ def add_icon_task( dir, scale ) } } -def checksum_task() +def checksum_task = tasks.create( "checksumAssets", Exec ) { - return tasks.create( "checksumAssets", Exec ) { - commandLine "sh", "-c", - "(test -d assets && " + - "rm -f assets/files.sum assets/sums.sum && " + - "sha256sum \$(find assets -type f -print) | sed 's/ assets\\// /' >files.sum && " + - "sha256sum files.sum >sums.sum && " + - "mv files.sum sums.sum assets) || rm -rf assets"; - } + commandLine "sh", "-c", + "(test -d assets && " + + "rm -f assets/files.sum assets/sums.sum && " + + "sha256sum \$(find assets -type f -print) | sed 's/ assets\\// /' >files.sum && " + + "sha256sum files.sum >sums.sum && " + + "mv files.sum sums.sum assets) || rm -rf assets"; } -tasks.whenTaskAdded +def icon_tasks = [ + add_icon_task( "ldpi", 0.75 ), + add_icon_task( "mdpi", 1 ), + add_icon_task( "hdpi", 1.5 ), + add_icon_task( "xhdpi", 2 ), + add_icon_task( "xxhdpi", 3 ), + add_icon_task( "xxxhdpi", 4 ) +] + +tasks.configureEach { - if (name.equals( "generateDebugResources" )) + if (name.equals( "preBuild" ) || + name.equals( "processDebugResources" ) || + name.equals( "processDebugNavigationResources" ) || + name.equals( "mergeDebugResources" )) { - dependsOn add_icon_task( "ldpi", 0.75 ) - dependsOn add_icon_task( "mdpi", 1 ) - dependsOn add_icon_task( "hdpi", 1.5 ) - dependsOn add_icon_task( "xhdpi", 2 ) - dependsOn add_icon_task( "xxhdpi", 3 ) - dependsOn add_icon_task( "xxxhdpi", 4 ) + dependsOn icon_tasks } - if (name.equals( "generateDebugAssets" )) + if (name.equals( "preBuild" ) || + name.equals( "generateDebugAssets" ) || + name.equals( "mergeDebugAssets" )) { - dependsOn checksum_task() + dependsOn checksum_task } } @@ -88,8 +106,8 @@ tasks.withType(JavaCompile) android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" + namespace "org.winehq.wine" + compileSdkVersion 36 defaultConfig { @@ -97,7 +115,6 @@ android minSdkVersion 17 versionCode 1 versionName "@PACKAGE_VERSION@" - setProperty( "archivesBaseName", "wine" ) } sourceSets @@ -110,3 +127,19 @@ android main.manifest.srcFile get_srcdir() + "/AndroidManifest.xml" } } + +configurations.configureEach +{ + exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib" +} + +androidComponents +{ + onVariants(selector().all()) + { variant -> + variant.outputs.forEach + { output -> + output.outputFileName.set("wine-${variant.name}.apk") + } + } +} -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10354