|
44 | 44 | import grails.core.GrailsApplication; |
45 | 45 |
|
46 | 46 | import org.grails.core.legacy.LegacyGrailsApplication; |
| 47 | +import org.grails.plugins.support.WatchPattern; |
47 | 48 | import org.grails.spring.RuntimeSpringConfiguration; |
48 | 49 | import org.grails.io.support.GrailsResourceUtils; |
49 | 50 |
|
@@ -87,7 +88,7 @@ public abstract class AbstractGrailsPluginManager implements GrailsPluginManager |
87 | 88 | protected ApplicationContext applicationContext; |
88 | 89 | protected Map<String, GrailsPlugin> failedPlugins = new HashMap<String, GrailsPlugin>(); |
89 | 90 | protected boolean loadCorePlugins = true; |
90 | | - |
| 91 | + |
91 | 92 | private static final String CONFIG_BINDING_USER_HOME = "userHome"; |
92 | 93 | private static final String CONFIG_BINDING_GRAILS_HOME = "grailsHome"; |
93 | 94 | private static final String CONFIG_BINDING_APP_NAME = "appName"; |
@@ -356,6 +357,7 @@ public void setPluginFilter(PluginFilter pluginFilter) { |
356 | 357 | // no-op |
357 | 358 | } |
358 | 359 |
|
| 360 | + @Deprecated |
359 | 361 | public boolean supportsCurrentBuildScope(String pluginName) { |
360 | 362 | GrailsPlugin plugin = getGrailsPlugin(pluginName); |
361 | 363 | return plugin == null || plugin.supportsScope(BuildScope.getCurrent()); |
@@ -385,6 +387,33 @@ public void informOfClassChange(Class<?> aClass) { |
385 | 387 | if(!plugin.isEnabled(applicationContext.getEnvironment().getActiveProfiles())) return; |
386 | 388 | plugin.notifyOfEvent(GrailsPlugin.EVENT_ON_CHANGE, aClass); |
387 | 389 | } |
| 390 | + else { |
| 391 | + String classNameAsPath = aClass.getName().replace('.', File.separatorChar); |
| 392 | + String groovyClass = classNameAsPath + ".groovy"; |
| 393 | + String javaClass = classNameAsPath + ".java"; |
| 394 | + for (GrailsPlugin grailsPlugin : pluginList) { |
| 395 | + List<WatchPattern> watchPatterns = grailsPlugin.getWatchedResourcePatterns(); |
| 396 | + if(watchPatterns != null) { |
| 397 | + for (WatchPattern watchPattern : watchPatterns) { |
| 398 | + File parent = watchPattern.getDirectory(); |
| 399 | + String extension = watchPattern.getExtension(); |
| 400 | + |
| 401 | + if(parent != null && extension != null) { |
| 402 | + File f = new File(parent, groovyClass); |
| 403 | + if(f.exists() && f.getName().endsWith(extension)) { |
| 404 | + grailsPlugin.notifyOfEvent(GrailsPlugin.EVENT_ON_CHANGE, aClass); |
| 405 | + } |
| 406 | + else { |
| 407 | + f = new File(parent, javaClass); |
| 408 | + if(f.exists() && f.getName().endsWith(extension)) { |
| 409 | + grailsPlugin.notifyOfEvent(GrailsPlugin.EVENT_ON_CHANGE, aClass); |
| 410 | + } |
| 411 | + } |
| 412 | + } |
| 413 | + } |
| 414 | + } |
| 415 | + } |
| 416 | + } |
388 | 417 | } |
389 | 418 |
|
390 | 419 | public String getPluginPath(String name) { |
|
0 commit comments