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

Fixed command blocks disabling with conditionals, bug fix in launch

sequence.
parent 5c54ebba
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -155,12 +155,15 @@ public class VDTRunner {
				runningBuilds.removeConfiguration(consoleName); 
				return;
			}
			
			
			if (numItem<(argumentsItemsArray.length-1)){ // Not for the last
				//                IConsoleManager man = ConsolePlugin.getDefault().getConsoleManager(); // debugging
				//                IConsole[] consoles=(IConsole[]) man.getConsoles();

//			if (numItem<(argumentsItemsArray.length-1)){ // Not for the last
			// find out if there are any non-parsers left
			boolean moreToProcess=false;
			for (int i=numItem+1;i<argumentsItemsArray.length;numItem++)
				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"
				if (iCons==null){
					System.out.println("Could not get console for the specified process");
+9 −2
Original line number Diff line number Diff line
@@ -64,7 +64,9 @@ public class VDTRunnerConfiguration {
    private String consoleFinish; // double prompt? - string to look for in consoleBuffer to finish
    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 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 VDTConsoleRunner consoleRunner=null;

@@ -216,12 +218,17 @@ public class VDTRunnerConfiguration {
    }
    public void setToolName(String str) {
    	this.toolName=str;
    	this.buildDateTime=VDTRunner.renderProcessLabel("");
    	this.originalConsoleName=VDTRunner.renderProcessLabel(this.toolName); //
    }
    public String getOriginalConsoleName() {
    	return originalConsoleName;
    }

    public String getBuildDateTime() {
    	return this.buildDateTime;
    }

    public String getToolName() {
    	return toolName;
    }
+24 −14
Original line number Diff line number Diff line
@@ -23,8 +23,10 @@ import java.util.List;
public class BuildParamsItem implements Cloneable{
	private String [] params;
	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 mark;         // remove this sequence on the output only (to preserve white spaces) Already applied
//    private String nameAsParser; // name as a parser, null if not used as a parser
    private String name;         // name of a block
    private boolean is_parser;
    
    private String toolErrors;   // Eclipse pattern for pattern recognizer
    private String toolWarnings; // Eclipse pattern for pattern recognizer
    private String toolInfo;     // Eclipse pattern for pattern recognizer
@@ -41,8 +43,9 @@ public class BuildParamsItem implements Cloneable{
	public BuildParamsItem (
			String [] params,
			String consoleName,
		    String nameAsParser,
//		    String mark,
//		    String nameAsParser,
		    String name,
//		    boolean is_parser,
		    String toolErrors,
		    String toolWarnings,
		    String toolInfo,
@@ -54,8 +57,9 @@ public class BuildParamsItem implements Cloneable{
			) {
		this.consoleName=consoleName;
		this.params=params; // no need to clone?
		this.nameAsParser=nameAsParser;
//		this.mark=mark;
//		this.nameAsParser=nameAsParser;
		this.name=name;
		this.is_parser=(name!=null); // true
		this.toolErrors=toolErrors;
		this.toolWarnings=toolWarnings;
		this.toolInfo=toolInfo;
@@ -70,8 +74,9 @@ public class BuildParamsItem implements Cloneable{
		this (
				item.params,
				item.consoleName,
				item.nameAsParser,
//				item.mark,
//				item.nameAsParser,
				item.name,
//				item.is_parser,
				item.toolErrors,
				item.toolWarnings,
				item.toolInfo,
@@ -81,6 +86,7 @@ public class BuildParamsItem implements Cloneable{
				item.stdout,
				item.timeout
				);
		this.is_parser=item.is_parser;
	}

	public BuildParamsItem clone () {
@@ -113,23 +119,27 @@ public class BuildParamsItem implements Cloneable{
	}
*/	
	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
	        Iterator<BuildParamsItem> itemsIter = items.iterator(); // command lines block is empty (yes, there is nothing in project output)
	        while(itemsIter.hasNext()) {
	        	BuildParamsItem item = (BuildParamsItem)itemsIter.next();
				if(	
						nameAsParser.equals(item.stderr) ||
						nameAsParser.equals(item.stdout)){
//						nameAsParser.equals(item.stderr) ||
//						nameAsParser.equals(item.stdout)){
					name.equals(item.stderr) ||
					name.equals(item.stdout)){
					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 getErrors()      { return toolErrors; }
	public String getWarnings()    { return toolWarnings; }
+8 −1
Original line number Diff line number Diff line
@@ -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.conditions.StringConditionParser;
import com.elphel.vdt.util.StringPair;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;


public abstract class Context {
@@ -226,6 +228,11 @@ public abstract class Context {
        	prompt=commandLinesBlock.applyMark(prompt); // remove mark sequence
        	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]
            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>>();
            for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) {
            	String line = (String)lineIter.next();
+3 −1
Original line number Diff line number Diff line
@@ -199,6 +199,8 @@ public class CommandLinesBlock extends UpdateableStringsContainer
    public boolean isFileKind() {return kind ==  ParamTypeString.KIND.FILE; }
    public boolean isConsoleKind() { return kind ==  ParamTypeString.KIND.TEXT; }
    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 getSeparator()   { return separator; }    
	public String getMark()        { return mark; }
@@ -206,7 +208,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
	public String getWarnings()    { return toolWarnings; }
	public String getInfo()        { return toolInfo; }
	public String getPrompt()      { return prompt; }
	public String getInterrupt()   { return prompt; }
	public String getInterrupt()   { return interrupt; }
	public String getStderr()      { return stderr; }
	public String getStdout()      { return stdout; }
	public String getTimeout()     { return timeout; }