Commit 4a32831e authored by Andrey Filippov's avatar Andrey Filippov

continue on tool sequence

parent fa962a13
...@@ -115,7 +115,7 @@ public class ToolLogFile { ...@@ -115,7 +115,7 @@ public class ToolLogFile {
* @param hasErr Has error log (if no separate output log - no suffix * @param hasErr Has error log (if no separate output log - no suffix
* @param buildStamp if null - write log mode, "" - read link (latest) file, else - read that build stamp file * @param buildStamp if null - write log mode, "" - read link (latest) file, else - read that build stamp file
*/ */
public ToolLogFile ( public ToolLogFile(
String logDir, String logDir,
String logTool, String logTool,
String logName, String logName,
......
...@@ -198,6 +198,7 @@ public class VDTConsoleRunner{ ...@@ -198,6 +198,7 @@ public class VDTConsoleRunner{
System.out.println("Using success string: \""+buildParamsItem.getSuccessString()+"\""); System.out.println("Using success string: \""+buildParamsItem.getSuccessString()+"\"");
System.out.println("Using failure string: \""+buildParamsItem.getFailureString()+"\""); System.out.println("Using failure string: \""+buildParamsItem.getFailureString()+"\"");
} }
String timeStamp=ToolsCore.getTool(runConfig.getToolName()).getTimeStamp();
toolLogFile=(((fSendOutputToStreamProxy!=null) || (fSendErrorsToStreamProxy!=null)))? toolLogFile=(((fSendOutputToStreamProxy!=null) || (fSendErrorsToStreamProxy!=null)))?
(new ToolLogFile ( (new ToolLogFile (
runConfig.getLogDir(), runConfig.getLogDir(),
...@@ -206,11 +207,7 @@ public class VDTConsoleRunner{ ...@@ -206,11 +207,7 @@ public class VDTConsoleRunner{
null, // extension - use default null, // extension - use default
fHasStdout, // fSendOutputToStreamProxy!=null, //boolean useOut, fHasStdout, // fSendOutputToStreamProxy!=null, //boolean useOut,
fHasStderr, // fSendErrorsToStreamProxy!=null, //boolean useErr, WRONG fHasStderr, // fSendErrorsToStreamProxy!=null, //boolean useErr, WRONG
null)) : null;//String buildStamp timeStamp)) : null;//String buildStamp - use the one from the tool
//final ToolLogFile fToolLogFile=toolLogFile;
//errorListener=null;
// if (fSendErrorsToStreamProxy!=null){
final IStreamMonitor consoleErrStreamMonitor=consoleInStreamProxy.getErrorStreamMonitor(); final IStreamMonitor consoleErrStreamMonitor=consoleInStreamProxy.getErrorStreamMonitor();
errorListener=new IStreamListener(){ errorListener=new IStreamListener(){
...@@ -399,7 +396,10 @@ public class VDTConsoleRunner{ ...@@ -399,7 +396,10 @@ public class VDTConsoleRunner{
VDTLaunchUtil.getRunner().abortLaunch(runConfig.getOriginalConsoleName()); VDTLaunchUtil.getRunner().abortLaunch(runConfig.getOriginalConsoleName());
return; return;
} }
if (runConfig.gotGood()){ if (runConfig.gotGood() ||
((buildParamsItem.getFailureString()!=null) && // was only looking for bad, otherwise OK
(buildParamsItem.getSuccessString()==null))
){
tool.setDirty(false); tool.setDirty(false);
tool.setState(TOOL_STATE.SUCCESS); tool.setState(TOOL_STATE.SUCCESS);
} else if (buildParamsItem.getSuccessString()!=null){ } else if (buildParamsItem.getSuccessString()!=null){
......
...@@ -98,7 +98,7 @@ public class VDTRunner { ...@@ -98,7 +98,7 @@ public class VDTRunner {
tool.setState(TOOL_STATE.FAILURE); tool.setState(TOOL_STATE.FAILURE);
// tool.setRunning(false); // tool.setRunning(false);
tool.setMode(TOOL_MODE.STOP); tool.setMode(TOOL_MODE.STOP);
tool.setTimeStamp(); // tool.setTimeStamp(); // will set at start
tool.toolFinished(); tool.toolFinished();
//removeConfiguration //removeConfiguration
runningBuilds.removeConfiguration(runConfig.getOriginalConsoleName()); runningBuilds.removeConfiguration(runConfig.getOriginalConsoleName());
...@@ -270,7 +270,7 @@ public class VDTRunner { ...@@ -270,7 +270,7 @@ public class VDTRunner {
// tool.setRunning(false); // tool.setRunning(false);
tool.setMode(TOOL_MODE.STOP); tool.setMode(TOOL_MODE.STOP);
tool.setTimeStamp(); // tool.setTimeStamp(); //will set at start
if ((tool.getState()==TOOL_STATE.SUCCESS) && runConfig.isKeptOpen()) { if ((tool.getState()==TOOL_STATE.SUCCESS) && runConfig.isKeptOpen()) {
tool.setState(TOOL_STATE.KEPT_OPEN); tool.setState(TOOL_STATE.KEPT_OPEN);
} else { // failure on not } else { // failure on not
......
...@@ -139,6 +139,7 @@ public class BuildParamsItem implements Cloneable{ ...@@ -139,6 +139,7 @@ public class BuildParamsItem implements Cloneable{
} }
public String getNameAsParser() { return is_parser?name:null; } public String getNameAsParser() { return is_parser?name:null; }
public boolean isParser() {return is_parser;}
public String getName() { return name; } public String getName() { return name; }
public String getErrors() { return toolErrors; } public String getErrors() { return toolErrors; }
public String getWarnings() { return toolWarnings; } public String getWarnings() { return toolWarnings; }
......
...@@ -26,6 +26,7 @@ import java.util.Iterator; ...@@ -26,6 +26,7 @@ import java.util.Iterator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.Config;
import com.elphel.vdt.core.tools.config.ConfigException; import com.elphel.vdt.core.tools.config.ConfigException;
import com.elphel.vdt.core.tools.config.xml.XMLConfig; import com.elphel.vdt.core.tools.config.xml.XMLConfig;
...@@ -58,6 +59,7 @@ public abstract class Context { ...@@ -58,6 +59,7 @@ public abstract class Context {
private String workingDirectory; private String workingDirectory;
private String version; private String version;
private Context context=null; private Context context=null;
private int currentHash; // calculated during buildparam from non-parser command blocks and command files.
protected Context(String name, protected Context(String name,
String controlInterfaceName, String controlInterfaceName,
String label, String label,
...@@ -77,6 +79,17 @@ public abstract class Context { ...@@ -77,6 +79,17 @@ public abstract class Context {
this.paramContainer = new ParameterContainer(params); 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 { public void init(Config config) throws ConfigException {
checkNotInitialized(); checkNotInitialized();
...@@ -217,16 +230,38 @@ public abstract class Context { ...@@ -217,16 +230,38 @@ public abstract class Context {
} }
return consoleList; 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 { public BuildParamsItem[] buildParams() throws ToolException {
return buildParams(false);
}
public BuildParamsItem[] buildParams(boolean dryRun) throws ToolException {
List<BuildParamsItem> buildParamItems = new ArrayList<BuildParamsItem>(); List<BuildParamsItem> buildParamItems = new ArrayList<BuildParamsItem>();
// List<String> commandLineParams = new ArrayList<String>(); // List<String> commandLineParams = new ArrayList<String>();
Iterator<CommandLinesBlock> commandLinesBlockIter = commandLinesBlocks.iterator(); // command lines block is empty (yes, there is nothing in project output) Iterator<CommandLinesBlock> commandLinesBlockIter = commandLinesBlocks.iterator(); // command lines block is empty (yes, there is nothing in project output)
createdControlFiles.clear(); createdControlFiles.clear();
currentHash=0;
while(commandLinesBlockIter.hasNext()) { while(commandLinesBlockIter.hasNext()) {
CommandLinesBlock commandLinesBlock = (CommandLinesBlock)commandLinesBlockIter.next(); CommandLinesBlock commandLinesBlock = (CommandLinesBlock)commandLinesBlockIter.next();
...@@ -281,6 +316,7 @@ public abstract class Context { ...@@ -281,6 +316,7 @@ public abstract class Context {
if (isConsoleName) { if (isConsoleName) {
// System.out.println("TODO: Enable console command generation here"); // System.out.println("TODO: Enable console command generation here");
printStringsToConsoleLine(commandLineParams, commandSequence,sep,mark); printStringsToConsoleLine(commandLineParams, commandSequence,sep,mark);
//if (name!=null) - it is a parser, do not include in hashcode generation
buildParamItems.add( buildParamItems.add(
new BuildParamsItem ( new BuildParamsItem (
(String[])commandLineParams.toArray(new String[commandLineParams.size()]), (String[])commandLineParams.toArray(new String[commandLineParams.size()]),
...@@ -313,12 +349,17 @@ public abstract class Context { ...@@ -313,12 +349,17 @@ public abstract class Context {
// write strings to control file // write strings to control file
boolean controlFileExists = controlFileExists(controlFileName); boolean controlFileExists = controlFileExists(controlFileName);
if (!dryRun) {
printStringsToFile(controlFileName, controlFileExists, commandSequence, sep, mark); printStringsToFile(controlFileName, controlFileExists, commandSequence, sep, mark);
if(!controlFileExists)
if(!controlFileExists) createdControlFiles.add(controlFileName);
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 } else { // processing command line
printStringsToCommandLine(commandLineParams, commandSequence, mark); printStringsToCommandLine(commandLineParams, commandSequence, mark);
...@@ -351,6 +392,27 @@ public abstract class Context { ...@@ -351,6 +392,27 @@ public abstract class Context {
BuildParamsItem buildParamsItem = (BuildParamsItem)buildParamItemsIter.next(); BuildParamsItem buildParamsItem = (BuildParamsItem)buildParamItemsIter.next();
buildParamsItem.removeNonParser(buildParamItems); 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()]); return (BuildParamsItem[])buildParamItems.toArray(new BuildParamsItem[buildParamItems.size()]);
} }
......
...@@ -27,6 +27,12 @@ public class BuildStampGenerator extends AbstractGenerator { ...@@ -27,6 +27,12 @@ public class BuildStampGenerator extends AbstractGenerator {
} }
protected String[] getStringValues() { 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
/*******************************************************************************
* Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package com.elphel.vdt.core.tools.generators;
import com.elphel.vdt.VDT;
import com.elphel.vdt.ui.variables.SelectedResourceManager;
/**
* Generates name of teh sate file without extension
*
*/
public class StateBaseGenerator extends AbstractGenerator {
public static final String NAME = VDT.GENERATOR_ID_STATE_FILE;
public String getName() {
return NAME;
}
protected String[] getStringValues() {
String base=(tool0!=null)?tool0.getStateFile(): "";
if (base.lastIndexOf('.')>=0) base=base.substring(0,base.lastIndexOf('.'));
return new String[] {base};
}
}
...@@ -49,6 +49,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -49,6 +49,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
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 String baseToolName; private String baseToolName;
...@@ -100,7 +101,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -100,7 +101,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
private boolean dirty=false; // tool ran before its sources (runtime value) private boolean dirty=false; // tool ran before its sources (runtime value)
private boolean pinned=false; // tool ran before its sources (runtime value) private boolean pinned=false; // tool ran before its sources (runtime value)
private long runStamp=0; // timestamp of the tool last ran (0 - never) // private long runStamp=0; // timestamp of the tool last ran (0 - never)
private TOOL_STATE state=TOOL_STATE.NEW; // tool state (succ, fail,new, running) private TOOL_STATE state=TOOL_STATE.NEW; // tool state (succ, fail,new, running)
// private boolean running=false; // private boolean running=false;
// private long finishTimeStamp=0; // private long finishTimeStamp=0;
...@@ -121,7 +122,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -121,7 +122,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
private TOOL_MODE runMode; private TOOL_MODE runMode;
private TOOL_MODE lastRunMode; // last running (not STOP) mode private TOOL_MODE lastRunMode; // last running (not STOP) mode
private int lastRunHash; // hash code of the last run
public Tool(String name, public Tool(String name,
String controlInterfaceName, String controlInterfaceName,
...@@ -222,7 +223,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -222,7 +223,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
PLAYBACK PLAYBACK
} }
public void setRunStamp(long runStamp) { this.runStamp=runStamp; } // public void setRunStamp(long runStamp) { this.runStamp=runStamp; }
public List<String> getDepends() { return depends; } public List<String> getDepends() { return depends; }
public boolean isDirty() { return dirty; } public boolean isDirty() { return dirty; }
// public boolean isRunning() { return running; } // public boolean isRunning() { return running; }
...@@ -231,7 +232,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -231,7 +232,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public TOOL_MODE getLastMode() { return lastRunMode; } public TOOL_MODE getLastMode() { return lastRunMode; }
public long getRunStamp() { return runStamp; } // public long getRunStamp() { return runStamp; }
public TOOL_STATE getState() { return state; } public TOOL_STATE getState() { return state; }
public boolean isPinned() { return pinned; } public boolean isPinned() { return pinned; }
public String getOpenState() { return openState; } public String getOpenState() { return openState; }
...@@ -240,13 +241,6 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -240,13 +241,6 @@ public class Tool extends Context implements Cloneable, Inheritable {
public Tool getOpenTool() { return openTool; } public Tool getOpenTool() { return openTool; }
public void setOpenTool(Tool openTool) { this.openTool=openTool;} public void setOpenTool(Tool openTool) { this.openTool=openTool;}
public void setTimeStamp(){
timeStamp=SelectedResourceManager.getDefault().getBuildStamp();
}
public String getFinishTimeStamp(){
return timeStamp;
}
public void setDirty(boolean dirty) { public void setDirty(boolean dirty) {
this.dirty=dirty; this.dirty=dirty;
...@@ -262,14 +256,37 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -262,14 +256,37 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
public void setMode(TOOL_MODE mode) { public void setMode(TOOL_MODE mode) {
if ((runMode!=TOOL_MODE.STOP) && (mode==TOOL_MODE.STOP)){ // jsut stopped
lastRunHash=getCurrentHash();
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println(":::: Tool "+name+": lastRunHash="+lastRunHash);
}
}
runMode=mode; runMode=mode;
if (mode!=TOOL_MODE.STOP) lastRunMode=mode; if (mode!=TOOL_MODE.STOP) lastRunMode=mode;
if (mode == TOOL_MODE.RUN) { // Only RUN
setTimeStamp(); // copy current time to tool timestamp
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println(":::: Tool "+name+": setTimeStamp="+timeStamp);
}
}
// toolFinished(); // toolFinished();
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("--->> "+name+": setMode("+mode+"), lastRunMode="+lastRunMode); System.out.println("--->> "+name+": setMode("+mode+"), lastRunMode="+lastRunMode);
} }
} }
public boolean hashMatch(){
return lastRunHash == getCurrentHash();
}
public int getLastRunHash(){
return lastRunHash;
}
public void setLastRunHash(int hash){ // to restore from file
lastRunHash=hash;
}
public void setState(TOOL_STATE state) { public void setState(TOOL_STATE state) {
this.state=state; this.state=state;
// toolFinished(); // toolFinished();
...@@ -284,18 +301,6 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -284,18 +301,6 @@ public class Tool extends Context implements Cloneable, Inheritable {
public void toolFinished(){ public void toolFinished(){
designFlowView.getToolSequence().toolFinished(this); designFlowView.getToolSequence().toolFinished(this);
/*
System.out.println("Tool "+getName()+" FINISHED - add more stuff here");
if (designFlowView!=null){
Display.getDefault().syncExec(new Runnable() {
public void run() {
designFlowView.updateLaunchAction(); // Run from Display thread to prevent "invalid thread access" when called from Runner
}
});
}
*/
} }
...@@ -659,13 +664,19 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here"); ...@@ -659,13 +664,19 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here");
return null; return null;
} }
public String getStateFile() {return getStateFile(true); } public String getStateFile() {return getStateFile(true); } // With timestamp or as specified in resultFile
public String getStateFile(boolean first) { public String getStateFile(boolean first) {
if (resultFile!=null) return resultFile; if (resultFile!=null) return resultFile;
List<String> names= getResultNames(); List<String> names= getResultNames();
if (names!=null) { if (names!=null) {
if (names.size()==0) return null; if (names.size()==0) return null;
return ToolLogFile.insertTimeStamp(names.get(0),SelectedResourceManager.getDefault().getBuildStamp()); // return ToolLogFile.insertTimeStamp(names.get(0),SelectedResourceManager.getDefault().getBuildStamp());
String stamp=getTimeStamp();
if (stamp==null){
// System.out.println("*** Warning: no timestamp available in Tool.getStateFile() for tool "+getName()); // OK when dryRun
return null;
}
return ToolLogFile.insertTimeStamp(names.get(0),getTimeStamp());
} }
if (!first) return null ; // prevent loops if (!first) return null ; // prevent loops
if (restoreMaster != null) return restoreMaster.getStateFile(false); if (restoreMaster != null) return restoreMaster.getStateFile(false);
...@@ -673,13 +684,42 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here"); ...@@ -673,13 +684,42 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here");
return null; return null;
} }
public void setTimeStamp(){
timeStamp=SelectedResourceManager.getDefault().getBuildStamp();
}
public void setTimeStamp(String timeStamp){
this.timeStamp=timeStamp;
}
public String getTimeStamp() {return getTimeStamp(true); } // With timestamp or as specified in resultFile
public String getTimeStamp(boolean first){
if (timeStamp!=null) return timeStamp;
if (!first) return null ; // prevent loops
if (restoreMaster != null) return restoreMaster.getTimeStamp(false);
if (saveMaster != null) return saveMaster.getTimeStamp(false);
return null;
}
public String getStateLink() {return getStateLink(true); } // No timestamp, link name (or null)
public String getStateLink(boolean first) {
List<String> names= getResultNames();
if (names!=null) {
if (names.size()==0) return null;
return names.get(0);
}
if (!first) return null ; // prevent loops
if (restoreMaster != null) return restoreMaster.getStateLink(false);
if (saveMaster != null) return saveMaster.getStateLink(false);
return null;
}
public void setResultFile(String filename){ public void setResultFile(String filename){
resultFile=filename; resultFile=filename;
} }
public String getResultName(){ public String getResultName(){ // does not look at masters
List<String> names= getResultNames(); List<String> names= getResultNames();
if ((names==null) || (names.size()==0)) return null; if ((names==null) || (names.size()==0)) return null;
return names.get(0); return names.get(0);
...@@ -690,6 +730,8 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here"); ...@@ -690,6 +730,8 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here");
memento.putBoolean(name+TAG_TOOL_PINNED, new Boolean(pinned)); memento.putBoolean(name+TAG_TOOL_PINNED, new Boolean(pinned));
memento.putString(name+TAG_TOOL_STATE, this.state.toString()); memento.putString(name+TAG_TOOL_STATE, this.state.toString());
if (timeStamp!=null) memento.putString(name+TAG_TOOL_TIMESTAMP, timeStamp); if (timeStamp!=null) memento.putString(name+TAG_TOOL_TIMESTAMP, timeStamp);
if (lastRunHash!=0) memento.putInteger(name+TAG_TOOL_LASTRUNHASH, lastRunHash);
} }
public void restoreState(IMemento memento) { public void restoreState(IMemento memento) {
...@@ -707,6 +749,8 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here"); ...@@ -707,6 +749,8 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here");
} }
String timestamp=memento.getString(name+TAG_TOOL_TIMESTAMP); String timestamp=memento.getString(name+TAG_TOOL_TIMESTAMP);
if (timestamp!=null) this.timeStamp=timestamp; if (timestamp!=null) this.timeStamp=timestamp;
Integer hc=memento.getInteger(name+TAG_TOOL_LASTRUNHASH);
if (hc!=null) lastRunHash=hc;
} }
...@@ -1012,6 +1056,7 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here"); ...@@ -1012,6 +1056,7 @@ System.out.println("Tool "+getName()+" FINISHED - add more stuff here");
return super.buildParams(); return super.buildParams();
} }
protected List<String> buildCommandString(String paramStringTemplate) protected List<String> buildCommandString(String paramStringTemplate)
throws ToolException throws ToolException
{ {
......
...@@ -23,9 +23,11 @@ import org.eclipse.core.resources.IProject; ...@@ -23,9 +23,11 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import com.elphel.vdt.Txt; import com.elphel.vdt.Txt;
import com.elphel.vdt.VDT;
import com.elphel.vdt.core.launching.LaunchCore; import com.elphel.vdt.core.launching.LaunchCore;
import com.elphel.vdt.core.launching.ToolLogFile; import com.elphel.vdt.core.launching.ToolLogFile;
import com.elphel.vdt.core.tools.ToolsCore; import com.elphel.vdt.core.tools.ToolsCore;
...@@ -42,11 +44,164 @@ import java.io.File; ...@@ -42,11 +44,164 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
public class ToolSequence { public class ToolSequence {
public static final QualifiedName OPTION_TOOL_HASHCODE = new QualifiedName(VDT.ID_VDT, "OPTION_TOOL_HASHCODE");
public static final QualifiedName OPTION_TOOL_TIMESTAMP = new QualifiedName(VDT.ID_VDT, "OPTION_TOOL_TIMESTAMP");
private boolean shiftPressed=false;
private DesignFlowView designFlowView; private DesignFlowView designFlowView;
private boolean stopOn; // Stop button is pressed
private boolean saveOn; // save button is on
public boolean okToRun(){
if (isAnyToolRunnig()){
MessageUI.error("Some tool(s) are running, can not start another one. Press 'stop' button while holding"+
" 'Shift' key if it is an error. This is a debug feature - the tools will not be stopped (just marked as if stopped)");
return false;
}
// Do other things: turn off SAVE, STOP, ...
setStop(false);
setSave(false);
designFlowView.setToggleSaveTools(false);
designFlowView.setToggleStopTools(false);
return true;
}
public void setShiftPressed(boolean pressed){
shiftPressed=pressed;
System.out.println("setShiftPressed("+shiftPressed+")");
}
public boolean isShiftPressed(){
return shiftPressed;
}
public ToolSequence(DesignFlowView designFlowView){ public ToolSequence(DesignFlowView designFlowView){
this.designFlowView=designFlowView; this.designFlowView=designFlowView;
} }
public void setStop(boolean pressed){
this.stopOn=pressed;
if (pressed && shiftPressed) {
System.out.println("Marking all running tools as if they are stopped");
stopAllRunnig();
}
}
public void setSave(boolean pressed){
this.saveOn=pressed;
}
public boolean isStop(){
return stopOn;
}
public boolean isSave(){
return saveOn;
}
public boolean isSaveEnabled(){
return !getToolsToSave().isEmpty();
}
public List<Tool> getOpenSessions(){
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
List<Tool> sessionList=new ArrayList<Tool>();
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
System.out.println("Looking for open console: "+tool.getName()+
" state="+tool.getState());
if (
(tool.getState()==TOOL_STATE.KEPT_OPEN) &&
(tool.getOpenTool()!=null) &&
(tool.getOpenState()!=null)){
// See if state file is not saved
Tool ranTool=tool.getOpenTool();
String stateDirString=ranTool.getStateDir();
if (stateDirString==null){
System.out.println("getOpenSessions(): stateDirString==null");
continue;
}
String linkString=ranTool.getStateLink();
if (linkString==null){
System.out.println("getOpenSessions(): linkString==null");
continue;
}
IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString);
IFile link= stateDir.getFile(linkString); // null
IFile target= stateDir.getFile(tool.getOpenState());
System.out.println("****link.getRawLocation()= "+link.getRawLocation().toString());
System.out.println("****target.getLocation()= "+target.getLocation().toString());
sessionList.add(tool);
}
}
return sessionList;
}
// TODO: "save" - finds the first unsaved state and launches save.
// If none available - turns off save and updates view.
// when tool is finished - check "save" button, and if "on" - repeat again
// save is turned off by any tool launch and finish with error
// Decide how to find out any tool is running (search all and ) and overrun block - block will just set all tools to not-running
/**
* Create list of tools (just one with a single open session) that have unsaved state
* @return never null, may be empty list
*/
public List<Tool> getToolsToSave(){
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
List<Tool> saveToolsList=new ArrayList<Tool>();
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
// System.out.println("Looking for open console: "+tool.getName()+" state="+tool.getState());
if (
(tool.getState()==TOOL_STATE.KEPT_OPEN) &&
(tool.getOpenTool()!=null) &&
(tool.getOpenState()!=null)){
// See if state file is not saved
Tool ranTool=tool.getOpenTool();
String stateDirString=ranTool.getStateDir();
if (stateDirString==null){
System.out.println("getOpenSessions(): stateDirString==null");
continue;
}
String linkString=ranTool.getStateLink();
if (linkString==null){
System.out.println("getOpenSessions(): linkString==null");
continue;
}
IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString);
IFile link= stateDir.getFile(linkString); // null
IFile target= stateDir.getFile(tool.getOpenState());
System.out.println("****link.getRawLocation()= "+link.getRawLocation().toString());
System.out.println("****target.getLocation()= "+target.getLocation().toString());
if (!link.getRawLocation().toString().equals(target.getLocation().toString())){
saveToolsList.add(ranTool);
System.out.println("****Adding= "+ranTool.getName());
}
}
}
return saveToolsList;
}
//TODO: make possible to run multiple tools async if they do not share common session
public boolean isAnyToolRunnig(){
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
List<Tool> saveToolsList=new ArrayList<Tool>();
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
if (tool.isRunning()) return true;
}
return false;
}
// call when double-click on stop?
public void stopAllRunnig(){ // does not actually stop - just marks as if stopped for debug purposes
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
List<Tool> saveToolsList=new ArrayList<Tool>();
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
if (tool.isRunning()) {
tool.setState(TOOL_STATE.FAILURE);
tool.setMode(TOOL_MODE.STOP);
}
}
}
public void toolFinished(Tool tool){ public void toolFinished(Tool tool){
if (tool.isRunning()) { if (tool.isRunning()) {
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
...@@ -54,14 +209,35 @@ public class ToolSequence { ...@@ -54,14 +209,35 @@ public class ToolSequence {
return; return;
} }
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
System.out.println("\nTool "+tool.getName()+" FINISHED - add more stuff here"); System.out.println("\nTool "+tool.getName()+" FINISHED , state="+tool.getState()+", mode="+tool.getLastMode());
if (tool.getState()==TOOL_STATE.SUCCESS){ if (tool.getState()==TOOL_STATE.SUCCESS){
// Update state of the session(s) - should be done after run or restore
if (
(tool.getLastMode()==TOOL_MODE.RUN) ||
(tool.getLastMode()==TOOL_MODE.RESTORE)){
boolean sessionUpdated=updateSessionTools(tool); // Update state
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
System.out.println("updateSessionTools("+tool.getName()+"tool)-> "+sessionUpdated);
}
if (tool.getLastMode()==TOOL_MODE.RESTORE){
restoreToolProperties(tool);// set last run hashcode and timestamp for the tool just restored
}
// Check for stop here
if (
(tool.getLastMode()==TOOL_MODE.RUN) || // not needed, but won't harm. Update will be after save
(tool.getLastMode()==TOOL_MODE.SAVE)){
updateLinkLatest(tool); // Do not update link if the session was just restored. Or should it be updated
//Currently hashcode/timestamp are set by the restore tool (at least when (by mistake) it was trying to save - it used it's own
}
getToolsToSave();
if (tryAutoSave(tool)) return; // started autoSave that will trigger "toolFinished" again if (tryAutoSave(tool)) return; // started autoSave that will trigger "toolFinished" again
updateLinkLatest(tool); // TODO - maybe swap and do updateLinkLatest before tryAutoSave
} else if (tool.getState()==TOOL_STATE.KEPT_OPEN){ } else if (tool.getState()==TOOL_STATE.KEPT_OPEN){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
System.out.println("\nTool "+tool.getName()+" kept open , state="+tool.getState()+", mode="+tool.getLastMode());
} else { } else {
} }
if (designFlowView!=null){ if (designFlowView!=null){
Display.getDefault().syncExec(new Runnable() { Display.getDefault().syncExec(new Runnable() {
...@@ -71,11 +247,57 @@ public class ToolSequence { ...@@ -71,11 +247,57 @@ public class ToolSequence {
}); });
} }
} }
public boolean restoreToolProperties(Tool tool){
if (tool.getLastMode()!=TOOL_MODE.RESTORE) return false;
if (tool.getRestoreMaster()!=null) tool=tool.getRestoreMaster();
else {
System.out.println("Tool "+tool.getName()+" does not have restoreMaster, but it came with getLastMode()!=TOOL_MODE.RESTORE");
}
String stateDirString=tool.getStateDir();
// String linkString=tool.getStateLink();
String targetString=tool.getStateFile(); // With timestamp or specifically set through selection
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString);
// Create file for target and see if it actually exists
IFile target= stateDir.getFile(targetString);
if (!target.exists()){
System.out.println("BUG: file that was just restored does not exist: "+
target.getLocation().toOSString());
return false;
}
String timestamp=null;
String sHashCode=null;
int hashCode=0;
try {
timestamp=target.getPersistentProperty(OPTION_TOOL_TIMESTAMP);
System.out.println("Got timestamp="+timestamp+" in "+target.getLocation().toOSString());
} catch (CoreException e) {
System.out.println("No timestamp in "+target.getLocation().toOSString());
}
try {
sHashCode=target.getPersistentProperty(OPTION_TOOL_HASHCODE);
hashCode=Integer.parseInt(sHashCode);
System.out.println("Got hashcode="+hashCode+" ("+sHashCode+") in "+target.getLocation().toOSString());
} catch (CoreException e) {
System.out.println("No hashcode in "+target.getLocation().toOSString());
}
if (timestamp!=null) {
tool.setTimeStamp(timestamp);
System.out.println("Restored timestamp="+timestamp+" for tool"+tool.getName());
}
if (hashCode!=0) {
tool.setLastRunHash(hashCode);
System.out.println("Restored lastRunHashCode="+hashCode+" for tool"+tool.getName());
}
return (timestamp!=null) && (hashCode!=0);
}
private boolean tryAutoSave(Tool tool){ private boolean tryAutoSave(Tool tool){
if ( if ((tool.getSave()!=null) && // save tool exists
(tool.getSave()!=null) && tool.getAutoSave() && // autosave enabled
tool.getAutoSave() && (designFlowView!=null) && // not needed anymore?
(designFlowView!=null) &&
(tool.getLastMode()==TOOL_MODE.RUN)) { // it was not playback of logs (tool.getLastMode()==TOOL_MODE.RUN)) { // it was not playback of logs
final Tool fTool=tool.getSave(); final Tool fTool=tool.getSave();
final IProject fProject = SelectedResourceManager.getDefault().getSelectedProject(); final IProject fProject = SelectedResourceManager.getDefault().getSelectedProject();
...@@ -105,23 +327,35 @@ public class ToolSequence { ...@@ -105,23 +327,35 @@ public class ToolSequence {
} }
}); });
return true; return true;
} else if (tool.getSaveMaster()!=null){ } else if (tool.getSaveMaster()!=null){ // that was save?
// tool.getSaveMaster().setRunning(false); // turn off the master tool that invoked this save one (may be called directly too) tool=tool.getSaveMaster();
tool.getSaveMaster().setMode(TOOL_MODE.STOP); tool.setMode(TOOL_MODE.STOP);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("Finished autosave tool "+tool.getName()+" for "+tool.getSaveMaster().getName()); System.out.println("Finished autosave tool "+tool.getName()+" for "+tool.getName());
} }
} }
return false; return false;
} }
// Result file may be skipped, in that case link should not be updated, but the console state should be // Result file may be skipped, in that case link should not be updated, but the console state should be
/**
* Update "latest" link to the last generated
* Executed after =TOOL_MODE.SAVE
* @param tool tool that just ran
*/
private void updateLinkLatest(Tool tool){ private void updateLinkLatest(Tool tool){
if (tool.getLastMode()==TOOL_MODE.PLAYBACK) return; // do nothing here if (tool.getLastMode()==TOOL_MODE.PLAYBACK) return; // do nothing here
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("updateLinkLatest("+tool.getName()+"), getLastMode()= "+tool.getLastMode());
}
String stateDirString=tool.getStateDir(); String stateDirString=tool.getStateDir();
String linkString=tool.getResultName(); String linkString=tool.getStateLink();
String targetString=tool.getStateFile(); // With timestamp or specifically set through selection String targetString=tool.getStateFile(); // With timestamp or specifically set through selection
System.out.println("Tool:"+tool.getName()+
" stateDirString="+stateDirString+
" linkString ="+linkString+
" targetString="+targetString);
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString); IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString);
// Create file for target and see if it actually exists // Create file for target and see if it actually exists
...@@ -139,9 +373,15 @@ public class ToolSequence { ...@@ -139,9 +373,15 @@ public class ToolSequence {
} }
// if (!file.exists()){ // if (!file.exists()){
if (!target.exists()){ if (!target.exists()){
System.out.println("Will not link "+linkString+" to nonexistent resource:"+targetString+" in "+stateDirString+": "+target.getLocation()); System.out.println("Will not link "+linkString+" to nonexistent resource:"+targetString+
" in "+stateDirString+": "+target.getLocation());
return; // No link created as there was no snapshot, but the console state is valid. return; // No link created as there was no snapshot, but the console state is valid.
} }
if (linkString==null){
System.out.println("No link name available for "+tool.getName());
return;
}
IFile link= stateDir.getFile(linkString); IFile link= stateDir.getFile(linkString);
try { try {
...@@ -163,8 +403,36 @@ public class ToolSequence { ...@@ -163,8 +403,36 @@ public class ToolSequence {
System.out.println("target.getModificationStamp()= "+target.getModificationStamp()); System.out.println("target.getModificationStamp()= "+target.getModificationStamp());
} }
if (tool.getSaveMaster()!=null){
tool=tool.getSaveMaster();
}
tool.getTimeStamp();
// tool.getLastRunHash()+"";
String sHash= new Integer(tool.getLastRunHash()).toString();
System.out.println("tool.getLastRunHash()="+tool.getLastRunHash()+", sHash="+sHash);
try {
target.setPersistentProperty(OPTION_TOOL_TIMESTAMP, tool.getTimeStamp());
System.out.println("setPersistentProperty("+OPTION_TOOL_TIMESTAMP+","+tool.getTimeStamp()+
" on "+target.getLocation().toOSString());
} catch (CoreException e) {
System.out.println("Failed to setPersistentProperty("+OPTION_TOOL_TIMESTAMP+","+tool.getTimeStamp()+
" on "+target.getLocation().toOSString());
}
try {
target.setPersistentProperty(OPTION_TOOL_HASHCODE, sHash);
System.out.println("setPersistentProperty("+OPTION_TOOL_HASHCODE+","+sHash+
" on "+target.getLocation().toOSString());
} catch (CoreException e) {
System.out.println("Failed to setPersistentProperty("+OPTION_TOOL_HASHCODE+","+sHash+
" on "+target.getLocation().toOSString());
}
} }
/**
* Update open session(s) state
* @param tool - tool just finished
* @return true if update happened
*/
private boolean updateSessionTools(Tool tool){ private boolean updateSessionTools(Tool tool){
String targetString=tool.getStateFile(); String targetString=tool.getStateFile();
// after restore this may be a non-timestamp file - use current timestamp instead of the restored? // after restore this may be a non-timestamp file - use current timestamp instead of the restored?
...@@ -192,9 +460,17 @@ public class ToolSequence { ...@@ -192,9 +460,17 @@ public class ToolSequence {
for(Iterator<Tool> iter = sessionList.iterator(); iter.hasNext();) { for(Iterator<Tool> iter = sessionList.iterator(); iter.hasNext();) {
Tool consoleTool=iter.next(); Tool consoleTool=iter.next();
consoleTool.setOpenState(targetString); consoleTool.setOpenState(targetString);
consoleTool.setOpenTool(tool);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
System.out.println("Set openState of "+consoleTool.getName()+" to "+targetString); System.out.println("Set openState of "+consoleTool.getName()+" to "+targetString);
if (tool.getRestoreMaster()!=null) { // after restore save master tool
consoleTool.setOpenTool(tool.getRestoreMaster());
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
System.out.println("Set setOpenTool of "+consoleTool.getName()+" to "+tool.getRestoreMaster().getName());
} else {
consoleTool.setOpenTool(tool);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
System.out.println("Set setOpenTool of "+consoleTool.getName()+" to "+tool.getName());
}
} }
} }
return true; return true;
......
...@@ -102,7 +102,7 @@ public class RepeaterRecognizer implements Recognizer { ...@@ -102,7 +102,7 @@ public class RepeaterRecognizer implements Recognizer {
String repSuffix, String repSuffix,
String separator) String separator)
{ {
System.out.println("Ever get here? RepeaterRecognizer.java:findGenerator()"); System.out.println("Ever get here? RepeaterRecognizer.java:findGenerator()"); // yes, sure
AbstractGenerator gen=new FilteredSourceListGenerator(repPrefix, repSuffix, separator); AbstractGenerator gen=new FilteredSourceListGenerator(repPrefix, repSuffix, separator);
if (genName.equals(gen.getName())) return gen; if (genName.equals(gen.getName())) return gen;
gen=new SourceListGenerator(repPrefix, repSuffix, separator); gen=new SourceListGenerator(repPrefix, repSuffix, separator);
......
...@@ -38,7 +38,8 @@ public class SimpleGeneratorRecognizer implements Recognizer { ...@@ -38,7 +38,8 @@ public class SimpleGeneratorRecognizer implements Recognizer {
new BuildStampGenerator(), new BuildStampGenerator(),
new UserNameGenerator(), new UserNameGenerator(),
new StateDirGenerator(), new StateDirGenerator(),
new StateFileGenerator() new StateFileGenerator(),
new StateBaseGenerator()
}; };
public SimpleGeneratorRecognizer(){ public SimpleGeneratorRecognizer(){
......
...@@ -74,14 +74,13 @@ public class VDTPluginImages { ...@@ -74,14 +74,13 @@ public class VDTPluginImages {
public static final ImageDescriptor DESC_PACKAGE_PROPERTIES = create(ICONS_PATH, "obj16"+File.separator+"package_prop.gif", null); public static final ImageDescriptor DESC_PACKAGE_PROPERTIES = create(ICONS_PATH, "obj16"+File.separator+"package_prop.gif", null);
public static final ImageDescriptor DESC_PROJECT_PROPERTIES = create(ICONS_PATH, "obj16"+File.separator+"project_prop.gif", null); public static final ImageDescriptor DESC_PROJECT_PROPERTIES = create(ICONS_PATH, "obj16"+File.separator+"project_prop.gif", null);
public static final ImageDescriptor DESC_DESIGM_MENU = create(ICONS_PATH, "obj16"+File.separator+"design_menu.gif", null); public static final ImageDescriptor DESC_DESIGM_MENU = create(ICONS_PATH, "obj16"+File.separator+"design_menu.gif", null);
public static final ImageDescriptor DESC_TOOLS_LINKED = create(ICONS_PATH, "obj16"+File.separator+"link.png", null);
public static final ImageDescriptor DESC_TOOLS_LINKED = create(ICONS_PATH, "obj16"+File.separator+"link.png", null);
public static final ImageDescriptor DESC_TOOLS_UNLINKED = create(ICONS_PATH, "obj16"+File.separator+"broken_link.png", null); public static final ImageDescriptor DESC_TOOLS_UNLINKED = create(ICONS_PATH, "obj16"+File.separator+"broken_link.png", null);
public static final ImageDescriptor DESC_TOOLS_SAVE = create(ICONS_PATH, "obj16"+File.separator+"save.png", null);
public static final ImageDescriptor DESC_TOOLS_STOP = create(ICONS_PATH, "obj16"+File.separator+"stop.png", null);
public static final ImageDescriptor DESC_TOOLS_PIN = create(ICONS_PATH, "obj16"+File.separator+"pin.png", null); public static final ImageDescriptor DESC_TOOLS_PIN = create(ICONS_PATH, "obj16"+File.separator+"pin.png", null);
public static final ImageDescriptor DESC_TOOLS_RESTORE = create(ICONS_PATH, "obj16"+File.separator+"restore.png", null); public static final ImageDescriptor DESC_TOOLS_RESTORE = create(ICONS_PATH, "obj16"+File.separator+"restore.png", null);
public static final ImageDescriptor DESC_TOOLS_RESTORE_SELECT = create(ICONS_PATH, "obj16"+File.separator+"restore_select.png", null); public static final ImageDescriptor DESC_TOOLS_RESTORE_SELECT = create(ICONS_PATH, "obj16"+File.separator+"restore_select.png", null);
public static final String ICON_TOOLSTATE_NEW = "obj16"+File.separator+"white.png"; public static final String ICON_TOOLSTATE_NEW = "obj16"+File.separator+"white.png";
public static final String ICON_TOOLSTATE_BAD = "obj16"+File.separator+"cross.png"; public static final String ICON_TOOLSTATE_BAD = "obj16"+File.separator+"cross.png";
public static final String ICON_TOOLSTATE_BAD_OLD = "obj16"+File.separator+"cross_dim.png"; public static final String ICON_TOOLSTATE_BAD_OLD = "obj16"+File.separator+"cross_dim.png";
......
...@@ -86,6 +86,7 @@ public class ContextOptionsDialog extends Dialog { ...@@ -86,6 +86,7 @@ public class ContextOptionsDialog extends Dialog {
, new String[] {context.getLabel(), e.getMessage()}) , new String[] {context.getLabel(), e.getMessage()})
, e ); , e );
} }
context.recalcHashCodes();
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
System.out.println("ContexOptionsDialog.okPressed()"); System.out.println("ContexOptionsDialog.okPressed()");
// Need to update Design menu as it uses calculated parameters // Need to update Design menu as it uses calculated parameters
......
...@@ -294,7 +294,6 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe ...@@ -294,7 +294,6 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe
} }
public String getBuildStamp(){ public String getBuildStamp(){
return timestamp; return timestamp;
} }
......
...@@ -103,6 +103,8 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -103,6 +103,8 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
// private Action launchAction; // private Action launchAction;
private Action toggleLinkedTools; private Action toggleLinkedTools;
private Action toggleSaveTools;
private Action toggleStopTools;
private Action showInstallationPropertiesAction; private Action showInstallationPropertiesAction;
private ClearAction clearInstallationPropertiesAction; private ClearAction clearInstallationPropertiesAction;
...@@ -152,6 +154,12 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -152,6 +154,12 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
public ToolSequence getToolSequence(){ public ToolSequence getToolSequence(){
return toolSequence; return toolSequence;
} }
public void setToggleSaveTools(boolean checked){
toggleSaveTools.setChecked(checked);
}
public void setToggleStopTools(boolean checked){
toggleStopTools.setChecked(checked);
}
/* /*
* Method declared on IViewPart. * Method declared on IViewPart.
...@@ -211,6 +219,25 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -211,6 +219,25 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
if (memento != null) if (memento != null)
restoreState(memento); restoreState(memento);
memento = null; memento = null;
tree.addListener(SWT.KeyUp, new Listener(){
@Override
public void handleEvent(Event event) {
if (event.keyCode == SWT.SHIFT) {
toolSequence.setShiftPressed(false);
}
}
});
tree.addListener(SWT.KeyDown, new Listener(){
@Override
public void handleEvent(Event event) {
if (event.keyCode == SWT.SHIFT) {
toolSequence.setShiftPressed(true);
}
}
});
} // createPartControl() } // createPartControl()
private void doLoadDesignMenu() { private void doLoadDesignMenu() {
...@@ -322,7 +349,9 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -322,7 +349,9 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
// drillDownAdapter.addNavigationActions(manager); // drillDownAdapter.addNavigationActions(manager);
manager.add(new Separator("toolbar-separator")); manager.add(new Separator("toolbar-separator"));
manager.add(toggleLinkedTools); manager.add(toggleLinkedTools);
manager.add(toggleSaveTools);
manager.add(toggleStopTools);
manager.add(new Separator());
manager.add(showInstallationPropertiesAction); manager.add(showInstallationPropertiesAction);
manager.add(showPackagePropertiesToolbarAction); manager.add(showPackagePropertiesToolbarAction);
manager.add(showProjectPropertiesToolbarAction); manager.add(showProjectPropertiesToolbarAction);
...@@ -351,6 +380,25 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -351,6 +380,25 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
toggleLinkedTools.setToolTipText("Toggle tool dependency"); toggleLinkedTools.setToolTipText("Toggle tool dependency");
toggleLinkedTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_LINKED); toggleLinkedTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_LINKED);
toggleLinkedTools.setChecked(!SelectedResourceManager.getDefault().isToolsLinked()); // normally happens before reading memento toggleLinkedTools.setChecked(!SelectedResourceManager.getDefault().isToolsLinked()); // normally happens before reading memento
toggleSaveTools= new Action("Save tool state", Action.AS_CHECK_BOX) {
public void run() {
toolSequence.setSave(isChecked());
}
};
toggleSaveTools.setToolTipText("Save tool state");
toggleSaveTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_SAVE);
toggleStopTools= new Action("Stop tools", Action.AS_CHECK_BOX) {
public void run() {
toolSequence.setStop(isChecked());
}
};
toggleStopTools.setToolTipText("Request tool sequence stop (when convenient), with <SHFT> - mark stopped (for debug)");
toggleStopTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_STOP);
showInstallationPropertiesAction = new Action() { showInstallationPropertiesAction = new Action() {
public void run() { public void run() {
...@@ -645,7 +693,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -645,7 +693,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
try { try {
launchTool( launchTool(
fTool, // tool, will get fTool, // tool, will get
// fDesignFlowView, // to be able to launch update when build state of the tool changes TOOL_MODE.RUN,
finalI, finalI,
fFullPath, fFullPath,
fIgnoreFilter); fIgnoreFilter);
...@@ -697,7 +745,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -697,7 +745,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
try { try {
launchTool( launchTool(
restoreTool, restoreTool,
// fDesignFlowView, // to be able to launch update when build state of the tool changes TOOL_MODE.RESTORE,
0, 0,
fFullPath, fFullPath,
fIgnoreFilter); fIgnoreFilter);
...@@ -727,7 +775,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -727,7 +775,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
try { try {
launchTool( launchTool(
restoreTool, restoreTool,
// fDesignFlowView, // to be able to launch update when build state of the tool changes TOOL_MODE.RESTORE,
0, 0,
fFullPath, fFullPath,
fIgnoreFilter); fIgnoreFilter);
...@@ -828,14 +876,15 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -828,14 +876,15 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
private void launchTool( private void launchTool(
Tool tool, Tool tool,
// final DesignFlowView designFlowView, TOOL_MODE mode,
int choice, int choice,
String fullPath, String fullPath,
String ignoreFilter) throws CoreException { String ignoreFilter) throws CoreException {
if (tool != null) { if (tool != null) {
// tool.setDesignFlowView(designFlowView); // tool.setDesignFlowView(designFlowView);
tool.setDesignFlowView(this); // maybe will not be needed with ToolSequencing class tool.setDesignFlowView(this); // maybe will not be needed with ToolSequencing class
tool.setMode(TOOL_MODE.RUN); if (!toolSequence.okToRun()) return;
tool.setMode(mode) ; //TOOL_MODE.RUN);
tool.toolFinished(); tool.toolFinished();
tool.setChoice(0); tool.setChoice(0);
SelectedResourceManager.getDefault().updateActionChoice(fullPath, choice, ignoreFilter); // Andrey SelectedResourceManager.getDefault().updateActionChoice(fullPath, choice, ignoreFilter); // Andrey
...@@ -869,6 +918,8 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -869,6 +918,8 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
System.out.println("logBuildStamp="+logBuildStamp); System.out.println("logBuildStamp="+logBuildStamp);
} }
tool.setDesignFlowView(designFlowView); tool.setDesignFlowView(designFlowView);
if (!toolSequence.okToRun()) return;
// tool.setRunning(true); // tool.setRunning(true);
tool.setMode(TOOL_MODE.PLAYBACK); tool.setMode(TOOL_MODE.PLAYBACK);
tool.toolFinished(); tool.toolFinished();
......
...@@ -74,9 +74,6 @@ public class LocalContextsAction extends ContextsAction { ...@@ -74,9 +74,6 @@ public class LocalContextsAction extends ContextsAction {
dialog.setTitle(title); dialog.setTitle(title);
dialog.create(); dialog.create();
int result=dialog.open(); int result=dialog.open();
// if (result == Window.OK){
// updateActions();
// }
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
System.out.println("LocalContextAction()->"+result); System.out.println("LocalContextAction()->"+result);
} }
......
...@@ -48,18 +48,41 @@ ...@@ -48,18 +48,41 @@
label="Synthesize design" label="Synthesize design"
icon="Retort.png" icon="Retort.png"
call="VivadoSynthesis"/> call="VivadoSynthesis"/>
<menuitem name="VivadoOptPlace" <!-- <menuitem name="VivadoOptPlace"
label="Optimize and place design" label="Optimize and place design"
icon="mondrian2x2.png" icon="mondrian2x2.png"
call="VivadoOptPlace"/> call="VivadoOptPlace"/> -->
<menuitem name="VivadoOpt"
label="Optimize design"
icon="opt_blue.png"
call="VivadoOpt"/>
<menuitem name="VivadoOptPower"
label="Reduce power"
icon="fire.png"
call="VivadoOptPower"/>
<menuitem name="VivadoPlace"
label="Place design"
icon="mondrian2x2.png"
call="VivadoPlace"/>
<menuitem name="VivadoOptPhys"
label="Post-placement optimize"
icon="opt_yellow.png"
call="VivadoOptPhys"/>
<menuitem name="VivadoRoute" <menuitem name="VivadoRoute"
label="Route design" label="Route design"
icon="route66.png" icon="route66.png"
call="VivadoRoute"/> call="VivadoRoute"/>
<menuitem name="VivadoBitstream" <menuitem name="VivadoBitstream"
label="Generate bitstream" label="Generate bitstream"
icon="bitstream.png" icon="bitstream.png"
call="VivadoBitstream"/> call="VivadoBitstream"/>
<menuitem name="Vivado Test" <menuitem name="Vivado Test"
label="Send a 'Hello World' command to the remote Vivado session" label="Send a 'Hello World' command to the remote Vivado session"
icon="my_tool.gif" icon="my_tool.gif"
......
...@@ -110,6 +110,10 @@ ...@@ -110,6 +110,10 @@
<parameter id="VivadoLocalDir" label="Local Xilinx directory" tooltip="Local project subdirectroy for Xilinx Vivado generated files" <parameter id="VivadoLocalDir" label="Local Xilinx directory" tooltip="Local project subdirectroy for Xilinx Vivado generated files"
type="Pathname" default="vivado" format="CopyValue" readonly="false" /> type="Pathname" default="vivado" format="CopyValue" readonly="false" />
<parameter id="VivadoLocalResultDir" label="Local Xilinx results directory"
tooltip="Local project subdirectroy for Xilinx Vivado generated result files"
type="Pathname" default="vivado" format="CopyValue" readonly="false" />
<parameter id="VivadoLogDir" label="Local Vivado tool logsx directory" tooltip="Local project subdirectroy for Xilinx Vivado tools log files" <parameter id="VivadoLogDir" label="Local Vivado tool logsx directory" tooltip="Local project subdirectroy for Xilinx Vivado tools log files"
type="Pathname" default="vivado_logs" format="CopyValue" readonly="false" /> type="Pathname" default="vivado_logs" format="CopyValue" readonly="false" />
...@@ -129,6 +133,25 @@ ...@@ -129,6 +133,25 @@
default="%%ProjectName-opt-place.dcp" default="%%ProjectName-opt-place.dcp"
type="Filename" format="CopyValue" /> type="Filename" format="CopyValue" />
<parameter id="SnapshotOpt"
label="Optimization snapshot" tooltip="Name of Vivado snapshot archive after optimization"
default="%%ProjectName-opt.dcp"
type="Filename" format="CopyValue" />
<parameter id="SnapshotOptPower"
label="Power optimization snapshot" tooltip="Name of Vivado snapshot archive after power optimization"
default="%%ProjectName-opt-power.dcp"
type="Filename" format="CopyValue" />
<parameter id="SnapshotPlace"
label="Placement snapshot" tooltip="Name of Vivado snapshot archive after placement"
default="%%ProjectName-place.dcp"
type="Filename" format="CopyValue" />
<parameter id="SnapshotOptPhys"
label="Physical optimization snapshot" tooltip="Name of Vivado snapshot archive after physical optimization"
default="%%ProjectName-opt-phys.dcp"
type="Filename" format="CopyValue" />
<parameter id="SnapshotRoute" <parameter id="SnapshotRoute"
label="Routing snapshot" tooltip="Name of Vivado snapshot archive after routing" label="Routing snapshot" tooltip="Name of Vivado snapshot archive after routing"
...@@ -145,6 +168,25 @@ ...@@ -145,6 +168,25 @@
default="false" default="false"
type="Boolean" format="None" /> type="Boolean" format="None" />
<parameter id="DisableVivadoOpt"
label="Disable Vivado optimization" tooltip="Disable tool Vivado Optimize"
default="false"
type="Boolean" format="None" />
<parameter id="DisableVivadoOptPower"
label="Disable Vivado power optimization" tooltip="Disable reduction of power consumption"
default="false"
type="Boolean" format="None" />
<parameter id="DisableVivadoPlace"
label="Disable placement" tooltip="Disable tool Vivado Place"
default="false"
type="Boolean" format="None" />
<parameter id="DisableVivadoOptPhys"
label="Disable phys. optimization" tooltip="Disable tool Vivado Physical (post-placement) Optimization"
default="false"
type="Boolean" format="None" />
<parameter id="DisableVivadoRoute" <parameter id="DisableVivadoRoute"
label="Disable Vivado route" tooltip="Disable tool Vivado route" label="Disable Vivado route" tooltip="Disable tool Vivado route"
...@@ -176,20 +218,29 @@ ...@@ -176,20 +218,29 @@
"part" "part"
"VivadoProjectRoot" "VivadoProjectRoot"
"VivadoLocalDir" "VivadoLocalDir"
"VivadoLocalResultDir"
"VivadoLogDir" "VivadoLogDir"
"VivadoIgnoreSource" "VivadoIgnoreSource"
"SedPaths" "SedPaths"
</group> </group>
<group name="VivadoDisable" label="Selectively disable Vivado tools"> <group name="VivadoDisable" label="Selectively disable Vivado tools">
"DisableVivadoSynth" "DisableVivadoSynth"
"DisableVivadoOptPlace" <!-- "DisableVivadoOptPlace" -->
"DisableVivadoOpt"
"DisableVivadoOptPower"
"DisableVivadoPlace"
"DisableVivadoOptPhys"
"DisableVivadoRoute" "DisableVivadoRoute"
"DisableVivadoBitsteam" "DisableVivadoBitsteam"
</group> </group>
<!-- TODO: make time-stamped and "latest" for snapshots --> <!-- TODO: make time-stamped and "latest" for snapshots -->
<group name="VivadoSnapshots" label="Vivado snapshot archive names"> <group name="VivadoSnapshots" label="Vivado snapshot archive names">
"SnapshotSynth" "SnapshotSynth"
"SnapshotOptPlace" <!-- "SnapshotOptPlace" -->
"SnapshotOpt"
"SnapshotOptPower"
"SnapshotPlace"
"SnapshotOptPhys"
"SnapshotRoute" "SnapshotRoute"
</group> </group>
</input> </input>
......
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