implements PR023
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ public final class DependencyContext {
|
||||
throw new BuildException("dependenciesByProjectId: internal error: rootProjectId ProjectId not set");
|
||||
}
|
||||
if (rootStdlib == null) {
|
||||
throw new BuildException("dependenciesByProjectId: internal error: rootStdlibMajor not set");
|
||||
throw new BuildException("dependenciesByProjectId: internal error: rootStdlib not set");
|
||||
}
|
||||
final var dependenciesByProject = buildDependenciesByProject();
|
||||
final var workspaceGraph = new WorkspaceGraph(projectTable, dependenciesByProject);
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import p.studio.compiler.source.identifiers.ProjectId;
|
||||
public record ResolvedWorkspace(
|
||||
ProjectId mainProjectId,
|
||||
FrontendSpec frontendSpec,
|
||||
int stdlibMajor,
|
||||
int stdlib,
|
||||
WorkspaceGraph graph,
|
||||
BuildStack stack) {
|
||||
public ProjectDescriptor mainProject() {
|
||||
|
||||
+11
-11
@@ -45,7 +45,7 @@ public final class PrometeuManifestUtils {
|
||||
.error(true)
|
||||
.message("[DEPS]: manifest missing 'version': " + manifestPathCanon));
|
||||
}
|
||||
final var stdlibMajorMaybe = parseStdlibMajor(dto.stdlib(), manifestPathCanon, issuesLocal);
|
||||
final var stdlibMaybe = parseStdlib(dto.stdlib(), manifestPathCanon, issuesLocal);
|
||||
final var language = StringUtils.isBlank(dto.language())
|
||||
? FrontendRegistryService.getDefaultFrontendSpec().getLanguageId()
|
||||
: dto.language();
|
||||
@@ -54,34 +54,34 @@ public final class PrometeuManifestUtils {
|
||||
issues.merge(issuesLocal);
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMajorMaybe.getAsInt(), ReadOnlyList.wrap(dependencies)));
|
||||
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMaybe.getAsInt(), ReadOnlyList.wrap(dependencies)));
|
||||
}
|
||||
|
||||
private static OptionalInt parseStdlibMajor(
|
||||
final String stdlib,
|
||||
private static OptionalInt parseStdlib(
|
||||
final String stdlibStr,
|
||||
final Path manifestPathCanon,
|
||||
final BuildingIssueSink issues) {
|
||||
if (StringUtils.isBlank(stdlib)) {
|
||||
if (StringUtils.isBlank(stdlibStr)) {
|
||||
issues.report(builder -> builder
|
||||
.error(true)
|
||||
.message("[DEPS]: manifest missing 'stdlib': " + manifestPathCanon));
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
final int stdlibMajor;
|
||||
final int stdlib;
|
||||
try {
|
||||
stdlibMajor = Integer.parseInt(stdlib);
|
||||
stdlib = Integer.parseInt(stdlibStr);
|
||||
} catch (NumberFormatException e) {
|
||||
issues.report(builder -> builder
|
||||
.error(true)
|
||||
.message("[DEPS]: invalid 'stdlib' major version \"" + stdlib + "\": " + manifestPathCanon));
|
||||
.message("[DEPS]: invalid 'stdlib' major version \"" + stdlibStr + "\": " + manifestPathCanon));
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
if (stdlibMajor <= 0 || !stdlib.equals(Integer.toString(stdlibMajor))) {
|
||||
if (stdlib <= 0 || !stdlibStr.equals(Integer.toString(stdlib))) {
|
||||
issues.report(builder -> builder
|
||||
.error(true)
|
||||
.message("[DEPS]: invalid 'stdlib' major version \"" + stdlib + "\": " + manifestPathCanon));
|
||||
.message("[DEPS]: invalid 'stdlib' major version \"" + stdlibStr + "\": " + manifestPathCanon));
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
return OptionalInt.of(stdlibMajor);
|
||||
return OptionalInt.of(stdlib);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user