Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #768 #952

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions org.lflang/src/org/lflang/generator/python/PythonGenerator.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import org.lflang.FileConfig
import org.lflang.InferredType
import org.lflang.JavaAstUtils
import org.lflang.Target
import org.lflang.TargetConfig
import org.lflang.TargetConfig.Mode
import org.lflang.TargetProperty.CoordinationType
import org.lflang.federated.FedFileConfig
Expand Down Expand Up @@ -1313,7 +1312,6 @@ class PythonGenerator extends CGenerator {
* @param context Context relating to invocation of the code generator.
*/
override void doGenerate(Resource resource, LFGeneratorContext context) {

// If there are federates, assign the number of threads in the CGenerator to 1
if (isFederated) {
targetConfig.threads = 1;
Expand Down Expand Up @@ -1355,6 +1353,7 @@ class PythonGenerator extends CGenerator {
if (this.main !== null) {
val codeMapsForFederate = generatePythonFiles(federate)
codeMaps.putAll(codeMapsForFederate)
copyTargetFiles();
if (!targetConfig.noCompile) {
compilingFederatesContext.reportProgress(
String.format("Validating %d/%d sets of generated files...", federateCount, federates.size()),
Expand Down Expand Up @@ -1395,17 +1394,11 @@ class PythonGenerator extends CGenerator {
"bash")
}
}

/**
* Copy Python specific target code to the src-gen directory
* Also, copy all files listed in the target property `files` into the
* src-gen folder of the main .lf file.
*
* @param targetConfig The targetConfig to read the `files` from.
* @param fileConfig The fileConfig used to make the copy and resolve paths.
*/
override copyUserFiles(TargetConfig targetConfig, FileConfig fileConfig) {
super.copyUserFiles(targetConfig, fileConfig);
def copyTargetFiles() {
// Copy the required target language files into the target file system.
// This will also overwrite previous versions.
fileConfig.copyFileFromClassPath(
Expand Down