Open
Description
As discussed with @ctrueden, this should allow scripts to import the output objects of other scripts.
Given a script:
#@script(name="coolutils")
#@output imagefunctions
imagefunctions = {
tile(a) {
}
}
This should be importable like this:
#@import("coolutils")
imagefunctions.tile(a)
or with a local scope:
#@import("coolutils", scope="cool")
cool.imagefunctions.tile(a)
Subtasks:
- ImportProcessor implements ScriptProcessor
- Harvest the import statements and stash them in the ScriptInfo as a property via
info.set(String, String)
- Probably stash them in the ScriptService in a map
- Harvest the import statements and stash them in the ScriptInfo as a property via
-
ScriptImportPreprocessor implements PreprocessorPlugin
- If the module being preprocessed is not a
ScriptModule
, stop. - Otherwise:
-
for importName in ((ScriptInfo) module.getInfo()).getProperty("imports")
:-
moduleService.run(moduleService.getModuleByName(importName)
-
((ScriptModule) module).getEngine() .getBindings(ScriptContext.ENGINE_SCOPE).putAll(outputs)
-
-
- If the module being preprocessed is not a
- Needed sub tasks:
-
ModuleService#getModuleByName: getModules().stream().filter(m -> name.equals(m.getName()).limit(1)...
-
ScriptInfo.getProperty(String)
/ScriptInfo.setProperty(String, Object)
-
Metadata
Metadata
Assignees
Labels
No labels