No, I do not see the convertToWebp[Up to date]
Also i checked that the task does executes in both cases but the behaviour is
different.
Below is the snippet of what I am using in my build.gradle :
def flavorName, buildType
task convertToWebp << {
println 'OS : ' + System.getProperty('os.name')
ext.convert = { dir ->
println ' convert invoked ' // --- (1)
def files = file(dir).listFiles()
files.each { File file ->
if (file.isFile()) {
def imageName = file.getName() // ----- (2)
println 'File : ' + imageName
// Conversion of webp to png images
}
}
}
println ' Converting drawables...' // ---- (3)
def drawablesDir =
file("$buildDir/intermediates/res/$flavorName/$buildType/").listFiles()
drawablesDir.each { dir ->
if (dir.isDirectory()) {
def name = dir.name
println ' isDirectory : ' + name // ----- (4)
if (name.startsWith('drawable-')) {
println 'Directory : ' + name
convert("$buildDir/intermediates/res/$flavorName/$buildType/$name/")
}
}
}
}
tasks.whenTaskAdded { task ->
if (task.name.startsWith('merge') &&
task.name.contains('ReleaseResources')) {
// extract flavor name and buildtype from
merge<flavor><buildType>Resources task name
println 'flavorName : ' + flavorName + ' and buildType is : ' +
buildType
} else if (task.name.startsWith('process') &&
task.name.contains('ReleaseResources')) {
println ' dependency set' // ------ (5)
task.dependsOn convertToWebp
}
}
Results of my build are :
Case A : when using name convertToWebp :
code at (5) is invoked
Line at (3) is also invoked but not (1), (2) and (4)
Case B : when using name : pngToWebp :
(1), (2), (3), (4) and (5) are executed
Let me know if any other info is needed.
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.