Provide Script Names to Script Engines (#1885)

Signed-off-by: Brian O'Connell <broconne@gmail.com>
This commit is contained in:
boc-tothefuture 2021-03-02 15:36:07 -05:00 committed by GitHub
parent b0b6848e04
commit 89796e79c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,6 +56,8 @@ import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import javax.script.ScriptEngine;
/**
* The {@link ScriptFileWatcher} watches the jsr223 directory for files. If a new/modified file is detected, the script
* is read and passed to the {@link ScriptEngineManager}.
@ -209,6 +211,7 @@ public class ScriptFileWatcher extends AbstractWatchService implements ReadyTrac
ScriptEngineContainer container = manager.createScriptEngine(scriptType, scriptIdentifier);
if (container != null) {
container.getScriptEngine().put(ScriptEngine.FILENAME, fileName);
manager.loadScript(container.getIdentifier(), reader,
dependency -> dependencyTracker.addLibForScript(scriptIdentifier, dependency));
loaded.add(url);