Skip to content

Commit

Permalink
Merge pull request #2247 from lf-lang/fed-clean
Browse files Browse the repository at this point in the history
Fixed clean building federated programs
  • Loading branch information
cmnrd authored Mar 19, 2024
2 parents 9cab7b4 + a50f961 commit fb4917b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/org/lflang/generator/GeneratorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public void reportCommandErrors(String stderr) {

/** Check if a clean was requested from the standalone compiler and perform the clean step. */
protected void cleanIfNeeded(LFGeneratorContext context) {
if (context.getArgs().clean()) {
if (context.isCleanRequested()) {
try {
context.getFileConfig().doClean();
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ enum Mode {
/** Get the error reporter for this context; construct one if it hasn't been constructed yet. */
MessageReporter getErrorReporter();

/** Return true if the user requested a clean build in this context. */
default boolean isCleanRequested() {
return getArgs().clean();
}

/**
* Mark the code generation process performed in this context as finished with the result {@code
* result}.
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/org/lflang/generator/SubContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public SubContext(
this.endPercentProgress = endPercentProgress;
}

@Override
public boolean isCleanRequested() {
return false;
} /// never clean in a sub context

@Override
public CancelIndicator getCancelIndicator() {
return containingContext.getCancelIndicator();
Expand Down

0 comments on commit fb4917b

Please sign in to comment.