本文整理汇总了Java中com.intellij.openapi.compiler.CompileContext类的典型用法代码示例。如果您正苦于以下问题:Java CompileContext类的具体用法?Java CompileContext怎么用?Java CompileContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompileContext类属于com.intellij.openapi.compiler包,在下文中一共展示了CompileContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compilationFinished
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
public void compilationFinished( boolean aborted, int errors, int warnings, CompileContext compileContext )
{
if( getIjProject().isDisposed() )
{
return;
}
if( errors > 0 || aborted )
{
return;
}
List<DebuggerSession> sessions = getHotSwappableDebugSessions();
if( !sessions.isEmpty() )
{
hotSwapSessions( sessions );
}
}
示例2: compilationFinished
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
public void compilationFinished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
final Map<String, List<String>> generated = myGeneratedPaths.getAndSet(new HashMap<String, List<String>>());
if (myProject.isDisposed()) {
return;
}
if (errors == 0 && !aborted && myPerformHotswapAfterThisCompilation) {
for (HotSwapVetoableListener listener : myListeners) {
if (!listener.shouldHotSwap(compileContext)) {
return;
}
}
List<DebuggerSession> sessions = getHotSwappableDebugSessions();
if (!sessions.isEmpty()) {
hotSwapSessions(sessions, generated);
}
}
myPerformHotswapAfterThisCompilation = true;
}
示例3: compileAndAnalyze
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
private void compileAndAnalyze(final Project project, final AnalysisScope scope) {
if (project.isDisposed()) {
return;
}
final CompilerManager compilerManager = CompilerManager.getInstance(project);
compilerManager.make(compilerManager.createProjectCompileScope(project), new CompileStatusNotification() {
@Override
public void finished(final boolean aborted, final int errors, final int warnings, final CompileContext compileContext) {
if (aborted || errors != 0) return;
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
doAnalyze(project, scope);
}
});
}});
}
示例4: init
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
public void init() {
CompilerManager compilerManager = CompilerManager.getInstance(myProject);
class MyCompileTask implements CompileTask {
private final boolean myBefore;
MyCompileTask(boolean before) {
myBefore = before;
}
@Override
public boolean execute(CompileContext context) {
return doExecuteCompileTasks(myBefore, context);
}
}
compilerManager.addBeforeTask(new MyCompileTask(true));
compilerManager.addAfterTask(new MyCompileTask(false));
fireTasksChanged();
}
示例5: doExecuteCompileTasks
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
private boolean doExecuteCompileTasks(boolean myBefore, @NotNull CompileContext context) {
final List<String> modules = ContainerUtil.map(context.getCompileScope().getAffectedModules(), new Function<Module, String>() {
@Override
public String fun(Module module) {
return ExternalSystemApiUtil.getExternalProjectPath(module);
}
});
final Collection<Phase> phases = ContainerUtil.newArrayList();
if (myBefore) {
if(context.isRebuild()) {
phases.add(Phase.BEFORE_REBUILD);
}
phases.add(Phase.BEFORE_COMPILE);
}
else {
phases.add(Phase.AFTER_COMPILE);
if(context.isRebuild()) {
phases.add(Phase.AFTER_REBUILD);
}
}
return runTasks(modules, ArrayUtil.toObjectArray(phases, Phase.class));
}
示例6: generate
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
private static void generate(Project project, final Module... modules) {
CompilerManager.getInstance(project).executeTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
// todo: compatibility with background autogenerating
for (Module module : modules) {
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null) {
for (AndroidAutogeneratorMode mode : AndroidAutogeneratorMode.values()) {
AndroidCompileUtil.generate(facet, mode, context, true);
}
}
}
return true;
}
}, new ModuleCompileScope(project, modules, false), AndroidBundle.message("android.compile.messages.generating.r.java.content.name"),
null);
}
示例7: buildAndSignIntellijProject
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
private void buildAndSignIntellijProject() {
CompilerManager.getInstance(myProject).make(myCompileScope, new CompileStatusNotification() {
@Override
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
if (aborted || errors != 0) {
return;
}
final String title = AndroidBundle.message("android.extract.package.task.title");
ProgressManager.getInstance().run(new Task.Backgroundable(myProject, title, true, null) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
createAndAlignApk(myApkPath);
}
});
}
});
}
示例8: isReleaseBuild
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
public static boolean isReleaseBuild(@NotNull CompileContext context) {
final Boolean value = context.getCompileScope().getUserData(RELEASE_BUILD_KEY);
if (value != null && value.booleanValue()) {
return true;
}
final Project project = context.getProject();
final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, context.getCompileScope(), false);
if (artifacts != null) {
for (Artifact artifact : artifacts) {
final ArtifactProperties<?> properties = artifact.getProperties(AndroidArtifactPropertiesProvider.getInstance());
if (properties instanceof AndroidApplicationArtifactProperties) {
final AndroidArtifactSigningMode signingMode = ((AndroidApplicationArtifactProperties)properties).getSigningMode();
if (signingMode != AndroidArtifactSigningMode.DEBUG &&
signingMode != AndroidArtifactSigningMode.DEBUG_WITH_CUSTOM_CERTIFICATE) {
return true;
}
}
}
}
return false;
}
示例9: AndroidGradleProjectComponent
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
public AndroidGradleProjectComponent(@NotNull final Project project) {
super(project);
// Register a task that will be executed after project build (e.g. make, rebuild, generate sources) with JPS.
ProjectBuilder.getInstance(project).addAfterProjectBuildTask(new ProjectBuilder.AfterProjectBuildTask() {
@Override
public void execute(@NotNull GradleInvocationResult result) {
PostProjectBuildTasksExecutor.getInstance(project).onBuildCompletion(result);
}
@Override
public boolean execute(CompileContext context) {
PostProjectBuildTasksExecutor.getInstance(project).onBuildCompletion(context);
return true;
}
});
}
示例10: testAssembleTaskIsNotInvokedForLocalAarModuleOnJps
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
@Test @IdeGuiTest
public void testAssembleTaskIsNotInvokedForLocalAarModuleOnJps() throws IOException {
IdeFrameFixture ideFrame = importProjectAndWaitForProjectSyncToFinish("MultipleModuleTypes");
CompileContext context = ideFrame.invokeProjectMakeUsingJps();
String[] invokedTasks = null;
for (CompilerMessage msg : context.getMessages(INFORMATION)) {
String text = msg.getMessage();
Matcher matcher = JPS_EXECUTING_TASKS_MSG_PATTERN.matcher(text);
if (matcher.matches()) {
String allTasks = matcher.group(1);
invokedTasks = allTasks.split(", ");
break;
}
}
// In JPS we cannot call "compileJava" because in JPS "Make" means "assemble".
assertThat(invokedTasks).containsOnly(":app:assembleDebug", ":javaLib:assemble");
int errorCount = context.getMessageCount(ERROR);
assertEquals(0, errorCount);
}
示例11: setUpInWriteAction
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
@Override
protected void setUpInWriteAction() throws Exception {
super.setUpInWriteAction();
final GradleResourceCompilerConfigurationGenerator buildConfigurationGenerator = new GradleResourceCompilerConfigurationGenerator(myProject);
CompilerManager.getInstance(myProject).addBeforeTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
AccessToken token = ReadAction.start();
try {
buildConfigurationGenerator.generateBuildConfiguration(context);
}
finally {
token.finish();
}
return true;
}
});
}
示例12: runActivity
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
@Override
public void runActivity(@NotNull final Project project) {
configureBuildClasspath(project);
showNotificationForUnlinkedGradleProject(project);
final GradleResourceCompilerConfigurationGenerator buildConfigurationGenerator = new GradleResourceCompilerConfigurationGenerator(project);
CompilerManager.getInstance(project).addBeforeTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
AccessToken token = ReadAction.start();
try {
buildConfigurationGenerator.generateBuildConfiguration(context);
}
finally {
token.finish();
}
return true;
}
});
}
示例13: compileAndUpload
import com.intellij.openapi.compiler.CompileContext; //导入依赖的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();
}
}
});
}
});
}
示例14: initComponent
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
@Override
public void initComponent() {
if (!isNormalProject()) return;
if (isInitialized.getAndSet(true)) return;
CompilerManager compilerManager = CompilerManager.getInstance(myProject);
class MyCompileTask implements CompileTask {
private final boolean myBefore;
MyCompileTask(boolean before) {
myBefore = before;
}
@Override
public boolean execute(CompileContext context) {
return doExecute(myBefore, context);
}
}
compilerManager.addBeforeTask(new MyCompileTask(true));
compilerManager.addAfterTask(new MyCompileTask(false));
}
示例15: doExecute
import com.intellij.openapi.compiler.CompileContext; //导入依赖的package包/类
private boolean doExecute(boolean before, CompileContext context) {
List<MavenRunnerParameters> parametersList;
synchronized (this) {
parametersList = new ArrayList<MavenRunnerParameters>();
Set<MavenCompilerTask> tasks = before ? myState.beforeCompileTasks : myState.afterCompileTasks;
if (context.isRebuild()) {
tasks = Sets.union(before ? myState.beforeRebuildTask : myState.afterRebuildTask, tasks);
}
for (MavenCompilerTask each : tasks) {
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(each.getProjectPath());
if (file == null) continue;
MavenExplicitProfiles explicitProfiles = myProjectsManager.getExplicitProfiles();
parametersList.add(new MavenRunnerParameters(true,
file.getParent().getPath(),
Arrays.asList(each.getGoal()),
explicitProfiles.getEnabledProfiles(),
explicitProfiles.getDisabledProfiles()));
}
}
return myRunner.runBatch(parametersList, null, null, TasksBundle.message("maven.tasks.executing"), context.getProgressIndicator());
}