Skip to content

Commit

Permalink
comment and function rename
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnrd committed Jun 19, 2024
1 parent e5cfc62 commit c5f50f3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/src/main/kotlin/org/lflang/generator/cpp/CppGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class CppGenerator(
"Code generation complete. Compiling...", IntegratedBuilder.GENERATED_PERCENT_PROGRESS
)
if (targetConfig.get(DockerProperty.INSTANCE).enabled) {
copySrcGenBaseDirIntoSrcGenDir()
copySrcGenBaseDirIntoDockerDir()
buildUsingDocker()
} else {
if (platformGenerator.doCompile(context)) {
Expand All @@ -107,9 +107,15 @@ class CppGenerator(
}
}

private fun copySrcGenBaseDirIntoSrcGenDir() {
/**
* Copy the contents of the entire src-gen directory to a nested src-gen directory next to the generated Dockerfile.
*/
private fun copySrcGenBaseDirIntoDockerDir() {
FileUtil.deleteDirectory(context.fileConfig.srcGenPath.resolve("src-gen"))
try {
// We need to copy in two steps via a temporary directory, as the target directory
// is located within the source directory. Without the temporary directory, copying
// fails as we modify the source while writing the target.
val tempDir = Files.createTempDirectory(context.fileConfig.outPath, "src-gen-directory")
try {
FileUtil.copyDirectoryContents(context.fileConfig.srcGenBasePath, tempDir, false)
Expand Down

0 comments on commit c5f50f3

Please sign in to comment.