Skip to content

Commit

Permalink
Clean up phase
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-ambrosio committed Oct 14, 2021
1 parent 25cd45a commit 1335230
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/main/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/main/java/io/vlingo/xoom/designer/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.vlingo.xoom.common.Tuple2;
import io.vlingo.xoom.designer.codegen.CodeGenerationParameterValidationStep;
import io.vlingo.xoom.designer.codegen.StagingFolderCleanUpStep;
import io.vlingo.xoom.designer.codegen.StagingFolderCleanUpStep.Phase;
import io.vlingo.xoom.designer.codegen.TemporaryTaskFolderCreationStep;
import io.vlingo.xoom.designer.codegen.java.applicationsettings.ApplicationSettingsGenerationStep;
import io.vlingo.xoom.designer.codegen.java.autodispatch.AutoDispatchMappingGenerationStep;
Expand Down Expand Up @@ -77,7 +78,7 @@ private static List<CodeGenerationStep> codeGenerationSteps() {
//Preliminary
new CodeGenerationParameterValidationStep(),
new MainClassResolverStep(),
new StagingFolderCleanUpStep(),
new StagingFolderCleanUpStep(Phase.PRE_GENERATION),
new TemporaryTaskFolderCreationStep(),
//Java
new ReadmeFileGenerationStep(),
Expand Down Expand Up @@ -110,7 +111,7 @@ private static List<CodeGenerationStep> codeGenerationSteps() {
new MavenWrapperInstallationStep(),
new SchemaPushStep(withType(CommandExecutionProcess.class)),
new SchemaPullStep(withType(CommandExecutionProcess.class)),
new StagingFolderCleanUpStep()
new StagingFolderCleanUpStep(Phase.POST_GENERATION)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.vlingo.xoom.codegen.CodeGenerationStep;
import io.vlingo.xoom.designer.ModelProcessingException;
import io.vlingo.xoom.designer.infrastructure.StagingFolder;
import io.vlingo.xoom.turbo.ComponentRegistry;
import org.apache.commons.io.FileUtils;

import java.io.IOException;
Expand All @@ -20,6 +21,12 @@

public class StagingFolderCleanUpStep implements CodeGenerationStep {

private final Phase phase;

public StagingFolderCleanUpStep(final Phase phase) {
this.phase = phase;
}

@Override
public void process(final CodeGenerationContext context) {
try {
Expand All @@ -39,4 +46,18 @@ private void removeDirectory(final Path directory) {
}
}

@Override
public boolean shouldProcess(final CodeGenerationContext context) {
final GenerationTarget generationTarget = ComponentRegistry.withType(GenerationTarget.class);
if(generationTarget.supportDownload()) {
return phase.equals(Phase.PRE_GENERATION);
}
return true;
}

public enum Phase {
PRE_GENERATION,
POST_GENERATION
}

}

0 comments on commit 1335230

Please sign in to comment.