Commit 0f196859 authored by Alexandre Julliard's avatar Alexandre Julliard

wineandroid: Generate assets checksum from the gradle build file.

parent ae4199e2
......@@ -20,9 +20,5 @@ EXTRA_TARGETS = wine-debug.apk
all: wine-debug.apk
wine-debug.apk: build.gradle $(srcdir)/AndroidManifest.xml $(srcdir)/WineActivity.java $(srcdir)/wine.svg
(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
gradle -q assembleDebug && mv build/outputs/apk/wine-debug.apk .
gradle -q assembleDebug
mv build/outputs/apk/wine-debug.apk $@
......@@ -32,7 +32,8 @@ buildscript
}
}
def add_icon_task( dir, scale ) {
def add_icon_task( dir, scale )
{
return tasks.create( "createIcon-" + dir, Exec ) {
def outdir = new File( "res", "drawable-" + dir )
outputs.dir( outdir )
......@@ -45,15 +46,33 @@ def add_icon_task( dir, scale ) {
}
}
tasks.whenTaskAdded { t ->
if (t.name.equals( "generateDebugResources" )) {
t.dependsOn add_icon_task( "ldpi", 0.75 )
t.dependsOn add_icon_task( "mdpi", 1 )
t.dependsOn add_icon_task( "hdpi", 1.5 )
t.dependsOn add_icon_task( "xhdpi", 2 )
t.dependsOn add_icon_task( "xxhdpi", 3 )
t.dependsOn add_icon_task( "xxxhdpi", 4 )
}
def checksum_task()
{
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";
}
}
tasks.whenTaskAdded
{
if (name.equals( "generateDebugResources" ))
{
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 )
}
if (name.equals( "generateDebugAssets" ))
{
dependsOn checksum_task()
}
}
tasks.withType(JavaCompile)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment