stefan-hoeck / idris2-webidl

Parsers and (eventually) Idris code generator for WebIDL documents
BSD 2-Clause "Simplified" License
13 stars 3 forks source link

How do I actually run it? #7

Open gergoerdi opened 2 years ago

gergoerdi commented 2 years ago

Because idris2-dom is missing IndexedDB support, I thought I'd just plop in the WebIDL files from e.g. https://searchfox.org/mozilla-central/source/dom/webidl and it should Just Work (tm), but alas, I can't even figure out how to run it. It seems to look for an .idr output file in some directory somewhere (that I can kind-of override mostly with the -o flag, if only I pass the -o flag before the input file name?!), but I thought the whole point is to create the .idr file.

gergoerdi commented 2 years ago

Also, one of the outputs seems to be the Web.Internal.Types module, but that module is already part of idris2-dom so I will have a bad time if my IndexedDB FFI package also has that module. Or is the idea that it would have to be included with idris2-dom, together with all other W3C specs past, present and future?

gergoerdi commented 2 years ago

OK I kind of figured out how it works: basically, it needs $OUT/Web/Raw and $OUT/Web/Internal directories to already exist (if run with -o $OUT), but otherwise doesn't seem to do any readback.

Which turns out to be a problem on its own, because it means I can't re-run it on idris2-dom, without knowing the exact set of input files. Otherwise, it removes all the existing definitions from Web.Interlal.Types.

stefan-hoeck commented 2 years ago

Yeah sorry, running this is very basic, but it didn't bother me so far... Here's how to run this after building it with make lib:

$ build/exec/generateDomBindings -o outdir idl/*.webidl

where outdir is the source dir of the idris2-dom project (for instance: ../idris2-dom/src). And yes, I need to make this more accessible, possibly by adding a proper make target which automatically generates the necessary directories in outdir.

Please note also that it makes no sense to run this with a single .webidl file, since many interfaces are spread across several files.

stefan-hoeck commented 2 years ago

And yes, the Web.Internal.Types is hardcoded so far. Another thing that needs changing, if this should be used by other projects than idris2-dom.

gergoerdi commented 2 years ago

Yeah sorry, running this is very basic, but it didn't bother me so far... Here's how to run this after building it with make lib:

$ build/exec/generateDomBindings -o outdir idl/*.webidl

Ah, I missed that /idl directory in idris2-webidl because I was looking for it in idris2-dom (since in my mind, idris2-webidl was a generic tool and idris2-dom was just one use of it, with its own set of IDLs to compile). So in that case, I should be able to re-create the whole of idris2-dom with the addition of the IndexedDB interfaces. Let me try just that.