org.gradle.tooling.model.idea.IdeaSingleEntryLibraryDependency Java Examples

The following examples show how to use org.gradle.tooling.model.idea.IdeaSingleEntryLibraryDependency. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GradleTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
static File getDependency(String path, String groupId, String artifactId, String version) {
    try (ProjectConnection connection = GradleConnector.newConnector().forProjectDirectory(new File(path)).connect()) {
        Optional<IdeaSingleEntryLibraryDependency> dependency = (Optional<IdeaSingleEntryLibraryDependency>) connection.getModel(IdeaProject.class).getModules().stream().flatMap(module -> module.getDependencies().stream()).
                filter(dep -> dep instanceof IdeaSingleEntryLibraryDependency).
                map(dep -> (IdeaSingleEntryLibraryDependency)dep).
                filter(library -> isCoordinateSame((IdeaSingleEntryLibraryDependency) library, groupId, artifactId, version)).findFirst();
        if (dependency.isPresent()) {
            return dependency.get().getFile();
        } else {
            return GradleToolDelegate.getDeploymentFile(groupId + ":" + artifactId + ":" + version);
        }
    }
}
 
Example #2
Source File: GradleTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 4 votes vote down vote up
private static boolean isCoordinateSame(IdeaSingleEntryLibraryDependency library, String groupId, String artifactId, String version) {
    return library.getGradleModuleVersion().getGroup().equals(groupId) &&
            library.getGradleModuleVersion().getName().equals(artifactId) &&
            library.getGradleModuleVersion().getVersion().equals(version);
}
 
Example #3
Source File: ConsumerTargetTypeProvider.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConsumerTargetTypeProvider() {
    configuredTargetTypes.put(IdeaSingleEntryLibraryDependency.class.getCanonicalName(), IdeaSingleEntryLibraryDependency.class);
    configuredTargetTypes.put(IdeaModuleDependency.class.getCanonicalName(), IdeaModuleDependency.class);
    configuredTargetTypes.put(GradleFileBuildOutcome.class.getCanonicalName(), GradleFileBuildOutcome.class);
}
 
Example #4
Source File: ConsumerTargetTypeProvider.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConsumerTargetTypeProvider() {
    configuredTargetTypes.put(IdeaSingleEntryLibraryDependency.class.getCanonicalName(), IdeaSingleEntryLibraryDependency.class);
    configuredTargetTypes.put(IdeaModuleDependency.class.getCanonicalName(), IdeaModuleDependency.class);
    configuredTargetTypes.put(GradleFileBuildOutcome.class.getCanonicalName(), GradleFileBuildOutcome.class);
}
 
Example #5
Source File: ConsumerTargetTypeProvider.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConsumerTargetTypeProvider() {
    configuredTargetTypes.put(IdeaSingleEntryLibraryDependency.class.getCanonicalName(), IdeaSingleEntryLibraryDependency.class);
    configuredTargetTypes.put(IdeaModuleDependency.class.getCanonicalName(), IdeaModuleDependency.class);
    configuredTargetTypes.put(GradleFileBuildOutcome.class.getCanonicalName(), GradleFileBuildOutcome.class);
}
 
Example #6
Source File: ConsumerTargetTypeProvider.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConsumerTargetTypeProvider() {
    configuredTargetTypes.put(IdeaSingleEntryLibraryDependency.class.getCanonicalName(), IdeaSingleEntryLibraryDependency.class);
    configuredTargetTypes.put(IdeaModuleDependency.class.getCanonicalName(), IdeaModuleDependency.class);
    configuredTargetTypes.put(GradleFileBuildOutcome.class.getCanonicalName(), GradleFileBuildOutcome.class);
}