Class PluginHelper
java.lang.Object
com.offbynull.coroutines.instrumenter.PluginHelper
Helper class for use by build system plugins.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
instrument
(Instrumenter instrumenter, InstrumentationSettings settings, File srcDir, File dstDir, Consumer<String> logger) Instruments class files and generates detail files.static void
instrument
(Instrumenter instrumenter, InstrumentationSettings settings, Map<File, File> srcDstMapping, Consumer<String> logger) Instruments class files and generates detail files.Given a source and destination path, scans the source path for class files and translates them to the destination path.
-
Constructor Details
-
PluginHelper
private PluginHelper()
-
-
Method Details
-
mapPaths
Given a source and destination path, scans the source path for class files and translates them to the destination path. This method recursively scans the path.For example, imagine source path of
/src
and a destination path of/dst
.../src/A.class -> /dst/A.class /src/a/B.class -> /dst/B.class /src/a/b/c/d/e/C.class -> /dst/a/b/c/d/e/C.class /src/a/b/c/d/e/D.class -> /dst/a/b/c/d/e/D.class
- Parameters:
srcDir
- source directorydstDir
- destination directory- Returns:
- source class to destination class mapping
- Throws:
NullPointerException
- if any argument isnull
IllegalArgumentException
- if either of the paths passed in are not directories
-
instrument
public static void instrument(Instrumenter instrumenter, InstrumentationSettings settings, Map<File, File> srcDstMapping, Consumer<String> logger) throws IOExceptionInstruments class files and generates detail files. Detail files are placed alongside destination class files -- they have the same name but the extension will be changed to.coroutinesinfo
.- Parameters:
instrumenter
- instrumentersettings
- instrumentation settingssrcDstMapping
- class files to instrument mapped to destination files where the final instrumented results will be placedlogger
- logger to dump messages to (if any)- Throws:
NullPointerException
- if any argument isnull
or containsnull
IllegalArgumentException
- if a source class file doesn't existIOException
- on IO error
-
instrument
public static void instrument(Instrumenter instrumenter, InstrumentationSettings settings, File srcDir, File dstDir, Consumer<String> logger) throws IOException Instruments class files and generates detail files. This method is equivalent to calling...Map<File, File> srcDstMapping = mapPaths(srcDir, dstDir); instrument(instrumenter, settings, srcDstMapping, logger);
- Parameters:
instrumenter
- instrumentersettings
- instrumentation settingssrcDir
- source directorydstDir
- destination directorylogger
- logger to dump messages to (if any)- Throws:
NullPointerException
- if any argument isnull
or containsnull
IllegalArgumentException
- if either of the paths passed in are not directories (or if a file insrcDir
was removed while this method is executing)IOException
- on IO error
-