use of org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope in project intellij-community by JetBrains.
the class BuildManager method runAutoMake.
private void runAutoMake() {
final Project project = getCurrentContextProject();
if (project == null || !canStartAutoMake(project)) {
return;
}
final List<TargetTypeBuildScope> scopes = CmdlineProtoUtil.createAllModulesScopes(false);
final AutoMakeMessageHandler handler = new AutoMakeMessageHandler(project);
final TaskFuture future = scheduleBuild(project, false, true, false, scopes, Collections.emptyList(), Collections.emptyMap(), handler);
if (future != null) {
myAutomakeFutures.put(future, project);
try {
future.waitFor();
} finally {
myAutomakeFutures.remove(future);
if (handler.unprocessedFSChangesDetected()) {
scheduleAutoMake();
}
}
}
}
use of org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope in project intellij-community by JetBrains.
the class CompileScopeUtil method mergeScopes.
private static void mergeScopes(Map<String, TargetTypeBuildScope> scopeById, List<TargetTypeBuildScope> scopes) {
for (TargetTypeBuildScope scope : scopes) {
String id = scope.getTypeId();
TargetTypeBuildScope old = scopeById.get(id);
if (old == null) {
scopeById.put(id, scope);
} else {
scopeById.put(id, mergeScope(old, scope));
}
}
}
use of org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope in project intellij-community by JetBrains.
the class JpsGantProjectBuilder method runBuild.
private void runBuild(final Set<String> modulesSet, final boolean allModules, boolean includeTests) {
if (!myDryRun) {
System.setProperty(GlobalOptions.USE_DEFAULT_FILE_LOGGING_OPTION, "false");
final AntMessageHandler messageHandler = new AntMessageHandler();
//noinspection AssignmentToStaticFieldFromInstanceMethod
AntLoggerFactory.ourMessageHandler = new AntMessageHandler();
AntLoggerFactory.ourFileLoggerFactory = myFileLoggerFactory;
Logger.setFactory(AntLoggerFactory.class);
boolean forceBuild = !myBuildIncrementally;
List<TargetTypeBuildScope> scopes = new ArrayList<>();
for (JavaModuleBuildTargetType type : JavaModuleBuildTargetType.ALL_TYPES) {
if (includeTests || !type.isTests()) {
List<String> namesToCompile = new ArrayList<>(allModules ? getAllModules() : modulesSet);
if (type.isTests()) {
namesToCompile.removeAll(myCompiledModuleTests);
myCompiledModuleTests.addAll(namesToCompile);
} else {
namesToCompile.removeAll(myCompiledModules);
myCompiledModules.addAll(namesToCompile);
}
if (namesToCompile.isEmpty())
continue;
TargetTypeBuildScope.Builder builder = TargetTypeBuildScope.newBuilder().setTypeId(type.getTypeId()).setForceBuild(forceBuild);
if (allModules) {
scopes.add(builder.setAllTargets(true).build());
} else if (!modulesSet.isEmpty()) {
scopes.add(builder.addAllTargetId(modulesSet).build());
}
}
}
info("Starting build; incremental: " + myBuildIncrementally + ", cache directory: " + myDataStorageRoot.getAbsolutePath());
info("Build scope: " + (allModules ? "all" : modulesSet.size()) + " modules, " + (includeTests ? "including tests" : "production only"));
long compilationStart = System.currentTimeMillis();
try {
myBuildInfoPrinter.printBlockOpenedMessage(this, "Compilation");
Standalone.runBuild(myModelLoader, myDataStorageRoot, messageHandler, scopes, false);
} catch (Throwable e) {
error(e);
} finally {
myBuildInfoPrinter.printBlockClosedMessage(this, "Compilation");
}
if (messageHandler.myFailed) {
error("Compilation failed");
} else if (!myStatisticsReported) {
myBuildInfoPrinter.printStatisticsMessage(this, "Compilation time, ms", String.valueOf(System.currentTimeMillis() - compilationStart));
myStatisticsReported = true;
}
} else {
info("Building skipped as we're running dry");
}
}
use of org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope in project intellij-community by JetBrains.
the class BuildSession method scopeContainsModulesOnlyForIncrementalMake.
private static boolean scopeContainsModulesOnlyForIncrementalMake(List<TargetTypeBuildScope> scopes) {
TargetTypeRegistry typeRegistry = null;
for (TargetTypeBuildScope scope : scopes) {
if (scope.getForceBuild())
return false;
final String typeId = scope.getTypeId();
if (isJavaModuleBuildType(typeId)) {
// fast check
continue;
}
if (typeRegistry == null) {
// lazy init
typeRegistry = TargetTypeRegistry.getInstance();
}
final BuildTargetType<?> targetType = typeRegistry.getTargetType(typeId);
if (targetType != null && !(targetType instanceof ModuleInducedTargetType)) {
return false;
}
}
return true;
}
use of org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope in project android by JetBrains.
the class AndroidBuildTargetScopeProvider method getBuildTargetScopes.
@NotNull
@Override
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter, @NotNull Project project, boolean forceBuild) {
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID) || AndroidProjectInfo.getInstance(project).requiresAndroidModel()) {
return Collections.emptyList();
}
final List<String> appTargetIds = new ArrayList<>();
final List<String> libTargetIds = new ArrayList<>();
final List<String> allTargetIds = new ArrayList<>();
final List<String> manifestMergingTargetIds = new ArrayList<>();
final boolean fullBuild = AndroidCompileUtil.isFullBuild(baseScope);
for (Module module : baseScope.getAffectedModules()) {
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
continue;
}
allTargetIds.add(module.getName());
if (fullBuild) {
if (facet.canBeDependency()) {
libTargetIds.add(module.getName());
} else {
if (facet.getProperties().ENABLE_MANIFEST_MERGING) {
manifestMergingTargetIds.add(module.getName());
}
appTargetIds.add(module.getName());
}
}
}
final List<TargetTypeBuildScope> result = new ArrayList<>();
result.add(CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.MANIFEST_MERGING_BUILD_TARGET_TYPE_ID, manifestMergingTargetIds, forceBuild));
if (fullBuild && !isProGuardUsed(project, baseScope)) {
result.add(CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.PRE_DEX_BUILD_TARGET_TYPE_ID, Collections.singletonList("only"), forceBuild));
}
result.addAll(Arrays.asList(CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.AAR_DEPS_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild), CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.DEX_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild), CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.RESOURCE_CACHING_BUILD_TARGET_ID, allTargetIds, forceBuild), CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.RESOURCE_PACKAGING_BUILD_TARGET_ID, appTargetIds, forceBuild), CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.PACKAGING_BUILD_TARGET_TYPE_ID, appTargetIds, forceBuild), CmdlineProtoUtil.createTargetsScope(AndroidCommonUtils.LIBRARY_PACKAGING_BUILD_TARGET_ID, libTargetIds, forceBuild)));
return result;
}
Aggregations