Commit bd3994cd authored by Andrey Filippov's avatar Andrey Filippov

fixed command line inheritance, added "weight" to command blocks

attributes to organize them when using base tools.
parent a96d6ad2
......@@ -55,6 +55,9 @@ public class ParamGroupNodeReader extends AbstractConditionNodeReader {
String name = XMLConfig.getAttributeValue(node, XMLConfig.PARAMGROUP_NAME_ATTR);
String label = XMLConfig.getAttributeValue(node, XMLConfig.PARAMGROUP_LABEL_ATTR);
String visible = XMLConfig.getAttributeValue(node, XMLConfig.PARAMGROUP_VISIBLE_ATTR);
String weightString = XMLConfig.getAttributeValue(node, XMLConfig.PARAMGROUP_WEIGHT_ATTR);
if(name == null && label == null)
throw new ConfigException("Parameter group in context '" + context.getName() +
......@@ -68,6 +71,15 @@ public class ParamGroupNodeReader extends AbstractConditionNodeReader {
} else {
isVisible = true;
}
double weight=1.0;
if (weightString!=null){
try {
weight=Double.parseDouble(weightString);
} catch (Exception e){
throw new ConfigException("Parameter group in context '" + context.getName() +
"' has invalid weight string '"+weightString+"' - floating point value is expected.");
}
}
ConditionalStringsList params =
config.readConditionalStringsNode(node, context, condition);
......@@ -79,6 +91,7 @@ public class ParamGroupNodeReader extends AbstractConditionNodeReader {
return new ParamGroup(name,
label,
isVisible,
weight,
params,
deleteParams,
insertParams,
......
......@@ -65,6 +65,7 @@ public class XMLConfig extends Config {
static final String PARAMGROUP_NAME_ATTR = "name";
static final String PARAMGROUP_LABEL_ATTR = "label";
static final String PARAMGROUP_VISIBLE_ATTR = "visible";
static final String PARAMGROUP_WEIGHT_ATTR = "weight";
public static final String PARAMGROUP_SEPARATOR = "---";
static final String PARAMETER_TAG = "parameter";
......
......@@ -206,7 +206,8 @@ public abstract class Context {
if ((pattern==null) || (pattern.length()==0)) return pattern;
Parameter param=findParam(pattern);
if (param==null) return pattern;
List<String> lv=param.getCurrentValue();
// List<String> lv=param.getCurrentValue();
List<String> lv=param.getValue(null); // null - topFormatProcessor
if ((lv==null) || (lv.size()==0)) return null;
return lv.get(0);
}
......
......@@ -30,10 +30,12 @@ public class ParamGroup extends UpdateableStringsContainer
private String label;
private boolean visible;
private Condition relevant;
private double weight; // heigher the weight, later the group
public ParamGroup(String name,
String label,
boolean visible,
double weight,
ConditionalStringsList params,
ConditionalStringsList deleteParams,
List<NamedConditionalStringsList> insertParams,
......@@ -55,12 +57,14 @@ public class ParamGroup extends UpdateableStringsContainer
this.visible = visible;
this.relevant = relevant;
this.weight=weight;
}
public ParamGroup(ParamGroup paramGroup) {
this(paramGroup.name,
paramGroup.label,
paramGroup.visible,
paramGroup.weight,
paramGroup.strings != null?
(ConditionalStringsList)paramGroup.strings.clone() : null,
paramGroup.deleteStrings != null?
......@@ -94,6 +98,10 @@ public class ParamGroup extends UpdateableStringsContainer
return visible;
}
public double getWeight(){
return weight;
}
public boolean isRelevant() {
return relevant == null || relevant.isTrue(null); // null for topFormatProcessor (this value will not be used for other parameter value)
}
......
......@@ -35,6 +35,7 @@ import com.elphel.vdt.core.tools.params.types.ParamTypeBool;
import com.elphel.vdt.core.tools.params.types.ParamTypeString;
import com.elphel.vdt.core.tools.params.types.ParamTypeString.KIND;
import com.elphel.vdt.core.tools.params.types.RunFor;
import com.elphel.vdt.ui.MessageUI;
import com.elphel.vdt.ui.VDTPluginImages;
import com.elphel.vdt.ui.views.DesignFlowView;
import com.elphel.vdt.ui.variables.SelectedResourceManager;
......@@ -45,12 +46,12 @@ import com.elphel.vdt.veditor.preference.PreferenceStrings;
public class Tool extends Context implements Cloneable, Inheritable {
private static final String ICON_ID_PREFIX = VDT.ID_VDT + ".Tool.Image.";
private static final String ICON_ID_ACTION = ".action.";
private static final String TAG_TOOL_PINNED = ".toolstate.pinned";
private static final String TAG_TOOL_STATE = ".toolstate.state";
private static final String TAG_TOOL_TIMESTAMP = ".toolstate.timeStamp";
private static final String TAG_TOOL_LASTRUNHASH = ".toolstate.lastRunHash";
private static final String TAG_TOOL_FILEDEPSTAMP = ".toolstate.fileDependency.";
private static final String TAG_TOOL_STATEDEPSTAMP = ".toolstate.stateDependency.";
// private static final String TAG_TOOL_PINNED = ".toolstate.pinned";
// private static final String TAG_TOOL_STATE = ".toolstate.state";
// private static final String TAG_TOOL_TIMESTAMP = ".toolstate.timeStamp";
// private static final String TAG_TOOL_LASTRUNHASH = ".toolstate.lastRunHash";
// private static final String TAG_TOOL_FILEDEPSTAMP = ".toolstate.fileDependency.";
// private static final String TAG_TOOL_STATEDEPSTAMP = ".toolstate.stateDependency.";
private static final String MEMENTO_TOOL_TYPE = VDT.ID_VDT+".tool";
private static final String MEMENTO_TOOL_PINNED = "pinned";
private static final String MEMENTO_TOOL_STATE = "state";
......@@ -527,6 +528,10 @@ public class Tool extends Context implements Cloneable, Inheritable {
if (restoreString== null) restoreString = baseTool.restoreString;
if (saveString== null) saveString = baseTool.saveString;
if (autoSaveString== null) autoSaveString = baseTool.autoSaveString;
// What about output lines attributes?
}
public void initDisabled() throws ConfigException{
......@@ -1440,9 +1445,24 @@ public class Tool extends Context implements Cloneable, Inheritable {
private void inheritParamGroups() throws ConfigException {
EntityUtils.update(baseTool.paramGroups, paramGroups);
// Sort paramGroups according to weight
boolean inOrder=false;
while (!inOrder){
inOrder=true;
for (int i=0;i<(paramGroups.size()-1);i++){
if (paramGroups.get(i).getWeight()>paramGroups.get(i+1).getWeight()){
paramGroups.add(i,paramGroups.remove(i+1));
inOrder=false;
}
}
}
}
private void inheritCommandLines() throws ConfigException {
DEBUG_PRINT("inheritCommandLines(), baseTool="+baseTool.getName()+", this="+getName());
if (getName().equals("VivadoSynthesis")){
// MessageUI.error("inheritCommandLines() for "+getName());
}
EntityUtils.update(baseTool.commandLinesBlocks, commandLinesBlocks);
}
......
......@@ -17,10 +17,13 @@
package com.elphel.vdt.ui.views;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import com.elphel.vdt.core.tools.params.ToolSequence;
import com.elphel.vdt.veditor.VerilogPlugin;
......@@ -60,9 +63,10 @@ public class ClearLogFiles extends ClearAction {
if (messageBox.getReturnCode() == 0) {
for (IFile file:toRemove){
try {
file.delete(0,null);
// file.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT ,null);
file.delete(true ,null);
} catch (CoreException e) {
System.out.println("Could not delete "+file.getLocation().toOSString());
System.out.println("Could not delete "+file.getLocation().toOSString()+", exception:"+e);
}
}
}
......
......@@ -62,7 +62,9 @@
restore="RestoreVivadoSynthesis"
disable="DisableVivadoSynth"
autosave="AutosaveVivadoSynthesis"
save="SaveVivadoSynthesis" >
save="SaveVivadoSynthesis"
inherits="VivadoToolPrototype"
>
<extensions-list>
<extension mask="v" />
......@@ -178,6 +180,7 @@
type="String" format="CopyValue" visible="false" />
<!-- parser parameters -->
<!--
<parameter id="PatternErrors" label="Errors" tooltip= "Regular expression for error messages"
default=".*ERROR: (\[.*\].*)\[(.*):([0-9]+)\]"
visible="true" type="String" format="CopyValue"/>
......@@ -203,7 +206,7 @@
default="true" visible="true" omit="true" type="Boolean" format="GrepFilterProblemSyntax"/>
<parameter id="OtherProblems" label="Other problems" tooltip= "Other problem patterns (after opening '[') to be suppressed)"
default="" visible="true" omit="" type="Stringlist" format="GrepFilterProblemOtherSyntax"/>
-->
<!-- invisible/calculated parameters -->
<parameter id="AutosaveVivadoSynthesis" default="?%%ChosenActionIndex=0 ^ %SkipSnapshotSynth=false : true, false"
visible="false" type="Boolean" format="None"/>
......@@ -255,6 +258,7 @@
"quiet"
"verbose"
</group>
<!--
<group name="Parser">
"NoFileProblem"
"Memdata"
......@@ -264,12 +268,11 @@
"Project"
"Timing"
"OtherProblems"
"---"
"PatternErrors"
"PatternWarnings"
"PatternInfo"
</group>
-->
</input>
<output>
......@@ -298,7 +301,7 @@
prompt="@@FINISH@@"
success="synth_design completed successfully"
log=""
stdout="parser_VivadoSynth">
stdout="parser_Vivado">
<!-- synth_design completed successfully -->
"cd ~/%VivadoProjectRoot\n"
"set outputDir ~/%VivadoProjectRoot/%VivadoRemoteDir\n"
......@@ -344,6 +347,7 @@
"\n"
"puts \"@@FINISH@@\"\n"
</line>
<!--
<line name="parser_VivadoSynth"
errors= "PatternErrors"
warnings= "PatternWarnings"
......@@ -352,9 +356,8 @@
"%GrepEWI"
"| %SedPaths"
<if NoBabyTalk="true">
"| grep --line-buffered -v \"license\""
"| grep - -line-buffered -v \"license\""
</if>
<!-- Various grep filters -->
"%Memdata"
"%Synth"
"%Netlist"
......@@ -363,10 +366,12 @@
"%Timing"
"%OtherProblems"
<if NoFileProblem="true">
<!-- Add [Synthesis:0000] to lines that do not have [file:line] - then "Synthesis" will appear in "Problems" location-->
"| sed -u 's@^[^\[]*\[[^\[]*$@&amp;\[Synthesis:0000\]@'"
</if>
</line>
-->
<!-- Add [Synthesis:0000] to lines that do not have [file:line] - then "Synthesis" will appear in "Problems" location-->
</output>
</tool>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment