Update gen_aidl documentation #103
Comments
I got it (kind of) working. Below is a stripped-down, commented version of what I ended up doing. I don't know when the plan is for deprecating the gen_aidl rule, but in the meantime, putting something like this in the documentation would be good.
Edit: updated example to include the genfile part, that I was missing. |
Hi, Agreed, the aidl stuff is confusing. The import_path is particularly nasty, I'll use your tips to improve the quality of the existing docs, if that's Regards, Simon On Fri, Apr 11, 2014 at 9:24 PM, benkc notifications@github.com wrote:
|
Actually, it looks like @shs96c never got around to updating these docs. |
So the Here is my configuration:
In IntelliJ everything gets displayed correctly, but I am not able to build with buck because |
I just found a way to get it working:
Is that the intended way to do it? EDIT: Unfortunately I'm now not able to install the app because of |
That looks about right. I don't think you need the intermediate android_library :
Not sure about the |
@marcinkosiba Thanks! Yeah I figured out that the |
It looks like the documentation largely matches what was found here today. I'll add @marcinkosiba's example as an example on that page now and add some text to clarify the root. |
I'm not sure if this is just a bug in the documentation, or a bug in the gen_aidl rule itself. The documentation for gen_aidl() is pretty sparse. I did however find an example in this previous issue:
#29
There's mention both there and in the docs of deprecating the gen_aidl() rule and making android_library handle aidl files, but my testing indicates that hasn't been done. (android_library() seems to completely ignore .aidl files in its srcs.)
The documentation and example both indicate that the 'aidl' argument has to be a single .aidl file. Does this mean I need a gen_aidl rule for each of my .aidl files? I've tried putting a glob there, but that results in a CoerceFailedException.
The more problematic thing is the import_path argument. The example in issue 29 shows it being the path to the directory that the .aidl file is in; however, I have found that while the 'aidl' argument is relative to the BUCK file, the import_paths argument is relative to the .buckconfig file. Moreover, regardless of what directory I put there, I (at best) get errors of the form:
couldn't find import for class com.blah.blah.blah.ipc.RemoteableFooBar
RemoteableFooBar is an aidl file in the same directory as the .aidl file I've pointed my 'aidl' argument at, which is also sometimes the same directory that I have import_path set to.
I've tried making my gen_aidl rule point at one of the above RemoteableFooBar.aidl files instead, but then the build says:
aidl can only generate code for interfaces, not parcelables or flattenables,
.aidl files that only declare parcelables or flattenablesmay not go in the Makefile.
I'm not sure what import_path should point to, but I've found it can only be a single path (not a glob or array or colon-separated), and the example shows it pointing to the same directory as the aidl file. Regardless of where I point it, I get the error that it couldn't find imports. (Or sillier errors, like that the directory I'm in doesn't exist if I leave it blank.)
The text was updated successfully, but these errors were encountered: