frontend spec by workspace instead
This commit is contained in:
+2
-4
@@ -1,11 +1,9 @@
|
||||
package p.studio.compiler.workspaces;
|
||||
|
||||
import p.studio.compiler.messages.BuildingIssue;
|
||||
import p.studio.compiler.messages.BuildingIssues;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.models.BuilderPipelineContext;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
import p.studio.utilities.structures.ReadOnlyCollection;
|
||||
|
||||
public interface PipelineStage {
|
||||
BuildingIssues run(BuilderPipelineContext ctx, LogAggregator logs);
|
||||
BuildingIssueSink run(BuilderPipelineContext ctx, LogAggregator logs);
|
||||
}
|
||||
|
||||
+6
-6
@@ -3,7 +3,7 @@ package p.studio.compiler.workspaces.stages;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import p.studio.compiler.messages.BuildingIssues;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.models.BuilderPipelineContext;
|
||||
import p.studio.compiler.models.SourceHandle;
|
||||
import p.studio.compiler.workspaces.PipelineStage;
|
||||
@@ -26,15 +26,15 @@ import java.util.stream.Collectors;
|
||||
public class LoadPipelineStage implements PipelineStage {
|
||||
|
||||
@Override
|
||||
public BuildingIssues run(final BuilderPipelineContext ctx, final LogAggregator logs) {
|
||||
final var issues = BuildingIssues.empty();
|
||||
public BuildingIssueSink run(final BuilderPipelineContext ctx, final LogAggregator logs) {
|
||||
final var issues = BuildingIssueSink.empty();
|
||||
|
||||
// Iterates projects; "loads sources"; registers files
|
||||
ctx.resolvedWorkspace.topologicalOrder().forEach(pId -> {
|
||||
final var pd = ctx.resolvedWorkspace.graph().projectTable().get(pId);
|
||||
logs.using(log).info("Project [ " + pd.getName() + " ] source loading...");
|
||||
|
||||
final var allowedExtensions = normalize(pd.getFrontendSpec().getAllowedExtensions());
|
||||
final var allowedExtensions = normalize(ctx.resolvedWorkspace.frontendSpec().getAllowedExtensions());
|
||||
for (final var sourceRootPath : pd.getSourceRoots()) {
|
||||
logs.using(log).debug("Walking source root [ " + sourceRootPath + " ]");
|
||||
|
||||
@@ -52,14 +52,14 @@ public class LoadPipelineStage implements PipelineStage {
|
||||
var fileId = ctx.fileTable.register(rawFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
issues.add(builder -> builder
|
||||
issues.report(builder -> builder
|
||||
.error(true)
|
||||
.message("Failed to load project [ " + pd.getName() + " ]")
|
||||
.exception(e));
|
||||
}
|
||||
}
|
||||
});
|
||||
return BuildingIssues.empty();
|
||||
return BuildingIssueSink.empty();
|
||||
}
|
||||
|
||||
private static ReadOnlySet<String> normalize(final ReadOnlySet<String> extensions) {
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
package p.studio.compiler.workspaces.stages;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import p.studio.compiler.messages.BuildingIssues;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
import p.studio.compiler.messages.DependencyConfig;
|
||||
import p.studio.compiler.models.BuilderPipelineContext;
|
||||
import p.studio.compiler.workspaces.DependencyService;
|
||||
@@ -14,18 +14,18 @@ import java.nio.file.Paths;
|
||||
@Slf4j
|
||||
public class ResolvePipelineStage implements PipelineStage {
|
||||
@Override
|
||||
public BuildingIssues run(final BuilderPipelineContext ctx, LogAggregator logs) {
|
||||
public BuildingIssueSink run(final BuilderPipelineContext ctx, LogAggregator logs) {
|
||||
try {
|
||||
ctx.rootProjectPathCanon = Paths.get(ctx.config.rootProjectPath()).toRealPath();
|
||||
} catch (IOException e) {
|
||||
return BuildingIssues.empty()
|
||||
.add(builder -> builder
|
||||
return BuildingIssueSink.empty()
|
||||
.report(builder -> builder
|
||||
.error(true)
|
||||
.message("[BUILD]: root project directory no found: " + ctx.config.rootProjectPath())
|
||||
.exception(e));
|
||||
}
|
||||
final var dependencyConfig = new DependencyConfig(ctx.config.explain(), ctx.rootProjectPathCanon);
|
||||
ctx.resolvedWorkspace = DependencyService.INSTANCE.run(dependencyConfig, logs);
|
||||
return BuildingIssues.empty();
|
||||
return BuildingIssueSink.empty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user