Java源码示例:org.gradle.tooling.model.idea.IdeaModuleDependency
示例1
/**
* Compute the dependencies of a given {@code IdeaModule} and group them by their scope.
*
* Note: This method does not follow project->project dependencies. It just makes a note of them in a separate collection.
*
* @param module the IdeaModule reference.
*/
@SuppressWarnings("UnstableApiUsage")
private void computeProjectDependencies(IdeaModule module) {
ARTIFACT_DEPS_OF_PRJ.computeIfAbsent(module.getName(), moduleName -> {
Map<String, Set<ArtifactSpec>> dependencies = new HashMap<>();
module.getDependencies().forEach(dep -> {
if (dep instanceof IdeaModuleDependency) {
// Add the dependency to the list.
String name = ((IdeaModuleDependency) dep).getTargetModuleName();
PRJ_DEPS_OF_PRJ.computeIfAbsent(moduleName, key -> new HashSet<>()).add(name);
} else if (dep instanceof ExternalDependency) {
ExternalDependency extDep = (ExternalDependency) dep;
GradleModuleVersion gav = extDep.getGradleModuleVersion();
ArtifactSpec spec = new ArtifactSpec("compile", gav.getGroup(), gav.getName(), gav.getVersion(),
"jar", null, extDep.getFile());
String depScope = dep.getScope().getScope();
dependencies.computeIfAbsent(depScope, s -> new HashSet<>()).add(spec);
}
});
return dependencies;
});
}
示例2
public ConsumerTargetTypeProvider() {
configuredTargetTypes.put(IdeaSingleEntryLibraryDependency.class.getCanonicalName(), IdeaSingleEntryLibraryDependency.class);
configuredTargetTypes.put(IdeaModuleDependency.class.getCanonicalName(), IdeaModuleDependency.class);
configuredTargetTypes.put(GradleFileBuildOutcome.class.getCanonicalName(), GradleFileBuildOutcome.class);
}
示例3
public ConsumerTargetTypeProvider() {
configuredTargetTypes.put(IdeaSingleEntryLibraryDependency.class.getCanonicalName(), IdeaSingleEntryLibraryDependency.class);
configuredTargetTypes.put(IdeaModuleDependency.class.getCanonicalName(), IdeaModuleDependency.class);
configuredTargetTypes.put(GradleFileBuildOutcome.class.getCanonicalName(), GradleFileBuildOutcome.class);
}
示例4
public ConsumerTargetTypeProvider() {
configuredTargetTypes.put(IdeaSingleEntryLibraryDependency.class.getCanonicalName(), IdeaSingleEntryLibraryDependency.class);
configuredTargetTypes.put(IdeaModuleDependency.class.getCanonicalName(), IdeaModuleDependency.class);
configuredTargetTypes.put(GradleFileBuildOutcome.class.getCanonicalName(), GradleFileBuildOutcome.class);
}
示例5
public ConsumerTargetTypeProvider() {
configuredTargetTypes.put(IdeaSingleEntryLibraryDependency.class.getCanonicalName(), IdeaSingleEntryLibraryDependency.class);
configuredTargetTypes.put(IdeaModuleDependency.class.getCanonicalName(), IdeaModuleDependency.class);
configuredTargetTypes.put(GradleFileBuildOutcome.class.getCanonicalName(), GradleFileBuildOutcome.class);
}