Moving sts-gradle-model plugin into headless services
Closer to original in main
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
initscript {
|
||||
dependencies {
|
||||
classpath files('sts-gradle-model-plugin.jar')
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: sts.model.plugin.StsModelPlugin
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
@@ -25,7 +22,6 @@ import org.eclipse.buildship.core.internal.workspace.NewProjectHandler;
|
||||
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;
|
||||
@@ -39,6 +35,7 @@ import org.springframework.ide.eclipse.boot.core.initializr.InitializrService;
|
||||
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;
|
||||
@@ -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;
|
||||
@@ -117,13 +109,12 @@ public class GradleSpringBootProject extends SpringBootProject {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -252,29 +243,4 @@ public class GradleSpringBootProject extends SpringBootProject {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user