本文整理汇总了Java中com.intellij.openapi.compiler.CompileScope类的典型用法代码示例。如果您正苦于以下问题:Java CompileScope类的具体用法?Java CompileScope怎么用?Java CompileScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompileScope类属于com.intellij.openapi.compiler包,在下文中一共展示了CompileScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CompileContextImpl
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
public CompileContextImpl(final Project project,
final CompilerTask compilerSession,
CompileScope compileScope,
boolean isMake, boolean isRebuild) {
myProject = project;
myBuildSession = compilerSession;
myCompileScope = compileScope;
myMake = isMake;
myIsRebuild = isRebuild;
myStartCompilationStamp = System.currentTimeMillis();
myProjectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
myProjectCompileScope = new ProjectCompileScope(myProject);
myIsAnnotationProcessorsEnabled = CompilerConfiguration.getInstance(project).isAnnotationProcessorsEnabled();
if (compilerSession != null) {
final Object sessionId = ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.get(compileScope);
if (sessionId != null) {
// in case compilation is started as a part of some execution session,
// all compilation tasks should have the same sessionId in order for successive task not to clean messages
// from previous compilation tasks run within this execution session
compilerSession.setSessionId(sessionId);
}
}
final CompilerWorkspaceConfiguration workspaceConfig = CompilerWorkspaceConfiguration.getInstance(myProject);
myShouldUpdateProblemsView = workspaceConfig.MAKE_PROJECT_ON_SAVE;
}
示例2: cleanupChildrenRecursively
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
private void cleanupChildrenRecursively(@NotNull final Object fromElement, final @Nullable CompileScope scope, @NotNull UUID currentSessionId) {
final ErrorViewStructure structure = myPanel.getErrorViewStructure();
for (ErrorTreeElement element : structure.getChildElements(fromElement)) {
if (element instanceof GroupingElement) {
if (scope != null) {
final VirtualFile file = ((GroupingElement)element).getFile();
if (file != null && !scope.belongs(file.getUrl())) {
continue;
}
}
if (!currentSessionId.equals(element.getData())) {
structure.removeElement(element);
}
else {
cleanupChildrenRecursively(element, scope, currentSessionId);
}
}
else {
if (!currentSessionId.equals(element.getData())) {
structure.removeElement(element);
}
}
}
}
示例3: compileAndUpload
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
private void compileAndUpload() {
final Runnable startUploading = new Runnable() {
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
startUploadingProcess();
}
});
}
};
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
final CompileScope moduleScope = compilerManager.createModuleCompileScope(myAppEngineFacet.getModule(), true);
final CompileScope compileScope = ArtifactCompileScope.createScopeWithArtifacts(moduleScope, Collections.singletonList(myArtifact));
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
compilerManager.make(compileScope, new CompileStatusNotification() {
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
if (!aborted && errors == 0) {
startUploading.run();
}
}
});
}
});
}
示例4: compile
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
private void compile(final CompileScope scope) {
try {
CompilerTester tester = new CompilerTester(myProject, Arrays.asList(scope.getAffectedModules()));
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
new MavenResourceCompilerConfigurationGenerator(myProject, MavenProjectsManager.getInstance(myProject).getProjectsTreeForTests())
.generateBuildConfiguration(false);
}
});
try {
List<CompilerMessage> messages = tester.make(scope);
for (CompilerMessage message : messages) {
if (message.getCategory() == CompilerMessageCategory.ERROR) {
fail("Compilation failed with error: " + message.getMessage());
}
}
}
finally {
tester.tearDown();
}
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
示例5: getBuildTargetScopes
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
@NotNull
@Override
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter,
@NotNull Project project, boolean forceBuild) {
List<String> pluginArtifactTargetIds = new ArrayList<String>();
for (Module module : baseScope.getAffectedModules()) {
if (PluginModuleType.isOfType(module)) {
pluginArtifactTargetIds.add(module.getName()+":plugin");
}
}
if (pluginArtifactTargetIds.isEmpty()) {
return Collections.emptyList();
}
return Collections.singletonList(CmdlineProtoUtil.createTargetsScope(ArtifactBuildTargetType.INSTANCE.getTypeId(), pluginArtifactTargetIds, forceBuild));
}
示例6: actionPerformed
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
final CreateIpaDialog dialog = new CreateIpaDialog(e.getProject());
dialog.show();
if(dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
// create IPA
IpaConfig ipaConfig = dialog.getIpaConfig();
CompileScope scope = CompilerManager.getInstance(e.getProject()).createModuleCompileScope(ipaConfig.module, true);
scope.putUserData(IPA_CONFIG_KEY, ipaConfig);
CompilerManager.getInstance(e.getProject()).compile(scope, new CompileStatusNotification() {
@Override
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
RoboVmPlugin.logInfo(e.getProject(), "IPA creation complete, %d errors, %d warnings", errors, warnings);
}
});
}
}
示例7: getAdditionalScope
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
@Override
public CompileScope getAdditionalScope(@NotNull final CompileScope baseScope, @NotNull CompilerFilter filter, @NotNull final Project project) {
if (ArtifactCompileScope.getArtifacts(baseScope) != null) {
return null;
}
final ArtifactsCompiler compiler = ArtifactsCompiler.getInstance(project);
if (compiler == null || !filter.acceptCompiler(compiler)) {
return null;
}
return new ReadAction<CompileScope>() {
protected void run(final Result<CompileScope> result) {
final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, baseScope, false);
result.setResult(ArtifactCompileScope.createScopeForModulesInArtifacts(project, artifacts));
}
}.execute().getResultObject();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ArtifactAdditionalCompileScopeProvider.java
示例8: compileAndUpload
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
private void compileAndUpload() {
final Runnable startUploading = new Runnable() {
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
startUploadingProcess();
}
});
}
};
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
final CompileScope moduleScope = compilerManager.createModuleCompileScope(myAppEngineFacet.getModule(), true);
final CompileScope compileScope = ArtifactCompileScope.createScopeWithArtifacts(moduleScope, Collections.singletonList(myArtifact), true);
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
compilerManager.make(compileScope, new CompileStatusNotification() {
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
if (!aborted && errors == 0) {
startUploading.run();
}
}
});
}
});
}
示例9: addScope
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
private void addScope(CompileScope scope) {
if (scope instanceof CompositeScope) {
final CompositeScope compositeScope = (CompositeScope)scope;
for (CompileScope childScope : compositeScope.myScopes) {
addScope(childScope);
}
}
else {
myScopes.add(scope);
}
Map<Key, Object> map = scope.exportUserData();
for (Map.Entry<Key, Object> entry : map.entrySet()) {
putUserData(entry.getKey(), entry.getValue());
}
}
示例10: getBuildTargetScopes
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
@NotNull
@Override
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull final CompileScope baseScope, @NotNull CompilerFilter filter,
@NotNull final Project project, final boolean forceBuild) {
final ArtifactsCompiler compiler = ArtifactsCompiler.getInstance(project);
if (compiler == null || !filter.acceptCompiler(compiler)) {
return Collections.emptyList();
}
final List<TargetTypeBuildScope> scopes = new ArrayList<TargetTypeBuildScope>();
new ReadAction() {
protected void run(@NotNull final Result result) {
final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, baseScope, false);
if (ArtifactCompileScope.getArtifacts(baseScope) == null) {
Set<Module> modules = ArtifactUtil.getModulesIncludedInArtifacts(artifacts, project);
CompileScopeUtil.addScopesForModules(modules, scopes, forceBuild);
}
if (!artifacts.isEmpty()) {
TargetTypeBuildScope.Builder builder = TargetTypeBuildScope.newBuilder()
.setTypeId(ArtifactBuildTargetType.INSTANCE.getTypeId())
.setForceBuild(ArtifactCompileScope.isArtifactRebuildForced(baseScope));
for (Artifact artifact : artifacts) {
builder.addTargetId(artifact.getName());
}
scopes.add(builder.build());
}
}
}.execute();
return scopes;
}
示例11: createScopeWithArtifacts
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
public static CompileScope createScopeWithArtifacts(final CompileScope baseScope, @NotNull Collection<Artifact> artifacts, final boolean forceArtifactBuild) {
baseScope.putUserData(ARTIFACTS_KEY, artifacts.toArray(new Artifact[artifacts.size()]));
if (forceArtifactBuild) {
baseScope.putUserData(FORCE_ARTIFACT_BUILD, Boolean.TRUE);
}
return baseScope;
}
示例12: getArtifactsToBuild
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
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;
}
示例13: doBuild
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
private static void doBuild(@NotNull Project project, final @NotNull List<ArtifactPopupItem> items, boolean rebuild) {
final Set<Artifact> artifacts = getArtifacts(items, project);
final CompileScope scope = ArtifactCompileScope.createArtifactsScope(project, artifacts, rebuild);
ArtifactsWorkspaceSettings.getInstance(project).setArtifactsToBuild(artifacts);
//in external build we can set 'rebuild' flag per target type
CompilerManager.getInstance(project).make(scope, null);
}
示例14: addScope
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
private void addScope(CompileScope scope) {
if (scope instanceof CompositeScope) {
final CompositeScope compositeScope = (CompositeScope)scope;
for (CompileScope childScope : compositeScope.myScopes) {
addScope(childScope);
}
}
else {
myScopes.add(scope);
}
}
示例15: getFiles
import com.intellij.openapi.compiler.CompileScope; //导入依赖的package包/类
@NotNull
public VirtualFile[] getFiles(FileType fileType, boolean inSourceOnly) {
Set<VirtualFile> allFiles = new THashSet<VirtualFile>();
for (CompileScope scope : myScopes) {
final VirtualFile[] files = scope.getFiles(fileType, inSourceOnly);
if (files.length > 0) {
ContainerUtil.addAll(allFiles, files);
}
}
return VfsUtil.toVirtualFileArray(allFiles);
}