All checks were successful
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 61.98% (17344/27983)
* Branch Coverage: 53.07% (6720/12663)
* Lines of Code: 27983
* Cyclomatic Complexity: 11207
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 11, passed: 581
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
49 lines
1.4 KiB
Java
49 lines
1.4 KiB
Java
package p.studio.projects;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import p.packer.messages.PackerProjectContext;
|
|
import p.studio.AppMode;
|
|
import p.studio.lsp.messages.LspProjectContext;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
public record ProjectReference(
|
|
String name,
|
|
String version,
|
|
String languageId,
|
|
int stdlibVersion,
|
|
AppMode target,
|
|
Path rootPath) {
|
|
@Override
|
|
public String toString() {
|
|
return name;
|
|
}
|
|
|
|
private Path absoluteRootPath() {
|
|
return rootPath().toAbsolutePath().normalize();
|
|
}
|
|
|
|
private String displayRelativePath(final String resolve) {
|
|
final Path normalizedPath = rootPath.toAbsolutePath().normalize();
|
|
try {
|
|
final var path = StringUtils.isNotBlank(resolve)
|
|
? absoluteRootPath().resolve(resolve)
|
|
: absoluteRootPath();
|
|
return path.relativize(normalizedPath).toString().replace('\\', '/');
|
|
} catch (IllegalArgumentException ignored) {
|
|
return normalizedPath.toString().replace('\\', '/');
|
|
}
|
|
}
|
|
|
|
public PackerProjectContext toPackerProjectContext() {
|
|
return new PackerProjectContext(name, absoluteRootPath());
|
|
}
|
|
|
|
public LspProjectContext toLspProjectContext() {
|
|
return new LspProjectContext(
|
|
rootPath().toAbsolutePath().normalize().toString(),
|
|
languageId(),
|
|
rootPath());
|
|
}
|
|
}
|