Search in sources :

Example 1 with ProjectCompileScope

use of com.intellij.compiler.impl.ProjectCompileScope in project android by JetBrains.

the class AndroidGradleBuildTargetScopeProvider method getBuildTargetScopes.

@Override
@NotNull
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter, @NotNull Project project, boolean forceBuild) {
    if (!AndroidProjectInfo.getInstance(project).requiresAndroidModel()) {
        return Collections.emptyList();
    }
    BuildSettings buildSettings = BuildSettings.getInstance(project);
    String runConfigurationTypeId = baseScope.getUserData(CompilerManager.RUN_CONFIGURATION_TYPE_ID_KEY);
    buildSettings.setRunConfigurationTypeId(runConfigurationTypeId);
    if (baseScope instanceof ProjectCompileScope) {
        // Make or Rebuild project
        BuildMode buildMode = forceBuild ? BuildMode.REBUILD : BuildMode.ASSEMBLE;
        if (buildSettings.getBuildMode() == null) {
            buildSettings.setBuildMode(buildMode);
        }
        Module[] modulesToBuild = ModuleManager.getInstance(project).getModules();
        buildSettings.setModulesToBuild(modulesToBuild);
    } else if (baseScope instanceof ModuleCompileScope) {
        String userDataString = ((ModuleCompileScope) baseScope).getUserDataString();
        Module[] modulesToBuild;
        if (userDataString.contains("RUN_CONFIGURATION")) {
            // Triggered by a "Run Configuration"
            modulesToBuild = baseScope.getAffectedModules();
        } else {
            // Triggered by menu item.
            // Make selected modules
            modulesToBuild = Projects.getModulesToBuildFromSelection(project, null);
        }
        buildSettings.setModulesToBuild(modulesToBuild);
        buildSettings.setBuildMode(BuildMode.ASSEMBLE);
    } else if (baseScope instanceof CompositeScope) {
        // Compile selected modules
        buildSettings.setModulesToBuild(Projects.getModulesToBuildFromSelection(project, null));
        buildSettings.setBuildMode(BuildMode.COMPILE_JAVA);
    }
    TargetTypeBuildScope scope = CmdlineProtoUtil.createTargetsScope(AndroidGradleBuildTargetConstants.TARGET_TYPE_ID, Collections.singletonList(AndroidGradleBuildTargetConstants.TARGET_ID), forceBuild);
    return Collections.singletonList(scope);
}
Also used : ProjectCompileScope(com.intellij.compiler.impl.ProjectCompileScope) CompositeScope(com.intellij.compiler.impl.CompositeScope) BuildSettings(com.android.tools.idea.gradle.project.BuildSettings) BuildMode(com.android.tools.idea.gradle.util.BuildMode) Module(com.intellij.openapi.module.Module) ModuleCompileScope(com.intellij.compiler.impl.ModuleCompileScope) TargetTypeBuildScope(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with ProjectCompileScope

use of com.intellij.compiler.impl.ProjectCompileScope in project intellij-community by JetBrains.

the class CheckResourcesAction method checkResources.

@VisibleForTesting
public static void checkResources(Project project, @Nullable CompileStatusNotification callback, boolean rebuild) {
    ProjectCompileScope scope = new ProjectCompileScope(project);
    scope.putUserData(GroovyResourceChecker.CHECKING_RESOURCES_REBUILD, rebuild);
    CompilerManager.getInstance(project).make(scope, callback);
}
Also used : ProjectCompileScope(com.intellij.compiler.impl.ProjectCompileScope) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

ProjectCompileScope (com.intellij.compiler.impl.ProjectCompileScope)2 BuildSettings (com.android.tools.idea.gradle.project.BuildSettings)1 BuildMode (com.android.tools.idea.gradle.util.BuildMode)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 CompositeScope (com.intellij.compiler.impl.CompositeScope)1 ModuleCompileScope (com.intellij.compiler.impl.ModuleCompileScope)1 Module (com.intellij.openapi.module.Module)1 NotNull (org.jetbrains.annotations.NotNull)1 TargetTypeBuildScope (org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope)1