Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JS Scripting (Nashorn) addon to addons #14005

Closed
florian-h05 opened this issue Dec 18, 2022 · 3 comments · Fixed by #14013
Closed

Add JS Scripting (Nashorn) addon to addons #14005

florian-h05 opened this issue Dec 18, 2022 · 3 comments · Fixed by #14013

Comments

@florian-h05
Copy link
Contributor

florian-h05 commented Dec 18, 2022

When openHAB 4.0 switches to Java 17, NashornJS will be removed from core.

We should then add the JS Scripting (Nashorn) automation addon to the addons repository.

We should discuss the following questions:

  • Install Nashorn by default or not? I‘d vote against it (assuming Blockly is fully ported until then, but I expect it to be) and instead install JS Scripting (GraalJS) by default, because it is much more modern and has a well documented helper library.
  • Which MIME type should it use? I‘d say that Nashorn gives the application/javascript (default) MIME type to GraalJS and gets a special MIME type (comparable to what GraalJS currently has), e.g. application/javascript;version=ES5

Cc/ @rkoshak @digitaldan @J-N-K @cweitkamp @kaikreuzer @wborn (Sorry for pinging you all)

@florian-h05 florian-h05 added this to the 4.0 milestone Dec 18, 2022
@wborn wborn linked a pull request Dec 19, 2022 that will close this issue
3 tasks
@J-N-K J-N-K moved this from Todo to In Progress in openHAB 4 Issue Tracking Dec 19, 2022
@florian-h05
Copy link
Contributor Author

PR to add the JS Scripting (Nashorn) engine to the addons repository is now open: #14013.

@rkoshak
Copy link
Contributor

rkoshak commented Dec 20, 2022

I'd agree with this plan only if we have some sort of upgrade automation to go fix everyone's rules to use the swapped MIME type. I believe it was always the intent to give the official MIME to GraalVM JS at this point but it's going to break a lot of people's systems if we don't help them. I just tried the 4.0 snapshot and it didn't go well on that front.

Note: the only way to change the MIME type in a Script (i.e. stuff under Scripts in MainUI) is through the REST API or editing the JSONDB file manually. We must avoid that if at all possible.

Assuming Blockly is ported, I have no worries about not including Nashorn by default. Moving to a new version is the time to break all the things! But we need to help clean up where we can.

@florian-h05
Copy link
Contributor Author

florian-h05 commented Dec 20, 2022

Note: the only way to change the MIME type in a Script (i.e. stuff under Scripts in MainUI) is through the REST API or editing the JSONDB file manually. We must avoid that if at all possible.

Yes, we need a easy to use option in the UI for that.
@rkoshak I have a PR for this: openhab/openhab-webui#1601.

Probably we should also have an option to regenerate all Blockly scripts at once, so that the user doesn't have to open each Blockly and click the save button. That is definitely something the UI needs to do.

@wborn wborn changed the title Add JS Scripting (Nashorn) addon to addons? Add JS Scripting (Nashorn) addon to addons Dec 22, 2022
Repository owner moved this from In Progress to Done in openHAB 4 Issue Tracking Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants