// Image build only (Dockerfile): puts the -sources.jar of the app's JitPack-hosted libraries (org.fossify:* and // com.github.*, direct and transitive, on the foss debug and release runtime classpaths) into the Gradle cache, so // they can be read offline the way an IDE shows a dependency's sources. Missing sources are listed, not fatal. allprojects { p -> p.afterEvaluate { if (p.path != ':app') return p.tasks.register('benchCacheSources') { doLast { def ids = new TreeSet() ['fossDebugRuntimeClasspath', 'fossReleaseRuntimeClasspath'].each { name -> p.configurations.getByName(name).incoming.resolutionResult.allComponents.each { c -> def id = c.moduleVersion def group = id?.group ?: '' if (group == 'org.fossify' || group.startsWith('com.github.')) { ids << "${id.group}:${id.name}:${id.version}".toString() } } } ids.each { coord -> def cfg = p.configurations.detachedConfiguration(p.dependencies.create("${coord}:sources@jar".toString())) cfg.transitive = false def files = cfg.incoming.artifactView { lenient(true) }.files.files println(files ? "sources ${coord} -> ${files*.name.join(',')}" : "sources ${coord} -> none") } } } } }