Page 1 of 1

Specifying supported platforms in Inclusions entry for LCB extension?

Posted: Tue Jul 10, 2018 4:00 am
by trevordevore
I have some extensions that use FFI and are specific to a single platform. In the Standalone Builder > Inclusions tab I want the supported platform icons to represent the supported platform. Looking at revsblibrary.livecodescript I can see that extensions are hard coded to be supported on all platforms as there is this line of code:

Code: Select all

-- LCB extensions are available on all platforms
put revSBAllPlatforms() into tExtension["platforms"]
 
Now that we have FFI it is more likely that an extension may only work on a single platform. Is there any support for specifying supported platforms in the extension header?

Re: Specifying supported platforms in Inclusions entry for LCB extension?

Posted: Wed Aug 01, 2018 4:29 am
by bwmilby
When the widget is generated, platform will need to be added to the manifest. If the "OS" and "Platforms" keys are included in the library level doc comment, then they do make it to the lcdoc file that is generated. I started looking at the code briefly, but didn't follow it all to way to see if more was needed than just getting those keys added to the manifest.

The code does mix the terminology though. In the dictionary, platforms are (desktop, server, mobile) and OS is (mac, windows, linux, ios, android, html5). revSBAllPlatforms() returns (MacOSX,Windows,Linux,iOS,Android,Emscripten).
As an aside, the Toast library does have "Platforms: android" in the LCB source so the dictionary currently shows android in both the platform and OS filter lists.
If that happens, then the revSBAvailableExtensions handler can check for tExtension["platforms"] being empty before populating it with revSBAllPlatforms().

To adjust the manifest, so far I think the following need to be modified:
ide/Toolset/libraries/revidedeveloperextensionlibrary.livecodescript - line 571
toolchain/lc-compile/src/generate.g - add after line 171, add after line 259

Update: I was able to add "metadata" tags for platforms and os so they get into the manifest.xml file and are then loaded into the array when the module is loaded. Metadata tags do not currently get inserted into the documentation though, so the information would need to be included in both places. I'm thinking it would make more sense to target certain pieces of metadata and include them in the dictionary entries. Title does get included, so just a matter of figuring out where to add them.

Re: Specifying supported platforms in Inclusions entry for LCB extension?

Posted: Thu Aug 02, 2018 7:27 am
by bwmilby
Is this what you are after?
extension.jpg
What I did was add 2 new metadata items that are processed at the module/library/widget level. Now 'os' and 'platforms' are both processed. If platforms are specified without os, then it is assumed that all os variants are supported. If any os is specified, then only the os list is used.

It is going to take 2 PRs since there are code changes on both the IDE and engine side of the project.

I'm still working on the built in widgets/libraries to get the entries in the right place.

Re: Specifying supported platforms in Inclusions entry for LCB extension?

Posted: Thu Aug 02, 2018 2:04 pm
by trevordevore
Yes bwmilby, that is what I am looking to do. Great work!

Re: Specifying supported platforms in Inclusions entry for LCB extension?

Posted: Fri Aug 03, 2018 4:17 am
by bwmilby
PRs have been submitted. Not sure where the release note should go, so I'll add that once someone takes a look (could be in the LCB notes, engine notes, or IDE notes)

https://github.com/livecode/livecode/pull/6623
https://github.com/livecode/livecode-ide/pull/1988

Re: Specifying supported platforms in Inclusions entry for LCB extension?

Posted: Fri Aug 03, 2018 5:44 am
by trevordevore
You are the man @bwmilby!

Re: Specifying supported platforms in Inclusions entry for LCB extension?

Posted: Sat Aug 04, 2018 7:34 pm
by bwmilby
Thanks!

While I'm at it, would it be a good idea to add Version and Author to the dictionary for the Library level entry? We could script it to not include Livecode as an author, but for other authors that would seem to be a nice addition.

Re: Specifying supported platforms in Inclusions entry for LCB extension?

Posted: Sat Aug 04, 2018 8:15 pm
by trevordevore
I think those additions would be very useful.