Created
February 14, 2019 05:59
-
-
Save jrodbx/c02c733f168b523dd827ff04f82f2ec4 to your computer and use it in GitHub Desktop.
Download AGP Sources
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 agpVersion = '3.5.0-alpha03' | |
repositories { | |
google() | |
jcenter() | |
} | |
configurations { | |
agp | |
} | |
dependencies { | |
agp "com.android.tools.build:gradle:${agpVersion}" | |
} | |
task dumpSources { | |
inputs.files configurations.agp | |
outputs.dir "com.android.tools.build/$agpVersion/" | |
doLast { | |
def componentIds = configurations.agp.incoming.resolutionResult.allDependencies | |
.findAll { it.selected.id.group.startsWith('com.android.tools') } | |
.collect { it.selected.id } | |
.toSet() | |
ArtifactResolutionResult result = dependencies.createArtifactResolutionQuery() | |
.forComponents(componentIds) | |
.withArtifacts(JvmLibrary, SourcesArtifact) | |
.execute() | |
result.resolvedComponents.each { ComponentArtifactsResult component -> | |
Set<ArtifactResult> sources = component.getArtifacts(SourcesArtifact) | |
sources.each { ArtifactResult ar -> | |
println "Found ${ar.file}." | |
if (ar instanceof ResolvedArtifactResult) { | |
def group = ar.id.componentIdentifier.group | |
def module = ar.id.componentIdentifier.module | |
def version = ar.id.componentIdentifier.version | |
println "Extracting to com.android.tools.build/$agpVersion/$group/$module/$version." | |
copy { | |
from zipTree(ar.file) | |
into file("com.android.tools.build/$agpVersion/$group/$module/$version") | |
} | |
println "Done extracting $module." | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment