Commit 35b57a4b authored by Andrey Filippov's avatar Andrey Filippov

Fixed command blocks disabling with conditionals, bug fix in launch

sequence.
parent 5c54ebba
...@@ -155,12 +155,15 @@ public class VDTRunner { ...@@ -155,12 +155,15 @@ public class VDTRunner {
runningBuilds.removeConfiguration(consoleName); runningBuilds.removeConfiguration(consoleName);
return; return;
} }
// if (numItem<(argumentsItemsArray.length-1)){ // Not for the last
// find out if there are any non-parsers left
if (numItem<(argumentsItemsArray.length-1)){ // Not for the last boolean moreToProcess=false;
// IConsoleManager man = ConsolePlugin.getDefault().getConsoleManager(); // debugging for (int i=numItem+1;i<argumentsItemsArray.length;numItem++)
// IConsole[] consoles=(IConsole[]) man.getConsoles(); if (argumentsItemsArray[numItem].getNameAsParser()==null) {
moreToProcess=true;
break;
}
if (moreToProcess){
IOConsole iCons= (IOConsole) DebugUITools.getConsole(process); // had non-null fPatternMatcher , fType="org.eclipse.debug.ui.ProcessConsoleType" IOConsole iCons= (IOConsole) DebugUITools.getConsole(process); // had non-null fPatternMatcher , fType="org.eclipse.debug.ui.ProcessConsoleType"
if (iCons==null){ if (iCons==null){
System.out.println("Could not get console for the specified process"); System.out.println("Could not get console for the specified process");
......
...@@ -64,7 +64,9 @@ public class VDTRunnerConfiguration { ...@@ -64,7 +64,9 @@ public class VDTRunnerConfiguration {
private String consoleFinish; // double prompt? - string to look for in consoleBuffer to finish private String consoleFinish; // double prompt? - string to look for in consoleBuffer to finish
private String consoleBuffer; // accumulates stdout & stderr, looking for consoleFinish (endsWith() ) private String consoleBuffer; // accumulates stdout & stderr, looking for consoleFinish (endsWith() )
private int extraChars=100; // Allow these chars to appear in the output after consoleFinish (user pressed smth.?) private int extraChars=100; // Allow these chars to appear in the output after consoleFinish (user pressed smth.?)
private String originalConsoleName=null; private String originalConsoleName=null; // will replace
private String buildDateTime=null;
private Set<IConsole> consoles=null; // parser consoles opened for this console private Set<IConsole> consoles=null; // parser consoles opened for this console
private VDTConsoleRunner consoleRunner=null; private VDTConsoleRunner consoleRunner=null;
...@@ -216,12 +218,17 @@ public class VDTRunnerConfiguration { ...@@ -216,12 +218,17 @@ public class VDTRunnerConfiguration {
} }
public void setToolName(String str) { public void setToolName(String str) {
this.toolName=str; this.toolName=str;
this.buildDateTime=VDTRunner.renderProcessLabel("");
this.originalConsoleName=VDTRunner.renderProcessLabel(this.toolName); // this.originalConsoleName=VDTRunner.renderProcessLabel(this.toolName); //
} }
public String getOriginalConsoleName() { public String getOriginalConsoleName() {
return originalConsoleName; return originalConsoleName;
} }
public String getBuildDateTime() {
return this.buildDateTime;
}
public String getToolName() { public String getToolName() {
return toolName; return toolName;
} }
......
...@@ -23,8 +23,10 @@ import java.util.List; ...@@ -23,8 +23,10 @@ import java.util.List;
public class BuildParamsItem implements Cloneable{ public class BuildParamsItem implements Cloneable{
private String [] params; private String [] params;
private String consoleName; // null for external tools running in a new console private String consoleName; // null for external tools running in a new console
private String nameAsParser; // name as a parser, null if not used as a parser // private String nameAsParser; // name as a parser, null if not used as a parser
// private String mark; // remove this sequence on the output only (to preserve white spaces) Already applied private String name; // name of a block
private boolean is_parser;
private String toolErrors; // Eclipse pattern for pattern recognizer private String toolErrors; // Eclipse pattern for pattern recognizer
private String toolWarnings; // Eclipse pattern for pattern recognizer private String toolWarnings; // Eclipse pattern for pattern recognizer
private String toolInfo; // Eclipse pattern for pattern recognizer private String toolInfo; // Eclipse pattern for pattern recognizer
...@@ -41,8 +43,9 @@ public class BuildParamsItem implements Cloneable{ ...@@ -41,8 +43,9 @@ public class BuildParamsItem implements Cloneable{
public BuildParamsItem ( public BuildParamsItem (
String [] params, String [] params,
String consoleName, String consoleName,
String nameAsParser, // String nameAsParser,
// String mark, String name,
// boolean is_parser,
String toolErrors, String toolErrors,
String toolWarnings, String toolWarnings,
String toolInfo, String toolInfo,
...@@ -54,8 +57,9 @@ public class BuildParamsItem implements Cloneable{ ...@@ -54,8 +57,9 @@ public class BuildParamsItem implements Cloneable{
) { ) {
this.consoleName=consoleName; this.consoleName=consoleName;
this.params=params; // no need to clone? this.params=params; // no need to clone?
this.nameAsParser=nameAsParser; // this.nameAsParser=nameAsParser;
// this.mark=mark; this.name=name;
this.is_parser=(name!=null); // true
this.toolErrors=toolErrors; this.toolErrors=toolErrors;
this.toolWarnings=toolWarnings; this.toolWarnings=toolWarnings;
this.toolInfo=toolInfo; this.toolInfo=toolInfo;
...@@ -70,8 +74,9 @@ public class BuildParamsItem implements Cloneable{ ...@@ -70,8 +74,9 @@ public class BuildParamsItem implements Cloneable{
this ( this (
item.params, item.params,
item.consoleName, item.consoleName,
item.nameAsParser, // item.nameAsParser,
// item.mark, item.name,
// item.is_parser,
item.toolErrors, item.toolErrors,
item.toolWarnings, item.toolWarnings,
item.toolInfo, item.toolInfo,
...@@ -81,6 +86,7 @@ public class BuildParamsItem implements Cloneable{ ...@@ -81,6 +86,7 @@ public class BuildParamsItem implements Cloneable{
item.stdout, item.stdout,
item.timeout item.timeout
); );
this.is_parser=item.is_parser;
} }
public BuildParamsItem clone () { public BuildParamsItem clone () {
...@@ -113,23 +119,27 @@ public class BuildParamsItem implements Cloneable{ ...@@ -113,23 +119,27 @@ public class BuildParamsItem implements Cloneable{
} }
*/ */
public void removeNonParser(List<BuildParamsItem> items){ public void removeNonParser(List<BuildParamsItem> items){
// if (items==null) return; should never happen as the list includes itself // if (nameAsParser==null) return;
if (nameAsParser==null) return; if (!is_parser) return;
if (consoleName==null) { // console script can not be a parser if (consoleName==null) { // console script can not be a parser
Iterator<BuildParamsItem> itemsIter = items.iterator(); // command lines block is empty (yes, there is nothing in project output) Iterator<BuildParamsItem> itemsIter = items.iterator(); // command lines block is empty (yes, there is nothing in project output)
while(itemsIter.hasNext()) { while(itemsIter.hasNext()) {
BuildParamsItem item = (BuildParamsItem)itemsIter.next(); BuildParamsItem item = (BuildParamsItem)itemsIter.next();
if( if(
nameAsParser.equals(item.stderr) || // nameAsParser.equals(item.stderr) ||
nameAsParser.equals(item.stdout)){ // nameAsParser.equals(item.stdout)){
name.equals(item.stderr) ||
name.equals(item.stdout)){
return; // do nothing - keep nameAsParser return; // do nothing - keep nameAsParser
} }
} }
} }
nameAsParser=null; is_parser=false;
} }
public String getNameAsParser(){ return nameAsParser; } // public String getNameAsParser(){ return nameAsParser; }
public String getNameAsParser(){ return is_parser?name:null; }
public String getName() { return name; }
// public String getMark() { return mark; } // public String getMark() { return mark; }
public String getErrors() { return toolErrors; } public String getErrors() { return toolErrors; }
public String getWarnings() { return toolWarnings; } public String getWarnings() { return toolWarnings; }
......
...@@ -34,6 +34,8 @@ import com.elphel.vdt.core.tools.params.types.ParamTypeString; ...@@ -34,6 +34,8 @@ import com.elphel.vdt.core.tools.params.types.ParamTypeString;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
import com.elphel.vdt.core.tools.params.conditions.StringConditionParser; import com.elphel.vdt.core.tools.params.conditions.StringConditionParser;
import com.elphel.vdt.util.StringPair; import com.elphel.vdt.util.StringPair;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
public abstract class Context { public abstract class Context {
...@@ -225,7 +227,12 @@ public abstract class Context { ...@@ -225,7 +227,12 @@ public abstract class Context {
prompt=commandLinesBlock.parseCntrl(prompt); // replace control character codes (\n,\t,\x) prompt=commandLinesBlock.parseCntrl(prompt); // replace control character codes (\n,\t,\x)
prompt=commandLinesBlock.applyMark(prompt); // remove mark sequence prompt=commandLinesBlock.applyMark(prompt); // remove mark sequence
String interrupt=commandLinesBlock.getInterrupt(); String interrupt=commandLinesBlock.getInterrupt();
List<String> lines = commandLinesBlock.getLines(); // [%Param_Shell_Options, echo BuildDir=%BuildDir ;, echo SimulationTopFile=%SimulationTopFile ;, echo SimulationTopModule=%SimulationTopModule ;, echo BuildDir=%BuildDir;, %Param_PreExe, %Param_Exe, %Param_TopModule, %TopModulesOther, %ModuleLibrary, %LegacyModel, %NoSpecify, %v, %SourceList, %ExtraFiles, %Filter_String] List<String> lines = commandLinesBlock.getLines(); // [%Param_Shell_Options, echo BuildDir=%BuildDir ;, echo SimulationTopFile=%SimulationTopFile ;, echo SimulationTopModule=%SimulationTopModule ;, echo BuildDir=%BuildDir;, %Param_PreExe, %Param_Exe, %Param_TopModule, %TopModulesOther, %ModuleLibrary, %LegacyModel, %NoSpecify, %v, %SourceList, %ExtraFiles, %Filter_String]
if ((lines.size()==0) && commandLinesBlock.hadStrings()){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("Removing command lines block by false condition");
continue; // to enable conditionals for the command line blocks, still making possible to use emty blocks for no-arguments programs
}
List<List<String>> commandSequence = new ArrayList<List<String>>(); List<List<String>> commandSequence = new ArrayList<List<String>>();
for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) { for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) {
String line = (String)lineIter.next(); String line = (String)lineIter.next();
......
...@@ -199,6 +199,8 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -199,6 +199,8 @@ public class CommandLinesBlock extends UpdateableStringsContainer
public boolean isFileKind() {return kind == ParamTypeString.KIND.FILE; } public boolean isFileKind() {return kind == ParamTypeString.KIND.FILE; }
public boolean isConsoleKind() { return kind == ParamTypeString.KIND.TEXT; } public boolean isConsoleKind() { return kind == ParamTypeString.KIND.TEXT; }
public List<String> getLines() { return ConditionUtils.resolveConditionStrings(strings); } public List<String> getLines() { return ConditionUtils.resolveConditionStrings(strings); }
// to distinguish between empty command block (program w/o any parameters) and conditionally removed one
public boolean hadStrings() {return (strings!=null) && (strings.getEntries().size()>0); }
public String getName() { return name; } public String getName() { return name; }
public String getSeparator() { return separator; } public String getSeparator() { return separator; }
public String getMark() { return mark; } public String getMark() { return mark; }
...@@ -206,7 +208,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -206,7 +208,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
public String getWarnings() { return toolWarnings; } public String getWarnings() { return toolWarnings; }
public String getInfo() { return toolInfo; } public String getInfo() { return toolInfo; }
public String getPrompt() { return prompt; } public String getPrompt() { return prompt; }
public String getInterrupt() { return prompt; } public String getInterrupt() { return interrupt; }
public String getStderr() { return stderr; } public String getStderr() { return stderr; }
public String getStdout() { return stdout; } public String getStdout() { return stdout; }
public String getTimeout() { return timeout; } public String getTimeout() { return timeout; }
......
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