Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Following BSP requests are supported in the current implementation:
- `buildTarget/cleanCache`
- `buildTarget/javacOptions`
- `buildTarget/scalacOptions`
- `buildTarget/test`
- `workspace/buildTargets`
- `workspace/reload`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public Object buildAll(String modelName, Project rootProject) {
gradleSourceSet.setCleanTaskName(cleanTaskName);
Set<String> taskNames = new HashSet<>();
gradleSourceSet.setTaskNames(taskNames);
taskNames.add(classesTaskName);
taskNames.add(cleanTaskName);
taskNames.add(getFullTaskName(projectPath, sourceSet.getProcessResourcesTaskName()));
String projectName = stripPathPrefix(gradleSourceSet.getProjectPath());
if (projectName == null || projectName.length() == 0) {
projectName = gradleSourceSet.getProjectName();
Expand Down
2 changes: 1 addition & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

dependencies {
implementation project(':model')
implementation 'org.gradle:gradle-tooling-api:8.7'
implementation 'org.gradle:gradle-tooling-api:8.8'
implementation 'ch.epfl.scala:bsp4j:2.1.0-M4'
implementation 'org.apache.commons:commons-lang3:3.13.0'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

package ch.epfl.scala.bsp4j.extended;

import java.util.Objects;

import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;

import ch.epfl.scala.bsp4j.TestFinish;
import ch.epfl.scala.bsp4j.TestStatus;

/**
* Extended {@link TestFinish}, which contains the Suite, class, method.
* {@link TestFinish} only contains file location which Gradle doesn't have.
*/
public class TestFinishEx extends TestFinish {

private TestName testName;

private String stackTrace;

/**
* Create a new instance of {@link TestFinishEx}.
*/
public TestFinishEx(@NonNull String displayName, @NonNull TestStatus status,
@NonNull TestName testName) {
super(displayName, status);
this.testName = testName;
}


public TestName getTestName() {
return testName;
}

public void setTestName(TestName testName) {
this.testName = testName;
}

public String getStackTrace() {
return stackTrace;
}

public void setStackTrace(String stackTrace) {
this.stackTrace = stackTrace;
}

@Override
@Pure
public String toString() {
ToStringBuilder b = new ToStringBuilder(this);
b.add(super.toString());
b.add("testName", this.testName);
b.add("stackTrace", this.stackTrace);
return b.toString();
}

@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + Objects.hash(testName, stackTrace);
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TestFinishEx other = (TestFinishEx) obj;
return Objects.equals(testName, other.testName)
&& Objects.equals(stackTrace, other.stackTrace);
}
}
117 changes: 117 additions & 0 deletions server/src/main/java/ch/epfl/scala/bsp4j/extended/TestName.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

package ch.epfl.scala.bsp4j.extended;

import java.util.Objects;

import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;

/**
* BSP TestName, which contains the test name and the test hierarchy
* e.g. method/class/suite
*/
public class TestName {

private String displayName;

private String suiteName;

private String className;

private String methodName;

private TestName parent;

/**
* Create a new instance of {@link TestName}.
*/
public TestName(@NonNull String displayName, String suiteName,
String className, String methodName) {
this.displayName = displayName;
this.suiteName = suiteName;
this.className = className;
this.methodName = methodName;
}

public String getDisplayName() {
return displayName;
}

public void setDisplayName(String displayName) {
this.displayName = displayName;
}

public String getSuiteName() {
return suiteName;
}

public void setSuiteName(String suiteName) {
this.suiteName = suiteName;
}

public String getClassName() {
return className;
}

public void setClassName(String className) {
this.className = className;
}

public String getMethodName() {
return methodName;
}

public void setMethodName(String methodName) {
this.methodName = methodName;
}

public TestName getParent() {
return parent;
}

public void setParent(TestName parent) {
this.parent = parent;
}

@Override
@Pure
public String toString() {
ToStringBuilder b = new ToStringBuilder(this);
b.add("displayName", this.displayName);
b.add("suiteName", this.suiteName);
b.add("className", this.className);
b.add("methodName", this.methodName);
b.add("parent", this.parent);
return b.toString();
}

@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + Objects.hash(displayName, suiteName, className, methodName, parent);
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TestName other = (TestName) obj;
return Objects.equals(displayName, other.displayName)
&& Objects.equals(suiteName, other.suiteName)
&& Objects.equals(className, other.className)
&& Objects.equals(methodName, other.methodName)
&& Objects.equals(parent, other.parent);
}
}
69 changes: 69 additions & 0 deletions server/src/main/java/ch/epfl/scala/bsp4j/extended/TestStartEx.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

package ch.epfl.scala.bsp4j.extended;

import java.util.Objects;

import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;

import ch.epfl.scala.bsp4j.TestStart;

/**
* Extended {@link TestStart}, which contains the Suite, class, method.
* {@link TestStart} only contains file location which Gradle doesn't have.
*/
public class TestStartEx extends TestStart {

private TestName testName;

/**
* Create a new instance of {@link TestStartEx}.
*/
public TestStartEx(@NonNull String displayName, @NonNull TestName testName) {
super(displayName);
this.testName = testName;
}

public TestName getTestName() {
return testName;
}

public void setTestName(TestName testName) {
this.testName = testName;
}

@Override
@Pure
public String toString() {
ToStringBuilder b = new ToStringBuilder(this);
b.add(super.toString());
b.add("testName", this.testName);
return b.toString();
}

@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + Objects.hashCode(testName);
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TestStartEx other = (TestStartEx) obj;
return Objects.equals(testName, other.testName);
}
}
Loading