mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
jps: Revert creating an artifact, construct classpath manually instead
GitOrigin-RevId: 0430b42f94907c2d6abcc6c6b882af5bff65d0c5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bb41ca9b2c
commit
0fdd1ef8da
Generated
-9
@@ -1,9 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="jps-javac-rt-rpc">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/jps_javac_rt_rpc</output-path>
|
||||
<root id="archive" name="jps-javac-rt-rpc.jar">
|
||||
<element id="module-output" name="intellij.platform.jps.build.javac.rt.rpc" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.5.1/protobuf-java-3.5.1.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
@@ -53,7 +53,10 @@ class CommunityStandaloneJpsBuilder {
|
||||
module("intellij.platform.jps.build.javac.rt")
|
||||
}
|
||||
dir("rt") {
|
||||
artifact("jps-javac-rt-rpc")
|
||||
jar("jps-javac-rt-rpc.jar") {
|
||||
module("intellij.platform.jps.build.javac.rt.rpc")
|
||||
}
|
||||
moduleLibrary("intellij.platform.jps.build.javac.rt.rpc", "protobuf-java6")
|
||||
}
|
||||
//layout of groovy jars must be consistent with GroovyBuilder.getGroovyRtRoots method
|
||||
jar("groovy-jps.jar") { module("intellij.groovy.jps") }
|
||||
|
||||
@@ -19,6 +19,7 @@ import io.netty.handler.codec.protobuf.ProtobufDecoder;
|
||||
import io.netty.resolver.AddressResolverGroup;
|
||||
import io.netty.util.NetUtil;
|
||||
import net.n3.nanoxml.IXMLBuilder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.maven.aether.ArtifactRepositoryManager;
|
||||
import org.jetbrains.jps.builders.impl.java.EclipseCompilerTool;
|
||||
import org.jetbrains.jps.builders.java.JavaCompilingTool;
|
||||
@@ -33,7 +34,9 @@ import org.jetbrains.org.objectweb.asm.ClassWriter;
|
||||
|
||||
import javax.tools.*;
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -52,7 +55,13 @@ public final class ClasspathBootstrap {
|
||||
ProtobufDecoder.class, // netty codec
|
||||
};
|
||||
|
||||
private static final String EXTERNAL_JAVAC_JAR_ARTIFACT_NAME = "jps-javac-rt-rpc";
|
||||
|
||||
private static final String DEFAULT_MAVEN_REPOSITORY_PATH = ".m2/repository";
|
||||
private static final String PROTOBUF_JAVA6_VERSION = "3.5.1";
|
||||
private static final String PROTOBUF_JAVA6_JAR_NAME = "protobuf-java-" + PROTOBUF_JAVA6_VERSION + ".jar";
|
||||
|
||||
private static final String EXTERNAL_JAVAC_MODULE_NAME = "intellij.platform.jps.build.javac.rt.rpc";
|
||||
private static final String EXTERNAL_JAVAC_JAR_NAME = "jps-javac-rt-rpc.jar";
|
||||
|
||||
public static List<String> getBuildProcessApplicationClasspath() {
|
||||
final Set<String> cp = new HashSet<>();
|
||||
@@ -103,6 +112,7 @@ public final class ClasspathBootstrap {
|
||||
|
||||
public static List<File> getExternalJavacProcessClasspath(String sdkHome, JavaCompilingTool compilingTool) {
|
||||
final Set<File> cp = new LinkedHashSet<>();
|
||||
cp.add(getResourceFile(ExternalJavacProcess.class)); // self
|
||||
cp.add(getResourceFile(JavacReferenceCollector.class)); // jps-javac-extension library
|
||||
|
||||
// util
|
||||
@@ -113,11 +123,7 @@ public final class ClasspathBootstrap {
|
||||
for (Class<?> aClass : COMMON_REQUIRED_CLASSES) {
|
||||
cp.add(getResourceFile(aClass));
|
||||
}
|
||||
String externalJavacClassesRoot = getResourcePath(ExternalJavacProcess.class);
|
||||
cp.add(new File(externalJavacClassesRoot));
|
||||
Path jarArtifactPath = PathManager.getJarArtifactPath(externalJavacClassesRoot,
|
||||
EXTERNAL_JAVAC_JAR_ARTIFACT_NAME);
|
||||
cp.add(jarArtifactPath.toFile());
|
||||
addExternalJavacRpcClasspath(cp);
|
||||
|
||||
try {
|
||||
final Class<?> cmdLineWrapper = Class.forName("com.intellij.rt.execution.CommandLineWrapper");
|
||||
@@ -170,6 +176,32 @@ public final class ClasspathBootstrap {
|
||||
return new ArrayList<>(cp);
|
||||
}
|
||||
|
||||
private static void addExternalJavacRpcClasspath(@NotNull Collection<File> cp) {
|
||||
Path rootPath = Paths.get(getResourcePath(ExternalJavacProcess.class));
|
||||
if (Files.isRegularFile(rootPath)) {
|
||||
// running regular installation
|
||||
Path rtDirPath = rootPath.resolveSibling("rt");
|
||||
cp.add(rtDirPath.resolve(EXTERNAL_JAVAC_JAR_NAME).toFile());
|
||||
cp.add(rtDirPath.resolve(PROTOBUF_JAVA6_JAR_NAME).toFile());
|
||||
}
|
||||
else {
|
||||
// running from sources or on the build server
|
||||
cp.add(rootPath.resolveSibling(EXTERNAL_JAVAC_MODULE_NAME).toFile());
|
||||
|
||||
// take the library from the local maven repository
|
||||
File localRepositoryDir = getMavenLocalRepositoryDir();
|
||||
File protobufJava6File = new File(FileUtil.join(localRepositoryDir.getAbsolutePath(),
|
||||
"com", "google", "protobuf", "protobuf-java", PROTOBUF_JAVA6_VERSION,
|
||||
PROTOBUF_JAVA6_JAR_NAME));
|
||||
cp.add(protobufJava6File);
|
||||
}
|
||||
}
|
||||
|
||||
private static @NotNull File getMavenLocalRepositoryDir() {
|
||||
final String userHome = System.getProperty("user.home", null);
|
||||
return userHome != null ? new File(userHome, DEFAULT_MAVEN_REPOSITORY_PATH) : new File(DEFAULT_MAVEN_REPOSITORY_PATH);
|
||||
}
|
||||
|
||||
public static String getResourcePath(Class<?> aClass) {
|
||||
return PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ class JavaPluginLayout {
|
||||
withModule("intellij.java.resources.en", "resources.jar")
|
||||
|
||||
// JavacRemoteProto generated against protobuf-java6; don't let it sneak into the IDE classpath and shadow its JavacRemoteProto.
|
||||
withArtifact("jps-javac-rt-rpc", "rt")
|
||||
withModule("intellij.platform.jps.build.javac.rt.rpc", "rt/jps-javac-rt-rpc.jar")
|
||||
withModuleLibrary("protobuf-java6", "intellij.platform.jps.build.javac.rt.rpc", "rt")
|
||||
|
||||
["intellij.java.compiler.antTasks",
|
||||
"intellij.java.guiForms.compiler",
|
||||
|
||||
Reference in New Issue
Block a user