mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
out-of-process build option renamed. Added switch between server and serverless implementations
This commit is contained in:
@@ -17,7 +17,6 @@ package com.intellij.compiler;
|
||||
|
||||
import com.intellij.ProjectTopics;
|
||||
import com.intellij.application.options.PathMacrosImpl;
|
||||
import com.intellij.compiler.impl.CompileDriver;
|
||||
import com.intellij.compiler.server.impl.CompileServerClasspathManager;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
@@ -164,7 +163,7 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
}
|
||||
|
||||
private boolean shouldTriggerMake(List<? extends VFileEvent> events) {
|
||||
if (!CompileDriver.runOutOfProcessMakeAsServer()) {
|
||||
if (CompilerWorkspaceConfiguration.useServerlessOutOfProcessBuild()) {
|
||||
return false;
|
||||
}
|
||||
for (VFileEvent event : events) {
|
||||
@@ -295,7 +294,7 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
continue;
|
||||
}
|
||||
final CompilerWorkspaceConfiguration config = CompilerWorkspaceConfiguration.getInstance(project);
|
||||
if (!config.useCompileServer() || !config.MAKE_PROJECT_ON_SAVE) {
|
||||
if (!config.useOutOfProcessBuild() || !config.MAKE_PROJECT_ON_SAVE) {
|
||||
continue;
|
||||
}
|
||||
final RequestFuture future = submitCompilationTask(project, false, true, Collections.<String>emptyList(), Collections.<String>emptyList(),
|
||||
@@ -584,7 +583,7 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
cmdLine.addParameter("-server");
|
||||
cmdLine.addParameter("-XX:MaxPermSize=150m");
|
||||
cmdLine.addParameter("-XX:ReservedCodeCacheSize=64m");
|
||||
cmdLine.addParameter("-Xmx" + Registry.intValue("compiler.server.heap.size") + "m");
|
||||
cmdLine.addParameter("-Xmx" + Registry.intValue("compiler.process.heap.size") + "m");
|
||||
cmdLine.addParameter("-Djava.awt.headless=true");
|
||||
|
||||
final String shouldGenerateIndex = System.getProperty(GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION);
|
||||
@@ -601,7 +600,7 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
cmdLine.addParameter("-D" + GlobalOptions.MAX_SIMULTANEOUS_BUILDS_OPTION + "=" + maxBuilds);
|
||||
}
|
||||
|
||||
final String additionalOptions = Registry.stringValue("compiler.server.vm.options");
|
||||
final String additionalOptions = Registry.stringValue("compiler.process.vm.options");
|
||||
if (!StringUtil.isEmpty(additionalOptions)) {
|
||||
final StringTokenizer tokenizer = new StringTokenizer(additionalOptions, " ", false);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
@@ -610,16 +609,16 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
}
|
||||
|
||||
// debugging
|
||||
final int debugPort = Registry.intValue("compiler.server.debug.port");
|
||||
final int debugPort = Registry.intValue("compiler.process.debug.port");
|
||||
if (debugPort > 0) {
|
||||
cmdLine.addParameter("-XX:+HeapDumpOnOutOfMemoryError");
|
||||
cmdLine.addParameter("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=" + debugPort);
|
||||
}
|
||||
|
||||
if (Registry.is("compiler.server.use.memory.temp.cache")) {
|
||||
if (Registry.is("compiler.process.use.memory.temp.cache")) {
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.USE_MEMORY_TEMP_CACHE_OPTION);
|
||||
}
|
||||
if (Registry.is("compiler.server.use.external.javac.process")) {
|
||||
if (Registry.is("compiler.process.use.external.javac")) {
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.USE_EXTERNAL_JAVAC_OPTION);
|
||||
}
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.HOSTNAME_OPTION + "=" + NetUtils.getLocalHostString());
|
||||
|
||||
@@ -108,12 +108,6 @@ public class CompileDriver {
|
||||
// to be used in tests only for debug output
|
||||
public static volatile boolean ourDebugMode = false;
|
||||
|
||||
// todo: temp option
|
||||
private static final boolean OUT_OF_PROCESS_MAKE_AS_SERVER = true; // out-of-process make implementation switch (server / per-project build process)
|
||||
public static boolean runOutOfProcessMakeAsServer() {
|
||||
return OUT_OF_PROCESS_MAKE_AS_SERVER;
|
||||
}
|
||||
|
||||
private final Project myProject;
|
||||
private final Map<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> myGenerationCompilerModuleToOutputDirMap; // [IntermediateOutputCompiler, Module] -> [ProductionSources, TestSources]
|
||||
private final String myCachesDirectoryPath;
|
||||
@@ -161,7 +155,7 @@ public class CompileDriver {
|
||||
|
||||
myGenerationCompilerModuleToOutputDirMap = new HashMap<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>>();
|
||||
|
||||
if (!useCompileServer()) {
|
||||
if (!useOutOfProcessBuild()) {
|
||||
final LocalFileSystem lfs = LocalFileSystem.getInstance();
|
||||
final IntermediateOutputCompiler[] generatingCompilers = CompilerManager.getInstance(myProject).getCompilers(IntermediateOutputCompiler.class, myCompilerFilter);
|
||||
final Module[] allModules = ModuleManager.getInstance(myProject).getModules();
|
||||
@@ -193,12 +187,12 @@ public class CompileDriver {
|
||||
public void rebuild(CompileStatusNotification callback) {
|
||||
CompileScope projectScope = ArtifactCompileScope.createScopeWithArtifacts(new ProjectCompileScope(myProject),
|
||||
ArtifactUtil.getArtifactWithOutputPaths(myProject), false);
|
||||
final CompileScope compileScope = useCompileServer() ? projectScope : addAdditionalRoots(projectScope, ALL_EXCEPT_SOURCE_PROCESSING);
|
||||
final CompileScope compileScope = useOutOfProcessBuild() ? projectScope : addAdditionalRoots(projectScope, ALL_EXCEPT_SOURCE_PROCESSING);
|
||||
doRebuild(callback, null, true, compileScope);
|
||||
}
|
||||
|
||||
public void make(CompileScope scope, CompileStatusNotification callback) {
|
||||
if (!useCompileServer()) {
|
||||
if (!useOutOfProcessBuild()) {
|
||||
scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);
|
||||
}
|
||||
if (validateCompilerConfiguration(scope, false)) {
|
||||
@@ -454,7 +448,7 @@ public class CompileDriver {
|
||||
|
||||
final MessageBus messageBus = myProject.getMessageBus();
|
||||
|
||||
if (OUT_OF_PROCESS_MAKE_AS_SERVER) {
|
||||
if (!CompilerWorkspaceConfiguration.useServerlessOutOfProcessBuild()) {
|
||||
final CompileServerManager csManager = CompileServerManager.getInstance();
|
||||
csManager.cancelAutoMakeTasks(myProject);
|
||||
return csManager.submitCompilationTask(myProject, compileContext.isRebuild(), compileContext.isMake(), moduleNames, artifactNames, paths,
|
||||
@@ -649,7 +643,7 @@ public class CompileDriver {
|
||||
final boolean checkCachesVersion) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
final boolean useServer = useCompileServer();
|
||||
final boolean useServer = useOutOfProcessBuild();
|
||||
|
||||
final String contentName =
|
||||
forceCompile ? CompilerBundle.message("compiler.content.name.compile") : CompilerBundle.message("compiler.content.name.make");
|
||||
@@ -694,7 +688,7 @@ public class CompileDriver {
|
||||
if (myProject.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
LOG.info("COMPILATION STARTED " + (OUT_OF_PROCESS_MAKE_AS_SERVER? "(COMPILE SERVER)" : "(BUILD PROCESS)"));
|
||||
LOG.info("COMPILATION STARTED " + (CompilerWorkspaceConfiguration.useServerlessOutOfProcessBuild() ? "(BUILD PROCESS)" : "(COMPILE SERVER)"));
|
||||
if (message != null) {
|
||||
compileContext.addMessage(message);
|
||||
}
|
||||
@@ -720,7 +714,7 @@ public class CompileDriver {
|
||||
finally {
|
||||
final long finish = System.currentTimeMillis();
|
||||
CompilerUtil.logDuration(
|
||||
"\tCOMPILATION FINISHED " + (OUT_OF_PROCESS_MAKE_AS_SERVER? "(COMPILE SERVER)" : "(BUILD PROCESS)") + "; Errors: " +
|
||||
"\tCOMPILATION FINISHED " + (CompilerWorkspaceConfiguration.useServerlessOutOfProcessBuild() ? "(BUILD PROCESS)" : "(COMPILE SERVER)") + "; Errors: " +
|
||||
compileContext.getMessageCount(CompilerMessageCategory.ERROR) +
|
||||
"; warnings: " +
|
||||
compileContext.getMessageCount(CompilerMessageCategory.WARNING),
|
||||
@@ -2310,7 +2304,7 @@ public class CompileDriver {
|
||||
}
|
||||
|
||||
private boolean validateCompilerConfiguration(final CompileScope scope, boolean checkOutputAndSourceIntersection) {
|
||||
if (useCompileServer()) {
|
||||
if (useOutOfProcessBuild()) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
@@ -2504,8 +2498,8 @@ public class CompileDriver {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean useCompileServer() {
|
||||
return CompilerWorkspaceConfiguration.getInstance(myProject).useCompileServer();
|
||||
private boolean useOutOfProcessBuild() {
|
||||
return CompilerWorkspaceConfiguration.getInstance(myProject).useOutOfProcessBuild();
|
||||
}
|
||||
|
||||
private void showCyclicModulesHaveDifferentLanguageLevel(Module[] modulesInChunk) {
|
||||
|
||||
+1
-1
@@ -1300,7 +1300,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
|
||||
final ProjectRef projRef = new ProjectRef(project);
|
||||
final int projectId = getProjectId(project);
|
||||
|
||||
if (CompilerWorkspaceConfiguration.getInstance(project).useCompileServer()) {
|
||||
if (CompilerWorkspaceConfiguration.getInstance(project).useOutOfProcessBuild()) {
|
||||
suspendProject(project);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
|
||||
|
||||
public CompilerUIConfigurable(final Project project) {
|
||||
myProject = project;
|
||||
final boolean isServerOptionEnabled = Registry.is("compiler.server.enabled") || ApplicationManager.getApplication().isInternal();
|
||||
final boolean isServerOptionEnabled = Registry.is("compiler.out-of-process.build.enabled") || ApplicationManager.getApplication().isInternal();
|
||||
myCbUseCompileServer.setVisible(isServerOptionEnabled);
|
||||
myCbMakeProjectOnSave.setVisible(isServerOptionEnabled);
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.compiler.server;
|
||||
import com.intellij.ProjectTopics;
|
||||
import com.intellij.application.options.PathMacrosImpl;
|
||||
import com.intellij.compiler.CompilerWorkspaceConfiguration;
|
||||
import com.intellij.compiler.impl.CompileDriver;
|
||||
import com.intellij.compiler.server.impl.CompileServerClasspathManager;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
@@ -175,7 +174,7 @@ public class BuildManager implements ApplicationComponent{
|
||||
}
|
||||
|
||||
private boolean shouldTriggerMake(List<? extends VFileEvent> events) {
|
||||
if (CompileDriver.runOutOfProcessMakeAsServer()) {
|
||||
if (!CompilerWorkspaceConfiguration.useServerlessOutOfProcessBuild()) {
|
||||
return false;
|
||||
}
|
||||
for (VFileEvent event : events) {
|
||||
@@ -274,7 +273,7 @@ public class BuildManager implements ApplicationComponent{
|
||||
continue;
|
||||
}
|
||||
final CompilerWorkspaceConfiguration config = CompilerWorkspaceConfiguration.getInstance(project);
|
||||
if (!config.useCompileServer() || !config.MAKE_PROJECT_ON_SAVE) {
|
||||
if (!config.useOutOfProcessBuild() || !config.MAKE_PROJECT_ON_SAVE) {
|
||||
continue;
|
||||
}
|
||||
final List<String> emptyList = Collections.emptyList();
|
||||
@@ -580,7 +579,7 @@ public class BuildManager implements ApplicationComponent{
|
||||
cmdLine.addParameter("-server");
|
||||
cmdLine.addParameter("-XX:MaxPermSize=150m");
|
||||
cmdLine.addParameter("-XX:ReservedCodeCacheSize=64m");
|
||||
cmdLine.addParameter("-Xmx" + Registry.intValue("compiler.server.heap.size") + "m");
|
||||
cmdLine.addParameter("-Xmx" + Registry.intValue("compiler.process.heap.size") + "m");
|
||||
cmdLine.addParameter("-Djava.awt.headless=true");
|
||||
|
||||
final String shouldGenerateIndex = System.getProperty(GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION);
|
||||
@@ -588,7 +587,7 @@ public class BuildManager implements ApplicationComponent{
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION +"=" + shouldGenerateIndex);
|
||||
}
|
||||
|
||||
final String additionalOptions = Registry.stringValue("compiler.server.vm.options");
|
||||
final String additionalOptions = Registry.stringValue("compiler.process.vm.options");
|
||||
if (!StringUtil.isEmpty(additionalOptions)) {
|
||||
final StringTokenizer tokenizer = new StringTokenizer(additionalOptions, " ", false);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
@@ -597,16 +596,16 @@ public class BuildManager implements ApplicationComponent{
|
||||
}
|
||||
|
||||
// debugging
|
||||
final int debugPort = Registry.intValue("compiler.server.debug.port");
|
||||
final int debugPort = Registry.intValue("compiler.process.debug.port");
|
||||
if (debugPort > 0) {
|
||||
cmdLine.addParameter("-XX:+HeapDumpOnOutOfMemoryError");
|
||||
cmdLine.addParameter("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=" + debugPort);
|
||||
}
|
||||
|
||||
if (Registry.is("compiler.server.use.memory.temp.cache")) {
|
||||
if (Registry.is("compiler.process.use.memory.temp.cache")) {
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.USE_MEMORY_TEMP_CACHE_OPTION);
|
||||
}
|
||||
if (Registry.is("compiler.server.use.external.javac.process")) {
|
||||
if (Registry.is("compiler.process.use.external.javac")) {
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.USE_EXTERNAL_JAVAC_OPTION);
|
||||
}
|
||||
final String host = NetUtils.getLocalHostString();
|
||||
|
||||
@@ -56,7 +56,11 @@ public class CompilerWorkspaceConfiguration implements PersistentStateComponent<
|
||||
XmlSerializerUtil.copyBean(state, this);
|
||||
}
|
||||
|
||||
public boolean useCompileServer() {
|
||||
return USE_COMPILE_SERVER && (Registry.is("compiler.server.enabled") || ApplicationManager.getApplication().isInternal());
|
||||
public boolean useOutOfProcessBuild() {
|
||||
return USE_COMPILE_SERVER && (Registry.is("compiler.out-of-process.build.enabled") || ApplicationManager.getApplication().isInternal());
|
||||
}
|
||||
|
||||
public static boolean useServerlessOutOfProcessBuild() {
|
||||
return !Registry.is("compiler.out-of-process.as-server");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,15 +146,15 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent{
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean isServerMode = CompilerWorkspaceConfiguration.getInstance(myProject).useCompileServer();
|
||||
final boolean shouldPerformScan = !isServerMode || generatedPaths == null;
|
||||
final boolean isOutOfProcessMode = CompilerWorkspaceConfiguration.getInstance(myProject).useOutOfProcessBuild();
|
||||
final boolean shouldPerformScan = !isOutOfProcessMode || generatedPaths == null;
|
||||
|
||||
final HotSwapProgressImpl findClassesProgress = shouldPerformScan ? new HotSwapProgressImpl(myProject) : null;
|
||||
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
public void run() {
|
||||
final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses = shouldPerformScan?
|
||||
scanForModifiedClassesWithProgress(sessions, findClassesProgress, !isServerMode) :
|
||||
scanForModifiedClassesWithProgress(sessions, findClassesProgress, !isOutOfProcessMode) :
|
||||
HotSwapManager.findModifiedClasses(sessions, generatedPaths);
|
||||
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
|
||||
@@ -130,29 +130,39 @@ compiler.perform.outputs.refresh.on.start.description=Whether to perform initial
|
||||
compiler.max.static.constants.searches=3000
|
||||
compiler.max.static.constants.searches.description=If the number of changed compile time constants exceeds this value, make will start full-project rebuild
|
||||
|
||||
compiler.server.enabled=false
|
||||
compiler.server.enabled.description=Enable out-of-process compilation
|
||||
# out-of-process build parameters
|
||||
|
||||
compiler.server.heap.size=300
|
||||
compiler.server.heap.size.description=Heap size value in MB for the compile server process
|
||||
compiler.out-of-process.build.enabled=false
|
||||
compiler.out-of-process.build.enabled.description=Enable out-of-process compilation
|
||||
|
||||
compiler.out-of-process.as-server=true
|
||||
compiler.out-of-process.as-server.description=Use implementation of out-of-process build as server process
|
||||
|
||||
compiler.process.heap.size=300
|
||||
compiler.process.heap.size.description=Heap size value in MB for the compile server process
|
||||
|
||||
compiler.process.vm.options=-ea
|
||||
compiler.process.vm.options.description=Additional options for compile server's VM
|
||||
|
||||
compiler.process.use.memory.temp.cache=true
|
||||
compiler.process.use.memory.temp.cache.description=Store temporary data in memory for faster compilation; requires larger server heap size
|
||||
|
||||
compiler.process.use.external.javac=true
|
||||
compiler.process.use.external.javac.description=Run javac compiler in a separate process (allows to run build process with smaller heap size)
|
||||
|
||||
compiler.process.debug.port=-1
|
||||
#compiler.server.javac.debug.port=-1
|
||||
|
||||
|
||||
# parameters specific to server implementation
|
||||
compiler.server.max.simultaneous.builds=1
|
||||
compiler.server.max.simultaneous.builds.description=The max number of simultaneous build sessions. Increasing this value may require larger server heap size
|
||||
|
||||
compiler.server.vm.options=-ea
|
||||
compiler.server.vm.options.description=Additional options for compile server's VM
|
||||
|
||||
compiler.server.use.memory.temp.cache=true
|
||||
compiler.server.use.memory.temp.cache.description=Store temporary data in memory for faster compilation; requires larger server heap size
|
||||
|
||||
compiler.server.use.external.javac.process=true
|
||||
compiler.server.use.external.javac.process.description=Run javac compiler in external process (allows to run compile server with smaller heap size)
|
||||
|
||||
compiler.server.ping.interval=5
|
||||
compiler.server.ping.interval.description=Interval in seconds between ping requests the IDE periodically sends to server. If server does not receive pings for some time, it shuts down. Specify -1 to disable this feature.
|
||||
|
||||
compiler.server.debug.port=-1
|
||||
#compiler.server.javac.debug.port=-1
|
||||
# end of out-of-process build parameters
|
||||
|
||||
|
||||
vcs.show.colored.annotations=true
|
||||
vcs.showConsole=true
|
||||
|
||||
Reference in New Issue
Block a user