Class MuzzleGradlePluginUtil


  • public final class MuzzleGradlePluginUtil
    extends Object
    Entry point for the muzzle gradle plugin.
    • Method Detail

      • assertInstrumentationMuzzled

        public static void assertInstrumentationMuzzled​(ClassLoader agentClassLoader,
                                                        ClassLoader userClassLoader,
                                                        boolean assertPass)
                                                 throws Exception
        Verifies that all instrumentations present in the agentClassLoader can be safely applied to the passed userClassLoader.

        This method throws whenever one of the following step fails (and assertPass is true):

        1. userClassLoader is not matched by the InstrumentationModule.classLoaderMatcher() method
        2. ReferenceMatcher of any instrumentation module finds any mismatch
        3. any helper class defined in InstrumentationModule.getMuzzleHelperClassNames() fails to be injected into userClassLoader

        When assertPass = false this method behaves in an opposite way: failure in any of the first two steps is expected (helper classes are not injected at all).

        This method is repeatedly called by the :muzzle gradle task - each tested dependency version passes different userClassLoader.

        Throws:
        Exception
      • printMuzzleReferences

        public static void printMuzzleReferences​(ClassLoader instrumentationClassLoader)
        Prints all references from all instrumentation modules present in the passed instrumentationClassLoader.

        Called by the printMuzzleReferences gradle task.