Skip to content

Commit

Permalink
Add missing hierarhical-bin target property
Browse files Browse the repository at this point in the history
  • Loading branch information
lhstrh committed Oct 13, 2023
1 parent 23d65a5 commit a3effa1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/src/main/java/org/lflang/generator/MainContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.lflang.MessageReporter;
import org.lflang.generator.IntegratedBuilder.ReportProgress;
import org.lflang.target.TargetConfig;
import org.lflang.target.property.HierarchicalBinProperty;

/**
* A {@code MainContext} is an {@code LFGeneratorContext} that is not nested in any other generator
Expand Down Expand Up @@ -93,9 +94,8 @@ public MainContext(
this.args = args;

try {
var useHierarchicalBin =
args.containsKey("hierarchical-bin")
&& Boolean.parseBoolean(args.getProperty("hierarchical-bin"));
var key = new HierarchicalBinProperty().name();
var useHierarchicalBin = args.contains(key) && Boolean.parseBoolean(args.getProperty(key));
fileConfig =
Objects.requireNonNull(
LFGenerator.createFileConfig(
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/org/lflang/target/TargetConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.lflang.target.property.FastProperty;
import org.lflang.target.property.FedSetupProperty;
import org.lflang.target.property.FilesProperty;
import org.lflang.target.property.HierarchicalBinProperty;
import org.lflang.target.property.KeepaliveProperty;
import org.lflang.target.property.LoggingProperty;
import org.lflang.target.property.NoCompileProperty;
Expand Down Expand Up @@ -117,6 +118,7 @@ public TargetConfig(Target target) {
new ExternalRuntimePathProperty(),
new FastProperty(),
new FilesProperty(),
new HierarchicalBinProperty(),
new KeepaliveProperty(),
new LoggingProperty(),
new NoCompileProperty(),
Expand Down Expand Up @@ -238,7 +240,7 @@ public void load(Properties properties, MessageReporter err) {
var property = p.get();
property.update(this, (String) properties.get(key), err);
} else {
throw new RuntimeException("Attempting to load unrecognized target property");
throw new RuntimeException("Attempting to load unrecognized target property: " + key);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.lflang.target.property;

import java.util.Arrays;
import java.util.List;
import org.lflang.Target;

/**
* Whether the bin directory should have a flat or hierarchical organization. It is flat by default.
*/
public class HierarchicalBinProperty extends AbstractBooleanProperty {

@Override
public List<Target> supportedTargets() {
return Arrays.asList(Target.C, Target.CCPP);
}

@Override
public String name() {
return "hierarchical-bin";
}
}

0 comments on commit a3effa1

Please sign in to comment.