org.gradle.tooling.model.idea.IdeaProject Java Examples
The following examples show how to use
org.gradle.tooling.model.idea.IdeaProject.
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: GradleProject.java From meghanada-server with GNU General Public License v3.0 | 5 votes |
private void setCompileTarget(final IdeaProject ideaProject) { final IdeaJavaLanguageSettings javaLanguageSettings = ideaProject.getJavaLanguageSettings(); try { final String srcLevel = javaLanguageSettings.getLanguageLevel().toString(); final String targetLevel = javaLanguageSettings.getTargetBytecodeVersion().toString(); super.compileSource = srcLevel; super.compileTarget = targetLevel; } catch (UnsupportedMethodException e) { log.warn(e.getMessage()); } }
Example #2
Source File: BuildActionRunnerBackedConsumerConnection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(ProjectOutcomes.class) || modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(BuildEnvironment.class) || modelType.equals(GradleProject.class) || modelType.equals(Void.class); }
Example #3
Source File: InternalConnectionBackedConsumerConnection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(Void.class) || modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(GradleProject.class) || modelType.equals(BuildEnvironment.class); }
Example #4
Source File: ConnectionVersion4BackedConsumerConnection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(GradleProject.class) || modelType.equals(Void.class); }
Example #5
Source File: ModelMapping.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
static void addModelNameMappings(Map<Class<?>, String> map) { map.put(HierarchicalEclipseProject.class, "org.gradle.tooling.model.eclipse.HierarchicalEclipseProject"); map.put(EclipseProject.class, "org.gradle.tooling.model.eclipse.EclipseProject"); map.put(IdeaProject.class, "org.gradle.tooling.model.idea.IdeaProject"); map.put(GradleProject.class, "org.gradle.tooling.model.GradleProject"); map.put(BasicIdeaProject.class, "org.gradle.tooling.model.idea.BasicIdeaProject"); map.put(BuildEnvironment.class, "org.gradle.tooling.model.build.BuildEnvironment"); map.put(ProjectOutcomes.class, "org.gradle.tooling.model.outcomes.ProjectOutcomes"); map.put(Void.class, Void.class.getName()); }
Example #6
Source File: ModelMapping.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
static void addModelToProtocolMappings(Map<Class<?>, Class<?>> map) { map.put(HierarchicalEclipseProject.class, HierarchicalEclipseProjectVersion1.class); map.put(EclipseProject.class, EclipseProjectVersion3.class); map.put(IdeaProject.class, InternalIdeaProject.class); map.put(GradleProject.class, InternalGradleProject.class); map.put(BasicIdeaProject.class, InternalBasicIdeaProject.class); map.put(BuildEnvironment.class, InternalBuildEnvironment.class); map.put(ProjectOutcomes.class, InternalProjectOutcomes.class); map.put(Void.class, Void.class); }
Example #7
Source File: ModelMapping.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private static void addModelVersions(Map<Class<?>, String> map) { map.put(HierarchicalEclipseProject.class, "1.0-milestone-3"); map.put(EclipseProject.class, "1.0-milestone-3"); map.put(IdeaProject.class, "1.0-milestone-5"); map.put(GradleProject.class, "1.0-milestone-5"); map.put(BasicIdeaProject.class, "1.0-milestone-5"); map.put(BuildEnvironment.class, "1.0-milestone-8"); map.put(ProjectOutcomes.class, "1.2"); map.put(Void.class, "1.0-milestone-3"); map.put(GradleBuild.class, "1.8"); }
Example #8
Source File: BuildActionRunnerBackedConsumerConnection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(ProjectOutcomes.class) || modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(BuildEnvironment.class) || modelType.equals(GradleProject.class) || modelType.equals(Void.class); }
Example #9
Source File: InternalConnectionBackedConsumerConnection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(Void.class) || modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(GradleProject.class) || modelType.equals(BuildEnvironment.class); }
Example #10
Source File: ModelMapping.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
static void addModelNameMappings(Map<Class<?>, String> map) { map.put(HierarchicalEclipseProject.class, "org.gradle.tooling.model.eclipse.HierarchicalEclipseProject"); map.put(EclipseProject.class, "org.gradle.tooling.model.eclipse.EclipseProject"); map.put(IdeaProject.class, "org.gradle.tooling.model.idea.IdeaProject"); map.put(GradleProject.class, "org.gradle.tooling.model.GradleProject"); map.put(BasicIdeaProject.class, "org.gradle.tooling.model.idea.BasicIdeaProject"); map.put(BuildEnvironment.class, "org.gradle.tooling.model.build.BuildEnvironment"); map.put(ProjectOutcomes.class, "org.gradle.tooling.model.outcomes.ProjectOutcomes"); map.put(Void.class, Void.class.getName()); }
Example #11
Source File: ModelMapping.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
static void addModelToProtocolMappings(Map<Class<?>, Class<?>> map) { map.put(HierarchicalEclipseProject.class, HierarchicalEclipseProjectVersion1.class); map.put(EclipseProject.class, EclipseProjectVersion3.class); map.put(IdeaProject.class, InternalIdeaProject.class); map.put(GradleProject.class, InternalGradleProject.class); map.put(BasicIdeaProject.class, InternalBasicIdeaProject.class); map.put(BuildEnvironment.class, InternalBuildEnvironment.class); map.put(ProjectOutcomes.class, InternalProjectOutcomes.class); map.put(Void.class, Void.class); }
Example #12
Source File: ModelMapping.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private static void addModelVersions(Map<Class<?>, String> map) { map.put(HierarchicalEclipseProject.class, "1.0-milestone-3"); map.put(EclipseProject.class, "1.0-milestone-3"); map.put(IdeaProject.class, "1.0-milestone-5"); map.put(GradleProject.class, "1.0-milestone-5"); map.put(BasicIdeaProject.class, "1.0-milestone-5"); map.put(BuildEnvironment.class, "1.0-milestone-8"); map.put(ProjectOutcomes.class, "1.2"); map.put(Void.class, "1.0-milestone-3"); map.put(GradleBuild.class, "1.8"); }
Example #13
Source File: GradleTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
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 #14
Source File: BuildActionRunnerBackedConsumerConnection.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(ProjectOutcomes.class) || modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(BuildEnvironment.class) || modelType.equals(GradleProject.class) || modelType.equals(Void.class); }
Example #15
Source File: InternalConnectionBackedConsumerConnection.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(Void.class) || modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(GradleProject.class) || modelType.equals(BuildEnvironment.class); }
Example #16
Source File: ConnectionVersion4BackedConsumerConnection.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(GradleProject.class) || modelType.equals(Void.class); }
Example #17
Source File: ModelMapping.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
static void addModelNameMappings(Map<Class<?>, String> map) { map.put(HierarchicalEclipseProject.class, "org.gradle.tooling.model.eclipse.HierarchicalEclipseProject"); map.put(EclipseProject.class, "org.gradle.tooling.model.eclipse.EclipseProject"); map.put(IdeaProject.class, "org.gradle.tooling.model.idea.IdeaProject"); map.put(GradleProject.class, "org.gradle.tooling.model.GradleProject"); map.put(BasicIdeaProject.class, "org.gradle.tooling.model.idea.BasicIdeaProject"); map.put(BuildEnvironment.class, "org.gradle.tooling.model.build.BuildEnvironment"); map.put(ProjectOutcomes.class, "org.gradle.tooling.model.outcomes.ProjectOutcomes"); map.put(Void.class, Void.class.getName()); }
Example #18
Source File: ModelMapping.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
static void addModelToProtocolMappings(Map<Class<?>, Class<?>> map) { map.put(HierarchicalEclipseProject.class, HierarchicalEclipseProjectVersion1.class); map.put(EclipseProject.class, EclipseProjectVersion3.class); map.put(IdeaProject.class, InternalIdeaProject.class); map.put(GradleProject.class, InternalGradleProject.class); map.put(BasicIdeaProject.class, InternalBasicIdeaProject.class); map.put(BuildEnvironment.class, InternalBuildEnvironment.class); map.put(ProjectOutcomes.class, InternalProjectOutcomes.class); map.put(Void.class, Void.class); }
Example #19
Source File: ModelMapping.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private static void addModelVersions(Map<Class<?>, String> map) { map.put(HierarchicalEclipseProject.class, "1.0-milestone-3"); map.put(EclipseProject.class, "1.0-milestone-3"); map.put(IdeaProject.class, "1.0-milestone-5"); map.put(GradleProject.class, "1.0-milestone-5"); map.put(BasicIdeaProject.class, "1.0-milestone-5"); map.put(BuildEnvironment.class, "1.0-milestone-8"); map.put(ProjectOutcomes.class, "1.2"); map.put(Void.class, "1.0-milestone-3"); map.put(GradleBuild.class, "1.8"); }
Example #20
Source File: BuildActionRunnerBackedConsumerConnection.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(ProjectOutcomes.class) || modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(BuildEnvironment.class) || modelType.equals(GradleProject.class) || modelType.equals(Void.class); }
Example #21
Source File: InternalConnectionBackedConsumerConnection.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean maySupportModel(Class<?> modelType) { return modelType.equals(Void.class) || modelType.equals(HierarchicalEclipseProject.class) || modelType.equals(EclipseProject.class) || modelType.equals(IdeaProject.class) || modelType.equals(BasicIdeaProject.class) || modelType.equals(GradleProject.class) || modelType.equals(BuildEnvironment.class); }
Example #22
Source File: ModelMapping.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
static void addModelNameMappings(Map<Class<?>, String> map) { map.put(HierarchicalEclipseProject.class, "org.gradle.tooling.model.eclipse.HierarchicalEclipseProject"); map.put(EclipseProject.class, "org.gradle.tooling.model.eclipse.EclipseProject"); map.put(IdeaProject.class, "org.gradle.tooling.model.idea.IdeaProject"); map.put(GradleProject.class, "org.gradle.tooling.model.GradleProject"); map.put(BasicIdeaProject.class, "org.gradle.tooling.model.idea.BasicIdeaProject"); map.put(BuildEnvironment.class, "org.gradle.tooling.model.build.BuildEnvironment"); map.put(ProjectOutcomes.class, "org.gradle.tooling.model.outcomes.ProjectOutcomes"); map.put(Void.class, Void.class.getName()); }
Example #23
Source File: ModelMapping.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
static void addModelToProtocolMappings(Map<Class<?>, Class<?>> map) { map.put(HierarchicalEclipseProject.class, HierarchicalEclipseProjectVersion1.class); map.put(EclipseProject.class, EclipseProjectVersion3.class); map.put(IdeaProject.class, InternalIdeaProject.class); map.put(GradleProject.class, InternalGradleProject.class); map.put(BasicIdeaProject.class, InternalBasicIdeaProject.class); map.put(BuildEnvironment.class, InternalBuildEnvironment.class); map.put(ProjectOutcomes.class, InternalProjectOutcomes.class); map.put(Void.class, Void.class); }
Example #24
Source File: ModelMapping.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private static void addModelVersions(Map<Class<?>, String> map) { map.put(HierarchicalEclipseProject.class, "1.0-milestone-3"); map.put(EclipseProject.class, "1.0-milestone-3"); map.put(IdeaProject.class, "1.0-milestone-5"); map.put(GradleProject.class, "1.0-milestone-5"); map.put(BasicIdeaProject.class, "1.0-milestone-5"); map.put(BuildEnvironment.class, "1.0-milestone-8"); map.put(ProjectOutcomes.class, "1.2"); map.put(Void.class, "1.0-milestone-3"); map.put(GradleBuild.class, "1.8"); }
Example #25
Source File: GradleDependencyAdapter.java From thorntail with Apache License 2.0 | 4 votes |
/** * Get the dependencies via the Gradle IDEA model. * * @param connection the Gradle project connection. * @return the computed dependencies. */ private DeclaredDependencies getDependenciesViaIdeaModel(ProjectConnection connection) { DeclaredDependencies declaredDependencies = new DeclaredDependencies(); // 1. Get the IdeaProject model from the Gradle connection. IdeaProject prj = connection.getModel(IdeaProject.class); prj.getModules().forEach(this::computeProjectDependencies); // 2. Find the IdeaModule that maps to the project that we are looking at. Optional<? extends IdeaModule> prjModule = prj.getModules().stream() .filter(m -> m.getGradleProject().getProjectDirectory().toPath().equals(rootPath)) .findFirst(); // We need to return the following collection of dependencies, // 1. For the current project, return all artifacts that are marked as ["COMPILE", "TEST"] // 2. From the upstream-projects, add all dependencies that are marked as ["COMPILE"] // 3. For the current project, iterate through each dependencies marked as ["PROVIDED"] and do the following, // a.) Check if they are already available from 1 & 2. If yes, then nothing to do here. // b.) Check if this entry is defined as ["TEST"] in the upstream-projects. If yes, then include it. // -- The reason for doing this is because of the optimization that Gradle does on the IdeaModule library set. Set<ArtifactSpec> collectedDependencies = new HashSet<>(); prjModule.ifPresent(m -> { Map<String, Set<ArtifactSpec>> currentPrjDeps = ARTIFACT_DEPS_OF_PRJ.get(m.getName()); Set<String> upstreamProjects = PRJ_DEPS_OF_PRJ.getOrDefault(m.getName(), emptySet()); collectedDependencies.addAll(currentPrjDeps.getOrDefault(DEP_SCOPE_COMPILE, emptySet())); collectedDependencies.addAll(currentPrjDeps.getOrDefault(DEP_SCOPE_TEST, emptySet())); upstreamProjects.forEach(moduleName -> { Map<String, Set<ArtifactSpec>> moduleDeps = ARTIFACT_DEPS_OF_PRJ.getOrDefault(moduleName, emptyMap()); collectedDependencies.addAll(moduleDeps.getOrDefault(DEP_SCOPE_COMPILE, emptySet())); }); Set<ArtifactSpec> providedScopeDeps = currentPrjDeps.getOrDefault(DEP_SCOPE_PROVIDED, emptySet()); providedScopeDeps.removeAll(collectedDependencies); if (!providedScopeDeps.isEmpty()) { List<ArtifactSpec> testScopedLibs = new ArrayList<>(); upstreamProjects.forEach(moduleName -> testScopedLibs.addAll( ARTIFACT_DEPS_OF_PRJ.getOrDefault(moduleName, emptyMap()) .getOrDefault(DEP_SCOPE_TEST, emptySet()))); providedScopeDeps.stream().filter(testScopedLibs::contains).forEach(collectedDependencies::add); } }); collectedDependencies.forEach(declaredDependencies::add); return declaredDependencies; }