package scripting
- Alphabetic
- Public
- Protected
Type Members
- trait AmmoniteExecutor extends AnyRef
Provides an interface for the execution of scripts using the Ammonite interpreter.
Provides an interface for the execution of scripts using the Ammonite interpreter.
All scripts are compiled in-memory and no caching is performed.
- abstract class ScriptManager extends AnyRef
This class manages a hierarchy of scripts, and provides an interface that allows users to easily discover and run scripts on their CPGs.
This class manages a hierarchy of scripts, and provides an interface that allows users to easily discover and run scripts on their CPGs.
Scripts should be grouped inside folders placed within the application's
resources/scripts
directory, for example:resources |-- scripts |-- java |-- my-java-script.sc |-- go |-- csharp
To run
my-java-script.sc
you would run:runScript("java/my-java-script.sc", cpg)
Value Members
- object ScalaReflectWorkaround
a workaround for a scala reflect bug, where the first invocation of scala reflect fails idea: invoke this at the very start to trigger the bug.
a workaround for a scala reflect bug, where the first invocation of scala reflect fails idea: invoke this at the very start to trigger the bug. future invocations should be fine i asked to move the retry logic into scala reflect as a better way to handle this https://github.com/scala/bug/issues/12038#issuecomment-760629585
AMMENDMENT: Actually doing this once is not always enough. Not sure why this is the case but if the fact reflection has happened "long enough" before the intend reflections, the bug can again be triggered. This was just hidden by the fact that the tests got executed in a forked process, effectively always resetting the "already worked around" flag. So we we now do this any time workaroundScalaReflectBugByTriggeringReflection() is called and should be fine. AND ALWAYS REMEMBER: Global state is the root of all evil.
to reproduce the issue, comment out this workaround, publish cpg locally and run the following in the codescience repo:
cpg2sp/testOnly *PolicyAmmoniteExecutorTest
if the above is green without this workaround, we don't need it any more - object ScriptManager