Compare commits
No commits in common. "ff26bb3d4b86fdd75c0a5f104310d05a08ee36c3" and "22887b56cde324658868bc768f71266a80a2e1a5" have entirely different histories.
ff26bb3d4b
...
22887b56cd
2
.gitignore
vendored
2
.gitignore
vendored
@ -13,8 +13,6 @@ build
|
||||
.python-version
|
||||
.venv
|
||||
|
||||
# IA
|
||||
.junie
|
||||
/debug/
|
||||
!prometeu-studio/src/main/java/p/studio/workspaces/debug/
|
||||
!prometeu-studio/src/main/java/p/studio/workspaces/debug/**
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package p.studio.compiler;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.models.FrontendSemanticToken;
|
||||
import p.studio.compiler.models.FrontendSemanticTokenProvider;
|
||||
import p.studio.compiler.pbs.ast.PbsAst;
|
||||
@ -27,7 +26,6 @@ import java.util.Set;
|
||||
public final class PBSSemanticTokenProvider implements FrontendSemanticTokenProvider {
|
||||
private static final Set<String> BUILTIN_TYPE_NAMES = Set.of("int", "float", "bool", "string", "i32", "i64", "f32", "f64");
|
||||
private static final int DEFAULT_STDLIB_VERSION = 1;
|
||||
private static final AppMode DEFAULT_TARGET = AppMode.Game;
|
||||
private static final ResourceStdlibEnvironmentResolver STDLIB_RESOLVER = new ResourceStdlibEnvironmentResolver();
|
||||
private static final Map<PbsTokenKind, PbsSemanticKind> DECLARATION_KINDS = declarationKinds();
|
||||
|
||||
@ -212,7 +210,7 @@ public final class PBSSemanticTokenProvider implements FrontendSemanticTokenProv
|
||||
}
|
||||
|
||||
private Map<String, PbsSemanticKind> resolveStdlibExportKinds(final PbsAst.ModuleRef moduleRef) {
|
||||
final var stdlibEnvironment = STDLIB_RESOLVER.resolve(DEFAULT_STDLIB_VERSION, DEFAULT_TARGET);
|
||||
final var stdlibEnvironment = STDLIB_RESOLVER.resolve(DEFAULT_STDLIB_VERSION);
|
||||
return stdlibEnvironment.resolveModule(moduleRef.project(), moduleRef.pathSegments())
|
||||
.map(this::parseStdlibVisibleKinds)
|
||||
.orElseGet(Map::of);
|
||||
|
||||
@ -1,14 +1,21 @@
|
||||
package p.studio.compiler.pbs.stdlib;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public final class EmptyStdlibEnvironmentResolver implements StdlibEnvironmentResolver {
|
||||
private static final StdlibEnvironment EMPTY = (project, pathSegments) -> Optional.empty();
|
||||
private static final StdlibEnvironment EMPTY = new StdlibEnvironment() {
|
||||
@Override
|
||||
public Optional<StdlibModuleSource> resolveModule(
|
||||
final String project,
|
||||
final ReadOnlyList<String> pathSegments) {
|
||||
return Optional.empty();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public StdlibEnvironment resolve(final int stdlibVersion, final AppMode target) {
|
||||
public StdlibEnvironment resolve(final int stdlibVersion) {
|
||||
return EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +1,26 @@
|
||||
package p.studio.compiler.pbs.stdlib;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class ResourceStdlibEnvironmentResolver implements StdlibEnvironmentResolver {
|
||||
private static final String STDLIB_ROOT = "stdlib";
|
||||
|
||||
@Override
|
||||
public StdlibEnvironment resolve(final int stdlibVersion, final AppMode target) {
|
||||
return new ResourceStdlibEnvironment(stdlibVersion, target);
|
||||
public StdlibEnvironment resolve(final int stdlibVersion) {
|
||||
return new ResourceStdlibEnvironment(stdlibVersion);
|
||||
}
|
||||
|
||||
private record ResourceStdlibEnvironment(int stdlibVersion, AppMode target) implements StdlibEnvironment {
|
||||
private static final class ResourceStdlibEnvironment implements StdlibEnvironment {
|
||||
private final int stdlibVersion;
|
||||
|
||||
private ResourceStdlibEnvironment(final int stdlibVersion) {
|
||||
this.stdlibVersion = stdlibVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<StdlibModuleSource> resolveModule(
|
||||
@ -33,7 +36,7 @@ public final class ResourceStdlibEnvironmentResolver implements StdlibEnvironmen
|
||||
return Optional.of(new StdlibModuleSource(
|
||||
project,
|
||||
pathSegments,
|
||||
ReadOnlyList.wrap(List.of(new StdlibModuleSource.SourceFile("main.pbs", mainSource.get()))),
|
||||
ReadOnlyList.wrap(java.util.List.of(new StdlibModuleSource.SourceFile("main.pbs", mainSource.get()))),
|
||||
barrelSource.get()));
|
||||
}
|
||||
|
||||
@ -41,10 +44,7 @@ public final class ResourceStdlibEnvironmentResolver implements StdlibEnvironmen
|
||||
final String project,
|
||||
final ReadOnlyList<String> pathSegments) {
|
||||
final var pathBuilder = new StringBuilder();
|
||||
pathBuilder
|
||||
.append(target.exportReferenceName().toLowerCase())
|
||||
.append('/')
|
||||
.append(STDLIB_ROOT)
|
||||
pathBuilder.append(STDLIB_ROOT)
|
||||
.append('/')
|
||||
.append(stdlibVersion)
|
||||
.append('/')
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package p.studio.compiler.pbs.stdlib;
|
||||
|
||||
import p.studio.AppMode;
|
||||
|
||||
public interface StdlibEnvironmentResolver {
|
||||
StdlibEnvironment resolve(int stdlibVersion, AppMode target);
|
||||
StdlibEnvironment resolve(int stdlibVersion);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package p.studio.compiler.services;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.messages.FrontendPhaseContext;
|
||||
import p.studio.compiler.models.IRGlobalVisibility;
|
||||
@ -100,8 +99,7 @@ final class PbsModuleAssemblyService {
|
||||
projectIdByName,
|
||||
defaultSyntheticOwnerProjectId,
|
||||
diagnostics,
|
||||
ctx.stdlibVersion(),
|
||||
ctx.target());
|
||||
ctx.stdlibVersion());
|
||||
|
||||
final var modules = new ArrayList<PbsModuleVisibilityValidator.ModuleUnit>(modulesByCoordinates.size());
|
||||
for (final var entry : modulesByCoordinates.entrySet()) {
|
||||
@ -208,29 +206,28 @@ final class PbsModuleAssemblyService {
|
||||
final Map<String, ProjectId> projectIdByName,
|
||||
final ProjectId defaultSyntheticOwnerProjectId,
|
||||
final DiagnosticSink diagnostics,
|
||||
final int stdlibVersion,
|
||||
final AppMode target) {
|
||||
final var stdlibEnvironment = stdlibEnvironmentResolver.resolve(stdlibVersion, target);
|
||||
final int stdlibVersion) {
|
||||
final var stdlibEnvironment = stdlibEnvironmentResolver.resolve(stdlibVersion);
|
||||
final var pending = new ArrayDeque<PbsModuleVisibilityValidator.ModuleCoordinates>();
|
||||
final var resolved = new HashSet<ModuleId>();
|
||||
|
||||
enqueueReservedImportsFromKnownModules(modulesByCoordinates, pending);
|
||||
while (!pending.isEmpty()) {
|
||||
final var moduleCoordinates = pending.removeFirst();
|
||||
final var moduleId = moduleId(moduleTable, moduleCoordinates);
|
||||
if (!resolved.add(moduleId)) {
|
||||
final var target = pending.removeFirst();
|
||||
final var targetId = moduleId(moduleTable, target);
|
||||
if (!resolved.add(targetId)) {
|
||||
continue;
|
||||
}
|
||||
if (modulesByCoordinates.containsKey(moduleCoordinates)) {
|
||||
if (modulesByCoordinates.containsKey(target)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final var moduleSource = stdlibEnvironment.resolveModule(moduleCoordinates.project(), moduleCoordinates.pathSegments());
|
||||
final var moduleSource = stdlibEnvironment.resolveModule(target.project(), target.pathSegments());
|
||||
if (moduleSource.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final var syntheticOwnerProjectId = projectIdByName.getOrDefault(moduleCoordinates.project(), defaultSyntheticOwnerProjectId);
|
||||
final var syntheticOwnerProjectId = projectIdByName.getOrDefault(target.project(), defaultSyntheticOwnerProjectId);
|
||||
if (syntheticOwnerProjectId == null) {
|
||||
continue;
|
||||
}
|
||||
@ -244,15 +241,15 @@ final class PbsModuleAssemblyService {
|
||||
moduleData.barrels.addAll(loadedModule.barrelFiles().asList());
|
||||
modulesByCoordinates.put(loadedModule.coordinates(), moduleData);
|
||||
for (final var sourceFile : loadedModule.sourceFiles()) {
|
||||
moduleIdByFile.put(sourceFile.fileId(), moduleId);
|
||||
moduleIdByFile.put(sourceFile.fileId(), targetId);
|
||||
parsedSourceFiles.add(new PbsParsedSourceFile(
|
||||
sourceFile.fileId(),
|
||||
sourceFile.ast(),
|
||||
moduleId,
|
||||
targetId,
|
||||
SourceKind.SDK_INTERFACE));
|
||||
}
|
||||
for (final var barrelFile : loadedModule.barrelFiles()) {
|
||||
moduleIdByFile.put(barrelFile.fileId(), moduleId);
|
||||
moduleIdByFile.put(barrelFile.fileId(), targetId);
|
||||
}
|
||||
enqueueReservedImportsFromSourceFiles(loadedModule.sourceFiles().asList(), pending);
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.compiler.pbs;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.messages.FrontendPhaseContext;
|
||||
import p.studio.compiler.models.*;
|
||||
@ -461,8 +460,7 @@ class PbsGateUSdkInterfaceConformanceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
stdlibVersion,
|
||||
AppMode.Game);
|
||||
stdlibVersion);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.compiler.pbs;
|
||||
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.messages.FrontendPhaseContext;
|
||||
import p.studio.compiler.models.BuildStack;
|
||||
@ -80,8 +79,7 @@ class PbsGateUStdlibCompileTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(projectIds)),
|
||||
stdlibVersion,
|
||||
AppMode.Game);
|
||||
stdlibVersion);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
new PBSFrontendPhaseService().compile(
|
||||
@ -98,7 +96,7 @@ class PbsGateUStdlibCompileTest {
|
||||
|
||||
private Map<String, StdlibProjectFiles> discoverStdlibProjects(
|
||||
final int stdlibVersion) throws Exception {
|
||||
final var resourcePath = "game/stdlib/" + stdlibVersion;
|
||||
final var resourcePath = "stdlib/" + stdlibVersion;
|
||||
final var classLoader = PbsGateUStdlibCompileTest.class.getClassLoader();
|
||||
final var resource = classLoader.getResource(resourcePath);
|
||||
assertNotNull(resource, "Stdlib version " + stdlibVersion + " was not found on classpath at " + resourcePath);
|
||||
|
||||
@ -2,12 +2,16 @@ package p.studio.compiler.services;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.messages.Addressable;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.messages.FESurfaceContext;
|
||||
import p.studio.compiler.messages.FrontendPhaseContext;
|
||||
import p.studio.compiler.models.*;
|
||||
import p.studio.compiler.models.IRGlobalVisibility;
|
||||
import p.studio.compiler.models.BuildStack;
|
||||
import p.studio.compiler.models.IRHiddenGlobalKind;
|
||||
import p.studio.compiler.models.ProjectDescriptor;
|
||||
import p.studio.compiler.models.SourceHandle;
|
||||
import p.studio.compiler.models.SourceKind;
|
||||
import p.studio.compiler.pbs.PbsHostAdmissionErrors;
|
||||
import p.studio.compiler.pbs.linking.PbsLinkErrors;
|
||||
import p.studio.compiler.pbs.semantics.PbsSemanticsErrors;
|
||||
@ -74,7 +78,6 @@ class PBSFrontendPhaseServiceTest {
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game,
|
||||
p.studio.compiler.messages.HostAdmissionContext.permissiveDefault(),
|
||||
new FESurfaceContext(ReadOnlyList.from(new Addressable("assets.ui.panel", 91))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
@ -131,8 +134,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -183,8 +185,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -237,8 +238,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -308,8 +308,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -373,8 +372,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -418,8 +416,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
new PBSFrontendPhaseService().compile(
|
||||
@ -472,8 +469,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -561,8 +557,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -612,8 +607,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -670,8 +664,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -735,8 +728,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
7,
|
||||
AppMode.Game);
|
||||
7);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = frontendService.compile(
|
||||
@ -787,8 +779,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
7,
|
||||
AppMode.Game);
|
||||
7);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = frontendService.compile(
|
||||
@ -835,8 +826,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -889,8 +879,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -943,8 +932,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1003,8 +991,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1063,8 +1050,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1135,8 +1121,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1208,8 +1193,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1272,8 +1256,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = frontendService.compile(
|
||||
@ -1337,8 +1320,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = frontendService.compile(
|
||||
@ -1419,8 +1401,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1492,8 +1473,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
9,
|
||||
AppMode.Game);
|
||||
9);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = frontendService.compile(
|
||||
@ -1547,8 +1527,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1578,7 +1557,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var callableCalls = frameExecutable.instructions().stream()
|
||||
.filter(instruction ->
|
||||
instruction.kind() == p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.CALL_FUNC)
|
||||
.map(IRBackendExecutableFunction.Instruction::calleeCallableName)
|
||||
.map(instruction -> instruction.calleeCallableName())
|
||||
.toList();
|
||||
final var intrinsicCalls = frameExecutable.instructions().stream()
|
||||
.filter(instruction ->
|
||||
@ -1645,8 +1624,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1665,7 +1643,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var callableCalls = frameExecutable.instructions().stream()
|
||||
.filter(instruction ->
|
||||
instruction.kind() == p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.CALL_FUNC)
|
||||
.map(IRBackendExecutableFunction.Instruction::calleeCallableName)
|
||||
.map(instruction -> instruction.calleeCallableName())
|
||||
.toList();
|
||||
final var intrinsicCalls = frameExecutable.instructions().stream()
|
||||
.filter(instruction ->
|
||||
@ -1739,8 +1717,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
1,
|
||||
AppMode.Game);
|
||||
1);
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var irBackend = new PBSFrontendPhaseService().compile(
|
||||
@ -1759,7 +1736,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var callableCalls = frameExecutable.instructions().stream()
|
||||
.filter(instruction ->
|
||||
instruction.kind() == p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.CALL_FUNC)
|
||||
.map(IRBackendExecutableFunction.Instruction::calleeCallableName)
|
||||
.map(instruction -> instruction.calleeCallableName())
|
||||
.toList();
|
||||
final var intrinsicCalls = frameExecutable.instructions().stream()
|
||||
.filter(instruction ->
|
||||
@ -1827,8 +1804,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
new PBSFrontendPhaseService().compile(
|
||||
@ -1885,8 +1861,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
new PBSFrontendPhaseService().compile(
|
||||
@ -1957,8 +1932,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
11,
|
||||
AppMode.Game);
|
||||
11);
|
||||
final var deniedDiagnostics = DiagnosticSink.empty();
|
||||
|
||||
deniedFrontendService.compile(
|
||||
@ -2024,8 +1998,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
allowedProjectTable,
|
||||
allowedFileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(allowedProjectId))),
|
||||
12,
|
||||
AppMode.Game);
|
||||
12);
|
||||
final var allowedDiagnostics = DiagnosticSink.empty();
|
||||
|
||||
allowedFrontendService.compile(
|
||||
@ -2083,8 +2056,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var inlineHintsByFile = PBSFrontendPhaseService.inlineHintsByFile(
|
||||
@ -2141,8 +2113,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
final var ctx = new FrontendPhaseContext(
|
||||
projectTable,
|
||||
fileTable,
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))),
|
||||
AppMode.Game);
|
||||
new BuildStack(ReadOnlyList.wrap(List.of(projectId))));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
final var inlineHints = PBSFrontendPhaseService.inlineHintsByFile(
|
||||
@ -2177,7 +2148,7 @@ class PBSFrontendPhaseServiceTest {
|
||||
for (final var module : modules) {
|
||||
byModuleKey.put(moduleKey(module.project(), module.pathSegments()), module);
|
||||
}
|
||||
return (stdlib, target) -> {
|
||||
return stdlib -> {
|
||||
if (stdlib != acceptedStdlib) {
|
||||
return (project, pathSegments) -> Optional.empty();
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@ import p.studio.compiler.FrontendRegistryService;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.messages.FrontendPhaseContext;
|
||||
import p.studio.compiler.models.BuilderPipelineContext;
|
||||
import p.studio.compiler.source.diagnostics.DiagnosticSink;
|
||||
import p.studio.compiler.workspaces.AssetSurfaceContextLoader;
|
||||
import p.studio.compiler.source.diagnostics.DiagnosticSink;
|
||||
import p.studio.compiler.workspaces.PipelineStage;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
|
||||
@ -31,7 +31,6 @@ public class FrontendPhasePipelineStage implements PipelineStage {
|
||||
fileTable,
|
||||
ctx.resolvedWorkspace.stack(),
|
||||
ctx.resolvedWorkspace.stdlib(),
|
||||
ctx.resolvedWorkspace.target(),
|
||||
p.studio.compiler.messages.HostAdmissionContext.permissiveDefault(),
|
||||
assetSurfaceContextLoader.load(ctx.resolvedWorkspace.mainProject().getRootPath()));
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.compiler.models;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
|
||||
import java.nio.file.Path;
|
||||
@ -13,7 +12,6 @@ public final class ProjectDescriptor {
|
||||
private final Path rootPath; // canon root path
|
||||
private final String name; // project name
|
||||
private final String version; // project version
|
||||
private final AppMode target; // project target (Game or System)
|
||||
private final ReadOnlyList<Path> sourceRoots; // source roots canon paths for the project
|
||||
@Builder.Default
|
||||
private final SourceKind sourceKind = SourceKind.PROJECT;
|
||||
|
||||
@ -10,7 +10,6 @@ public record PrometeuManifestDTO(
|
||||
String version,
|
||||
String language,
|
||||
String stdlib,
|
||||
String target,
|
||||
List<DependencyDeclaration> dependencies) {
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package p.studio.compiler.models;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.exceptions.BuildException;
|
||||
import p.studio.compiler.messages.DependencyConfig;
|
||||
import p.studio.compiler.source.identifiers.ProjectId;
|
||||
@ -24,7 +23,6 @@ public final class DependencyContext {
|
||||
public Path mainProjectRootPathCanon;
|
||||
public FrontendSpec frontendSpec;
|
||||
public Integer rootStdlib;
|
||||
public AppMode target;
|
||||
public ProjectId rootProjectId;
|
||||
public BuildStack stack;
|
||||
|
||||
@ -53,7 +51,7 @@ public final class DependencyContext {
|
||||
}
|
||||
final var dependenciesByProject = buildDependenciesByProject();
|
||||
final var workspaceGraph = new WorkspaceGraph(projectTable, dependenciesByProject);
|
||||
return new ResolvedWorkspace(rootProjectId, frontendSpec, rootStdlib, target, workspaceGraph, stack);
|
||||
return new ResolvedWorkspace(rootProjectId, frontendSpec, rootStdlib, workspaceGraph, stack);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package p.studio.compiler.models;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.workspaces.DependencyReference;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
|
||||
@ -9,6 +8,5 @@ public record PrometeuManifest(
|
||||
String version,
|
||||
String language,
|
||||
int stdlib,
|
||||
AppMode target,
|
||||
ReadOnlyList<DependencyReference> dependencies) {
|
||||
}
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
package p.studio.compiler.models;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.source.identifiers.ProjectId;
|
||||
|
||||
public record ResolvedWorkspace(
|
||||
ProjectId mainProjectId,
|
||||
FrontendSpec frontendSpec,
|
||||
int stdlib,
|
||||
AppMode target,
|
||||
WorkspaceGraph graph,
|
||||
BuildStack stack) {
|
||||
public ProjectDescriptor mainProject() {
|
||||
|
||||
@ -2,9 +2,7 @@ package p.studio.compiler.utilities;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.FrontendRegistryService;
|
||||
import p.studio.compiler.dtos.PrometeuManifestDTO;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
@ -47,18 +45,7 @@ public final class PrometeuManifestUtils {
|
||||
.error(true)
|
||||
.message("[DEPS]: manifest missing 'version': " + manifestPathCanon));
|
||||
}
|
||||
if (StringUtils.isBlank(dto.target())) {
|
||||
issuesLocal.report(builder -> builder
|
||||
.error(true)
|
||||
.message("[DEPS]: manifest missing 'target': " + manifestPathCanon));
|
||||
}
|
||||
final var stdlibMaybe = parseStdlib(dto.stdlib(), manifestPathCanon, issuesLocal);
|
||||
final var target = EnumUtils.getEnum(AppMode.class, dto.target());
|
||||
if (target == null) {
|
||||
issuesLocal.report(builder -> builder
|
||||
.error(true)
|
||||
.message("[DEPS]: invalid 'target' \"" + dto.target() + "\": " + manifestPathCanon));
|
||||
}
|
||||
final var language = StringUtils.isBlank(dto.language())
|
||||
? FrontendRegistryService.getDefaultFrontendSpec().getLanguageId()
|
||||
: dto.language();
|
||||
@ -67,7 +54,7 @@ public final class PrometeuManifestUtils {
|
||||
issues.merge(issuesLocal);
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMaybe.getAsInt(), target, ReadOnlyList.wrap(dependencies)));
|
||||
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMaybe.getAsInt(), ReadOnlyList.wrap(dependencies)));
|
||||
}
|
||||
|
||||
private static OptionalInt parseStdlib(
|
||||
|
||||
@ -53,7 +53,6 @@ public class DiscoverPhase implements DependencyPhase {
|
||||
}
|
||||
if (rootPathCanon.equals(ctx.mainProjectRootPathCanon)) {
|
||||
ctx.rootStdlib = manifest.get().stdlib();
|
||||
ctx.target = manifest.get().target();
|
||||
}
|
||||
final var frontendSpec = FrontendRegistryService.getFrontendSpec(manifest.get().language());
|
||||
// Returns empty when language is unknown
|
||||
|
||||
@ -89,7 +89,6 @@ public final class WireProjectsPhase implements DependencyPhase {
|
||||
.rootPath(projectInfo.rootDirectory)
|
||||
.name(projectInfo.manifest.name())
|
||||
.version(projectInfo.manifest.version())
|
||||
.target(projectInfo.manifest.target())
|
||||
.sourceRoots(ReadOnlyList.wrap(sourceRoots))
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@ class PrometeuManifestUtilsTest {
|
||||
"version": "1.0.0",
|
||||
"language": "pbs",
|
||||
"stdlib": "1",
|
||||
"target": "Game",
|
||||
"dependencies": []
|
||||
}
|
||||
""");
|
||||
@ -75,47 +74,6 @@ class PrometeuManifestUtilsTest {
|
||||
assertTrue(issues.asCollection().stream().anyMatch(issue -> issue.getMessage().contains("invalid 'stdlib'")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildManifestRejectsNoTarget() throws IOException {
|
||||
final var manifestPath = writeManifest("""
|
||||
{
|
||||
"name": "main",
|
||||
"version": "1.0.0",
|
||||
"language": "pbs",
|
||||
"stdlib": "1",
|
||||
"dependencies": []
|
||||
}
|
||||
""");
|
||||
|
||||
final var issues = BuildingIssueSink.empty();
|
||||
final var manifest = PrometeuManifestUtils.buildManifest(tempDir, manifestPath, issues);
|
||||
|
||||
assertTrue(manifest.isEmpty());
|
||||
assertTrue(issues.hasErrors());
|
||||
assertTrue(issues.asCollection().stream().anyMatch(issue -> issue.getMessage().contains("missing 'target'")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildManifestRejectsInvalidTarget() throws IOException {
|
||||
final var manifestPath = writeManifest("""
|
||||
{
|
||||
"name": "main",
|
||||
"version": "1.0.0",
|
||||
"language": "pbs",
|
||||
"stdlib": "1",
|
||||
"target": "UnknownTarget",
|
||||
"dependencies": []
|
||||
}
|
||||
""");
|
||||
|
||||
final var issues = BuildingIssueSink.empty();
|
||||
final var manifest = PrometeuManifestUtils.buildManifest(tempDir, manifestPath, issues);
|
||||
|
||||
assertTrue(manifest.isEmpty());
|
||||
assertTrue(issues.hasErrors());
|
||||
assertTrue(issues.asCollection().stream().anyMatch(issue -> issue.getMessage().contains("invalid 'target'")));
|
||||
}
|
||||
|
||||
private Path writeManifest(final String content) throws IOException {
|
||||
final var manifestPath = tempDir.resolve("prometeu.json");
|
||||
Files.writeString(manifestPath, content);
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.compiler.workspaces.phases;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.messages.DependencyConfig;
|
||||
import p.studio.compiler.models.DependencyContext;
|
||||
import p.studio.compiler.models.ProjectDescriptor;
|
||||
@ -67,7 +66,7 @@ class StackPhaseTest {
|
||||
ctx.projectInfoTable.register(ProjectInfo.builder()
|
||||
.rootDirectory(root)
|
||||
.manifestPath(root.resolve("prometeu.json"))
|
||||
.manifest(new PrometeuManifest(name, "1.0.0", "pbs", 1, AppMode.Game, ReadOnlyList.wrap(List.of())))
|
||||
.manifest(new PrometeuManifest(name, "1.0.0", "pbs", 1, ReadOnlyList.wrap(List.of())))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.compiler.workspaces.phases;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.messages.DependencyConfig;
|
||||
import p.studio.compiler.models.DependencyContext;
|
||||
import p.studio.compiler.models.ProjectDescriptor;
|
||||
@ -43,17 +42,16 @@ class ValidatePhaseTest {
|
||||
ctx.projectInfoTable.register(ProjectInfo.builder()
|
||||
.rootDirectory(rootPath)
|
||||
.manifestPath(rootPath.resolve("prometeu.json"))
|
||||
.manifest(new PrometeuManifest("root", "1.0.0", "pbs", 1, AppMode.Game, ReadOnlyList.wrap(List.of())))
|
||||
.manifest(new PrometeuManifest("root", "1.0.0", "pbs", 1, ReadOnlyList.wrap(List.of())))
|
||||
.build());
|
||||
ctx.projectInfoTable.register(ProjectInfo.builder()
|
||||
.rootDirectory(depPath)
|
||||
.manifestPath(depPath.resolve("prometeu.json"))
|
||||
.manifest(new PrometeuManifest("dep", "1.0.0", "pbs", 2, AppMode.Game, ReadOnlyList.wrap(List.of())))
|
||||
.manifest(new PrometeuManifest("dep", "1.0.0", "pbs", 2, ReadOnlyList.wrap(List.of())))
|
||||
.build());
|
||||
|
||||
ctx.rootProjectId = rootProjectId;
|
||||
ctx.rootStdlib = 1;
|
||||
ctx.target = AppMode.Game;
|
||||
ctx.dependenciesByProject.add(List.of());
|
||||
ctx.dependenciesByProject.add(List.of());
|
||||
ctx.projectNameAndVersions.put("root", new java.util.HashSet<>(List.of("1.0.0")));
|
||||
@ -87,17 +85,16 @@ class ValidatePhaseTest {
|
||||
ctx.projectInfoTable.register(ProjectInfo.builder()
|
||||
.rootDirectory(rootPath)
|
||||
.manifestPath(rootPath.resolve("prometeu.json"))
|
||||
.manifest(new PrometeuManifest("root", "1.0.0", "pbs", 2, AppMode.Game, ReadOnlyList.wrap(List.of())))
|
||||
.manifest(new PrometeuManifest("root", "1.0.0", "pbs", 2, ReadOnlyList.wrap(List.of())))
|
||||
.build());
|
||||
ctx.projectInfoTable.register(ProjectInfo.builder()
|
||||
.rootDirectory(depPath)
|
||||
.manifestPath(depPath.resolve("prometeu.json"))
|
||||
.manifest(new PrometeuManifest("dep", "1.0.0", "pbs", 1, AppMode.Game, ReadOnlyList.wrap(List.of())))
|
||||
.manifest(new PrometeuManifest("dep", "1.0.0", "pbs", 1, ReadOnlyList.wrap(List.of())))
|
||||
.build());
|
||||
|
||||
ctx.rootProjectId = rootProjectId;
|
||||
ctx.rootStdlib = 2;
|
||||
ctx.target = AppMode.Game;
|
||||
ctx.dependenciesByProject.add(List.of());
|
||||
ctx.dependenciesByProject.add(List.of());
|
||||
ctx.projectNameAndVersions.put("root", new java.util.HashSet<>(List.of("1.0.0")));
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package p.studio.compiler.messages;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.models.BuildStack;
|
||||
import p.studio.compiler.models.SourceKind;
|
||||
import p.studio.compiler.source.identifiers.ProjectId;
|
||||
@ -14,16 +13,22 @@ public class FrontendPhaseContext {
|
||||
public final BuildStack stack;
|
||||
private final NameTable nameTable;
|
||||
private final int stdlibVersion;
|
||||
private final AppMode target;
|
||||
private final HostAdmissionContext hostAdmissionContext;
|
||||
private final FESurfaceContext feSurfaceContext;
|
||||
|
||||
public FrontendPhaseContext(
|
||||
final ProjectTableReader projectTable,
|
||||
final FileTableReader fileTable,
|
||||
final BuildStack stack) {
|
||||
this(projectTable, fileTable, stack, 1, HostAdmissionContext.permissiveDefault(), FESurfaceContext.empty());
|
||||
}
|
||||
|
||||
public FrontendPhaseContext(
|
||||
final ProjectTableReader projectTable,
|
||||
final FileTableReader fileTable,
|
||||
final BuildStack stack,
|
||||
final AppMode target) {
|
||||
this(projectTable, fileTable, stack, 1, target, HostAdmissionContext.permissiveDefault(), FESurfaceContext.empty());
|
||||
final int stdlibVersion) {
|
||||
this(projectTable, fileTable, stack, stdlibVersion, HostAdmissionContext.permissiveDefault(), FESurfaceContext.empty());
|
||||
}
|
||||
|
||||
public FrontendPhaseContext(
|
||||
@ -31,18 +36,8 @@ public class FrontendPhaseContext {
|
||||
final FileTableReader fileTable,
|
||||
final BuildStack stack,
|
||||
final int stdlibVersion,
|
||||
final AppMode target) {
|
||||
this(projectTable, fileTable, stack, stdlibVersion, target, HostAdmissionContext.permissiveDefault(), FESurfaceContext.empty());
|
||||
}
|
||||
|
||||
public FrontendPhaseContext(
|
||||
final ProjectTableReader projectTable,
|
||||
final FileTableReader fileTable,
|
||||
final BuildStack stack,
|
||||
final int stdlibVersion,
|
||||
final AppMode target,
|
||||
final HostAdmissionContext hostAdmissionContext) {
|
||||
this(projectTable, fileTable, stack, stdlibVersion, target, hostAdmissionContext, FESurfaceContext.empty());
|
||||
this(projectTable, fileTable, stack, stdlibVersion, hostAdmissionContext, FESurfaceContext.empty());
|
||||
}
|
||||
|
||||
public FrontendPhaseContext(
|
||||
@ -50,7 +45,6 @@ public class FrontendPhaseContext {
|
||||
final FileTableReader fileTable,
|
||||
final BuildStack stack,
|
||||
final int stdlibVersion,
|
||||
final AppMode target,
|
||||
final HostAdmissionContext hostAdmissionContext,
|
||||
final FESurfaceContext feSurfaceContext) {
|
||||
this.projectTable = projectTable;
|
||||
@ -58,7 +52,6 @@ public class FrontendPhaseContext {
|
||||
this.stack = stack;
|
||||
this.nameTable = new NameTable();
|
||||
this.stdlibVersion = stdlibVersion;
|
||||
this.target = target;
|
||||
this.hostAdmissionContext = hostAdmissionContext == null
|
||||
? HostAdmissionContext.permissiveDefault()
|
||||
: hostAdmissionContext;
|
||||
@ -75,10 +68,6 @@ public class FrontendPhaseContext {
|
||||
return stdlibVersion;
|
||||
}
|
||||
|
||||
public AppMode target() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public HostAdmissionContext hostAdmissionContext() {
|
||||
return hostAdmissionContext;
|
||||
}
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
package p.studio;
|
||||
|
||||
public enum AppMode {
|
||||
Game("Game"),
|
||||
System("System"),
|
||||
;
|
||||
|
||||
private final String reference;
|
||||
|
||||
AppMode(final String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String exportReferenceName() {
|
||||
return reference;
|
||||
}
|
||||
}
|
||||
@ -2,14 +2,30 @@ package p.studio.lsp.services.compiler;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import p.studio.compiler.FrontendRegistryService;
|
||||
import p.studio.compiler.messages.*;
|
||||
import p.studio.compiler.models.*;
|
||||
import p.studio.compiler.pbs.semantics.*;
|
||||
import p.studio.compiler.services.PBSFrontendPhaseService;
|
||||
import p.studio.compiler.messages.BuilderPipelineConfig;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.messages.FrontendPhaseContext;
|
||||
import p.studio.compiler.messages.BuildingIssue;
|
||||
import p.studio.compiler.messages.HostAdmissionContext;
|
||||
import p.studio.compiler.models.AnalysisSnapshot;
|
||||
import p.studio.compiler.models.BuilderPipelineContext;
|
||||
import p.studio.compiler.models.FrontendEditorPaletteSpec;
|
||||
import p.studio.compiler.models.FrontendHostProjectionEntrySpec;
|
||||
import p.studio.compiler.models.FrontendHostProjectionSpec;
|
||||
import p.studio.compiler.models.FrontendSemanticPresentationSpec;
|
||||
import p.studio.compiler.models.FrontendSemanticToken;
|
||||
import p.studio.compiler.models.FrontendTokenStyleSpec;
|
||||
import p.studio.compiler.models.FrontendVisualThemeSpec;
|
||||
import p.studio.compiler.source.identifiers.FileId;
|
||||
import p.studio.compiler.utilities.SourceProviderFactory;
|
||||
import p.studio.compiler.services.PBSFrontendPhaseService;
|
||||
import p.studio.compiler.workspaces.AssetSurfaceContextLoader;
|
||||
import p.studio.compiler.utilities.SourceProviderFactory;
|
||||
import p.studio.compiler.workspaces.BuilderPipelineService;
|
||||
import p.studio.compiler.pbs.semantics.PbsEditorialCompletionCandidate;
|
||||
import p.studio.compiler.pbs.semantics.PbsEditorialResolvedSymbol;
|
||||
import p.studio.compiler.pbs.semantics.PbsEditorialSignature;
|
||||
import p.studio.compiler.pbs.semantics.PbsEditorialSymbolKind;
|
||||
import p.studio.compiler.pbs.semantics.PbsEditorialSupportService;
|
||||
import p.studio.lsp.messages.*;
|
||||
import p.studio.lsp.services.LanguageServiceBridge;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
@ -17,7 +33,12 @@ import p.studio.utilities.structures.ReadOnlyList;
|
||||
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class CompilerLanguageServiceBridge implements LanguageServiceBridge {
|
||||
private final AssetSurfaceContextLoader assetSurfaceContextLoader = new AssetSurfaceContextLoader();
|
||||
@ -197,7 +218,6 @@ public final class CompilerLanguageServiceBridge implements LanguageServiceBridg
|
||||
pipelineContext.fileTable,
|
||||
pipelineContext.resolvedWorkspace.stack(),
|
||||
pipelineContext.resolvedWorkspace.stdlib(),
|
||||
pipelineContext.resolvedWorkspace.target(),
|
||||
HostAdmissionContext.permissiveDefault(),
|
||||
assetSurfaceContextLoader.load(pipelineContext.resolvedWorkspace.mainProject().getRootPath()));
|
||||
final var semanticReadSurface = PBSFrontendPhaseService.semanticReadSurface(
|
||||
|
||||
@ -2,8 +2,6 @@ package p.studio.projects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.projectstate.ProjectLocalStudioSetup;
|
||||
import p.studio.projectstate.ProjectLocalStudioSetupService;
|
||||
|
||||
@ -72,11 +70,11 @@ public final class ProjectCatalogService {
|
||||
}
|
||||
|
||||
public ProjectReference createProject(String projectName) {
|
||||
return createProject(new ProjectCreationRequest(projectName, projectsRoot, "pbs", 1, AppMode.Game, "src", 4, null));
|
||||
return createProject(new ProjectCreationRequest(projectName, projectsRoot, "pbs", 1, "src", 4, null));
|
||||
}
|
||||
|
||||
public ProjectReference createProject(String projectName, Path parentLocation) {
|
||||
return createProject(new ProjectCreationRequest(projectName, parentLocation, "pbs", 1, AppMode.Game, "src", 4, null));
|
||||
return createProject(new ProjectCreationRequest(projectName, parentLocation, "pbs", 1, "src", 4, null));
|
||||
}
|
||||
|
||||
public ProjectReference createProject(ProjectCreationRequest request) {
|
||||
@ -92,9 +90,6 @@ public final class ProjectCatalogService {
|
||||
if (request.stdlib() <= 0) {
|
||||
throw new IllegalArgumentException("project stdlib major must be positive");
|
||||
}
|
||||
if (request.target() == null) {
|
||||
throw new IllegalArgumentException("project target must not be null");
|
||||
}
|
||||
if (request.indentationWidth() <= 0) {
|
||||
throw new IllegalArgumentException("project indentation width must be positive");
|
||||
}
|
||||
@ -120,14 +115,13 @@ public final class ProjectCatalogService {
|
||||
"1.0.0",
|
||||
languageId,
|
||||
request.stdlib(),
|
||||
request.target(),
|
||||
projectRoot);
|
||||
Files.createDirectories(ProjectStudioPaths.studioRoot(projectReference));
|
||||
Files.createDirectories(projectRoot.resolve(sourceRoot));
|
||||
Files.createDirectories(projectRoot.resolve("assets"));
|
||||
Files.createDirectories(projectRoot.resolve("build"));
|
||||
Files.createDirectories(projectRoot.resolve("cartridge"));
|
||||
Files.writeString(manifestPath(projectRoot), defaultManifest(displayName, languageId, request.stdlib(), request.target()));
|
||||
Files.writeString(manifestPath(projectRoot), defaultManifest(displayName, languageId, request.stdlib()));
|
||||
Files.writeString(projectRoot.resolve(".gitignore"), defaultGitIgnore());
|
||||
projectLocalStudioSetupService.save(
|
||||
projectReference,
|
||||
@ -157,9 +151,6 @@ public final class ProjectCatalogService {
|
||||
if (manifest.version() == null || manifest.version().isBlank()) {
|
||||
throw new IllegalArgumentException("project manifest missing version: " + manifestPath);
|
||||
}
|
||||
if (manifest.target() == null || manifest.target().isBlank()) {
|
||||
throw new IllegalArgumentException("project manifest missing target: " + manifestPath);
|
||||
}
|
||||
if (manifest.language() == null || manifest.language().isBlank()) {
|
||||
throw new IllegalArgumentException("project manifest missing language: " + manifestPath);
|
||||
}
|
||||
@ -169,16 +160,11 @@ public final class ProjectCatalogService {
|
||||
} catch (RuntimeException runtimeException) {
|
||||
throw new IllegalArgumentException("project manifest invalid stdlib: " + manifestPath, runtimeException);
|
||||
}
|
||||
final AppMode target = EnumUtils.getEnum(AppMode.class, manifest.target());
|
||||
if (target == null) {
|
||||
throw new IllegalArgumentException("project manifest invalid target: " + manifestPath);
|
||||
}
|
||||
return new ProjectReference(
|
||||
manifest.name().trim(),
|
||||
manifest.version().trim(),
|
||||
manifest.language().trim(),
|
||||
stdlibMajor,
|
||||
target,
|
||||
normalizedRoot);
|
||||
}
|
||||
|
||||
@ -202,22 +188,17 @@ public final class ProjectCatalogService {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private String defaultManifest(
|
||||
final String projectName,
|
||||
final String languageId,
|
||||
final int stdlibMajor,
|
||||
final AppMode target) {
|
||||
private String defaultManifest(String projectName, String languageId, int stdlibMajor) {
|
||||
return """
|
||||
{
|
||||
"name": "%s",
|
||||
"version": "1.0.0",
|
||||
"language": "%s",
|
||||
"stdlib": "%d",
|
||||
"target": "%s",
|
||||
"dependencies": [
|
||||
]
|
||||
}
|
||||
""".formatted(projectName, languageId, stdlibMajor, target.exportReferenceName());
|
||||
""".formatted(projectName, languageId, stdlibMajor);
|
||||
}
|
||||
|
||||
private String defaultGitIgnore() {
|
||||
@ -242,7 +223,7 @@ public final class ProjectCatalogService {
|
||||
}
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
private record ProjectManifestSummary(String name, String version, String language, String stdlib, String target) {
|
||||
private record ProjectManifestSummary(String name, String version, String language, String stdlib) {
|
||||
}
|
||||
|
||||
private String sanitizeProjectName(String rawName) {
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package p.studio.projects;
|
||||
|
||||
import p.studio.AppMode;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public record ProjectCreationRequest(
|
||||
@ -9,7 +7,6 @@ public record ProjectCreationRequest(
|
||||
Path parentLocation,
|
||||
String languageId,
|
||||
int stdlib,
|
||||
AppMode target,
|
||||
String sourceRoot,
|
||||
int indentationWidth,
|
||||
String runtimePath) {
|
||||
|
||||
@ -2,7 +2,6 @@ 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;
|
||||
@ -12,7 +11,6 @@ public record ProjectReference(
|
||||
String version,
|
||||
String languageId,
|
||||
int stdlibVersion,
|
||||
AppMode target,
|
||||
Path rootPath) {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@ -181,7 +181,7 @@ public final class StudioShipperService {
|
||||
manifest.put("app_id", stableAppId(projectReference));
|
||||
manifest.put("title", projectReference.name());
|
||||
manifest.put("app_version", projectReference.version());
|
||||
manifest.put("app_mode", projectReference.target().exportReferenceName());
|
||||
manifest.put("app_mode", "Game");
|
||||
manifest.set("capabilities", capabilitiesNode(buildResult));
|
||||
manifest.set("asset_table", readArrayOrEmpty(projectReference.rootPath().resolve(BUILD_DIR).resolve(ASSET_TABLE_FILE)));
|
||||
manifest.set("preload", readArrayOrEmpty(projectReference.rootPath().resolve(BUILD_DIR).resolve(PRELOAD_FILE)));
|
||||
|
||||
@ -14,7 +14,6 @@ import javafx.stage.DirectoryChooser;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.Window;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.Container;
|
||||
import p.studio.projects.*;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
@ -299,7 +298,6 @@ public final class NewProjectWizard {
|
||||
Path.of(locationField.getText().trim()),
|
||||
selectedLanguageId(),
|
||||
selectedStdlib().version(),
|
||||
AppMode.Game, // hardcoded for now, we can add a separate step for this if needed
|
||||
selectedSourceRoot(),
|
||||
selectedIndentationWidth(),
|
||||
selectedRuntimePath())));
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.controls.shell;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.projects.ProjectStudioPaths;
|
||||
|
||||
@ -65,6 +64,6 @@ final class StudioActivityStorageServiceTest {
|
||||
|
||||
private ProjectReference project(String name) {
|
||||
final Path projectRoot = tempDir.resolve(name);
|
||||
return new ProjectReference("Main", "1.0.0", "pbs", 1, AppMode.Game, projectRoot);
|
||||
return new ProjectReference("Main", "1.0.0", "pbs", 1, projectRoot);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package p.studio.execution;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.StudioBackgroundTasks;
|
||||
import p.studio.debug.runtime.StudioRuntimeDebugConnectionSettings;
|
||||
import p.studio.debug.runtime.StudioRuntimeHandshakeClient;
|
||||
@ -184,7 +183,7 @@ final class StudioPlayStopCoordinatorTest {
|
||||
}
|
||||
|
||||
private ProjectReference projectReference() {
|
||||
return new ProjectReference("Main", "1.0.0", "pbs", 1, AppMode.Game, Path.of("/tmp/prometeu-play-stop"));
|
||||
return new ProjectReference("Main", "1.0.0", "pbs", 1, Path.of("/tmp/prometeu-play-stop"));
|
||||
}
|
||||
|
||||
private static final class RecordingHandshakeClient implements StudioRuntimeHandshakeClient {
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.projects;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -35,7 +34,7 @@ final class KnownProjectsServiceTest {
|
||||
final Path projectsRoot = tempDir.resolve("projects");
|
||||
Files.createDirectories(projectsRoot.resolve("alpha"));
|
||||
Files.writeString(projectsRoot.resolve("alpha").resolve("prometeu.json"), manifest("Alpha Project"));
|
||||
final ProjectReference alpha = new ProjectReference("Alpha Project", "1.0.0", "pbs", 1, AppMode.Game, projectsRoot.resolve("alpha"));
|
||||
final ProjectReference alpha = new ProjectReference("Alpha Project", "1.0.0", "pbs", 1, projectsRoot.resolve("alpha"));
|
||||
|
||||
final KnownProjectsService service = new KnownProjectsService(
|
||||
tempDir.resolve("known-projects.txt"),
|
||||
@ -53,7 +52,7 @@ final class KnownProjectsServiceTest {
|
||||
final Path projectsRoot = tempDir.resolve("projects");
|
||||
Files.createDirectories(projectsRoot.resolve("alpha"));
|
||||
Files.writeString(projectsRoot.resolve("alpha").resolve("prometeu.json"), manifest("Alpha Project"));
|
||||
final ProjectReference alpha = new ProjectReference("Alpha Project", "1.0.0", "pbs", 1, AppMode.Game, projectsRoot.resolve("alpha"));
|
||||
final ProjectReference alpha = new ProjectReference("Alpha Project", "1.0.0", "pbs", 1, projectsRoot.resolve("alpha"));
|
||||
|
||||
final KnownProjectsService service = new KnownProjectsService(
|
||||
tempDir.resolve("known-projects.txt"),
|
||||
@ -75,7 +74,6 @@ final class KnownProjectsServiceTest {
|
||||
"version": "1.0.0",
|
||||
"language": "pbs",
|
||||
"stdlib": "1",
|
||||
"target": "Game",
|
||||
"dependencies": []
|
||||
}
|
||||
""".formatted(name);
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.projects;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -39,7 +38,6 @@ final class ProjectCatalogServiceTest {
|
||||
assertEquals("1.0.0", project.version());
|
||||
assertEquals("pbs", project.languageId());
|
||||
assertEquals(1, project.stdlibVersion());
|
||||
assertEquals(AppMode.Game, project.target());
|
||||
assertTrue(Files.isDirectory(project.rootPath()));
|
||||
assertTrue(Files.isRegularFile(project.rootPath().resolve("prometeu.json")));
|
||||
assertTrue(Files.isRegularFile(project.rootPath().resolve(".gitignore")));
|
||||
@ -86,7 +84,6 @@ final class ProjectCatalogServiceTest {
|
||||
tempDir,
|
||||
"pbs",
|
||||
7,
|
||||
AppMode.Game,
|
||||
"code",
|
||||
8,
|
||||
"/opt/prometeu/runtime"));
|
||||
@ -138,7 +135,6 @@ final class ProjectCatalogServiceTest {
|
||||
"version": "1.0.0",
|
||||
"language": "pbs",
|
||||
"stdlib": "1",
|
||||
"target": "Game",
|
||||
"dependencies": []
|
||||
}
|
||||
""".formatted(name);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package p.studio.projectsessions;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.lsp.api.LspServerLifecycle;
|
||||
import p.studio.lsp.messages.LspProjectContext;
|
||||
import p.studio.lsp.messages.LspServerConfiguration;
|
||||
@ -30,7 +29,6 @@ final class StudioProjectSessionFactoryTest {
|
||||
"1.0.0",
|
||||
"pbs",
|
||||
1,
|
||||
AppMode.Game,
|
||||
Path.of("/tmp/example"));
|
||||
|
||||
final StudioProjectSession session = sessionFactory.open(projectReference);
|
||||
@ -60,7 +58,6 @@ final class StudioProjectSessionFactoryTest {
|
||||
"1.0.0",
|
||||
"pbs",
|
||||
1,
|
||||
AppMode.Game,
|
||||
Path.of("/tmp/example"))));
|
||||
|
||||
assertEquals("boom", failure.getMessage());
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package p.studio.projectsessions;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.execution.StudioExecutionSessionService;
|
||||
import p.studio.lsp.api.LspServerLifecycle;
|
||||
import p.studio.lsp.messages.LspProjectContext;
|
||||
@ -73,7 +72,7 @@ final class StudioProjectSessionTest {
|
||||
}
|
||||
|
||||
private ProjectReference projectReference() {
|
||||
return new ProjectReference("Example", "1.0.0", "pbs", 1, AppMode.Game, Path.of("/tmp/example"));
|
||||
return new ProjectReference("Example", "1.0.0", "pbs", 1, Path.of("/tmp/example"));
|
||||
}
|
||||
|
||||
private static final class RecordingProjectLocalStudioStateService extends ProjectLocalStudioStateService {
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.projectstate;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.projects.ProjectStudioPaths;
|
||||
|
||||
@ -76,6 +75,6 @@ final class ProjectLocalStudioSetupServiceTest {
|
||||
|
||||
private ProjectReference project(final String name) {
|
||||
final Path projectRoot = tempDir.resolve(name);
|
||||
return new ProjectReference("Main", "1.0.0", "pbs", 1, AppMode.Game, projectRoot);
|
||||
return new ProjectReference("Main", "1.0.0", "pbs", 1, projectRoot);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package p.studio.projectstate;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.projects.ProjectStudioPaths;
|
||||
|
||||
@ -98,6 +97,6 @@ final class ProjectLocalStudioStateServiceTest {
|
||||
|
||||
private ProjectReference project(final String name) {
|
||||
final Path projectRoot = tempDir.resolve(name);
|
||||
return new ProjectReference("Main", "1.0.0", "pbs", 1, AppMode.Game, projectRoot);
|
||||
return new ProjectReference("Main", "1.0.0", "pbs", 1, projectRoot);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import p.packer.messages.assets.AssetFamilyCatalog;
|
||||
import p.packer.messages.assets.OutputCodecCatalog;
|
||||
import p.packer.messages.assets.OutputFormatCatalog;
|
||||
import p.packer.messages.assets.PackerCodecConfigurationFieldType;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.workspaces.assets.metadata.AssetStudioGlyphSpecialization;
|
||||
import p.studio.workspaces.assets.metadata.AssetStudioSceneBankMetadata;
|
||||
@ -119,7 +118,7 @@ final class SceneBankWorkflowServiceTest {
|
||||
}
|
||||
|
||||
private ProjectReference projectReference() {
|
||||
return new ProjectReference("main", "1", "pbs", 1, AppMode.Game, tempDir.resolve("project"));
|
||||
return new ProjectReference("main", "1", "pbs", 1, tempDir.resolve("project"));
|
||||
}
|
||||
|
||||
private AssetWorkspaceAssetDetails createValidScene(ProjectReference project) throws Exception {
|
||||
|
||||
@ -8,10 +8,13 @@ import p.packer.messages.assets.AssetFamilyCatalog;
|
||||
import p.packer.messages.assets.OutputCodecCatalog;
|
||||
import p.packer.messages.assets.OutputFormatCatalog;
|
||||
import p.packer.messages.assets.PackerCodecConfigurationFieldType;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.workspaces.assets.metadata.AssetStudioGlyphSpecialization;
|
||||
import p.studio.workspaces.assets.metadata.AssetStudioMetadataService;
|
||||
import p.studio.workspaces.assets.metadata.AssetStudioSceneBankMetadata;
|
||||
import p.studio.workspaces.assets.metadata.AssetStudioSceneLayerBinding;
|
||||
import p.studio.workspaces.assets.metadata.AssetStudioSceneTile;
|
||||
import p.studio.workspaces.assets.messages.*;
|
||||
import p.studio.workspaces.assets.metadata.*;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -42,8 +45,8 @@ final class TiledAssetGenerationServiceTest {
|
||||
assertTrue(Files.isRegularFile(tsxPath));
|
||||
final TiledTilesetDocument tileset = codec.readTileset(tsxPath);
|
||||
assertEquals(2, tileset.tiles().size());
|
||||
assertEquals("a.png", tileset.tiles().getFirst().imageSource());
|
||||
assertEquals("glyph_id", tileset.tiles().getFirst().properties().getFirst().name());
|
||||
assertEquals("a.png", tileset.tiles().get(0).imageSource());
|
||||
assertEquals("glyph_id", tileset.tiles().get(0).properties().getFirst().name());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -67,7 +70,7 @@ final class TiledAssetGenerationServiceTest {
|
||||
final Path sceneRoot = projectRoot.resolve("assets/scenes/overworld");
|
||||
Files.createDirectories(sceneRoot);
|
||||
final AssetWorkspaceAssetDetails details = sceneDetails(sceneRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, AppMode.Game, projectRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, projectRoot);
|
||||
|
||||
final TiledAssetGenerationResult result = service.exportSceneBankTmx(projectReference, details);
|
||||
|
||||
@ -102,7 +105,7 @@ final class TiledAssetGenerationServiceTest {
|
||||
final Path sceneRoot = projectRoot.resolve("assets/scenes/overworld");
|
||||
Files.createDirectories(sceneRoot);
|
||||
final AssetWorkspaceAssetDetails details = sceneDetails(sceneRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, AppMode.Game, projectRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, projectRoot);
|
||||
|
||||
final Path tmxPath = sceneRoot.resolve("scene.tmx");
|
||||
Files.writeString(tmxPath, "legacy");
|
||||
@ -142,7 +145,7 @@ final class TiledAssetGenerationServiceTest {
|
||||
final Path sceneRoot = projectRoot.resolve("assets/scenes/overworld");
|
||||
Files.createDirectories(sceneRoot);
|
||||
final AssetWorkspaceAssetDetails details = sceneDetails(sceneRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, AppMode.Game, projectRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, projectRoot);
|
||||
assertTrue(service.exportSceneBankTmx(projectReference, details).success());
|
||||
|
||||
final Path tmxPath = sceneRoot.resolve("scene.tmx");
|
||||
@ -180,7 +183,7 @@ final class TiledAssetGenerationServiceTest {
|
||||
final Path sceneRoot = projectRoot.resolve("assets/scenes/overworld");
|
||||
Files.createDirectories(sceneRoot);
|
||||
final AssetWorkspaceAssetDetails details = sceneDetails(sceneRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, AppMode.Game, projectRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, projectRoot);
|
||||
assertTrue(service.exportSceneBankTmx(projectReference, details).success());
|
||||
|
||||
final Path tsxPath = tilesetRoot.resolve(TiledAssetGenerationService.GENERATED_TSX_FILE);
|
||||
@ -221,7 +224,7 @@ final class TiledAssetGenerationServiceTest {
|
||||
final Path sceneRoot = projectRoot.resolve("assets/scenes/overworld");
|
||||
Files.createDirectories(sceneRoot);
|
||||
final AssetWorkspaceAssetDetails details = sceneDetails(sceneRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, AppMode.Game, projectRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, projectRoot);
|
||||
assertTrue(service.exportSceneBankTmx(projectReference, details).success());
|
||||
|
||||
final Path tmxPath = sceneRoot.resolve("scene.tmx");
|
||||
@ -287,7 +290,7 @@ final class TiledAssetGenerationServiceTest {
|
||||
final Path sceneRoot = projectRoot.resolve("assets/scenes/overworld");
|
||||
Files.createDirectories(sceneRoot);
|
||||
final AssetWorkspaceAssetDetails details = sceneDetails(sceneRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, AppMode.Game, projectRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, projectRoot);
|
||||
assertTrue(service.exportSceneBankTmx(projectReference, details).success());
|
||||
|
||||
final Path tmxPath = sceneRoot.resolve("scene.tmx");
|
||||
@ -358,7 +361,7 @@ final class TiledAssetGenerationServiceTest {
|
||||
final Path sceneRoot = projectRoot.resolve("assets/scenes/overworld");
|
||||
Files.createDirectories(sceneRoot);
|
||||
final AssetWorkspaceAssetDetails details = sceneDetails(sceneRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, AppMode.Game, projectRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, projectRoot);
|
||||
|
||||
final Path tmxPath = sceneRoot.resolve("scene.tmx");
|
||||
Files.writeString(tmxPath, """
|
||||
@ -395,7 +398,7 @@ final class TiledAssetGenerationServiceTest {
|
||||
final Path sceneRoot = projectRoot.resolve("assets/scenes/overworld");
|
||||
Files.createDirectories(sceneRoot);
|
||||
final AssetWorkspaceAssetDetails details = sceneDetails(sceneRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, AppMode.Game, projectRoot);
|
||||
final ProjectReference projectReference = new ProjectReference("main", "1", "pbs", 1, projectRoot);
|
||||
|
||||
final Path tmxPath = sceneRoot.resolve("scene.tmx");
|
||||
Files.writeString(tmxPath, """
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
"version": "1.0.0",
|
||||
"language": "pbs",
|
||||
"stdlib": "1",
|
||||
"target": "Game",
|
||||
"dependencies": [
|
||||
]
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,6 @@
|
||||
"version": "1.0.0",
|
||||
"language": "pbs",
|
||||
"stdlib": "1",
|
||||
"target": "Game",
|
||||
"dependencies": [
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user