Class PluginHelper


  • public final class PluginHelper
    extends java.lang.Object
    Helper class for use by build system plugins.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PluginHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void instrument​(Instrumenter instrumenter, InstrumentationSettings settings, java.io.File srcDir, java.io.File dstDir, java.util.function.Consumer<java.lang.String> logger)
      Instruments class files and generates detail files.
      static void instrument​(Instrumenter instrumenter, InstrumentationSettings settings, java.util.Map<java.io.File,​java.io.File> srcDstMapping, java.util.function.Consumer<java.lang.String> logger)
      Instruments class files and generates detail files.
      static java.util.Map<java.io.File,​java.io.File> mapPaths​(java.io.File srcDir, java.io.File dstDir)
      Given a source and destination path, scans the source path for class files and translates them to the destination path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PluginHelper

        private PluginHelper()
    • Method Detail

      • mapPaths

        public static java.util.Map<java.io.File,​java.io.File> mapPaths​(java.io.File srcDir,
                                                                              java.io.File dstDir)
        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 directory
        dstDir - destination directory
        Returns:
        source class to destination class mapping
        Throws:
        java.lang.NullPointerException - if any argument is null
        java.lang.IllegalArgumentException - if either of the paths passed in are not directories
      • instrument

        public static void instrument​(Instrumenter instrumenter,
                                      InstrumentationSettings settings,
                                      java.util.Map<java.io.File,​java.io.File> srcDstMapping,
                                      java.util.function.Consumer<java.lang.String> logger)
                               throws java.io.IOException
        Instruments 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 - instrumenter
        settings - instrumentation settings
        srcDstMapping - class files to instrument mapped to destination files where the final instrumented results will be placed
        logger - logger to dump messages to (if any)
        Throws:
        java.lang.NullPointerException - if any argument is null or contains null
        java.lang.IllegalArgumentException - if a source class file doesn't exist
        java.io.IOException - on IO error
      • instrument

        public static void instrument​(Instrumenter instrumenter,
                                      InstrumentationSettings settings,
                                      java.io.File srcDir,
                                      java.io.File dstDir,
                                      java.util.function.Consumer<java.lang.String> logger)
                               throws java.io.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 - instrumenter
        settings - instrumentation settings
        srcDir - source directory
        dstDir - destination directory
        logger - logger to dump messages to (if any)
        Throws:
        java.lang.NullPointerException - if any argument is null or contains null
        java.lang.IllegalArgumentException - if either of the paths passed in are not directories (or if a file in srcDir was removed while this method is executing)
        java.io.IOException - on IO error