mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (warnings; formatting)
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.compiler.impl;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
@@ -84,24 +83,23 @@ import java.util.concurrent.TimeUnit;
|
||||
import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope;
|
||||
|
||||
public class CompileDriver {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileDriver");
|
||||
|
||||
private final Project myProject;
|
||||
private static final Key<Boolean> COMPILATION_STARTED_AUTOMATICALLY = Key.create("compilation_started_automatically");
|
||||
private static final Key<ExitStatus> COMPILE_SERVER_BUILD_STATUS = Key.create("COMPILE_SERVER_BUILD_STATUS");
|
||||
private static final long ONE_MINUTE_MS = 60L * 1000L;
|
||||
|
||||
private final Project myProject;
|
||||
private final Map<Module, String> myModuleOutputPaths = new HashMap<>();
|
||||
private final Map<Module, String> myModuleTestOutputPaths = new HashMap<>();
|
||||
|
||||
private static final Key<Boolean> COMPILATION_STARTED_AUTOMATICALLY = Key.create("compilation_started_automatically");
|
||||
|
||||
private CompilerFilter myCompilerFilter = CompilerFilter.ALL;
|
||||
|
||||
private static final long ONE_MINUTE_MS = 60L /*sec*/ * 1000L /*millisec*/;
|
||||
@SuppressWarnings("deprecation") private CompilerFilter myCompilerFilter = CompilerFilter.ALL;
|
||||
|
||||
public CompileDriver(Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setCompilerFilter(CompilerFilter compilerFilter) {
|
||||
myCompilerFilter = compilerFilter == null? CompilerFilter.ALL : compilerFilter;
|
||||
}
|
||||
@@ -356,9 +354,6 @@ public class CompileDriver {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static final Key<ExitStatus> COMPILE_SERVER_BUILD_STATUS = Key.create("COMPILE_SERVER_BUILD_STATUS");
|
||||
|
||||
private void startup(final CompileScope scope,
|
||||
final boolean isRebuild,
|
||||
final boolean forceCompile,
|
||||
@@ -366,8 +361,7 @@ public class CompileDriver {
|
||||
final CompilerMessage message) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
final String contentName =
|
||||
forceCompile ? CompilerBundle.message("compiler.content.name.compile") : CompilerBundle.message("compiler.content.name.make");
|
||||
final String contentName = CompilerBundle.message(forceCompile ? "compiler.content.name.compile" : "compiler.content.name.make");
|
||||
final boolean isUnitTestMode = ApplicationManager.getApplication().isUnitTestMode();
|
||||
final CompilerTask compileTask = new CompilerTask(myProject, contentName, isUnitTestMode, true, true, isCompilationStartedAutomatically(scope));
|
||||
|
||||
@@ -541,27 +535,10 @@ public class CompileDriver {
|
||||
return message;
|
||||
}
|
||||
|
||||
/*
|
||||
private void dropScopesCaches() {
|
||||
// hack to be sure the classpath will include the output directories
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
public void run() {
|
||||
((ProjectRootManagerEx)ProjectRootManager.getInstance(myProject)).clearScopesCachesForModules();
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
// [mike] performance optimization - this method is accessed > 15,000 times in Aurora
|
||||
private String getModuleOutputPath(final Module module, boolean inTestSourceContent) {
|
||||
final Map<Module, String> map = inTestSourceContent ? myModuleTestOutputPaths : myModuleOutputPaths;
|
||||
String path = map.get(module);
|
||||
if (path == null) {
|
||||
path = CompilerPaths.getModuleOutputPath(module, inTestSourceContent);
|
||||
map.put(module, path);
|
||||
}
|
||||
|
||||
return path;
|
||||
private String getModuleOutputPath(Module module, boolean inTestSourceContent) {
|
||||
Map<Module, String> map = inTestSourceContent ? myModuleTestOutputPaths : myModuleOutputPaths;
|
||||
return map.computeIfAbsent(module, k -> CompilerPaths.getModuleOutputPath(module, inTestSourceContent));
|
||||
}
|
||||
|
||||
public void executeCompileTask(final CompileTask task, final CompileScope scope, final String contentName, final Runnable onTaskFinished) {
|
||||
@@ -595,9 +572,8 @@ public class CompileDriver {
|
||||
try {
|
||||
CompileTask[] tasks = beforeTasks ? manager.getBeforeTasks() : manager.getAfterTasks();
|
||||
if (tasks.length > 0) {
|
||||
progressIndicator.setText(beforeTasks
|
||||
? CompilerBundle.message("progress.executing.precompile.tasks")
|
||||
: CompilerBundle.message("progress.executing.postcompile.tasks"));
|
||||
progressIndicator.setText(
|
||||
CompilerBundle.message(beforeTasks ? "progress.executing.precompile.tasks" : "progress.executing.postcompile.tasks"));
|
||||
for (CompileTask task : tasks) {
|
||||
if (!task.execute(context)) {
|
||||
return false;
|
||||
@@ -809,4 +785,4 @@ public class CompileDriver {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,6 +53,9 @@ import java.util.*;
|
||||
* @author nik
|
||||
*/
|
||||
public class JavaBuilderUtil {
|
||||
public static final Key<Callbacks.ConstantAffectionResolver> CONSTANT_SEARCH_SERVICE = Key.create("_constant_search_service_");
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.Builder");
|
||||
private static final Key<Set<File>> ALL_AFFECTED_FILES_KEY = Key.create("_all_affected_files_");
|
||||
private static final Key<Set<File>> ALL_COMPILED_FILES_KEY = Key.create("_all_compiled_files_");
|
||||
private static final Key<Set<File>> FILES_TO_COMPILE_KEY = Key.create("_files_to_compile_");
|
||||
@@ -60,13 +63,11 @@ public class JavaBuilderUtil {
|
||||
private static final Key<Set<File>> SUCCESSFULLY_COMPILED_FILES_KEY = Key.create("_successfully_compiled_files_");
|
||||
private static final Key<List<FileFilter>> SKIP_MARKING_DIRTY_FILTERS_KEY = Key.create("_skip_marking_dirty_filters_");
|
||||
private static final Key<Pair<Mappings, Callbacks.Backend>> MAPPINGS_DELTA_KEY = Key.create("_mappings_delta_");
|
||||
public static final Key<Callbacks.ConstantAffectionResolver> CONSTANT_SEARCH_SERVICE = Key.create("_constant_search_service_");
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.Builder");
|
||||
|
||||
public static void registerFileToCompile(CompileContext context, File file) {
|
||||
registerFilesToCompile(context, Collections.singleton(file));
|
||||
}
|
||||
|
||||
|
||||
public static void registerFilesToCompile(CompileContext context, Collection<File> files) {
|
||||
getFilesContainer(context, FILES_TO_COMPILE_KEY).addAll(files);
|
||||
}
|
||||
@@ -130,8 +131,10 @@ public class JavaBuilderUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated this method isn't supposed to be called by plugins anymore, the mappings are updated by the build process infrastructure automatically.
|
||||
* Use {@link #getDependenciesRegistrar(CompileContext)}, {@link #registerFilesToCompile(CompileContext, Collection)}, {@link #registerSuccessfullyCompiled(CompileContext, Collection)} instead.
|
||||
* @deprecated this method isn't supposed to be called by plugins anymore, the mappings are updated
|
||||
* by the build process infrastructure automatically. Use {@link #getDependenciesRegistrar(CompileContext)},
|
||||
* {@link #registerFilesToCompile(CompileContext, Collection)}, or
|
||||
* {@link #registerSuccessfullyCompiled(CompileContext, Collection)} instead.
|
||||
*/
|
||||
public static boolean updateMappings(CompileContext context,
|
||||
final Mappings delta,
|
||||
@@ -319,8 +322,8 @@ public class JavaBuilderUtil {
|
||||
|
||||
public static boolean isForcedRecompilationAllJavaModules(CompileContext context) {
|
||||
CompileScope scope = context.getScope();
|
||||
return scope.isBuildForcedForAllTargets(JavaModuleBuildTargetType.PRODUCTION) && scope.isBuildForcedForAllTargets(
|
||||
JavaModuleBuildTargetType.TEST);
|
||||
return scope.isBuildForcedForAllTargets(JavaModuleBuildTargetType.PRODUCTION) &&
|
||||
scope.isBuildForcedForAllTargets(JavaModuleBuildTargetType.TEST);
|
||||
}
|
||||
|
||||
public static boolean isCompileJavaIncrementally(CompileContext context) {
|
||||
@@ -465,4 +468,4 @@ public class JavaBuilderUtil {
|
||||
return !myFilter.accept(pathname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,11 +39,10 @@ import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 10/30/12
|
||||
* @since 30.10.2012
|
||||
*/
|
||||
public class BuildOperations {
|
||||
private BuildOperations() {
|
||||
}
|
||||
private BuildOperations() { }
|
||||
|
||||
public static void ensureFSStateInitialized(CompileContext context, BuildTarget<?> target) throws IOException {
|
||||
final ProjectDescriptor pd = context.getProjectDescriptor();
|
||||
@@ -135,13 +134,13 @@ public class BuildOperations {
|
||||
Map<T, Set<File>> cleanOutputsCorrespondingToChangedFiles(final CompileContext context, DirtyFilesHolder<R, T> dirtyFilesHolder) throws ProjectBuildException {
|
||||
final BuildDataManager dataManager = context.getProjectDescriptor().dataManager;
|
||||
try {
|
||||
final Map<T, Set<File>> cleanedSources = new java.util.HashMap<T, Set<File>>();
|
||||
final Map<T, Set<File>> cleanedSources = new HashMap<T, Set<File>>();
|
||||
|
||||
final THashSet<File> dirsToDelete = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
final Collection<String> deletedPaths = new ArrayList<String>();
|
||||
|
||||
dirtyFilesHolder.processDirtyFiles(new FileProcessor<R, T>() {
|
||||
private final Map<T, SourceToOutputMapping> mappingsCache = new java.util.HashMap<T, SourceToOutputMapping>(); // cache the mapping locally
|
||||
private final Map<T, SourceToOutputMapping> mappingsCache = new HashMap<T, SourceToOutputMapping>(); // cache the mapping locally
|
||||
private final TObjectIntHashMap<T> idsCache = new TObjectIntHashMap<T>();
|
||||
|
||||
@Override
|
||||
@@ -226,4 +225,4 @@ public class BuildOperations {
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,12 +38,14 @@ import java.util.Set;
|
||||
*/
|
||||
public class BuildTargetConfiguration {
|
||||
public static final Key<Set<JpsModule>> MODULES_WITH_TARGET_CONFIG_CHANGED_KEY = GlobalContextKey.create("_modules_with_target_config_changed_");
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(BuildTargetConfiguration.class);
|
||||
private static final GlobalContextKey<Set<File>> ALL_DELETED_ROOTS_KEY = GlobalContextKey.create("_all_deleted_output_roots_");
|
||||
|
||||
private final BuildTarget<?> myTarget;
|
||||
private final BuildTargetsState myTargetsState;
|
||||
private String myConfiguration;
|
||||
private volatile String myCurrentState;
|
||||
private static final GlobalContextKey<Set<File>> ALL_DELETED_ROOTS_KEY = GlobalContextKey.create("_all_deleted_output_roots_");
|
||||
|
||||
public BuildTargetConfiguration(BuildTarget<?> target, BuildTargetsState targetsState) {
|
||||
myTarget = target;
|
||||
@@ -140,7 +142,7 @@ public class BuildTargetConfiguration {
|
||||
}
|
||||
File file = getNonexistentOutputsFile();
|
||||
if (nonexistentOutputRoots.isEmpty()) {
|
||||
file.delete();
|
||||
FileUtil.delete(file);
|
||||
}
|
||||
else {
|
||||
FileUtil.writeToFile(file, StringUtil.join(nonexistentOutputRoots, "\n"));
|
||||
@@ -186,4 +188,4 @@ public class BuildTargetConfiguration {
|
||||
}
|
||||
return !storedNonExistentOutputs.containsAll(nonexistentOutputRoots);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user