clean up
This commit is contained in:
parent
9373996f86
commit
a3d512d8ce
@ -1,10 +1,5 @@
|
|||||||
package p.studio.compiler.messages;
|
package p.studio.compiler.messages;
|
||||||
|
|
||||||
import lombok.Getter;
|
public record BuilderPipelineConfig(
|
||||||
import lombok.Setter;
|
boolean explain,
|
||||||
|
String rootProjectPath) {}
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class BuilderPipelineConfig {
|
|
||||||
private String rootProjectPath;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import p.studio.compiler.exceptions.BuildException;
|
import p.studio.compiler.exceptions.BuildException;
|
||||||
import p.studio.compiler.messages.BuilderPipelineConfig;
|
import p.studio.compiler.messages.BuilderPipelineConfig;
|
||||||
import p.studio.compiler.models.BuilderPipelineContext;
|
import p.studio.compiler.models.BuilderPipelineContext;
|
||||||
import p.studio.compiler.workspaces.stages.DepsPipelineStage;
|
import p.studio.compiler.workspaces.stages.DependencyPipelineStage;
|
||||||
import p.studio.utilities.logs.LogAggregator;
|
import p.studio.utilities.logs.LogAggregator;
|
||||||
import p.studio.utilities.structures.ReadOnlyCollection;
|
import p.studio.utilities.structures.ReadOnlyCollection;
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ public class BuilderPipelineService {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
final var stages = List.<PipelineStage>of(
|
final var stages = List.<PipelineStage>of(
|
||||||
new DepsPipelineStage()
|
new DependencyPipelineStage()
|
||||||
);
|
);
|
||||||
INSTANCE = new BuilderPipelineService(stages);
|
INSTANCE = new BuilderPipelineService(stages);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,19 +11,19 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
public class DepsPipelineStage implements PipelineStage {
|
public class DependencyPipelineStage implements PipelineStage {
|
||||||
@Override
|
@Override
|
||||||
public BuildingIssues run(final BuilderPipelineContext ctx, LogAggregator logs) {
|
public BuildingIssues run(final BuilderPipelineContext ctx, LogAggregator logs) {
|
||||||
final Path rootCanonPath;
|
final Path rootCanonPath;
|
||||||
try {
|
try {
|
||||||
rootCanonPath = Paths.get(ctx.config.getRootProjectPath()).toRealPath();
|
rootCanonPath = Paths.get(ctx.config.rootProjectPath()).toRealPath();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return BuildingIssues.empty()
|
return BuildingIssues.empty()
|
||||||
.add(builder -> builder.error(true)
|
.add(builder -> builder.error(true)
|
||||||
.message("[BUILD]: root project directory no found: " + ctx.config.getRootProjectPath()));
|
.message("[BUILD]: root project directory no found: " + ctx.config.rootProjectPath()));
|
||||||
}
|
}
|
||||||
final var cfg = new DependencyConfig(false, rootCanonPath);
|
final var dependencyConfig = new DependencyConfig(ctx.config.explain(), rootCanonPath);
|
||||||
ctx.resolvedWorkspace = DependencyService.INSTANCE.run(cfg, logs);
|
ctx.resolvedWorkspace = DependencyService.INSTANCE.run(dependencyConfig, logs);
|
||||||
ctx.resolvedWorkspace.topologicalOrder().forEach(pd -> logs.info("Project [ " + pd.getName() + " ] read"));
|
ctx.resolvedWorkspace.topologicalOrder().forEach(pd -> logs.info("Project [ " + pd.getName() + " ] read"));
|
||||||
return BuildingIssues.empty();
|
return BuildingIssues.empty();
|
||||||
}
|
}
|
||||||
@ -51,8 +51,7 @@ public class BuilderWorkspace implements Workspace {
|
|||||||
buildButton.textProperty().bind(Container.i18n().bind(I18n.WORKSPACE_BUILDER_BUTTON_RUN));
|
buildButton.textProperty().bind(Container.i18n().bind(I18n.WORKSPACE_BUILDER_BUTTON_RUN));
|
||||||
buildButton.setOnAction(e -> {
|
buildButton.setOnAction(e -> {
|
||||||
final var logAggregator = LogAggregator.with(logs::appendText);
|
final var logAggregator = LogAggregator.with(logs::appendText);
|
||||||
final var config = new BuilderPipelineConfig();
|
final var config = new BuilderPipelineConfig(false, "../test-projects/main");
|
||||||
config.setRootProjectPath("../test-projects/main");
|
|
||||||
BuilderPipelineService.INSTANCE.run(config, logAggregator);
|
BuilderPipelineService.INSTANCE.run(config, logAggregator);
|
||||||
});
|
});
|
||||||
return new ToolBar(buildButton);
|
return new ToolBar(buildButton);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user