Loading src/com/elphel/vdt/core/launching/VDTConsoleRunner.java +6 −6 Original line number Diff line number Diff line Loading @@ -198,6 +198,7 @@ public class VDTConsoleRunner{ System.out.println("Using success string: \""+buildParamsItem.getSuccessString()+"\""); System.out.println("Using failure string: \""+buildParamsItem.getFailureString()+"\""); } String timeStamp=ToolsCore.getTool(runConfig.getToolName()).getTimeStamp(); toolLogFile=(((fSendOutputToStreamProxy!=null) || (fSendErrorsToStreamProxy!=null)))? (new ToolLogFile ( runConfig.getLogDir(), Loading @@ -206,11 +207,7 @@ public class VDTConsoleRunner{ null, // extension - use default fHasStdout, // fSendOutputToStreamProxy!=null, //boolean useOut, fHasStderr, // fSendErrorsToStreamProxy!=null, //boolean useErr, WRONG null)) : null;//String buildStamp //final ToolLogFile fToolLogFile=toolLogFile; //errorListener=null; // if (fSendErrorsToStreamProxy!=null){ timeStamp)) : null;//String buildStamp - use the one from the tool final IStreamMonitor consoleErrStreamMonitor=consoleInStreamProxy.getErrorStreamMonitor(); errorListener=new IStreamListener(){ Loading Loading @@ -399,7 +396,10 @@ public class VDTConsoleRunner{ VDTLaunchUtil.getRunner().abortLaunch(runConfig.getOriginalConsoleName()); return; } if (runConfig.gotGood()){ if (runConfig.gotGood() || ((buildParamsItem.getFailureString()!=null) && // was only looking for bad, otherwise OK (buildParamsItem.getSuccessString()==null)) ){ tool.setDirty(false); tool.setState(TOOL_STATE.SUCCESS); } else if (buildParamsItem.getSuccessString()!=null){ Loading src/com/elphel/vdt/core/launching/VDTRunner.java +2 −2 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class VDTRunner { tool.setState(TOOL_STATE.FAILURE); // tool.setRunning(false); tool.setMode(TOOL_MODE.STOP); tool.setTimeStamp(); // tool.setTimeStamp(); // will set at start tool.toolFinished(); //removeConfiguration runningBuilds.removeConfiguration(runConfig.getOriginalConsoleName()); Loading Loading @@ -270,7 +270,7 @@ public class VDTRunner { // tool.setRunning(false); tool.setMode(TOOL_MODE.STOP); tool.setTimeStamp(); // tool.setTimeStamp(); //will set at start if ((tool.getState()==TOOL_STATE.SUCCESS) && runConfig.isKeptOpen()) { tool.setState(TOOL_STATE.KEPT_OPEN); } else { // failure on not Loading src/com/elphel/vdt/core/tools/contexts/BuildParamsItem.java +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ public class BuildParamsItem implements Cloneable{ } public String getNameAsParser() { return is_parser?name:null; } public boolean isParser() {return is_parser;} public String getName() { return name; } public String getErrors() { return toolErrors; } public String getWarnings() { return toolWarnings; } Loading src/com/elphel/vdt/core/tools/contexts/Context.java +70 −8 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.ArrayList; import java.util.List; import com.elphel.vdt.core.tools.ToolsCore; import com.elphel.vdt.core.tools.config.Config; import com.elphel.vdt.core.tools.config.ConfigException; import com.elphel.vdt.core.tools.config.xml.XMLConfig; Loading Loading @@ -58,6 +59,7 @@ public abstract class Context { private String workingDirectory; private String version; private Context context=null; private int currentHash; // calculated during buildparam from non-parser command blocks and command files. protected Context(String name, String controlInterfaceName, String label, Loading @@ -77,6 +79,17 @@ public abstract class Context { this.paramContainer = new ParameterContainer(params); } /** * Generated hashcode for the last run of buildParams() - includes command files and non-parser command lines * @return generated hash code */ public int getCurrentHash(){ return currentHash; } public void setCurrentHash(int hash){ currentHash=hash; } public void init(Config config) throws ConfigException { checkNotInitialized(); Loading Loading @@ -217,16 +230,38 @@ public abstract class Context { } return consoleList; } // currently - for all tools, skip generation of control files, ignore errors public void recalcHashCodes(){ System.out.println("Context.java(): RECALC HASH CODES"); // called from ContextOptionsDialog.okPressed() line: 89 // all context parameters are already recalculated (buildParams() ), so now we just go through all tool contexts, // calling them with dryRun=true; for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){ try { tool.buildParams(false); if (tool.hashMatch()) System.out.println("recalcHashCodes(): "+tool.getName()+ " hashMatch()="+tool.hashMatch()+ " getCurrentHash()="+tool.getCurrentHash()+ " getLastRunHash()="+tool.getLastRunHash()); } catch (ToolException e) { System.out.println("failed buildParams(false) on tool="+tool.getName()+", e="+e.toString()); } } } public BuildParamsItem[] buildParams() throws ToolException { return buildParams(false); } public BuildParamsItem[] buildParams(boolean dryRun) throws ToolException { List<BuildParamsItem> buildParamItems = new ArrayList<BuildParamsItem>(); // List<String> commandLineParams = new ArrayList<String>(); Iterator<CommandLinesBlock> commandLinesBlockIter = commandLinesBlocks.iterator(); // command lines block is empty (yes, there is nothing in project output) createdControlFiles.clear(); currentHash=0; while(commandLinesBlockIter.hasNext()) { CommandLinesBlock commandLinesBlock = (CommandLinesBlock)commandLinesBlockIter.next(); Loading Loading @@ -281,6 +316,7 @@ public abstract class Context { if (isConsoleName) { // System.out.println("TODO: Enable console command generation here"); printStringsToConsoleLine(commandLineParams, commandSequence,sep,mark); //if (name!=null) - it is a parser, do not include in hashcode generation buildParamItems.add( new BuildParamsItem ( (String[])commandLineParams.toArray(new String[commandLineParams.size()]), Loading Loading @@ -313,12 +349,17 @@ public abstract class Context { // write strings to control file boolean controlFileExists = controlFileExists(controlFileName); if (!dryRun) { printStringsToFile(controlFileName, controlFileExists, commandSequence, sep, mark); if(!controlFileExists) createdControlFiles.add(controlFileName); } // include hash codes for each segment of the command file content for (List<String> lStr:commandSequence){ if (lStr!=null) for (String str:lStr){ if (str!=null) currentHash += str.hashCode(); } } } } else { // processing command line printStringsToCommandLine(commandLineParams, commandSequence, mark); Loading Loading @@ -351,6 +392,27 @@ public abstract class Context { BuildParamsItem buildParamsItem = (BuildParamsItem)buildParamItemsIter.next(); buildParamsItem.removeNonParser(buildParamItems); } // include hash codes for each line in the command sequence if it is not a parser for (BuildParamsItem item:buildParamItems){ if (!item.isParser()){ String [] params=item.getParams(); if (params!=null) for (int i=0;i<params.length;i++){ currentHash += params[i].hashCode(); } } } // System.out.println("BildParam("+dryRun+"), name="+name+" currentHash="+currentHash); // Seems that during build it worked on a working copy of the tool, so calculated parameter did not get back Tool proto=ToolsCore.getConfig().getContextManager().findTool(name); if (proto!=null){ if (proto!=this){ System.out.println("++++ Updating tool's currentHas from working copy, name="+name); proto.setCurrentHash(currentHash); } } return (BuildParamsItem[])buildParamItems.toArray(new BuildParamsItem[buildParamItems.size()]); } Loading src/com/elphel/vdt/core/tools/generators/BuildStampGenerator.java +7 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,12 @@ public class BuildStampGenerator extends AbstractGenerator { } protected String[] getStringValues() { return new String[] {SelectedResourceManager.getDefault().getBuildStamp()}; // if ( return new String[] {(tool0!=null)?tool0.getStateFile(): ""}; // System.out.println("#### BuildStampGenerator(): tool0="+ //((tool0!=null)?(tool0.getName()+" state="+tool0.getState()+" mode="+tool0.getMode()):"null")); String stamp=(tool0!=null)?tool0.getTimeStamp(): null; if (stamp==null) stamp=SelectedResourceManager.getDefault().getBuildStamp(); return new String[] {stamp}; } } No newline at end of file Loading
src/com/elphel/vdt/core/launching/VDTConsoleRunner.java +6 −6 Original line number Diff line number Diff line Loading @@ -198,6 +198,7 @@ public class VDTConsoleRunner{ System.out.println("Using success string: \""+buildParamsItem.getSuccessString()+"\""); System.out.println("Using failure string: \""+buildParamsItem.getFailureString()+"\""); } String timeStamp=ToolsCore.getTool(runConfig.getToolName()).getTimeStamp(); toolLogFile=(((fSendOutputToStreamProxy!=null) || (fSendErrorsToStreamProxy!=null)))? (new ToolLogFile ( runConfig.getLogDir(), Loading @@ -206,11 +207,7 @@ public class VDTConsoleRunner{ null, // extension - use default fHasStdout, // fSendOutputToStreamProxy!=null, //boolean useOut, fHasStderr, // fSendErrorsToStreamProxy!=null, //boolean useErr, WRONG null)) : null;//String buildStamp //final ToolLogFile fToolLogFile=toolLogFile; //errorListener=null; // if (fSendErrorsToStreamProxy!=null){ timeStamp)) : null;//String buildStamp - use the one from the tool final IStreamMonitor consoleErrStreamMonitor=consoleInStreamProxy.getErrorStreamMonitor(); errorListener=new IStreamListener(){ Loading Loading @@ -399,7 +396,10 @@ public class VDTConsoleRunner{ VDTLaunchUtil.getRunner().abortLaunch(runConfig.getOriginalConsoleName()); return; } if (runConfig.gotGood()){ if (runConfig.gotGood() || ((buildParamsItem.getFailureString()!=null) && // was only looking for bad, otherwise OK (buildParamsItem.getSuccessString()==null)) ){ tool.setDirty(false); tool.setState(TOOL_STATE.SUCCESS); } else if (buildParamsItem.getSuccessString()!=null){ Loading
src/com/elphel/vdt/core/launching/VDTRunner.java +2 −2 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class VDTRunner { tool.setState(TOOL_STATE.FAILURE); // tool.setRunning(false); tool.setMode(TOOL_MODE.STOP); tool.setTimeStamp(); // tool.setTimeStamp(); // will set at start tool.toolFinished(); //removeConfiguration runningBuilds.removeConfiguration(runConfig.getOriginalConsoleName()); Loading Loading @@ -270,7 +270,7 @@ public class VDTRunner { // tool.setRunning(false); tool.setMode(TOOL_MODE.STOP); tool.setTimeStamp(); // tool.setTimeStamp(); //will set at start if ((tool.getState()==TOOL_STATE.SUCCESS) && runConfig.isKeptOpen()) { tool.setState(TOOL_STATE.KEPT_OPEN); } else { // failure on not Loading
src/com/elphel/vdt/core/tools/contexts/BuildParamsItem.java +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ public class BuildParamsItem implements Cloneable{ } public String getNameAsParser() { return is_parser?name:null; } public boolean isParser() {return is_parser;} public String getName() { return name; } public String getErrors() { return toolErrors; } public String getWarnings() { return toolWarnings; } Loading
src/com/elphel/vdt/core/tools/contexts/Context.java +70 −8 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.ArrayList; import java.util.List; import com.elphel.vdt.core.tools.ToolsCore; import com.elphel.vdt.core.tools.config.Config; import com.elphel.vdt.core.tools.config.ConfigException; import com.elphel.vdt.core.tools.config.xml.XMLConfig; Loading Loading @@ -58,6 +59,7 @@ public abstract class Context { private String workingDirectory; private String version; private Context context=null; private int currentHash; // calculated during buildparam from non-parser command blocks and command files. protected Context(String name, String controlInterfaceName, String label, Loading @@ -77,6 +79,17 @@ public abstract class Context { this.paramContainer = new ParameterContainer(params); } /** * Generated hashcode for the last run of buildParams() - includes command files and non-parser command lines * @return generated hash code */ public int getCurrentHash(){ return currentHash; } public void setCurrentHash(int hash){ currentHash=hash; } public void init(Config config) throws ConfigException { checkNotInitialized(); Loading Loading @@ -217,16 +230,38 @@ public abstract class Context { } return consoleList; } // currently - for all tools, skip generation of control files, ignore errors public void recalcHashCodes(){ System.out.println("Context.java(): RECALC HASH CODES"); // called from ContextOptionsDialog.okPressed() line: 89 // all context parameters are already recalculated (buildParams() ), so now we just go through all tool contexts, // calling them with dryRun=true; for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){ try { tool.buildParams(false); if (tool.hashMatch()) System.out.println("recalcHashCodes(): "+tool.getName()+ " hashMatch()="+tool.hashMatch()+ " getCurrentHash()="+tool.getCurrentHash()+ " getLastRunHash()="+tool.getLastRunHash()); } catch (ToolException e) { System.out.println("failed buildParams(false) on tool="+tool.getName()+", e="+e.toString()); } } } public BuildParamsItem[] buildParams() throws ToolException { return buildParams(false); } public BuildParamsItem[] buildParams(boolean dryRun) throws ToolException { List<BuildParamsItem> buildParamItems = new ArrayList<BuildParamsItem>(); // List<String> commandLineParams = new ArrayList<String>(); Iterator<CommandLinesBlock> commandLinesBlockIter = commandLinesBlocks.iterator(); // command lines block is empty (yes, there is nothing in project output) createdControlFiles.clear(); currentHash=0; while(commandLinesBlockIter.hasNext()) { CommandLinesBlock commandLinesBlock = (CommandLinesBlock)commandLinesBlockIter.next(); Loading Loading @@ -281,6 +316,7 @@ public abstract class Context { if (isConsoleName) { // System.out.println("TODO: Enable console command generation here"); printStringsToConsoleLine(commandLineParams, commandSequence,sep,mark); //if (name!=null) - it is a parser, do not include in hashcode generation buildParamItems.add( new BuildParamsItem ( (String[])commandLineParams.toArray(new String[commandLineParams.size()]), Loading Loading @@ -313,12 +349,17 @@ public abstract class Context { // write strings to control file boolean controlFileExists = controlFileExists(controlFileName); if (!dryRun) { printStringsToFile(controlFileName, controlFileExists, commandSequence, sep, mark); if(!controlFileExists) createdControlFiles.add(controlFileName); } // include hash codes for each segment of the command file content for (List<String> lStr:commandSequence){ if (lStr!=null) for (String str:lStr){ if (str!=null) currentHash += str.hashCode(); } } } } else { // processing command line printStringsToCommandLine(commandLineParams, commandSequence, mark); Loading Loading @@ -351,6 +392,27 @@ public abstract class Context { BuildParamsItem buildParamsItem = (BuildParamsItem)buildParamItemsIter.next(); buildParamsItem.removeNonParser(buildParamItems); } // include hash codes for each line in the command sequence if it is not a parser for (BuildParamsItem item:buildParamItems){ if (!item.isParser()){ String [] params=item.getParams(); if (params!=null) for (int i=0;i<params.length;i++){ currentHash += params[i].hashCode(); } } } // System.out.println("BildParam("+dryRun+"), name="+name+" currentHash="+currentHash); // Seems that during build it worked on a working copy of the tool, so calculated parameter did not get back Tool proto=ToolsCore.getConfig().getContextManager().findTool(name); if (proto!=null){ if (proto!=this){ System.out.println("++++ Updating tool's currentHas from working copy, name="+name); proto.setCurrentHash(currentHash); } } return (BuildParamsItem[])buildParamItems.toArray(new BuildParamsItem[buildParamItems.size()]); } Loading
src/com/elphel/vdt/core/tools/generators/BuildStampGenerator.java +7 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,12 @@ public class BuildStampGenerator extends AbstractGenerator { } protected String[] getStringValues() { return new String[] {SelectedResourceManager.getDefault().getBuildStamp()}; // if ( return new String[] {(tool0!=null)?tool0.getStateFile(): ""}; // System.out.println("#### BuildStampGenerator(): tool0="+ //((tool0!=null)?(tool0.getName()+" state="+tool0.getState()+" mode="+tool0.getMode()):"null")); String stamp=(tool0!=null)?tool0.getTimeStamp(): null; if (stamp==null) stamp=SelectedResourceManager.getDefault().getBuildStamp(); return new String[] {stamp}; } } No newline at end of file