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