mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -38,8 +38,7 @@ import org.jetbrains.jps.incremental.storage.BuildDataManager;
|
||||
import org.jetbrains.jps.incremental.storage.SourceToFormMapping;
|
||||
import org.jetbrains.jps.javac.*;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.*;
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.ServerSocket;
|
||||
@@ -60,8 +59,14 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
private static final String FORM_EXTENSION = ".form";
|
||||
public static final boolean USE_EMBEDDED_JAVAC = System.getProperty(GlobalOptions.USE_EXTERNAL_JAVAC_OPTION) == null;
|
||||
private static final Key<Integer> JAVA_COMPILER_VERSION_KEY = Key.create("_java_compiler_version_");
|
||||
private static final Set<String> FILTERED_OPTIONS = new HashSet<String>(Arrays.<String>asList(
|
||||
"-target"
|
||||
));
|
||||
private static final Set<String> FILTERED_SINGLE_OPTIONS = new HashSet<String>(Arrays.<String>asList(
|
||||
"-g", "-deprecation", "-nowarn", "-verbose"
|
||||
));
|
||||
|
||||
public static final FileFilter JAVA_SOURCES_FILTER = new FileFilter() {
|
||||
private static final FileFilter JAVA_SOURCES_FILTER = new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(JAVA_EXTENSION);
|
||||
}
|
||||
@@ -282,8 +287,12 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
final String chunkName = getChunkPresentableName(chunk);
|
||||
context.processMessage(new ProgressMessage("Compiling java [" + chunkName + "]"));
|
||||
|
||||
final boolean compiledOk =
|
||||
files.isEmpty() || compileJava(chunk, files, classpath, platformCp, sourcePath, outs, context, diagnosticSink, outputSink);
|
||||
final int filesCount = files.size();
|
||||
boolean compiledOk = true;
|
||||
if (filesCount > 0) {
|
||||
LOG.info("Compiling " + filesCount + " java files; module: " + chunkName);
|
||||
compiledOk = compileJava(chunk, files, classpath, platformCp, sourcePath, outs, context, diagnosticSink, outputSink);
|
||||
}
|
||||
|
||||
context.checkCanceled();
|
||||
|
||||
@@ -389,7 +398,6 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
CompileContext context,
|
||||
DiagnosticOutputConsumer diagnosticSink,
|
||||
final OutputFileConsumer outputSink) throws Exception {
|
||||
LOG.info("Compiling " + files.size() + " java files");
|
||||
final List<String> options = getCompilationOptions(context, chunk);
|
||||
final ClassProcessingConsumer classesConsumer = new ClassProcessingConsumer(context, outputSink);
|
||||
try {
|
||||
@@ -726,17 +734,23 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
|
||||
final String customArgs = javacOpts.get("ADDITIONAL_OPTIONS_STRING");
|
||||
if (customArgs != null) {
|
||||
final StringTokenizer tokenizer = new StringTokenizer(customArgs, " \t\r\n");
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
final String token = tokenizer.nextToken();
|
||||
if ("-g".equals(token) || "-deprecation".equals(token) || "-nowarn".equals(token) || "-verbose".equals(token)) {
|
||||
final StringTokenizer customOptsTokenizer = new StringTokenizer(customArgs, " \t\r\n");
|
||||
boolean skip = false;
|
||||
while (customOptsTokenizer.hasMoreTokens()) {
|
||||
final String userOption = customOptsTokenizer.nextToken();
|
||||
if (FILTERED_OPTIONS.contains(userOption)) {
|
||||
skip = true;
|
||||
continue;
|
||||
}
|
||||
if (token.startsWith("-J-")) {
|
||||
vmOptions.add(token.substring("-J".length()));
|
||||
}
|
||||
else {
|
||||
options.add(token);
|
||||
if (!skip) {
|
||||
if (!FILTERED_SINGLE_OPTIONS.contains(userOption)) {
|
||||
if (userOption.startsWith("-J-")) {
|
||||
vmOptions.add(userOption.substring("-J".length()));
|
||||
}
|
||||
else {
|
||||
options.add(userOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,12 @@ import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
|
||||
import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.api.CanceledStatus;
|
||||
import org.jetbrains.jps.api.SharedThreadPool;
|
||||
|
||||
import javax.tools.*;
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -32,11 +31,9 @@ public class JavacServer {
|
||||
private final ChannelGroup myAllOpenChannels = new DefaultChannelGroup("javac-server");
|
||||
private final ChannelFactory myChannelFactory;
|
||||
private final ChannelPipelineFactory myPipelineFactory;
|
||||
private ExecutorService myThreadPool;
|
||||
|
||||
public JavacServer() {
|
||||
myThreadPool = Executors.newCachedThreadPool();
|
||||
myChannelFactory = new NioServerSocketChannelFactory(myThreadPool, myThreadPool, 1);
|
||||
myChannelFactory = new NioServerSocketChannelFactory(SharedThreadPool.INSTANCE, SharedThreadPool.INSTANCE, 1);
|
||||
final ChannelRegistrar channelRegistrar = new ChannelRegistrar();
|
||||
final ChannelHandler compilationRequestsHandler = new CompilationRequestsHandler();
|
||||
myPipelineFactory = new ChannelPipelineFactory() {
|
||||
@@ -198,10 +195,11 @@ public class JavacServer {
|
||||
|
||||
final CancelHandler cancelHandler = new CancelHandler();
|
||||
myCancelHandlers.add(cancelHandler);
|
||||
myThreadPool.submit(new Runnable() {
|
||||
SharedThreadPool.INSTANCE.submit(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
final JavacRemoteProto.Message exitMsg = compile(ctx, sessionId, options, files, cp, platformCp, srcPath, outs, cancelHandler);
|
||||
final JavacRemoteProto.Message exitMsg =
|
||||
compile(ctx, sessionId, options, files, cp, platformCp, srcPath, outs, cancelHandler);
|
||||
Channels.write(ctx.getChannel(), exitMsg);
|
||||
}
|
||||
finally {
|
||||
@@ -218,10 +216,14 @@ public class JavacServer {
|
||||
cancelBuilds();
|
||||
new Thread("StopThread") {
|
||||
public void run() {
|
||||
JavacServer.this.stop();
|
||||
try {
|
||||
JavacServer.this.stop();
|
||||
}
|
||||
finally {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
//System.exit(0);
|
||||
}
|
||||
else {
|
||||
reply = JavacProtoUtil.toMessage(sessionId, JavacProtoUtil.createFailure("Unsupported request type: " + requestType.name(), null));
|
||||
|
||||
@@ -93,7 +93,7 @@ public class JavacServerBootstrap {
|
||||
processHandler.addProcessListener(new ProcessAdapter() {
|
||||
public void onTextAvailable(ProcessEvent event, Key outputType) {
|
||||
final String text = event.getText();
|
||||
if (!StringUtil.isEmpty(text)) {
|
||||
if (!StringUtil.isEmptyOrSpaces(text)) {
|
||||
if (outputType == ProcessOutputTypes.STDOUT) {
|
||||
System.out.print("JAVAC_SERVER: " + text);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class OptimizedFileManager extends DefaultFileManager {
|
||||
private boolean isFile(File root) {
|
||||
Boolean cachedIsFile = myIsFile.get(root);
|
||||
if (cachedIsFile == null) {
|
||||
cachedIsFile = root.isFile();
|
||||
cachedIsFile = Boolean.valueOf(root.isFile());
|
||||
myIsFile.put(root, cachedIsFile);
|
||||
}
|
||||
return cachedIsFile.booleanValue();
|
||||
|
||||
@@ -164,7 +164,7 @@ class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
|
||||
private boolean isFile(File root) {
|
||||
Boolean cachedIsFile = myIsFile.get(root);
|
||||
if (cachedIsFile == null) {
|
||||
cachedIsFile = root.isFile();
|
||||
cachedIsFile = Boolean.valueOf(root.isFile());
|
||||
myIsFile.put(root, cachedIsFile);
|
||||
}
|
||||
return cachedIsFile.booleanValue();
|
||||
|
||||
Binary file not shown.
@@ -846,7 +846,7 @@ public class Mappings {
|
||||
}
|
||||
|
||||
private class Differential {
|
||||
final int DESPERATE_MASK = Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
|
||||
static final int DESPERATE_MASK = Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
|
||||
|
||||
final Mappings myDelta;
|
||||
final Collection<String> myRemoved;
|
||||
|
||||
@@ -139,13 +139,13 @@ compiler.out-of-process.build.enabled.description=Enable out-of-process compilat
|
||||
compiler.out-of-process.as-server=false
|
||||
compiler.out-of-process.as-server.description=Use implementation of out-of-process build as server process
|
||||
|
||||
compiler.process.heap.size=600
|
||||
compiler.process.heap.size=700
|
||||
compiler.process.heap.size.description=Heap size value in MB for the build process
|
||||
|
||||
compiler.process.32bit.vm.on.mac=true
|
||||
compiler.process.32bit.vm.on.mac.description=Force -d32 VM option on Mac (recommended for faster startup and lower memory footprint)
|
||||
|
||||
compiler.process.vm.options=-ea
|
||||
compiler.process.vm.options=
|
||||
compiler.process.vm.options.description=Additional options for compile server's VM
|
||||
|
||||
compiler.process.use.memory.temp.cache=true
|
||||
|
||||
Reference in New Issue
Block a user