Specifying supported platforms in Inclusions entry for LCB extension?

Moderators: LCMark, LCfraser

Post Reply
trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 907
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Specifying supported platforms in Inclusions entry for LCB extension?

Post by trevordevore » Tue Jul 10, 2018 4:00 am

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?
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

bwmilby
Posts: 212
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

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

Post by bwmilby » Wed Aug 01, 2018 4:29 am

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.
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

bwmilby
Posts: 212
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

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

Post by bwmilby » Thu Aug 02, 2018 7:27 am

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.
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 907
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

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

Post by trevordevore » Thu Aug 02, 2018 2:04 pm

Yes bwmilby, that is what I am looking to do. Great work!
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

bwmilby
Posts: 212
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

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

Post by bwmilby » Fri Aug 03, 2018 4:17 am

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
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 907
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

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

Post by trevordevore » Fri Aug 03, 2018 5:44 am

You are the man @bwmilby!
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

bwmilby
Posts: 212
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

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

Post by bwmilby » Sat Aug 04, 2018 7:34 pm

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.
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 907
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

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

Post by trevordevore » Sat Aug 04, 2018 8:15 pm

I think those additions would be very useful.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

Post Reply

Return to “LiveCode Builder”