Java Code Examples for com.intellij.openapi.compiler.CompileScope#getUserData()

The following examples show how to use com.intellij.openapi.compiler.CompileScope#getUserData() . 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: ArtifactCompileScope.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static Set<Artifact> getArtifactsToBuild(final Project project,
                                                final CompileScope compileScope,
                                                final boolean addIncludedArtifactsWithOutputPathsOnly) {
  final Artifact[] artifactsFromScope = getArtifacts(compileScope);
  final ArtifactManager artifactManager = ArtifactManager.getInstance(project);
  PackagingElementResolvingContext context = artifactManager.getResolvingContext();
  if (artifactsFromScope != null) {
    return addIncludedArtifacts(Arrays.asList(artifactsFromScope), context, addIncludedArtifactsWithOutputPathsOnly);
  }

  final Set<Artifact> cached = compileScope.getUserData(CACHED_ARTIFACTS_KEY);
  if (cached != null) {
    return cached;
  }

  Set<Artifact> artifacts = new HashSet<Artifact>();
  final Set<Module> modules = new HashSet<Module>(Arrays.asList(compileScope.getAffectedModules()));
  final List<Module> allModules = Arrays.asList(ModuleManager.getInstance(project).getModules());
  for (Artifact artifact : artifactManager.getArtifacts()) {
    if (artifact.isBuildOnMake()) {
      if (modules.containsAll(allModules)
          || containsModuleOutput(artifact, modules, context)) {
        artifacts.add(artifact);
      }
    }
  }
  Set<Artifact> result = addIncludedArtifacts(artifacts, context, addIncludedArtifactsWithOutputPathsOnly);
  compileScope.putUserData(CACHED_ARTIFACTS_KEY, result);
  return result;
}
 
Example 2
Source File: CompositeScope.java    From consulo with Apache License 2.0 5 votes vote down vote up
public <T> T getUserData(@Nonnull Key<T> key) {
  for (CompileScope compileScope : myScopes) {
    T userData = compileScope.getUserData(key);
    if (userData != null) {
      return userData;
    }
  }
  return super.getUserData(key);
}
 
Example 3
Source File: ArtifactCompileScope.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public static Artifact[] getArtifacts(CompileScope compileScope) {
  return compileScope.getUserData(ARTIFACTS_KEY);
}