public class APKModuleGraph extends Object implements AddsToRuleKey
Modifier and Type | Field and Description |
---|---|
static String |
ROOT_APKMODULE_NAME |
Constructor and Description |
---|
APKModuleGraph(Optional<com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableList<BuildTarget>>> seedConfigMap,
Optional<com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableList<String>>> appModuleDependencies,
Optional<List<BuildTarget>> blacklistedModules,
Set<String> modulesWithResources,
Set<String> modulesWithManifest,
TargetGraph targetGraph,
BuildTarget target)
Constructor for the
APKModule graph generator object |
APKModuleGraph(TargetGraph targetGraph,
BuildTarget target)
Constructor for the
APKModule graph generator object that produces a graph with only a
root module. |
APKModuleGraph(TargetGraph targetGraph,
BuildTarget target,
Optional<Set<BuildTarget>> seedTargets)
Constructor for the
APKModule graph generator object |
Modifier and Type | Method and Description |
---|---|
static Optional<List<BuildTarget>> |
extractTargetsFromQueries(Optional<List<Query>> queries)
Utility method for flattening a list of queries into the a list of the build targets they
resolve to.
|
APKModule |
findManifestModuleForTarget(BuildTarget target)
Get the Module that should contain the manifest for the given target or else fallback to the same logic of findResourceModuleForTarget.
|
APKModule |
findModuleForTarget(BuildTarget target)
Get the Module that contains the given target
|
APKModule |
findResourceModuleForTarget(BuildTarget target)
Get the Module that should contain the resources for the given target
|
com.google.common.collect.ImmutableSet<APKModule> |
getAPKModules() |
static com.google.common.collect.ImmutableMultimap<APKModule,String> |
getAPKModuleToClassesMap(com.google.common.collect.ImmutableMultimap<APKModule,Path> apkModuleToJarPathMap,
java.util.function.Function<String,String> translatorFunction,
ProjectFilesystem filesystem)
Group the classes in the input jars into a multimap based on the APKModule they belong to
|
Set<BuildTarget> |
getBuildTargets(APKModule module) |
DirectedAcyclicGraph<APKModule> |
getGraph()
Lazy generate the graph on first use
|
APKModule |
getRootAPKModule()
Get the APKModule representing the core application that is always included in the apk
|
Optional<com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableList<BuildTarget>>> |
getSeedConfigMap() |
com.google.common.collect.ImmutableSortedMap<APKModule,com.google.common.collect.ImmutableSortedSet<APKModule>> |
toOutgoingEdgesMap() |
public static final String ROOT_APKMODULE_NAME
public APKModuleGraph(TargetGraph targetGraph, BuildTarget target)
APKModule
graph generator object that produces a graph with only a
root module.public APKModuleGraph(Optional<com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableList<BuildTarget>>> seedConfigMap, Optional<com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableList<String>>> appModuleDependencies, Optional<List<BuildTarget>> blacklistedModules, Set<String> modulesWithResources, Set<String> modulesWithManifest, TargetGraph targetGraph, BuildTarget target)
APKModule
graph generator objectseedConfigMap
- A map of names to seed targets to use for creating APKModule
.appModuleDependencies
- a mapping of declared dependencies between module names. If a APKModule m1 depends on m2, it implies to buck that in order for m1 to be available for execution m2 must be available for use as well. Because of this, we can say that including a buck target in m2 effectively includes the buck-target in m2's dependent m1. In other words, m2 covers m1. Therefore, if a buck target is required by both these modules, we can safely place it in the minimal cover which is the APKModule m2.
blacklistedModules
- A list of targets that will NOT be included in any module.modulesWithResources
- A list of modules with resourcesmodulesWithManifest
- A list of modules with manifests. This parameter will be later used
to fetch Manifest information for each module.targetGraph
- The full target graph of the buildtarget
- The root target to use to traverse the graphpublic APKModuleGraph(TargetGraph targetGraph, BuildTarget target, Optional<Set<BuildTarget>> seedTargets)
APKModule
graph generator objecttargetGraph
- The full target graph of the buildtarget
- The root target to use to traverse the graphseedTargets
- The set of seed targets to use for creating APKModule
.public com.google.common.collect.ImmutableSortedMap<APKModule,com.google.common.collect.ImmutableSortedSet<APKModule>> toOutgoingEdgesMap()
public static Optional<List<BuildTarget>> extractTargetsFromQueries(Optional<List<Query>> queries)
queries
- list of queries, they are expected to have already been resolvedpublic DirectedAcyclicGraph<APKModule> getGraph()
public APKModule getRootAPKModule()
public com.google.common.collect.ImmutableSet<APKModule> getAPKModules()
public Optional<com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableList<BuildTarget>>> getSeedConfigMap()
public APKModule findModuleForTarget(BuildTarget target)
target
- target to serach for in modulespublic APKModule findResourceModuleForTarget(BuildTarget target)
target
- target to serach for in modulespublic APKModule findManifestModuleForTarget(BuildTarget target)
target
- target to search for in modulespublic static com.google.common.collect.ImmutableMultimap<APKModule,String> getAPKModuleToClassesMap(com.google.common.collect.ImmutableMultimap<APKModule,Path> apkModuleToJarPathMap, java.util.function.Function<String,String> translatorFunction, ProjectFilesystem filesystem) throws IOException
apkModuleToJarPathMap
- the mapping of APKModules to the path for the jar filestranslatorFunction
- function used to translate the class names to obfuscated namesfilesystem
- filesystem representation for resolving pathsIOException
public Set<BuildTarget> getBuildTargets(APKModule module)