Skip to content

Commit

Permalink
Moving sts-gradle-model plugin into headless services
Browse files Browse the repository at this point in the history
Closer to original in main
  • Loading branch information
BoykoAlex committed Apr 21, 2024
1 parent fd10ee3 commit 0c8644b
Show file tree
Hide file tree
Showing 38 changed files with 982 additions and 200 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="gradle-plugin/sts-gradle-model-plugin.jar"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.workbench,
com.google.guava,
org.springsource.ide.eclipse.commons.livexp,
org.springframework.ide.eclipse.boot;bundle-version="3.9.12"
org.springframework.ide.eclipse.boot;bundle-version="3.9.12",
org.springframework.tooling.gradle
Import-Package: org.apache.commons.io
Bundle-ClassPath: gradle-plugin/sts-gradle-model-plugin.jar,
.
Bundle-Activator: org.springframework.ide.eclipse.buildship30.Buildship30Plugin
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.properties,\
plugin.xml,\
about.html,\
gradle-plugin/sts-gradle-model-plugin.jar,\
gradle-plugin/init.gradle
about.html

Original file line number Diff line number Diff line change
Expand Up @@ -65,69 +65,6 @@
<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/gradle-plugin</directory>
<includes>
<include>*.jar</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>sts-gradle-model-build</id>
<phase>generate-resources</phase>
<configuration>
<workingDirectory>${project.basedir}/../sts-gradle-model-plugin/sts-gradle-model-plugin</workingDirectory>
<executable>${gradle.executable}</executable>
<arguments>
<argument>clean</argument>
<argument>build</argument>
<argument>-S</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-sts-gradle-model-jars</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>

<configuration>
<outputDirectory>${project.basedir}/gradle-plugin</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/../sts-gradle-model-plugin/sts-gradle-model-plugin/build/libs/</directory>
<includes>
<include>${gradle.model-plugin.artifactId}.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020 Pivotal, Inc.
* Copyright (c) 2020, 2024 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -11,9 +11,6 @@
package org.springframework.ide.eclipse.buildship30;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand All @@ -25,7 +22,6 @@
import org.eclipse.buildship.core.internal.workspace.SynchronizationJob;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.gradle.tooling.ModelBuilder;
Expand All @@ -39,6 +35,7 @@
import org.springframework.ide.eclipse.boot.core.initializr.InitializrUrl;
import org.springframework.ide.eclipse.boot.core.internal.SpringBootProject;
import org.springframework.ide.eclipse.boot.util.DependencyDelta;
import org.springframework.tooling.gradle.StsGradleToolingModelBuilder;
import org.springsource.ide.eclipse.commons.livexp.util.Log;

