Last active
September 30, 2022 05:22
-
-
Save bigdaz/3966a60423a6818ec7e33dbaf41edb36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hasher = services.get(org.gradle.internal.hash.ClassLoaderHierarchyHasher) | |
def classLoaderFactory = services.get(org.gradle.internal.classloader.HashingClassLoaderFactory) | |
project.afterEvaluate { | |
tasks.named('functionalTestMacosLatestGlobalAvailable') { task -> | |
for (int i = 0; i < task.actions.size(); i++) { | |
def action = task.actions[i] | |
def implementation = action.getActionImplementation(hasher) | |
buildScan.value "${task.path}:actions[${i}].class", implementation.typeName | |
buildScan.value "${task.path}:actions[${i}].hash", implementation.classLoaderHash.toString() | |
// For wrapped actions, print the classloader | |
if (action.hasProperty('action')) { | |
def cl = action.action.getClass().getClassLoader() | |
while (cl != null) { | |
def clHash = classLoaderFactory.getClassLoaderClasspathHash(cl) | |
if (cl instanceof URLClassLoader && clHash != null) { | |
buildScan.value "${task.path}:actions[${i}]:${cl.name}:hash", clHash.toString() | |
buildScan.value "${task.path}:actions[${i}]:${cl.name}:urls", cl.getURLs().collect { it.toString() }.join("\n") | |
} | |
cl = cl.parent | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment