added frontend compile phase

This commit is contained in:
2026-03-24 13:42:15 +00:00
parent 31c59f670e
commit c7c6c8bef5
18 changed files with 107 additions and 28 deletions
@@ -0,0 +1,14 @@
package p.studio.compiler.models;
import p.studio.compiler.source.identifiers.ProjectId;
import p.studio.utilities.structures.ReadOnlyList;
public class BuildStack {
public final ReadOnlyList<ProjectId> topologicalOrder;
public final ReadOnlyList<ProjectId> reverseTopologicalOrder;
public BuildStack(final ReadOnlyList<ProjectId> topologicalOrder) {
this.topologicalOrder = topologicalOrder;
this.reverseTopologicalOrder = topologicalOrder.invert();
}
}
@@ -12,6 +12,7 @@ import java.nio.file.Path;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Optional;
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class SourceHandle {
@@ -46,12 +47,16 @@ public class SourceHandle {
this.provider = factory.create(canonPath);
}
public byte[] readBytes() throws IOException {
return provider.read();
public Optional<byte[]> readBytes() {
try {
return Optional.ofNullable(provider.read());
} catch (IOException e) {
return Optional.empty();
}
}
public String readUtf8() throws IOException {
return new String(readBytes(), StandardCharsets.UTF_8);
public Optional<String> readUtf8() {
return readBytes().map(bytes -> new String(bytes, StandardCharsets.UTF_8));
}
@Override