added frontend compile phase
This commit is contained in:
+14
@@ -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();
|
||||
}
|
||||
}
|
||||
+9
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user