Skip to content

Commit

Permalink
Use TargetConfig constructor directly
Browse files Browse the repository at this point in the history
  • Loading branch information
lhstrh committed Mar 19, 2023
1 parent 0a50e96 commit 0c1137d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
Expand Up @@ -297,7 +297,7 @@ private Map<Path, CodeMap> compileFederates(
}
props.put("docker", "false");

TargetConfig subConfig = GeneratorUtils.getTargetConfig(
TargetConfig subConfig = new TargetConfig(
props, GeneratorUtils.findTargetDecl(subFileConfig.resource), subContextErrorReporter
);
SubContext subContext = new SubContext(context, IntegratedBuilder.VALIDATED_PERCENT_PROGRESS, 100) {
Expand Down
23 changes: 0 additions & 23 deletions org.lflang/src/org/lflang/generator/GeneratorUtils.java
Expand Up @@ -4,7 +4,6 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
Expand All @@ -17,13 +16,8 @@
import org.lflang.ErrorReporter;
import org.lflang.FileConfig;
import org.lflang.TargetConfig;
import org.lflang.TargetConfig.DockerOptions;
import org.lflang.TargetProperty.BuildType;
import org.lflang.TargetProperty.LogLevel;
import org.lflang.TargetProperty.UnionType;
import org.lflang.generator.LFGeneratorContext.Mode;
import org.lflang.TargetProperty;
import org.lflang.TargetProperty.SchedulerOption;
import org.lflang.lf.Action;
import org.lflang.lf.ActionOrigin;
import org.lflang.lf.Instantiation;
Expand Down Expand Up @@ -53,23 +47,6 @@ public static TargetDecl findTargetDecl(Resource resource) {
return findAll(resource, TargetDecl.class).iterator().next();
}

/**
* Set the appropriate target properties based on the target properties of
* the main .lf file and the given command-line arguments, if applicable.
* @param args The commandline arguments to process.
* @param target The target properties AST node.
* @param errorReporter The error reporter to which errors should be sent.
*/
public static TargetConfig getTargetConfig(
Properties args,
TargetDecl target,
ErrorReporter errorReporter
) {
final TargetConfig targetConfig = new TargetConfig(args, target, errorReporter);

return targetConfig;
}

/**
* Look for physical actions in 'resource'.
* If appropriate, set keepalive to true in
Expand Down
2 changes: 1 addition & 1 deletion org.lflang/src/org/lflang/generator/MainContext.java
Expand Up @@ -163,7 +163,7 @@ public void reportProgress(String message, int percentage) {
* reflected in the target configuration.
*/
public void loadTargetConfig() {
this.targetConfig = GeneratorUtils.getTargetConfig(
this.targetConfig = new TargetConfig(
args, GeneratorUtils.findTargetDecl(fileConfig.resource), errorReporter
);
}
Expand Down

0 comments on commit 0c1137d

Please sign in to comment.