Skip to content

Commit

Permalink
Support folders under "src/resources" in fastReload conifguration pro…
Browse files Browse the repository at this point in the history
…perty. (#305)

When hotreload is enabled gretty watches and always recompile/redeploy webapp if
there are any change "src/java" or "src/resources". That is
inconvenient when changing static resources in "src/resources" that
don't require recompilation/redeploy.

Workaround is to specify such folders under `src/resources` as
fastReload.

This change makes sure that fastReload check is performed before
recompile check for sources.
  • Loading branch information
aindlq authored May 19, 2024
1 parent c69f1dc commit 806457e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ abstract class BaseScannerManager implements ScannerManager {
}.each { wconfig ->
log.info 'changed file {} affects project {}', f, wconfig.projectPath
def proj = project.project(wconfig.projectPath)
if(proj.sourceSets.main.allSource.srcDirs.find { f.startsWith(it.absolutePath) }) {
if(ProjectReloadUtils.satisfiesOneOfReloadSpecs(f, fastReloadMap[proj.path])) {
log.info 'file {} is in fastReload directories', f
reloadProject(wconfig.projectPath, 'fastReload')
} else if(proj.sourceSets.main.allSource.srcDirs.find { f.startsWith(it.absolutePath) }) {
if(wconfig.recompileOnSourceChange) {
reloadProject(wconfig.projectPath, 'compile')
// restart is done when reacting to class change, not source change
Expand Down Expand Up @@ -219,9 +222,6 @@ abstract class BaseScannerManager implements ScannerManager {
reloadProject(wconfig.projectPath, 'compile')
webAppConfigsToRestart.add(wconfig)
}
} else if(ProjectReloadUtils.satisfiesOneOfReloadSpecs(f, fastReloadMap[proj.path])) {
log.info 'file {} is in fastReload directories', f
reloadProject(wconfig.projectPath, 'fastReload')
} else {
log.info 'file {} is not in fastReload directories, switching to fullReload', f
reloadProject(wconfig.projectPath, 'compile')
Expand Down

0 comments on commit 806457e

Please sign in to comment.