Skip to content

Commit

Permalink
Use location instead of Eclipse workspace path for classpath (#10153)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Mäder <[email protected]>
  • Loading branch information
tsmaeder committed Oct 17, 2018
1 parent f11a8a3 commit b9def1c
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ curl -sL ${DOWNLOAD_AGENT_BINARIES_URI} | tar xzf - -C ${LS_DIR}
echo writing start script to ${LS_LAUNCHER}
touch ${LS_LAUNCHER}
chmod +x ${LS_LAUNCHER}
echo "java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -noverify -Xmx1G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4410 -jar ${LS_DIR}/plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar -configuration ./config_linux -data ${LS_DIR}/data" > ${LS_LAUNCHER}
echo "java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -noverify -Xmx1G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4410 -jar ${LS_DIR}/plugins/org.eclipse.equinox.launcher_1.5.100.v20180607-1243.jar -configuration ./config_linux -data ${LS_DIR}/data" > ${LS_LAUNCHER}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
<artifactId>org.eclipse.jdt.ui</artifactId>
<packaging>jar</packaging>
<name>Che Plugin :: Java :: Eclipse JDT UI</name>
<properties>
<dto-generator-out-directory>${project.build.directory}/generated-sources/dto/</dto-generator-out-directory>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -181,6 +188,68 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-server-dto</id>
<phase>process-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dtoPackages>
<package>org.eclipse.che.ide.ext.java.shared</package>
</dtoPackages>
<outputDirectory>${dto-generator-out-directory}</outputDirectory>
<genClassName>org.eclipse.che.plugin.java.server.dto.DtoServerImpls</genClassName>
<impl>server</impl>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-resource</id>
<phase>process-sources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${dto-generator-out-directory}/META-INF</directory>
<targetPath>META-INF</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>add-source</id>
<phase>process-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${dto-generator-out-directory}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,6 @@
</excludes>
</configuration>
</plugin>
</plugins>
</plugins>
</build>
</project>
72 changes: 2 additions & 70 deletions plugins/plugin-java/che-plugin-java-ext-lang-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,13 @@
<artifactId>che-plugin-java-ext-lang-shared</artifactId>
<name>Che Plugin :: Java :: Extension Java Shared</name>
<properties>
<dto-generator-out-directory>${project.build.directory}/generated-sources/dto/</dto-generator-out-directory>
<findbugs.failonerror>false</findbugs.failonerror>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-gwt</artifactId>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
Expand Down Expand Up @@ -69,18 +56,6 @@
</resources>
</configuration>
</execution>
<execution>
<id>add-source</id>
<phase>process-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${dto-generator-out-directory}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand All @@ -95,49 +70,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-client-dto</id>
<phase>process-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dtoPackages>
<package>org.eclipse.che.ide.ext.java.shared</package>
</dtoPackages>
<outputDirectory>${dto-generator-out-directory}</outputDirectory>
<genClassName>org.eclipse.che.ide.ext.java.client.dto.DtoClientImpls</genClassName>
<impl>client</impl>
</configuration>
</execution>
<execution>
<id>generate-server-dto</id>
<phase>process-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dtoPackages>
<package>org.eclipse.che.ide.ext.java.shared</package>
</dtoPackages>
<outputDirectory>${dto-generator-out-directory}</outputDirectory>
<genClassName>org.eclipse.che.plugin.java.server.dto.DtoServerImpls</genClassName>
<impl>server</impl>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,23 @@ public List<String> getResolvedClasspath(String projectUri) {
* @param entries classpath entries
*/
public void updateClasspath(String projectUri, List<ClasspathEntry> entries) {
List<ClasspathEntry> fixedEntries =
entries.stream().map(this::fixEntry).collect(Collectors.toList());
UpdateClasspathParameters params = new UpdateClasspathParameters();
params.setProjectUri(projectUri);
params.setEntries(entries);
params.setEntries(fixedEntries);
executeCommand(UPDATE_PROJECT_CLASSPATH, singletonList(params));
}

private ClasspathEntry fixEntry(ClasspathEntry e) {
ClasspathEntry fixed =
new ClasspathEntry().withPath(prefixURI(e.getPath())).withEntryKind(e.getEntryKind());
if (e.getChildren() != null) {
fixed.setChildren(e.getChildren().stream().map(this::fixEntry).collect(Collectors.toList()));
}
return fixed;
}

/**
* Gets source folders of plain java project.
*
Expand All @@ -437,7 +448,8 @@ public List<String> getSourceFolders(String projectPath) {

String projectUri = LanguageServiceUtils.prefixURI(projectPath);
Type type = new TypeToken<ArrayList<String>>() {}.getType();
return doGetList(GET_SOURCE_FOLDERS, projectUri, type);
List<String> result = doGetList(GET_SOURCE_FOLDERS, projectUri, type);
return result.stream().map(LanguageServiceUtils::removePrefixUri).collect(Collectors.toList());
}

private void checkLanguageServerInitialized() {
Expand Down Expand Up @@ -674,7 +686,15 @@ private List<JarEntry> getLibraryChildren(ExternalLibrariesParameters params) {
private List<ClasspathEntry> getClasspathTree(String projectPath) {
String projectUri = prefixURI(projectPath);
Type type = new TypeToken<ArrayList<ClasspathEntry>>() {}.getType();
return doGetList(GET_CLASS_PATH_TREE_COMMAND, projectUri, type);
List<ClasspathEntry> result = doGetList(GET_CLASS_PATH_TREE_COMMAND, projectUri, type);
return result
.stream()
.map(
cpe -> {
cpe.setPath(LanguageServiceUtils.removePrefixUri(cpe.getPath()));
return cpe;
})
.collect(Collectors.toList());
}

private JarEntry getLibraryEntry(String resourceUri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.eclipse.che.selenium.core.project.ProjectTemplates;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.ConfigureClasspath;
import org.eclipse.che.selenium.pageobject.Consoles;
import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.Menu;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
Expand All @@ -38,6 +39,7 @@ public class ConfigureClasspathBaseTest {
@Inject private ConfigureClasspath configureClasspath;
@Inject private Menu menu;
@Inject private TestProjectServiceClient testProjectServiceClient;
@Inject private Consoles consoles;

@BeforeClass
public void prepare() throws Exception {
Expand All @@ -48,6 +50,7 @@ public void prepare() throws Exception {
PROJECT_NAME,
ProjectTemplates.MAVEN_JAVA_MULTIMODULE);
ide.open(ws);
consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME);
}

@Test
Expand Down

0 comments on commit b9def1c

Please sign in to comment.