Skip to content

Commit

Permalink
Address feedback from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
lhstrh committed Mar 7, 2024
1 parent dd85341 commit 8b5e98a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions core/src/main/java/org/lflang/generator/c/CGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,27 @@ public void doGenerate(Resource resource, LFGeneratorContext context) {
} else {
var cleanCode = code.removeLines("#line");
var cCompiler = new CCompiler(targetConfig, fileConfig, messageReporter, cppMode);
var success = false;
try {
if (!cCompiler.runCCompiler(this, context)) {
success = cCompiler.runCCompiler(this, context);
} catch (IOException e) {
messageReporter.nowhere().error("Unexpected error during compilation.");
} finally {
if (!success) {
// If compilation failed, remove any bin files that may have been created.
messageReporter.nowhere().error("Compilation was unsuccessful.");
CUtil.deleteBinFiles(fileConfig);
context.unsuccessfulFinish();
} else {
try {
cleanCode.writeToFile(targetFile);
} catch (IOException e) {
messageReporter
.nowhere()
.warning("Generated code may still contain line directives.");
}
context.finish(GeneratorResult.Status.COMPILED, null);
}
cleanCode.writeToFile(targetFile);
} catch (IOException e) {
messageReporter.nowhere().warning("Generated code may still contain line directives.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ protected String generateDockerFileContent() {
COPY include /reactor-c/include
WORKDIR /reactor-c/core/federated/RTI
%s
RUN mkdir -p build && \\
RUN rm -rf build && \\
mkdir build && \\
cd build && \\
cmake ../ && \\
make && \\
Expand Down

0 comments on commit 8b5e98a

Please sign in to comment.