small fixes
This commit is contained in:
+6
-15
@@ -1,27 +1,18 @@
|
||||
package p.studio.compiler.models;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import p.studio.compiler.messages.BuilderPipelineConfig;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
|
||||
public class BuilderPipelineContext {
|
||||
@Getter
|
||||
private final BuilderPipelineConfig config;
|
||||
@Getter
|
||||
private final LogAggregator logs;
|
||||
@Getter
|
||||
@Setter
|
||||
private ResolvedWorkspace resolvedWorkspace;
|
||||
public final BuilderPipelineConfig config;
|
||||
|
||||
public ResolvedWorkspace resolvedWorkspace;
|
||||
|
||||
private BuilderPipelineContext(
|
||||
final BuilderPipelineConfig config,
|
||||
final LogAggregator logs) {
|
||||
final BuilderPipelineConfig config) {
|
||||
this.config = config;
|
||||
this.logs = logs;
|
||||
}
|
||||
|
||||
public static BuilderPipelineContext seed(BuilderPipelineConfig config, LogAggregator logAggregator) {
|
||||
return new BuilderPipelineContext(config, logAggregator);
|
||||
public static BuilderPipelineContext basedOn(BuilderPipelineConfig config) {
|
||||
return new BuilderPipelineContext(config);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -30,10 +30,10 @@ public class BuilderPipelineService {
|
||||
public void run(
|
||||
final BuilderPipelineConfig config,
|
||||
final LogAggregator logs) {
|
||||
final var ctx = BuilderPipelineContext.seed(config, logs);
|
||||
final var ctx = BuilderPipelineContext.basedOn(config);
|
||||
|
||||
for (final var builderPipelineStage : stages) {
|
||||
final var issues = builderPipelineStage.run(ctx);
|
||||
final var issues = builderPipelineStage.run(ctx, logs);
|
||||
var error = false;
|
||||
if (ReadOnlyCollection.isNotEmpty(issues)) {
|
||||
for (final var issue : issues) {
|
||||
|
||||
+2
-1
@@ -2,8 +2,9 @@ package p.studio.compiler.workspaces;
|
||||
|
||||
import p.studio.compiler.messages.BuildingIssue;
|
||||
import p.studio.compiler.models.BuilderPipelineContext;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
import p.studio.utilities.structures.ReadOnlyCollection;
|
||||
|
||||
public interface PipelineStage {
|
||||
ReadOnlyCollection<BuildingIssue> run(BuilderPipelineContext ctx);
|
||||
ReadOnlyCollection<BuildingIssue> run(BuilderPipelineContext ctx, LogAggregator logs);
|
||||
}
|
||||
|
||||
+9
-9
@@ -5,33 +5,33 @@ import p.studio.compiler.messages.DependencyConfig;
|
||||
import p.studio.compiler.models.BuilderPipelineContext;
|
||||
import p.studio.compiler.workspaces.DependencyService;
|
||||
import p.studio.compiler.workspaces.PipelineStage;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
import p.studio.utilities.structures.ReadOnlyCollection;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
public class DepsPipelineStage implements PipelineStage {
|
||||
@Override
|
||||
public ReadOnlyCollection<BuildingIssue> run(final BuilderPipelineContext ctx) {
|
||||
public ReadOnlyCollection<BuildingIssue> run(final BuilderPipelineContext ctx, LogAggregator logs) {
|
||||
final Path rootCanonPath;
|
||||
try {
|
||||
rootCanonPath = Paths.get(ctx.getConfig().getRootProjectPath()).toRealPath();
|
||||
rootCanonPath = Paths.get(ctx.config.getRootProjectPath()).toRealPath();
|
||||
} catch (IOException e) {
|
||||
return ReadOnlyCollection.wrap(List.of(BuildingIssue
|
||||
return ReadOnlyCollection.with(BuildingIssue
|
||||
.builder()
|
||||
.error(true)
|
||||
.message("[DEPS]: rootProjectId directory no found: " + ctx.getConfig().getRootProjectPath())
|
||||
.build()));
|
||||
.message("[DEPS]: rootProjectId directory no found: " + ctx.config.getRootProjectPath())
|
||||
.build());
|
||||
}
|
||||
final var cfg = new DependencyConfig(false, rootCanonPath);
|
||||
final var resolvedWorkspace = DependencyService.INSTANCE.run(cfg, ctx.getLogs());
|
||||
final var resolvedWorkspace = DependencyService.INSTANCE.run(cfg, logs);
|
||||
for (final var pId : resolvedWorkspace.stack().projects()) {
|
||||
final var pd = resolvedWorkspace.graph().projectTable().get(pId);
|
||||
ctx.getLogs().info("Project [ " + pd.getName() + " ] read");
|
||||
logs.info("Project [ " + pd.getName() + " ] read");
|
||||
}
|
||||
ctx.setResolvedWorkspace(resolvedWorkspace);
|
||||
ctx.resolvedWorkspace = resolvedWorkspace;
|
||||
return ReadOnlyCollection.empty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user