Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vdt-plugin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
vdt-plugin
Commits
f2a02373
Commit
f2a02373
authored
Dec 26, 2015
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing tool dependencies, dirty flag
parent
8bd2c99b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
10 deletions
+99
-10
VerilogUtils.java
src/com/elphel/vdt/VerilogUtils.java
+2
-2
Tool.java
src/com/elphel/vdt/core/tools/params/Tool.java
+16
-6
ToolSequence.java
src/com/elphel/vdt/core/tools/params/ToolSequence.java
+81
-2
No files found.
src/com/elphel/vdt/VerilogUtils.java
View file @
f2a02373
...
@@ -188,7 +188,7 @@ public class VerilogUtils {
...
@@ -188,7 +188,7 @@ public class VerilogUtils {
}
// getDependencies()
}
// getDependencies()
public
static
IFile
[]
getDependencies
(
IFile
topFile
,
String
toolDefine
)
{
public
static
IFile
[]
getDependencies
(
IFile
topFile
,
String
toolDefine
)
{
//
/
System.out.println("===VerilogUtils.getDependencies("+topFile+")");
// System.out.println("===VerilogUtils.getDependencies("+topFile+")");
IProject
project
=
topFile
.
getProject
();
IProject
project
=
topFile
.
getProject
();
if
(
toolDefine
!=
null
)
{
if
(
toolDefine
!=
null
)
{
OutlineDatabase
outlineDatabase
=
new
OutlineDatabase
(
project
);
// new OutlineDatabase just for this scan
OutlineDatabase
outlineDatabase
=
new
OutlineDatabase
(
project
);
// new OutlineDatabase just for this scan
...
@@ -200,7 +200,7 @@ public class VerilogUtils {
...
@@ -200,7 +200,7 @@ public class VerilogUtils {
IFile
[]
topFiles
=
{
topFile
};
IFile
[]
topFiles
=
{
topFile
};
return
outlineDatabase
.
getClosureSorted
(
topFiles
);
return
outlineDatabase
.
getClosureSorted
(
topFiles
);
}
else
{
}
else
{
//
/
System.out.println("===---VerilogUtils.getDependencies("+topFile+") - using editor depends");
// System.out.println("===---VerilogUtils.getDependencies("+topFile+") - using editor depends");
return
getDependencies
(
new
IFile
[]
{
topFile
});
return
getDependencies
(
new
IFile
[]
{
topFile
});
}
}
}
}
...
...
src/com/elphel/vdt/core/tools/params/Tool.java
View file @
f2a02373
...
@@ -687,7 +687,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -687,7 +687,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
}
}
}
}
for
(
String
item:
list
){
for
(
String
item:
list
){
System
.
out
.
println
(
"-----> "
+
getName
()+
".getDependFiles()->"
+
item
);
DEBUG_PRINT
(
"-----> "
+
getName
()+
".getDependFiles()->"
+
item
);
}
}
return
list
;
return
list
;
}
}
...
@@ -1035,7 +1035,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1035,7 +1035,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
try
{
project
.
setPersistentProperty
(
qn
,
dependFilesTimestamps
.
get
(
file
));}
try
{
project
.
setPersistentProperty
(
qn
,
dependFilesTimestamps
.
get
(
file
));}
catch
(
CoreException
e
)
{
System
.
out
.
println
(
project
+
"Failed setPersistentProperty("
+
qn
+
", "
+
dependFilesTimestamps
.
get
(
file
)+
", e="
+
e
);}
catch
(
CoreException
e
)
{
System
.
out
.
println
(
project
+
"Failed setPersistentProperty("
+
qn
+
", "
+
dependFilesTimestamps
.
get
(
file
)+
", e="
+
e
);}
}
}
DEBUG_PRINT
(
"*** Updated persistent properties for tool "
+
getName
()+
" in the project "
+
project
.
toString
());
DEBUG_PRINT
(
"*** Updated persistent properties for tool "
+
getName
()+
" in the project "
+
project
.
toString
()+
", state="
+
getState
().
toString
());
}
}
public
void
restoreState
(
IProject
project
)
{
public
void
restoreState
(
IProject
project
)
{
...
@@ -1137,6 +1138,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1137,6 +1138,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
// if (getName().equals("ISExst")){
// if (getName().equals("ISExst")){
// System.out.println("restoreState(memento): Debugging ISExst");
// System.out.println("restoreState(memento): Debugging ISExst");
// }
// }
DEBUG_PRINT
(
name
+
" isDirty() == "
+
isDirty
());
IMemento
[]
toolMementos
=
memento
.
getChildren
(
MEMENTO_TOOL_TYPE
);
IMemento
[]
toolMementos
=
memento
.
getChildren
(
MEMENTO_TOOL_TYPE
);
IMemento
toolMemento
=
null
;
IMemento
toolMemento
=
null
;
for
(
IMemento
tm:
toolMementos
){
for
(
IMemento
tm:
toolMementos
){
...
@@ -1156,6 +1158,9 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1156,6 +1158,9 @@ public class Tool extends Context implements Cloneable, Inheritable {
if
(
state
!=
null
){
if
(
state
!=
null
){
try
{
try
{
setStateJustThis
(
TOOL_STATE
.
valueOf
(
state
));
setStateJustThis
(
TOOL_STATE
.
valueOf
(
state
));
DEBUG_PRINT
(
"Got memento data for "
+
name
+
" state="
+
state
.
toString
());
}
catch
(
IllegalArgumentException
e
){
}
catch
(
IllegalArgumentException
e
){
System
.
out
.
println
(
"Invalid tool state: "
+
state
+
" for tool "
+
name
+
" in memento"
);
System
.
out
.
println
(
"Invalid tool state: "
+
state
+
" for tool "
+
name
+
" in memento"
);
}
}
...
@@ -1192,6 +1197,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1192,6 +1197,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
// DEBUG_PRINT("Got memento data for "+name+":" + MEMENTO_TOOL_FILEDEPSTAMP+": name="+depName+" stamp="+value);
// DEBUG_PRINT("Got memento data for "+name+":" + MEMENTO_TOOL_FILEDEPSTAMP+": name="+depName+" stamp="+value);
}
}
}
}
DEBUG_PRINT
(
name
+
" isDirty() == "
+
isDirty
());
}
}
public
void
checkBaseTool
()
throws
ConfigException
{
public
void
checkBaseTool
()
throws
ConfigException
{
...
@@ -1498,10 +1505,13 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1498,10 +1505,13 @@ public class Tool extends Context implements Cloneable, Inheritable {
}
}
public
BuildParamsItem
[]
buildParams
(
boolean
dryRun
)
throws
ToolException
{
public
BuildParamsItem
[]
buildParams
(
boolean
dryRun
)
throws
ToolException
{
return
buildParams
(
dryRun
,
!
dryRun
);
}
public
BuildParamsItem
[]
buildParams
(
boolean
dryRun
,
boolean
reParse
)
throws
ToolException
{
DEBUG_PRINT
(
"buildParams("
+
dryRun
+
"): tool "
+
getName
()+
" state="
+
getState
()+
" dirty="
+
isDirty
()+
" hashMatch()="
+
hashMatch
()+
" pinned="
+
isPinned
());
DEBUG_PRINT
(
"buildParams("
+
dryRun
+
"
, "
+
reParse
+
"
): tool "
+
getName
()+
" state="
+
getState
()+
" dirty="
+
isDirty
()+
" hashMatch()="
+
hashMatch
()+
" pinned="
+
isPinned
());
setTreeReparse
(
!
dryRun
);
setTreeReparse
(
reParse
);
if
(
parentPackage
!=
null
)
if
(
parentPackage
!=
null
)
parentPackage
.
buildParams
();
parentPackage
.
buildParams
();
...
...
src/com/elphel/vdt/core/tools/params/ToolSequence.java
View file @
f2a02373
...
@@ -29,6 +29,10 @@ import org.eclipse.core.resources.IFile;
...
@@ -29,6 +29,10 @@ import org.eclipse.core.resources.IFile;
import
org.eclipse.core.resources.IFolder
;
import
org.eclipse.core.resources.IFolder
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.resources.IResourceChangeEvent
;
import
org.eclipse.core.resources.IResourceChangeListener
;
import
org.eclipse.core.resources.IResourceDelta
;
import
org.eclipse.core.resources.IResourceDeltaVisitor
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.core.runtime.QualifiedName
;
import
org.eclipse.core.runtime.QualifiedName
;
import
org.eclipse.swt.widgets.Display
;
import
org.eclipse.swt.widgets.Display
;
...
@@ -88,6 +92,9 @@ public class ToolSequence {
...
@@ -88,6 +92,9 @@ public class ToolSequence {
private
Map
<
String
,
ToolStateStamp
>
currentStates
;
private
Map
<
String
,
ToolStateStamp
>
currentStates
;
private
IMemento
unfinishedMemento
=
null
;
private
IMemento
unfinishedMemento
=
null
;
private
String
menuName
=
null
;
private
String
menuName
=
null
;
private
DependChangeListener
dependChangeListener
;
// private IProgressMonitor monitor;
// private IProgressMonitor monitor;
private
static
void
DEBUG_PRINT
(
String
msg
){
private
static
void
DEBUG_PRINT
(
String
msg
){
...
@@ -99,6 +106,7 @@ public class ToolSequence {
...
@@ -99,6 +106,7 @@ public class ToolSequence {
public
ToolSequence
(
DesignFlowView
designFlowView
){
public
ToolSequence
(
DesignFlowView
designFlowView
){
this
.
designFlowView
=
designFlowView
;
this
.
designFlowView
=
designFlowView
;
this
.
currentStates
=
new
Hashtable
<
String
,
ToolStateStamp
>();
this
.
currentStates
=
new
Hashtable
<
String
,
ToolStateStamp
>();
this
.
dependChangeListener
=
new
DependChangeListener
();
}
}
public
void
clearToolStates
(){
public
void
clearToolStates
(){
...
@@ -230,9 +238,20 @@ public class ToolSequence {
...
@@ -230,9 +238,20 @@ public class ToolSequence {
bars
.
getStatusLineManager
().
setMessage
(
""
);
bars
.
getStatusLineManager
().
setMessage
(
""
);
// designFlowView.changeMenuTitle(menuName);
// designFlowView.changeMenuTitle(menuName);
designFlowView
.
finalizeAfterVEditorDB
(
unfinishedMemento
);
designFlowView
.
finalizeAfterVEditorDB
(
unfinishedMemento
);
DEBUG_PRINT
(
"==============finalizeBootAfterVEditor()"
);
addResourceChangeListener
();
// }
// }
}
}
public
void
addResourceChangeListener
(){
VerilogPlugin
.
getWorkspace
().
addResourceChangeListener
(
dependChangeListener
,
IResourceChangeEvent
.
POST_CHANGE
);
DEBUG_PRINT
(
"==============addResourceChangeListener()"
);
}
public
void
toolFinished
(
Tool
tool
){
public
void
toolFinished
(
Tool
tool
){
if
(
tool
!=
null
)
doToolFinished
(
tool
);
if
(
tool
!=
null
)
doToolFinished
(
tool
);
if
(
designFlowView
!=
null
){
if
(
designFlowView
!=
null
){
...
@@ -1517,7 +1536,7 @@ java.lang.NullPointerException
...
@@ -1517,7 +1536,7 @@ java.lang.NullPointerException
// tool.updateContextOptions(project) recalculates parameters, but not the hashcodes
// tool.updateContextOptions(project) recalculates parameters, but not the hashcodes
tool
.
updateContextOptions
(
project
);
// Fill in parameters - it parses here too - at least some parameters? (not in menu mode)
tool
.
updateContextOptions
(
project
);
// Fill in parameters - it parses here too - at least some parameters? (not in menu mode)
try
{
try
{
tool
.
buildParams
(
true
);
// dryRun
tool
.
buildParams
(
true
,
true
);
// dryRun and re-parse for dependencies
}
catch
(
ToolException
e
)
{
}
catch
(
ToolException
e
)
{
System
.
out
.
println
(
"setToolsDirtyFlag(): failed to buildParams() for tool "
+
tool
.
getName
());
System
.
out
.
println
(
"setToolsDirtyFlag(): failed to buildParams() for tool "
+
tool
.
getName
());
}
}
...
@@ -1590,6 +1609,7 @@ java.lang.NullPointerException
...
@@ -1590,6 +1609,7 @@ java.lang.NullPointerException
if
(!
met
)
{
if
(!
met
)
{
tool
.
setDirty
(
true
);
tool
.
setDirty
(
true
);
newDirty
=
true
;
newDirty
=
true
;
DEBUG_PRINT
(
"propagateDirty(): Setting dirty flag for "
+
tool
.
getName
());
}
}
}
}
}
}
...
@@ -1701,7 +1721,7 @@ java.lang.NullPointerException
...
@@ -1701,7 +1721,7 @@ java.lang.NullPointerException
private
Map
<
String
,
String
>
makeDependFiles
(
Tool
tool
,
boolean
failOnMissing
){
private
Map
<
String
,
String
>
makeDependFiles
(
Tool
tool
,
boolean
failOnMissing
){
DEBUG_PRINT
(
"++++++ makeDependFiles("
+
tool
.
getName
()+
")"
);
DEBUG_PRINT
(
"++++++ makeDependFiles("
+
tool
.
getName
()+
")"
);
Map
<
String
,
String
>
depFiles
=
new
Hashtable
<
String
,
String
>();
Map
<
String
,
String
>
depFiles
=
new
Hashtable
<
String
,
String
>();
List
<
String
>
dependFileNames
=
tool
.
getDependFiles
();
// files on which this tool depends
List
<
String
>
dependFileNames
=
tool
.
getDependFiles
();
// files on which this tool depends
- make cached version
if
(
dependFileNames
!=
null
)
{
if
(
dependFileNames
!=
null
)
{
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
for
(
String
depFile:
dependFileNames
){
for
(
String
depFile:
dependFileNames
){
...
@@ -1729,5 +1749,64 @@ java.lang.NullPointerException
...
@@ -1729,5 +1749,64 @@ java.lang.NullPointerException
}
}
return
depFiles
;
return
depFiles
;
}
}
class
DeltaPrinter
implements
IResourceDeltaVisitor
{
public
boolean
visit
(
IResourceDelta
delta
)
{
IResource
res
=
delta
.
getResource
();
if
((
res
instanceof
IFile
)
&&
(
delta
.
getFlags
()
!=
IResourceDelta
.
MARKERS
))
{
IFile
file
=
(
IFile
)
res
;
switch
(
delta
.
getKind
())
{
case
IResourceDelta
.
ADDED
:
break
;
case
IResourceDelta
.
REMOVED
:
DEBUG_PRINT
(
"=====>>> DependChangeListener: removed "
+
file
);
setToolsDirtyFlag
(
false
);
break
;
case
IResourceDelta
.
CHANGED
:
DEBUG_PRINT
(
"=====>>> DependChangeListener: changed "
+
file
+
String
.
format
(
"0x%x"
,
delta
.
getFlags
()));
setToolsDirtyFlag
(
false
);
break
;
}
}
return
true
;
// visit the children
}
}
// Check dependency on resource change event
/**
* Class used to keep track of workspace resources
*/
class
DependChangeListener
implements
IResourceChangeListener
{
/**
* Called when a resource is changed
*/
public
void
resourceChanged
(
IResourceChangeEvent
event
)
{
// if (isAnyToolRunnigOrWaiting()) {
// DEBUG_PRINT("=====DependChangeListener.resourceChanged(): Tool is running");
// return;
// }
// DEBUG_PRINT("=====DependChangeListener.resourceChanged() start: "+event.getType());
switch
(
event
.
getType
())
{
case
IResourceChangeEvent
.
PRE_CLOSE
:
break
;
case
IResourceChangeEvent
.
PRE_DELETE
:
break
;
case
IResourceChangeEvent
.
POST_CHANGE
:
try
{
event
.
getDelta
().
accept
(
new
DeltaPrinter
());
}
catch
(
CoreException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
break
;
case
IResourceChangeEvent
.
PRE_BUILD
:
break
;
case
IResourceChangeEvent
.
POST_BUILD
:
break
;
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment