add AppMode for best boundaries over stdlib
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 61.98% (17344/27983)
* Branch Coverage: 53.07% (6720/12663)
* Lines of Code: 27983
* Cyclomatic Complexity: 11207
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 11, passed: 581
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 61.98% (17344/27983)
* Branch Coverage: 53.07% (6720/12663)
* Lines of Code: 27983
* Cyclomatic Complexity: 11207
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 11, passed: 581
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
This commit is contained in:
+1
@@ -10,6 +10,7 @@ public record PrometeuManifestDTO(
|
||||
String version,
|
||||
String language,
|
||||
String stdlib,
|
||||
String target,
|
||||
List<DependencyDeclaration> dependencies) {
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
||||
|
||||
+3
-1
@@ -1,5 +1,6 @@
|
||||
package p.studio.compiler.models;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.exceptions.BuildException;
|
||||
import p.studio.compiler.messages.DependencyConfig;
|
||||
import p.studio.compiler.source.identifiers.ProjectId;
|
||||
@@ -23,6 +24,7 @@ public final class DependencyContext {
|
||||
public Path mainProjectRootPathCanon;
|
||||
public FrontendSpec frontendSpec;
|
||||
public Integer rootStdlib;
|
||||
public AppMode target;
|
||||
public ProjectId rootProjectId;
|
||||
public BuildStack stack;
|
||||
|
||||
@@ -51,7 +53,7 @@ public final class DependencyContext {
|
||||
}
|
||||
final var dependenciesByProject = buildDependenciesByProject();
|
||||
final var workspaceGraph = new WorkspaceGraph(projectTable, dependenciesByProject);
|
||||
return new ResolvedWorkspace(rootProjectId, frontendSpec, rootStdlib, workspaceGraph, stack);
|
||||
return new ResolvedWorkspace(rootProjectId, frontendSpec, rootStdlib, target, workspaceGraph, stack);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package p.studio.compiler.models;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.workspaces.DependencyReference;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
|
||||
@@ -8,5 +9,6 @@ public record PrometeuManifest(
|
||||
String version,
|
||||
String language,
|
||||
int stdlib,
|
||||
AppMode target,
|
||||
ReadOnlyList<DependencyReference> dependencies) {
|
||||
}
|
||||
|
||||
+2
@@ -1,11 +1,13 @@
|
||||
package p.studio.compiler.models;
|
||||
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.source.identifiers.ProjectId;
|
||||
|
||||
public record ResolvedWorkspace(
|
||||
ProjectId mainProjectId,
|
||||
FrontendSpec frontendSpec,
|
||||
int stdlib,
|
||||
AppMode target,
|
||||
WorkspaceGraph graph,
|
||||
BuildStack stack) {
|
||||
public ProjectDescriptor mainProject() {
|
||||
|
||||
+14
-1
@@ -2,7 +2,9 @@ package p.studio.compiler.utilities;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.FrontendRegistryService;
|
||||
import p.studio.compiler.dtos.PrometeuManifestDTO;
|
||||
import p.studio.compiler.messages.BuildingIssueSink;
|
||||
@@ -45,7 +47,18 @@ public final class PrometeuManifestUtils {
|
||||
.error(true)
|
||||
.message("[DEPS]: manifest missing 'version': " + manifestPathCanon));
|
||||
}
|
||||
if (StringUtils.isBlank(dto.target())) {
|
||||
issuesLocal.report(builder -> builder
|
||||
.error(true)
|
||||
.message("[DEPS]: manifest missing 'target': " + manifestPathCanon));
|
||||
}
|
||||
final var stdlibMaybe = parseStdlib(dto.stdlib(), manifestPathCanon, issuesLocal);
|
||||
final var target = EnumUtils.getEnum(AppMode.class, dto.target());
|
||||
if (target == null) {
|
||||
issuesLocal.report(builder -> builder
|
||||
.error(true)
|
||||
.message("[DEPS]: invalid 'target' \"" + dto.target() + "\": " + manifestPathCanon));
|
||||
}
|
||||
final var language = StringUtils.isBlank(dto.language())
|
||||
? FrontendRegistryService.getDefaultFrontendSpec().getLanguageId()
|
||||
: dto.language();
|
||||
@@ -54,7 +67,7 @@ public final class PrometeuManifestUtils {
|
||||
issues.merge(issuesLocal);
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMaybe.getAsInt(), ReadOnlyList.wrap(dependencies)));
|
||||
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMaybe.getAsInt(), target, ReadOnlyList.wrap(dependencies)));
|
||||
}
|
||||
|
||||
private static OptionalInt parseStdlib(
|
||||
|
||||
+1
@@ -53,6 +53,7 @@ public class DiscoverPhase implements DependencyPhase {
|
||||
}
|
||||
if (rootPathCanon.equals(ctx.mainProjectRootPathCanon)) {
|
||||
ctx.rootStdlib = manifest.get().stdlib();
|
||||
ctx.target = manifest.get().target();
|
||||
}
|
||||
final var frontendSpec = FrontendRegistryService.getFrontendSpec(manifest.get().language());
|
||||
// Returns empty when language is unknown
|
||||
|
||||
+1
@@ -89,6 +89,7 @@ public final class WireProjectsPhase implements DependencyPhase {
|
||||
.rootPath(projectInfo.rootDirectory)
|
||||
.name(projectInfo.manifest.name())
|
||||
.version(projectInfo.manifest.version())
|
||||
.target(projectInfo.manifest.target())
|
||||
.sourceRoots(ReadOnlyList.wrap(sourceRoots))
|
||||
.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user