-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Refactor script dependency tracking #3168
Conversation
Signed-off-by: Jan N. Klug <github@klug.nrw>
3cc4606
to
abc6042
Compare
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
@openhab/core-maintainers If this should make it into 3.4 it should be reviewed ASAP. Even though I tested it for JS (and all other languages did not use dependency tracking, neither for file-based nor UI scripts/rules), there is the slight risk that it may break something. The broken API probably is not an issue since TTBOMK it was not used (except in the GraalJS add-on). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a useful addition to me! I've added a few comments below:
...penhab/core/automation/module/script/rulesupport/loader/AbstractScriptDependencyTracker.java
Outdated
Show resolved
Hide resolved
...penhab/core/automation/module/script/rulesupport/loader/AbstractScriptDependencyTracker.java
Outdated
Show resolved
Hide resolved
.../org/openhab/core/automation/module/script/rulesupport/loader/AbstractScriptFileWatcher.java
Show resolved
Hide resolved
.../openhab/core/automation/module/script/rulesupport/loader/AbstractScriptFileWatcherTest.java
Outdated
Show resolved
Hide resolved
...est/java/org/openhab/core/automation/module/script/internal/ScriptEngineManagerImplTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much. LGTM now!
Signed-off-by: Jan N. Klug <github@klug.nrw> GitOrigin-RevId: 4bcc15d
Fixes #3166
This needs to be merged together with the corresponding PR in openhab-addons, otherwise jsscripting will break.
With this change every
ScriptEngineFactory
can provide aDependencyTracker
that is injected in the execution context. Dependencies are tracked by an identifier (usually a path). Services implementingDependencyTracker.Listener
are notified of the script that need reloading by theengineIdentifier
of the script engine.The new structure allows decoupling of script/rule providers (file-based / UI based) and dependency trackers.
Signed-off-by: Jan N. Klug github@klug.nrw