import com.google.common.base.Supplier;
Expand All @@ -54,11 +51,6 @@ public class GradleSpringBootProject extends SpringBootProject {

private static final String WAR_PKG_NATURE = "org.eclipse.wst.common.project.facet.core.nature";

private static final Supplier<Path> cacheFolderSupplier = Suppliers.memoize(() -> {
IPath iPath = Buildship30Plugin.getDefault().getStateLocation().makeAbsolute();
return iPath.toFile().toPath().resolve("gradle-plugin");
});

private static class GradleModels {
EclipseProject eclipseProject;
StsToolingModel stsToolingModel;
Expand Down Expand Up @@ -117,13 +109,12 @@ public String javaVersion() {
if (build.isPresent()) {
try {
return build.get().withConnection(connection -> {
ModelBuilder<StsToolingModel> stsModelBuilder = connection.model(StsToolingModel.class)
.withArguments("--init-script", getInitScript().toString());
ModelBuilder<StsToolingModel> stsModelBuilder = StsGradleToolingModelBuilder.getModelBuilder(connection, project.getLocation().toFile(), null);
return new GradleModels(connection.model(EclipseProject.class).get(),
stsModelBuilder.get());
}, new NullProgressMonitor());
} catch (Exception e) {
Log.log(e);
} catch (Throwable t) {
Log.log(t);
return null;
}
}
Expand Down Expand Up @@ -252,29 +243,4 @@ public File executePackagingScript(IProgressMonitor monitor) throws CoreExceptio
throw new UnsupportedOperationException("Not implemented!");
}

private Path getInitScript() {
Path cacheFolder = cacheFolderSupplier.get();
Path initScript = cacheFolder.resolve("init.gradle");
Path jarPath = cacheFolder.resolve("sts-gradle-model-plugin.jar");
if (!Files.isDirectory(cacheFolder)) {
cacheFolder.toFile().mkdirs();
}
if (!Files.exists(initScript)) {
try {
Files.copy(getClass().getResourceAsStream("/gradle-plugin/init.gradle"), initScript);
} catch (IOException e) {
Log.log(e);
}
}
if (!Files.exists(jarPath)) {
try {
Files.copy(getClass().getResourceAsStream("/gradle-plugin/sts-gradle-model-plugin.jar"),
jarPath);
} catch (IOException e) {
Log.log(e);
}
}
return initScript;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,92 @@
<site>
<category-def name="Spring Tools 4 Language Server Integrations for Eclipse" label="Spring Tools 4 Language Server Integrations for Eclipse"/>

<feature id="org.springframework.tooling.boot.ls.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.boot.ls.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.integration.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.integration.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.bosh.ls.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.bosh.ls.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.concourse.ls.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.concourse.ls.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.eclipse.mylyn.wikitext_feature"/>
<feature id="org.eclipse.tm4e.feature"/>

<bundle id="org.springframework.tooling.ls.eclipse.commons"/>
<bundle id="org.springframework.tooling.ls.eclipse.commons.source"/>
<bundle id="org.springframework.tooling.jdt.ls.commons"/>
<bundle id="org.springframework.tooling.jdt.ls.commons.source"/>
<bundle id="org.springframework.tooling.ls.eclipse.gotosymbol"/>
<bundle id="org.springframework.tooling.ls.eclipse.gotosymbol.source"/>

<bundle id="org.springframework.ide.eclipse.editor.support"/>
<bundle id="org.springframework.ide.eclipse.editor.support.source"/>

<bundle id="org.springsource.ide.eclipse.commons.boot.ls"/>
<bundle id="org.springsource.ide.eclipse.commons.boot.ls.source"/>
<bundle id="org.springsource.ide.eclipse.commons.core"/>
<bundle id="org.springsource.ide.eclipse.commons.core.source"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.core"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.core.source"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.test.util"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.test.util.source"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.ui"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.ui.source"/>
<bundle id="org.springsource.ide.eclipse.commons.jdk_tools"/>
<bundle id="org.springsource.ide.eclipse.commons.jdk_tools.source"/>
<bundle id="org.springsource.ide.eclipse.commons.livexp"/>
<bundle id="org.springsource.ide.eclipse.commons.livexp.source"/>
<bundle id="org.springsource.ide.eclipse.commons.tests.util"/>
<bundle id="org.springsource.ide.eclipse.commons.tests.util.source"/>
<bundle id="org.springsource.ide.eclipse.commons.ui"/>
<bundle id="org.springsource.ide.eclipse.commons.ui.source"/>

<bundle id="io.projectreactor.reactor-core"/>
<bundle id="io.projectreactor.reactor-core.source"/>
<bundle id="org.reactivestreams.reactive-streams"/>
<bundle id="org.reactivestreams.reactive-streams.source"/>

<bundle id="org.eclipse.lsp4e"/>
<bundle id="org.eclipse.lsp4e.jdt"/>
<bundle id="org.eclipse.lsp4j"/>
<bundle id="org.eclipse.lsp4j.jsonrpc"/>
<bundle id="org.eclipse.xtext.xbase.lib"/>
<bundle id="org.jcodings"/>
<bundle id="org.joni"/>
<bundle id="org.apache.commons.lang3"/>
<feature id="org.springframework.tooling.boot.ls.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.boot.ls.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.integration.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.integration.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.bosh.ls.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.bosh.ls.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.concourse.ls.feature">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.springframework.tooling.concourse.ls.feature.source">
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
</feature>

<feature id="org.eclipse.mylyn.wikitext_feature"/>
<feature id="org.eclipse.tm4e.feature"/>

<bundle id="org.springframework.tooling.ls.eclipse.commons"/>
<bundle id="org.springframework.tooling.ls.eclipse.commons.source"/>
<bundle id="org.springframework.tooling.jdt.ls.commons"/>
<bundle id="org.springframework.tooling.jdt.ls.commons.source"/>
<bundle id="org.springframework.tooling.gradle"/>
<bundle id="org.springframework.tooling.gradle.source"/>
<bundle id="org.springframework.tooling.ls.eclipse.gotosymbol"/>
<bundle id="org.springframework.tooling.ls.eclipse.gotosymbol.source"/>

<bundle id="org.springframework.ide.eclipse.editor.support"/>
<bundle id="org.springframework.ide.eclipse.editor.support.source"/>

<bundle id="org.springsource.ide.eclipse.commons.boot.ls"/>
<bundle id="org.springsource.ide.eclipse.commons.boot.ls.source"/>
<bundle id="org.springsource.ide.eclipse.commons.core"/>
<bundle id="org.springsource.ide.eclipse.commons.core.source"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.core"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.core.source"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.test.util"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.test.util.source"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.ui"/>
<bundle id="org.springsource.ide.eclipse.commons.frameworks.ui.source"/>
<bundle id="org.springsource.ide.eclipse.commons.jdk_tools"/>
<bundle id="org.springsource.ide.eclipse.commons.jdk_tools.source"/>
<bundle id="org.springsource.ide.eclipse.commons.livexp"/>
<bundle id="org.springsource.ide.eclipse.commons.livexp.source"/>
<bundle id="org.springsource.ide.eclipse.commons.tests.util"/>
<bundle id="org.springsource.ide.eclipse.commons.tests.util.source"/>
<bundle id="org.springsource.ide.eclipse.commons.ui"/>
<bundle id="org.springsource.ide.eclipse.commons.ui.source"/>

<bundle id="io.projectreactor.reactor-core"/>
<bundle id="io.projectreactor.reactor-core.source"/>
<bundle id="org.reactivestreams.reactive-streams"/>
<bundle id="org.reactivestreams.reactive-streams.source"/>

<bundle id="org.eclipse.lsp4e"/>
<bundle id="org.eclipse.lsp4e.jdt"/>
<bundle id="org.eclipse.lsp4j"/>
<bundle id="org.eclipse.lsp4j.jsonrpc"/>
<bundle id="org.eclipse.xtext.xbase.lib"/>
<bundle id="org.jcodings"/>
<bundle id="org.joni"/>
<bundle id="org.apache.commons.lang3"/>

</site>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="gradle-plugin/sts-gradle-model-plugin.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/gradle-plugin/*.jar
Loading

0 comments on commit 0c8644b

Please sign in to comment.