Hi!
I want to create a android_resource rule that includes both checked-in resources and generated resources. I have a genrule that's creating the files I want, but I can't figure out how to get android_resource to tie them together. The documentation for android_resource says that I should be able to pass additional resource directories via deps, but both ways I can think of to do so give different errors.
The last step of my generating looks like this, just for reference:
genrule (
name = 'compileTzData',
srcs = glob(['tzdata/**']),
out = 'res',
cmd = '$(exe :compileTzData_binary) $SRCDIR $OUT',
visibility = ['PUBLIC'],
)
This puts a properly-layed-out "res" directory down under buck-out.
Here was my first approach to pull those in:
# One-step?
android_resource(
name = 'res',
res = 'library/src/main/res',
deps =
[
':compileTzData',
],
package = 'net.danlew.android.joda',
visibility = ['PUBLIC'],
)
That errors with:
dependency //3rdparty/jodatime_android:compileTzData (genrule) is not of type android_resource or android_library
So, I tried wrapping the genrule with an extra step of android_resource:
# Two-step?
android_resource(
name = 'res_generated',
res = ':compileTzData',
package = 'net.danlew.android.joda',
)
android_resource(
name = 'res',
res = 'library/src/main/res',
deps =
[
':res_generated',
],
package = 'net.danlew.android.joda',
visibility = ['PUBLIC'],
)
But that refuses to recognize the "res" argument as "output of this other rule", and instead interprets it as "literal directory name", like so:
parameter 'res': no such file or directory '3rdparty/jodatime_android/:compileTzData
Is there a way to get this to work?
I'm on a snapshot of Buck from back in March -- 9219f0adc65c6e5c5171d3af7ca98d1454ec3dd1 specifically. I've tried updating to latest today (9663eb09f844482f88523cc4c325f2fa10132db7), but that broke some existing genrules that are used by just about all our libraries -- more than I want to try to solve today, or even this week. :) But if there's a change somewhere between March and now that solves this, I'd be happy to try moving everyone here to that version.
Thanks!
-Ben