Assigned
Status Update
Comments
xa...@android.com <xa...@android.com>
jw...@gmail.com <jw...@gmail.com> #2
I was trying to modify the values resources, as the logic below:
1. copy all the values resources from original folder to another working folder
2. do something in the working folder.
3. exclude all the values inside the original resources folder, and include the new resources working folder
But exclude patterns do not work on android.sourceSets."${buildType}".res, or is there a better way to achieve it?
Reference script:
def filterVariant = { variantToFilter, filterTask->
def vv = android.sourceSets."${variantToFilter}".res.srcDirs
println "${variantToFilter} --> ${vv*.toString()}"
def variantRes = android.sourceSets."${variantToFilter}".res
variantRes.srcDirs.each{ resDir->
def filterOutput = "${buildDir}/res-filter"
if (resDir.toString().contains(filterOutput)) {
return
}
println "begin filter ${resDir} to ${filterOutput}/${variantToFilter}"
filterTask.from fileTree(dir: resDir, include: 'values*/*.xml')
filterTask.into "${filterOutput}/${variantToFilter}"
variantRes.exclude "${resDir}/values*/*.xml"
variantRes.srcDirs = variantRes.srcDirs << "${filterOutput}/${variantToFilter}"
}
}
project.task('filterMainResources', type: Copy) {
filterVariant 'main', it
}
android.libraryVariants.all{ variant ->
project.task("filter${variant.name }Resources", type: Copy) { filterTask ->
filterVariant "${variant.name }", filterTask
filterTask.dependsOn "filterMainResources"
}
variant.mergeResources.dependsOn("filter${variant.name }Resources")
}
1. copy all the values resources from original folder to another working folder
2. do something in the working folder.
3. exclude all the values inside the original resources folder, and include the new resources working folder
But exclude patterns do not work on android.sourceSets."${buildType}".res, or is there a better way to achieve it?
Reference script:
def filterVariant = { variantToFilter, filterTask->
def vv = android.sourceSets."${variantToFilter}".res.srcDirs
println "${variantToFilter} --> ${vv*.toString()}"
def variantRes = android.sourceSets."${variantToFilter}".res
variantRes.srcDirs.each{ resDir->
def filterOutput = "${buildDir}/res-filter"
if (resDir.toString().contains(filterOutput)) {
return
}
println "begin filter ${resDir} to ${filterOutput}/${variantToFilter}"
filterTask.from fileTree(dir: resDir, include: 'values*/*.xml')
filterTask.into "${filterOutput}/${variantToFilter}"
variantRes.exclude "${resDir}/values*/*.xml"
variantRes.srcDirs = variantRes.srcDirs << "${filterOutput}/${variantToFilter}"
}
}
project.task('filterMainResources', type: Copy) {
filterVariant 'main', it
}
android.libraryVariants.all{ variant ->
project.task("filter${
filterVariant "${
filterTask.dependsOn "filterMainResources"
}
variant.mergeResources.dependsOn("filter${
}
xa...@android.com <xa...@android.com> #3
You would have to also edit the resoure merger to take as input only your copied folder. This is really not something that's supported (also it's the wrong place to ask feedback on implementation like this).
xa...@android.com <xa...@android.com>
lo...@gmail.com <lo...@gmail.com> #4
Doing so for resources would help us to drastically reduce apk file sizes by taking less time to create per density apk, and in the long term, would allow low storage devices to install more apps by wasting less storage (what a bad idea to include XXXHDPI, XXHDPI and XHDPI in apks for HDPI low storage devices!)
ar...@gmail.com <ar...@gmail.com> #5
Any update on this?
I am currently doing a major refactoring/rewrite of our app (switching one networking-library with another) and would like to know if there currently is a way to exclude broken parts of the code and concentrate on testing already ported code easily.
That would help immensely!
I am currently doing a major refactoring/rewrite of our app (switching one networking-library with another) and would like to know if there currently is a way to exclude broken parts of the code and concentrate on testing already ported code easily.
That would help immensely!
r....@gmail.com <r....@gmail.com> #6
It's still not working for C or C++ code.
ti...@gmail.com <ti...@gmail.com> #7
I've been working with the latest tooling - gradle 3.0.0 wrapper - and trying to exclude aidl files which define parcelable classes - to eliminate warnings emitted by the aidl compiler and the "excludes" statements do not appear to be working for aidl even though they show up as available in the code completion.
ch...@google.com <ch...@google.com>
go...@sentio.com <go...@sentio.com> #8
any update? This issues is causing issue with our XML processing, any ETA?
jo...@gmail.com <jo...@gmail.com> #9
Any update? The include/exclude should throw UnsupportedOperationException at least as it's very confusing why some docs say it should work. Include/exclude doesn't work for any android sourceSets (java/kotlin), not just the ones listed in the description.
lu...@google.com <lu...@google.com>
vs...@gmail.com <vs...@gmail.com> #10
Comment has been deleted.
lo...@gmail.com <lo...@gmail.com> #11
Comment above is SPAM.
Description
We should do this for aidl/rs/jni/assets.
We could also do the same for res/ but it's a bit more complicated. Worth investigating.