Author: scabanovich
Date: 2011-10-13 20:51:34 -0400 (Thu, 13 Oct 2011)
New Revision: 35647
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java
Log:
JBIDE-9911
https://issues.jboss.org/browse/JBIDE-9911
Rebuild of all jars added when available cdi extensions changed.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java 2011-10-14
00:48:57 UTC (rev 35646)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java 2011-10-14
00:51:34 UTC (rev 35647)
@@ -72,23 +72,29 @@
}
}
- public void setRuntimes(String path, Set<String> newRuntimes) {
+ public boolean setRuntimes(String path, Set<String> newRuntimes) {
Set<String> oldRuntimes = runtimes.get(path);
if(oldRuntimes == null) {
- if(newRuntimes.isEmpty()) return;
+ if(newRuntimes.isEmpty()) {
+ return false;
+ }
oldRuntimes = new HashSet<String>();
}
+ boolean result = false;
for (String runtime: oldRuntimes) {
if(!newRuntimes.contains(runtime)) {
deleteRuntime(runtime);
+ result = true;
}
}
for (String runtime: newRuntimes) {
if(!oldRuntimes.contains(runtime)) {
addRuntime(runtime);
+ result = true;
}
}
if(newRuntimes.isEmpty()) runtimes.remove(path); else runtimes.put(path, newRuntimes);
+ return result;
}
private void addRuntime(String runtime) {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java 2011-10-14
00:48:57 UTC (rev 35646)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java 2011-10-14
00:51:34 UTC (rev 35647)
@@ -72,6 +72,8 @@
}
project.getExtensionManager().pathRemoved(p);
}
+ boolean newRuntimeDetected = false;
+ Set<String> processed = new HashSet<String>(processedPaths);
for (int i = 0; i < paths.size(); i++) {
String p = paths.get(i);
if(!requestForLoad(p)) continue;
@@ -83,24 +85,40 @@
if(o == null) continue;
//Load cdi extensions. Do we need beans.xml to look for extensions?
- project.getExtensionManager().setRuntimes(p, readRuntimes(o));
+ boolean nrd = project.getExtensionManager().setRuntimes(p, readRuntimes(o));
+ if(nrd) newRuntimeDetected = true;
newJars.getFileSystems().put(p, o);
XModelObject b = o.getChildByPath("META-INF/beans.xml");
- if(b == null) {
- continue;
+ if(b != null) {
+ newJars.getBeanModules().put(p, b);
}
- newJars.getBeanModules().put(p, b);
}
for (FileAnyImpl s: servicesInSrc.keySet()) {
IResource r = (IResource)s.getAdapter(IResource.class);
if(r != null && r.exists()) {
- project.getExtensionManager().setRuntimes(r.getFullPath().toString(),
readRuntimesInService(s));
+ boolean nrd = project.getExtensionManager().setRuntimes(r.getFullPath().toString(),
readRuntimesInService(s));
+ if(nrd) newRuntimeDetected = true;
}
}
+ if(newRuntimeDetected) {
+ for (String p: processed) {
+ String fileName = new File(p).getName();
+ if(EclipseResourceUtil.SYSTEM_JAR_SET.contains(fileName)) continue;
+ XModelObject o = FileSystemsHelper.getLibs(model).getLibrary(p);
+ if(o != null) {
+ newJars.getFileSystems().put(p, o);
+ XModelObject b = o.getChildByPath("META-INF/beans.xml");
+ if(b != null) {
+ newJars.getBeanModules().put(p, b);
+ }
+ }
+ }
+ }
+
validateProjectDependencies();
return newJars;
}