Skip to content

Loading…

JSON-RPC: automatically create JSON schema API description #4309

Merged
merged 3 commits into from

7 participants

@Montellese
Team Kodi member

Right now when editing the JSON schema API description of our JSON-RPC API we need to adjust one of the *.json files in xbmc/interfaces/json-rpc and we need to make the same changes in xbmc/interfaces/json-rpc/ServiceDescription.h which is read by the JSON-RPC implementation. But editing that file by hand is very tedious (which is why we have the separate *.json files in the first place). @topfs2 and I have written a tool to do that conversion and it's located at https://github.com/Montellese/jsd_builder. It takes the *.json files, a license.txt and a version.txt file to build the ServiceDescription.h. But right now this is a manual task.

This adds the necessary bits to the win32 build system to automatically create ServiceDescription.h during the build (similar to how it's done for the python code generation).
Would be nice if someone with the necessary linux bootstrap/depends/Makefile foo could add the necessary bits to also automate this in the linux buildsystem. IMO it can be done the same way as for the python code generation (i.e. during bootstrapping IIRC).

Obviously this is Gotham + 1.

@MartijnKaijser MartijnKaijser added this to the Pending for inclusion milestone
@Montellese Montellese added the RFC label
@jmarshallnz
Team Kodi member

@wsnipex mind taking a look?

@wsnipex
Team Kodi member
@jmarshallnz
Team Kodi member

Thanks :)

jenkins build this please

@Montellese
Team Kodi member

@wsnipex: Thanks. I've added some additional linux-magic which I haven't tested yet so please wait with merging. I'm also not 100% sure if we could/should add some additional logic to Xcode like I did for win32. Will have to check how it's done for the python code generation stuff.

@Montellese
Team Kodi member

I've removed the additional commit I added because it doesn't work. Ideally there'd be some logic in xbmc/interfaces/json-rpc/Makefile that would automatically trigger a re-generation of ServiceDescription.h if one of the *.json files changed. I tried to do it the same as it is done for the python code generation but that caused some problems which are probably due to the fact that codegenerator.mk now contains logic for two different auto-generated things.

jenkins build this please

@wsnipex
Team Kodi member

it would be easy to move the codegen to its own file, if that solves your issue.

@Montellese
Team Kodi member

Yeah I just didn't have time yesterday at 11 pm to give that a try. I'll do that this evening.

@wsnipex
Team Kodi member

fixed it up to (hopefully) do what you need and sent you a new PR

@Montellese Montellese added Improvement and removed RFC labels
@Montellese
Team Kodi member

@wsnipex: Yup works exactly like I wanted. Thanks a lot.

jenkins build this please (and this time also work on osx et al.)

@wsnipex
Team Kodi member

jenkins acting up again: Unrecognized macro 'ghprbPullId' in 'xbmc-pr${ghprbPullId}-${GIT_REVISION,length=7}'

lets try again: jenkins build this please

@Montellese
Team Kodi member

@wsnipex: Hm looks like this approach doesn't work for osx and android as it tries to cross-compile when being called through xbmc/interfaces/json-rpc/Makefile. Any easy way to get around this? If not we'll just go back to the initial bootstrap-only approach for linux et al.

@davilla

Build system tools should be added to depends in the native area. Lets not make another mess like TexturePacker please.

@wsnipex
Team Kodi member

yeah, guess it needs to go to depends for cross compile. sigh..

@Montellese
Team Kodi member

win32 build works now with jenkins: http://jenkins.xbmc.org/job/XBMC-WIN-32/798/

@davilla

add it to depends/native is trivial. depends knows how to pull from a git hash.
see tools/depends/target/xbmc-pvr-addons/Makefile
then add a tools/depends/native/jsd_builder, add jsd_builder to tools/depends/native/Makefile, done.

@davilla

look at tools/depends/native/yasm-native/Makefile, it's pretty simple. c/p then change to pull from a git hash.

@Montellese
Team Kodi member

@wsnipex: Thanks for moving the jsd_builder tool to depends. Let's give this another try.

jenkins build this please

@Montellese
Team Kodi member

All platform builds finally succeeded. Thanks again @wsnipex for your help.

@jmarshallnz
Team Kodi member

Are you gonna merge it? :)

@Montellese Montellese merged commit c47fb53 into xbmc:master

1 check passed

Details default Merged build #560 succeeded in 1 hr 36 min
@Montellese Montellese deleted the Montellese:jsonrpc_schema_creation branch
@jmarshallnz
Team Kodi member

:) Saves me editing the .h in my branch now ;)

@stefansaraev
Team Kodi member

you include a pre-built (binary x86_64) JsonSchemaBuilder. this shouldnt be there unless you have a very very good reason. there is none or I am blind...

@wsnipex
Team Kodi member

omg, good catch. Shame on me. To my defense, I didn't git commit -a, so I must have added it manually...
will remove asap

@Memphiz

@wsnipex - is it by intention to pass CFLAGS to CXX instead of CXXFLAGS and/or CPPFLAGS - also shouldn't it read LDFLAGS instead of LFLAGS? (same below for the .cpp.o branch).

Team Kodi member

agreed, this looks wrong, although it probably doesn't make a difference here. LDFLAGS isn't even used as there are no external deps.
But I didn't write this, just copied JsonSchemaBuilder in here.
@topfs2, @Montellese: ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.