当前位置: 首页>>代码示例>>Java>>正文


Java CompileContext类代码示例

本文整理汇总了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 );
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:19,代码来源:HotSwapComponent.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HotSwapUIImpl.java

示例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);
        }
      });
  }});
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:BaseClassesAnalysisAction.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ExternalSystemTaskActivator.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ExternalSystemTaskActivator.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidRegenerateSourcesAction.java

示例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);
        }
      });
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ExportSignedPackageWizard.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidCompileUtil.java

示例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;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidGradleProjectComponent.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MultipleModuleTypeCompilationTest.java

示例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;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GradleCompilingTestCase.java

示例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;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GradleStartupActivity.java

示例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();
          }
        }
      });
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AppEngineUploader.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MavenTasksManager.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MavenTasksManager.java


注:本文中的com.intellij.openapi.compiler.CompileContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。