Search in sources :

Example 1 with CompileScope

use of com.intellij.openapi.compiler.CompileScope in project intellij-community by JetBrains.

the class InternalProjectTaskRunner method createScope.

private static CompileScope createScope(CompilerManager compilerManager, ProjectTaskContext context, Collection<Module> modules, boolean includeDependentModules, boolean includeRuntimeDependencies) {
    CompileScope scope = compilerManager.createModulesCompileScope(modules.toArray(new Module[modules.size()]), includeDependentModules, includeRuntimeDependencies);
    RunConfiguration configuration = context.getRunConfiguration();
    if (configuration != null) {
        scope.putUserData(CompilerManager.RUN_CONFIGURATION_KEY, configuration);
        scope.putUserData(CompilerManager.RUN_CONFIGURATION_TYPE_ID_KEY, configuration.getType().getId());
    }
    ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.set(scope, context.getSessionId());
    return scope;
}
Also used : ArtifactCompileScope(com.intellij.packaging.impl.compiler.ArtifactCompileScope) CompileScope(com.intellij.openapi.compiler.CompileScope) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) Module(com.intellij.openapi.module.Module)

Example 2 with CompileScope

use of com.intellij.openapi.compiler.CompileScope in project intellij-community by JetBrains.

the class AppEngineUploader method compileAndUpload.

private void compileAndUpload() {
    final Runnable startUploading = () -> ApplicationManager.getApplication().invokeLater(() -> 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(() -> compilerManager.make(compileScope, new CompileStatusNotification() {

        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
            if (!aborted && errors == 0) {
                startUploading.run();
            }
        }
    }));
}
Also used : CompileStatusNotification(com.intellij.openapi.compiler.CompileStatusNotification) CompileScope(com.intellij.openapi.compiler.CompileScope) ArtifactCompileScope(com.intellij.packaging.impl.compiler.ArtifactCompileScope) CompilerManager(com.intellij.openapi.compiler.CompilerManager) CompileContext(com.intellij.openapi.compiler.CompileContext)

Example 3 with CompileScope

use of com.intellij.openapi.compiler.CompileScope in project intellij-plugins by JetBrains.

the class AirPackageAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null)
        return;
    final AirPackageDialog dialog = new AirPackageDialog(project);
    if (!dialog.showAndGet()) {
        return;
    }
    final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCs = dialog.getSelectedBCs();
    final Set<Module> modules = new THashSet<>();
    for (Pair<Module, FlexBuildConfiguration> bc : modulesAndBCs) {
        modules.add(bc.first);
    }
    final CompilerManager compilerManager = CompilerManager.getInstance(project);
    final CompileScope compileScope = compilerManager.createModulesCompileScope(modules.toArray(new Module[modules.size()]), false);
    FlexResourceBuildTargetScopeProvider.setBCsToCompileForPackaging(compileScope, modulesAndBCs);
    compilerManager.make(compileScope, new CompileStatusNotification() {

        public void finished(final boolean aborted, final int errors, final int warnings, final CompileContext compileContext) {
            if (!aborted && errors == 0) {
                createPackages(project, modulesAndBCs, dialog.getPasswords());
            }
        }
    });
}
Also used : CompilerManager(com.intellij.openapi.compiler.CompilerManager) CompileContext(com.intellij.openapi.compiler.CompileContext) THashSet(gnu.trove.THashSet) Project(com.intellij.openapi.project.Project) CompileStatusNotification(com.intellij.openapi.compiler.CompileStatusNotification) CompileScope(com.intellij.openapi.compiler.CompileScope) Module(com.intellij.openapi.module.Module) Pair(com.intellij.openapi.util.Pair)

Example 4 with CompileScope

use of com.intellij.openapi.compiler.CompileScope in project intellij-community by JetBrains.

the class InternalProjectTaskRunner method runModulesBuildTasks.

private static void runModulesBuildTasks(@NotNull Project project, @NotNull ProjectTaskContext context, @Nullable CompileStatusNotification compileNotification, @NotNull Map<Class<? extends ProjectTask>, List<ProjectTask>> tasksMap) {
    Collection<? extends ProjectTask> buildTasks = tasksMap.get(ModuleBuildTask.class);
    if (ContainerUtil.isEmpty(buildTasks))
        return;
    ModulesBuildSettings modulesBuildSettings = assembleModulesBuildSettings(buildTasks);
    CompilerManager compilerManager = CompilerManager.getInstance(project);
    CompileScope scope = createScope(compilerManager, context, modulesBuildSettings.modules, modulesBuildSettings.includeDependentModules, modulesBuildSettings.includeRuntimeDependencies);
    if (modulesBuildSettings.isIncrementalBuild) {
        compilerManager.make(scope, compileNotification);
    } else {
        compilerManager.compile(scope, compileNotification);
    }
}
Also used : ArtifactCompileScope(com.intellij.packaging.impl.compiler.ArtifactCompileScope) CompileScope(com.intellij.openapi.compiler.CompileScope) CompilerManager(com.intellij.openapi.compiler.CompilerManager)

Example 5 with CompileScope

use of com.intellij.openapi.compiler.CompileScope in project azure-tools-for-java by Microsoft.

the class IDEHelperImpl method buildArtifact.

private static ListenableFuture<Boolean> buildArtifact(@NotNull Project project, @NotNull final Artifact artifact, boolean rebuild) {
    final SettableFuture<Boolean> future = SettableFuture.create();
    Set<Artifact> artifacts = new LinkedHashSet<Artifact>(1);
    artifacts.add(artifact);
    CompileScope scope = ArtifactCompileScope.createArtifactsScope(project, artifacts, rebuild);
    ArtifactsWorkspaceSettings.getInstance(project).setArtifactsToBuild(artifacts);
    CompilerManager.getInstance(project).make(scope, new CompileStatusNotification() {

        @Override
        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
            future.set(!aborted && errors == 0);
        }
    });
    return future;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) CompileStatusNotification(com.intellij.openapi.compiler.CompileStatusNotification) ArtifactCompileScope(com.intellij.packaging.impl.compiler.ArtifactCompileScope) CompileScope(com.intellij.openapi.compiler.CompileScope) CompileContext(com.intellij.openapi.compiler.CompileContext) Artifact(com.intellij.packaging.artifacts.Artifact)

Aggregations

CompileScope (com.intellij.openapi.compiler.CompileScope)10 ArtifactCompileScope (com.intellij.packaging.impl.compiler.ArtifactCompileScope)6 CompilerManager (com.intellij.openapi.compiler.CompilerManager)5 CompileContext (com.intellij.openapi.compiler.CompileContext)4 Module (com.intellij.openapi.module.Module)4 CompileStatusNotification (com.intellij.openapi.compiler.CompileStatusNotification)3 Project (com.intellij.openapi.project.Project)2 File (java.io.File)2 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)2 JavaArtifact (com.android.builder.model.JavaArtifact)1 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 CompileContextImpl (com.intellij.compiler.impl.CompileContextImpl)1 ModuleCompileScope (com.intellij.compiler.impl.ModuleCompileScope)1 CompilerTask (com.intellij.compiler.progress.CompilerTask)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 CommitStepException (com.intellij.ide.wizard.CommitStepException)1 Pair (com.intellij.openapi.util.Pair)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Artifact (com.intellij.packaging.artifacts.Artifact)1