use of com.intellij.openapi.compiler.CompileContext in project intellij-community by JetBrains.
the class GradleCompilingTestCase method setUpInWriteAction.
@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;
}
});
}
use of com.intellij.openapi.compiler.CompileContext in project android by JetBrains.
the class AndroidCompileUtil method doGenerate.
public static boolean doGenerate(AndroidFacet facet, final AndroidAutogeneratorMode mode) {
assert !ApplicationManager.getApplication().isDispatchThread();
final CompileContext[] contextWrapper = new CompileContext[1];
final Module module = facet.getModule();
final Project project = module.getProject();
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
if (project.isDisposed())
return;
CompilerTask task = new CompilerTask(project, "Android auto-generation", true, false, true, true);
CompileScope scope = new ModuleCompileScope(module, false);
contextWrapper[0] = new CompileContextImpl(project, task, scope, false, false);
}
});
CompileContext context = contextWrapper[0];
if (context == null) {
return false;
}
generate(facet, mode, context, false);
return context.getMessages(CompilerMessageCategory.ERROR).length == 0;
}
use of com.intellij.openapi.compiler.CompileContext in project android by JetBrains.
the class MultipleModuleTypeCompilationTest method testAssembleTaskIsNotInvokedForLocalAarModuleOnJps.
@Ignore("failed in http://go/aj/job/studio-ui-test/345 and from IDEA")
@Test
public void testAssembleTaskIsNotInvokedForLocalAarModuleOnJps() throws IOException {
guiTest.importProjectAndWaitForProjectSyncToFinish("MultipleModuleTypes");
CompileContext context = guiTest.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).asList().containsExactly(":app:assembleDebug", ":javaLib:assemble");
int errorCount = context.getMessageCount(ERROR);
assertEquals(0, errorCount);
}
Aggregations