re-shape of compiler pipeline
This commit is contained in:
+25
-12
@@ -14,31 +14,36 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
class BuilderPipelineServiceOrderTest {
|
||||
|
||||
@Test
|
||||
void canonicalOrderMustContainOptimizeBetweenLowerAndEmit() throws Exception {
|
||||
final Field field = BuilderPipelineService.class.getDeclaredField("stages");
|
||||
field.setAccessible(true);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final var stages = (List<PipelineStage>) field.get(BuilderPipelineService.INSTANCE);
|
||||
final var stageTypes = stages.stream().map(Object::getClass).toList();
|
||||
void canonicalOrderMustExposeExpectedStageGroups() throws Exception {
|
||||
final var analyzeStages = stages("analyses");
|
||||
final var compileStages = stages("compile");
|
||||
final var buildStages = stages("build");
|
||||
|
||||
assertEquals(
|
||||
List.of(
|
||||
ResolveDepsPipelineStage.class,
|
||||
LoadSourcesPipelineStage.class,
|
||||
FrontendPhasePipelineStage.class,
|
||||
FrontendPhasePipelineStage.class),
|
||||
analyzeStages);
|
||||
|
||||
assertEquals(
|
||||
List.of(
|
||||
LowerToIRVMPipelineStage.class,
|
||||
OptimizeIRVMPipelineStage.class,
|
||||
EmitBytecodePipelineStage.class,
|
||||
LinkBytecodePipelineStage.class,
|
||||
VerifyBytecodePipelineStage.class,
|
||||
WriteBytecodeArtifactPipelineStage.class),
|
||||
stageTypes);
|
||||
VerifyBytecodePipelineStage.class),
|
||||
compileStages);
|
||||
|
||||
assertEquals(
|
||||
List.of(WriteBytecodeArtifactPipelineStage.class),
|
||||
buildStages);
|
||||
}
|
||||
|
||||
@Test
|
||||
void publicSurfaceMustExposeExplicitEntryPointsWithoutRun() {
|
||||
final var methodNames = List.of(BuilderPipelineService.class.getDeclaredMethods()).stream()
|
||||
final var methodNames = List.of(BuilderPipelineService.class.getMethods()).stream()
|
||||
.filter(method -> method.getDeclaringClass().equals(BuilderPipelineService.class))
|
||||
.map(Method::getName)
|
||||
.toList();
|
||||
|
||||
@@ -47,4 +52,12 @@ class BuilderPipelineServiceOrderTest {
|
||||
assertTrue(methodNames.contains("build"));
|
||||
assertFalse(methodNames.contains("run"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<Class<?>> stages(final String fieldName) throws Exception {
|
||||
final Field field = BuilderPipelineService.class.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
final var stages = (List<PipelineStage>) field.get(BuilderPipelineService.INSTANCE);
|
||||
return stages.stream().map(Object::getClass).toList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user