mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
jps modules re-layout
This commit is contained in:
Generated
-11
@@ -1,11 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="JPS-facade">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/jps-facade.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/rt/jps-incremental/src/jps-sources.zip!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
Generated
+4
@@ -12,6 +12,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/android/android.iml" filepath="$PROJECT_DIR$/plugins/android/android.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/annotations/annotations.iml" filepath="$PROJECT_DIR$/platform/annotations/annotations.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/ant/ant.iml" filepath="$PROJECT_DIR$/plugins/ant/ant.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps/antLayout/antlayout.iml" filepath="$PROJECT_DIR$/jps/antLayout/antlayout.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/boot/boot.iml" filepath="$PROJECT_DIR$/platform/boot/boot.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/bootstrap/bootstrap.iml" filepath="$PROJECT_DIR$/platform/bootstrap/bootstrap.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/build/build.iml" filepath="$PROJECT_DIR$/build/build.iml" />
|
||||
@@ -56,6 +57,9 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/VCS/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" group="plugins/Groovy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/jira-connector/jira-connector.iml" filepath="$PROJECT_DIR$/plugins/tasks/jira-connector/jira-connector.iml" group="plugins/tasks" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps/jps.iml" filepath="$PROJECT_DIR$/jps/jps.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" filepath="$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps/model/jps-model.iml" filepath="$PROJECT_DIR$/jps/model/jps-model.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" filepath="$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" group="java" />
|
||||
|
||||
@@ -149,10 +149,6 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
|
||||
module("notNull")
|
||||
}
|
||||
|
||||
jar("compile-server.jar") {
|
||||
module("compile-server")
|
||||
}
|
||||
|
||||
fileset(dir: "$home/lib", includesfile: "${home}/lib/required_for_dist.txt")
|
||||
|
||||
fileset(dir: "$home/lib/src") {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="protobuf" level="project" />
|
||||
<orderEntry type="library" name="Netty" level="project" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
<orderEntry type="module" module-name="annotations" />
|
||||
<orderEntry type="module" module-name="serverFacade" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.jpsservice;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 9/12/11
|
||||
*/
|
||||
public class Bootstrap {
|
||||
|
||||
public static final String JPS_RUNTIME_PATH = "rt/jps-incremental";
|
||||
|
||||
public static List<File> getApplicationClasspath() {
|
||||
final List<File> cp = new ArrayList<File>();
|
||||
cp.add(getResourcePath(Server.class));
|
||||
cp.add(getResourcePath(com.google.protobuf.Message.class)); // protobuf
|
||||
cp.add(getResourcePath(org.jboss.netty.bootstrap.Bootstrap.class)); // netty
|
||||
cp.addAll(org.jetbrains.jps.server.Bootstrap.getApplicationClasspath()); // jps incremental builders and dependencies
|
||||
|
||||
//final File jpsRuntime = new File(jpsFacadeJar.getParentFile(), JPS_RUNTIME_PATH);
|
||||
//final File[] files = jpsRuntime.listFiles();
|
||||
//if (files != null) {
|
||||
// for (File file : files) {
|
||||
// final String name = file.getName();
|
||||
// final boolean shouldAdd =
|
||||
// name.endsWith("jar") &&
|
||||
// (name.startsWith("ant") ||
|
||||
// name.startsWith("jps") ||
|
||||
// name.startsWith("asm") ||
|
||||
// name.startsWith("gant")||
|
||||
// name.startsWith("groovy") ||
|
||||
// name.startsWith("javac2") ||
|
||||
// name.startsWith("util") ||
|
||||
// name.startsWith("trove")
|
||||
// );
|
||||
// if (shouldAdd) {
|
||||
// cp.add(file);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
return cp;
|
||||
}
|
||||
|
||||
private static File getResourcePath(Class aClass) {
|
||||
return new File(PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
<orderEntry type="module" module-name="jsp-openapi" />
|
||||
<orderEntry type="module" module-name="java-impl" />
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="module" module-name="compile-server" />
|
||||
<orderEntry type="module" module-name="jps-builders" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.intellij.ProjectTopics;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
@@ -36,6 +38,7 @@ import com.intellij.openapi.roots.ModuleRootListener;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.ShutDownTracker;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -45,10 +48,10 @@ import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.net.NetUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.server.GlobalLibrary;
|
||||
import org.jetbrains.jps.server.SdkLibrary;
|
||||
import org.jetbrains.jpsservice.Bootstrap;
|
||||
import org.jetbrains.jpsservice.Client;
|
||||
import org.jetbrains.jps.api.GlobalLibrary;
|
||||
import org.jetbrains.jps.api.SdkLibrary;
|
||||
import org.jetbrains.jps.client.Client;
|
||||
import org.jetbrains.jps.server.ClasspathBootstrap;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
@@ -102,46 +105,77 @@ public class JpsServerManager implements ApplicationComponent{
|
||||
return "com.intellij.compiler.JpsServerManager";
|
||||
}
|
||||
|
||||
private volatile boolean myStartupFailed = false;
|
||||
|
||||
private boolean ensureServerStarted() {
|
||||
if (myProcessHandler != null) {
|
||||
return true;
|
||||
}
|
||||
if (!myStartupFailed) {
|
||||
try {
|
||||
final int port = NetUtils.findAvailableSocketPort();
|
||||
final Process process = launchServer(port);
|
||||
final OSProcessHandler processHandler = new OSProcessHandler(process, null);
|
||||
processHandler.startNotify();
|
||||
myServerClient = new Client();
|
||||
|
||||
if (myServerClient.connect(NetUtils.getLocalHostString(), port)) {
|
||||
|
||||
final PathMacros pathVars = PathMacros.getInstance();
|
||||
final Map<String, String> data = new HashMap<String, String>();
|
||||
for (String name : pathVars.getAllMacroNames()) {
|
||||
final String path = pathVars.getValue(name);
|
||||
if (path != null) {
|
||||
data.put(name, FileUtil.toSystemIndependentName(path));
|
||||
}
|
||||
try {
|
||||
final int port = NetUtils.findAvailableSocketPort();
|
||||
final Process process = launchServer(port);
|
||||
final OSProcessHandler processHandler = new OSProcessHandler(process, null);
|
||||
processHandler.addProcessListener(new ProcessAdapter() {
|
||||
public void startNotified(ProcessEvent event) {
|
||||
final boolean connected = createClient(port);
|
||||
if (!connected) {
|
||||
shutdownServer(myServerClient, processHandler);
|
||||
}
|
||||
else {
|
||||
myProcessHandler = processHandler;
|
||||
}
|
||||
|
||||
final List<GlobalLibrary> globals = new ArrayList<GlobalLibrary>();
|
||||
|
||||
fillSdks(globals);
|
||||
fillGlobalLibraries(globals);
|
||||
|
||||
myServerClient.sendSetupRequest(data, globals);
|
||||
}
|
||||
|
||||
myProcessHandler = processHandler;
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
myProcessHandler = null;
|
||||
myServerClient = null;
|
||||
}
|
||||
|
||||
public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
|
||||
final Client client = myServerClient;
|
||||
if (client != null) {
|
||||
client.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public void onTextAvailable(ProcessEvent event, Key outputType) {
|
||||
System.out.println(event.getText());
|
||||
LOG.info(event.getText());
|
||||
}
|
||||
});
|
||||
processHandler.startNotify();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e); // todo
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean createClient(int port) {
|
||||
final Client client = new Client();
|
||||
try {
|
||||
if (client.connect(NetUtils.getLocalHostString(), port)) {
|
||||
final PathMacros pathVars = PathMacros.getInstance();
|
||||
final Map<String, String> data = new HashMap<String, String>();
|
||||
for (String name : pathVars.getAllMacroNames()) {
|
||||
final String path = pathVars.getValue(name);
|
||||
if (path != null) {
|
||||
data.put(name, FileUtil.toSystemIndependentName(path));
|
||||
}
|
||||
}
|
||||
|
||||
final List<GlobalLibrary> globals = new ArrayList<GlobalLibrary>();
|
||||
|
||||
fillSdks(globals);
|
||||
fillGlobalLibraries(globals);
|
||||
|
||||
client.sendSetupRequest(data, globals);
|
||||
myServerClient = client;
|
||||
return true;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
myStartupFailed = true;
|
||||
LOG.error(e); // todo
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -185,14 +219,14 @@ public class JpsServerManager implements ApplicationComponent{
|
||||
final Sdk projectJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
|
||||
final GeneralCommandLine cmdLine = new GeneralCommandLine();
|
||||
cmdLine.setExePath(((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk));
|
||||
//cmdLine.addParameter("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5007");
|
||||
cmdLine.addParameter("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5008");
|
||||
cmdLine.addParameter("-Xmx256m");
|
||||
cmdLine.addParameter("-classpath");
|
||||
|
||||
final List<File> cp = Bootstrap.getApplicationClasspath();
|
||||
final List<File> cp = ClasspathBootstrap.getApplicationClasspath();
|
||||
cmdLine.addParameter(classpathToString(cp));
|
||||
|
||||
cmdLine.addParameter("org.jetbrains.jpsservice.Server");
|
||||
cmdLine.addParameter("org.jetbrains.jps.server.Server");
|
||||
cmdLine.addParameter(Integer.toString(port));
|
||||
|
||||
final File workDirectory = new File(PathManager.getSystemPath(), COMPILE_SERVER_SYSTEM_ROOT);
|
||||
|
||||
@@ -86,9 +86,9 @@ import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jpsservice.Client;
|
||||
import org.jetbrains.jpsservice.JpsRemoteProto;
|
||||
import org.jetbrains.jpsservice.JpsServerResponseHandlerAdapter;
|
||||
import org.jetbrains.jps.api.JpsRemoteProto;
|
||||
import org.jetbrains.jps.api.JpsServerResponseHandlerAdapter;
|
||||
import org.jetbrains.jps.client.Client;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
<orderEntry type="library" name="NanoXML" level="project" />
|
||||
<orderEntry type="library" name="jgoodies-forms" level="project" />
|
||||
<orderEntry type="library" name="Netty" level="project" />
|
||||
<orderEntry type="library" exported="" name="protobuf" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package org.jetbrains.jpsservice;
|
||||
|
||||
option java_package = "org.jetbrains.jpsservice";
|
||||
option java_package = "org.jetbrains.jps.api";
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
message Message {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.jetbrains.jps.server;
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.jetbrains.jps.server;
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.jetbrains.jps.server;
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+534
-534
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.jetbrains.jpsservice;
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.jetbrains.jpsservice;
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
+1
-4
@@ -1,11 +1,8 @@
|
||||
package org.jetbrains.jpsservice.impl;
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
import org.jetbrains.jps.incremental.messages.CompilerMessage;
|
||||
import org.jetbrains.jps.server.GlobalLibrary;
|
||||
import org.jetbrains.jps.server.SdkLibrary;
|
||||
import org.jetbrains.jpsservice.JpsRemoteProto;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.jpsservice;
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package org.jetbrains.jps.server;
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 10/4/11
|
||||
*/
|
||||
public class SdkLibrary extends GlobalLibrary{
|
||||
public class SdkLibrary extends GlobalLibrary {
|
||||
|
||||
private final String myHomePath;
|
||||
|
||||
+4
-6
@@ -1,4 +1,4 @@
|
||||
package org.jetbrains.jpsservice;
|
||||
package org.jetbrains.jps.client;
|
||||
|
||||
import org.jboss.netty.bootstrap.ClientBootstrap;
|
||||
import org.jboss.netty.channel.*;
|
||||
@@ -9,9 +9,7 @@ import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
|
||||
import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.server.GlobalLibrary;
|
||||
import org.jetbrains.jpsservice.impl.JpsClientMessageHandler;
|
||||
import org.jetbrains.jpsservice.impl.ProtoUtil;
|
||||
import org.jetbrains.jps.api.*;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
@@ -44,11 +42,11 @@ public class Client {
|
||||
new ProtobufDecoder(JpsRemoteProto.Message.getDefaultInstance()),
|
||||
new ProtobufVarint32LengthFieldPrepender(),
|
||||
new ProtobufEncoder(),
|
||||
new JpsClientMessageHandler() {
|
||||
new ClientMessageHandler() {
|
||||
|
||||
protected JpsServerResponseHandler getHandler(UUID sessionId) {
|
||||
final RequestFuture future = myHandlers.get(sessionId);
|
||||
return future != null? future.getHandler() : null;
|
||||
return future != null ? future.getHandler() : null;
|
||||
}
|
||||
|
||||
protected void terminateSession(UUID sessionId) {
|
||||
+5
-4
@@ -1,12 +1,13 @@
|
||||
package org.jetbrains.jpsservice.impl;
|
||||
package org.jetbrains.jps.client;
|
||||
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelHandler;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jpsservice.JpsRemoteProto;
|
||||
import org.jetbrains.jpsservice.JpsServerResponseHandler;
|
||||
import org.jetbrains.jps.api.JpsRemoteProto;
|
||||
import org.jetbrains.jps.api.JpsServerResponseHandler;
|
||||
import org.jetbrains.jps.api.ProtoUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -14,7 +15,7 @@ import java.util.UUID;
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 8/11/11
|
||||
*/
|
||||
public abstract class JpsClientMessageHandler extends SimpleChannelHandler{
|
||||
abstract class ClientMessageHandler extends SimpleChannelHandler{
|
||||
|
||||
public final void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
|
||||
final JpsRemoteProto.Message message = (JpsRemoteProto.Message)e.getMessage();
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package org.jetbrains.jps.incremental.java;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.*;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
+28
-4
@@ -32,17 +32,20 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Bootstrap class for dependency handling
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 9/12/11
|
||||
*/
|
||||
public class Bootstrap {
|
||||
private Bootstrap() {
|
||||
public class ClasspathBootstrap {
|
||||
private ClasspathBootstrap() {
|
||||
}
|
||||
|
||||
public static final String JPS_RUNTIME_PATH = "rt/jps-incremental";
|
||||
|
||||
public static List<File> getApplicationClasspath() {
|
||||
final List<File> cp = new ArrayList<File>();
|
||||
cp.add(getResourcePath(Facade.class)); // server facade module
|
||||
cp.add(getResourcePath(Server.class));
|
||||
cp.add(getResourcePath(com.google.protobuf.Message.class)); // protobuf
|
||||
cp.add(getResourcePath(org.jboss.netty.bootstrap.Bootstrap.class)); // netty
|
||||
cp.add(getResourcePath(TIntHash.class)); // trove
|
||||
cp.add(getResourcePath(FileUtil.class)); // util module
|
||||
cp.add(getResourcePath(ClassWriter.class)); // asm
|
||||
@@ -56,6 +59,27 @@ public class Bootstrap {
|
||||
cp.add(getResourcePath(NotNullVerifyingInstrumenter.class)); // not-null
|
||||
cp.add(getResourcePath(IXMLBuilder.class)); // nano-xml
|
||||
|
||||
//final File jpsRuntime = new File(jpsFacadeJar.getParentFile(), JPS_RUNTIME_PATH);
|
||||
//final File[] files = jpsRuntime.listFiles();
|
||||
//if (files != null) {
|
||||
// for (File file : files) {
|
||||
// final String name = file.getName();
|
||||
// final boolean shouldAdd =
|
||||
// name.endsWith("jar") &&
|
||||
// (name.startsWith("ant") ||
|
||||
// name.startsWith("jps") ||
|
||||
// name.startsWith("asm") ||
|
||||
// name.startsWith("gant")||
|
||||
// name.startsWith("groovy") ||
|
||||
// name.startsWith("javac2") ||
|
||||
// name.startsWith("util") ||
|
||||
// name.startsWith("trove")
|
||||
// );
|
||||
// if (shouldAdd) {
|
||||
// cp.add(file);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
return cp;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package org.jetbrains.jpsservice;
|
||||
package org.jetbrains.jps.server;
|
||||
|
||||
import org.jboss.netty.bootstrap.ServerBootstrap;
|
||||
import org.jboss.netty.channel.*;
|
||||
@@ -10,7 +10,7 @@ import org.jboss.netty.handler.codec.protobuf.ProtobufDecoder;
|
||||
import org.jboss.netty.handler.codec.protobuf.ProtobufEncoder;
|
||||
import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
|
||||
import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
|
||||
import org.jetbrains.jpsservice.impl.JpsServerMessageHandler;
|
||||
import org.jetbrains.jps.api.JpsRemoteProto;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -34,7 +34,7 @@ public class Server {
|
||||
myBuildsExecutor = Executors.newFixedThreadPool(MAX_SIMULTANEOUS_BUILD_SESSIONS);
|
||||
myChannelFactory = new NioServerSocketChannelFactory(threadPool, threadPool, 1);
|
||||
final ChannelRegistrar channelRegistrar = new ChannelRegistrar();
|
||||
final JpsServerMessageHandler messageHandler = new JpsServerMessageHandler(myBuildsExecutor, this);
|
||||
final ServerMessageHandler messageHandler = new ServerMessageHandler(myBuildsExecutor, this);
|
||||
myPipelineFactory = new ChannelPipelineFactory() {
|
||||
public ChannelPipeline getPipeline() throws Exception {
|
||||
return Channels.pipeline(
|
||||
+6
-8
@@ -1,13 +1,11 @@
|
||||
package org.jetbrains.jpsservice.impl;
|
||||
package org.jetbrains.jps.server;
|
||||
|
||||
import org.jboss.netty.channel.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.api.*;
|
||||
import org.jetbrains.jps.incremental.MessageHandler;
|
||||
import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
import org.jetbrains.jps.incremental.messages.CompilerMessage;
|
||||
import org.jetbrains.jps.server.*;
|
||||
import org.jetbrains.jpsservice.JpsRemoteProto;
|
||||
import org.jetbrains.jpsservice.Server;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
@@ -19,12 +17,12 @@ import java.util.concurrent.ExecutorService;
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 8/11/11
|
||||
*/
|
||||
public class JpsServerMessageHandler extends SimpleChannelHandler {
|
||||
class ServerMessageHandler extends SimpleChannelHandler {
|
||||
private final ConcurrentHashMap<String, CompilationTask> myBuildsInProgress = new ConcurrentHashMap<String, CompilationTask>();
|
||||
private final ExecutorService myBuildsExecutor;
|
||||
private final Server myServer;
|
||||
|
||||
public JpsServerMessageHandler(ExecutorService buildsExecutor, Server server) {
|
||||
public ServerMessageHandler(ExecutorService buildsExecutor, Server server) {
|
||||
myBuildsExecutor = buildsExecutor;
|
||||
myServer = server;
|
||||
}
|
||||
@@ -44,7 +42,7 @@ public class JpsServerMessageHandler extends SimpleChannelHandler {
|
||||
else {
|
||||
final JpsRemoteProto.Message.Request request = message.getRequest();
|
||||
final JpsRemoteProto.Message.Request.Type requestType = request.getRequestType();
|
||||
final Facade facade = Facade.getInstance();
|
||||
final ServerState facade = ServerState.getInstance();
|
||||
switch (requestType) {
|
||||
case COMPILE_REQUEST :
|
||||
reply = startBuild(sessionId, ctx, request.getCompileRequest());
|
||||
@@ -160,7 +158,7 @@ public class JpsServerMessageHandler extends SimpleChannelHandler {
|
||||
Channels.write(myChannelContext.getChannel(), ProtoUtil.toMessage(mySessionId, ProtoUtil.createBuildStartedEvent("build started")));
|
||||
Throwable error = null;
|
||||
try {
|
||||
Facade.getInstance().startBuild(myProjectPath, myModules, myParams, new MessageHandler() {
|
||||
ServerState.getInstance().startBuild(myProjectPath, myModules, myParams, new MessageHandler() {
|
||||
public void processMessage(BuildMessage buildMessage) {
|
||||
final JpsRemoteProto.Message.Response response;
|
||||
if (buildMessage instanceof CompilerMessage) {
|
||||
+6
-3
@@ -5,6 +5,9 @@ import org.jetbrains.jps.JavaSdk;
|
||||
import org.jetbrains.jps.Library;
|
||||
import org.jetbrains.jps.Module;
|
||||
import org.jetbrains.jps.Project;
|
||||
import org.jetbrains.jps.api.BuildParameters;
|
||||
import org.jetbrains.jps.api.GlobalLibrary;
|
||||
import org.jetbrains.jps.api.SdkLibrary;
|
||||
import org.jetbrains.jps.idea.IdeaProjectLoader;
|
||||
import org.jetbrains.jps.incremental.BuilderRegistry;
|
||||
import org.jetbrains.jps.incremental.CompileScope;
|
||||
@@ -19,7 +22,7 @@ import java.util.*;
|
||||
* Date: 9/10/11
|
||||
* @noinspection UnusedDeclaration
|
||||
*/
|
||||
public class Facade {
|
||||
class ServerState {
|
||||
public static final String IDEA_PROJECT_DIRNAME = ".idea";
|
||||
|
||||
private final Map<String, Project> myProjects = new HashMap<String, Project>();
|
||||
@@ -135,10 +138,10 @@ public class Facade {
|
||||
}
|
||||
|
||||
private static class InstanceHolder {
|
||||
static final Facade ourInstance = new Facade();
|
||||
static final ServerState ourInstance = new ServerState();
|
||||
}
|
||||
|
||||
public static Facade getInstance() {
|
||||
public static ServerState getInstance() {
|
||||
return InstanceHolder.ourInstance;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../jps-builders">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../jps-builders/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="jps-model" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
<orderEntry type="module" module-name="forms_rt" />
|
||||
<orderEntry type="module" module-name="forms-compiler" />
|
||||
<orderEntry type="module" module-name="notNull" />
|
||||
<orderEntry type="library" name="asm" level="project" />
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
<orderEntry type="library" name="NanoXML" level="project" />
|
||||
<orderEntry type="library" name="jgoodies-forms" level="project" />
|
||||
<orderEntry type="library" exported="" name="protobuf" level="project" />
|
||||
<orderEntry type="library" name="Netty" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
Binary file not shown.
@@ -44,4 +44,3 @@ xstream.jar
|
||||
swingx-core-1.6.2.jar
|
||||
netty-3.2.5.Final.jar
|
||||
protobuf-2.3.0.jar
|
||||
jps-facade.jar
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,12 +0,0 @@
|
||||
jps-incremental/ant-1.7.1.jar
|
||||
jps-incremental/ant-launcher.jar
|
||||
jps-incremental/asm-all-3.3.1.jar
|
||||
jps-incremental/gant-1.9.5_groovy-1.7.10.jar
|
||||
jps-incremental/groovy-all-1.7.1.jar
|
||||
jps-incremental/javac2-all.jar
|
||||
jps-incremental/jps.jar
|
||||
jps-incremental/jps-gwt.jar
|
||||
jps-incremental/jps-javaee.jar
|
||||
jps-incremental/jps-jpa.jar
|
||||
jps-incremental/util.jar
|
||||
jps-incremental/trove4j.jar
|
||||
|
||||
Reference in New Issue
Block a user