|
1 | 1 | package com.marklogic.client.ext.modulesloader.impl; |
2 | 2 |
|
3 | 3 | import com.marklogic.client.ext.helper.FilenameUtil; |
| 4 | +import com.marklogic.client.ext.helper.LoggingObject; |
4 | 5 | import com.marklogic.client.ext.modulesloader.Modules; |
5 | 6 | import com.marklogic.client.ext.modulesloader.ModulesFinder; |
6 | 7 | import org.springframework.core.io.FileSystemResource; |
|
21 | 22 | * Abstract implementation that provides implementations for loading all the different kinds of modules. |
22 | 23 | * Subclasses need to override the findModulesWithResolvedBaseDir method. |
23 | 24 | */ |
24 | | -public abstract class BaseModulesFinder implements ModulesFinder { |
| 25 | +public abstract class BaseModulesFinder extends LoggingObject implements ModulesFinder { |
25 | 26 |
|
26 | 27 | private FilenameFilter transformFilenameFilter = new TransformFilenameFilter(); |
27 | 28 | private FilenameFilter namespaceFilenameFilter = new NamespaceFilenameFilter(); |
@@ -165,10 +166,20 @@ public void setIncludeUnrecognizedPathsAsAssetPaths(boolean includeUnrecognizedP |
165 | 166 |
|
166 | 167 | @Override |
167 | 168 | public final Modules findModules(String baseDir) { |
| 169 | + if (logger.isDebugEnabled()) { |
| 170 | + logger.debug("Finding modules in baseDir: " + baseDir); |
| 171 | + } |
168 | 172 | if (!baseDir.startsWith("file:") && !baseDir.startsWith("classpath")) { |
169 | | - baseDir = Paths.get(baseDir).toUri().toString(); |
| 173 | + /** |
| 174 | + * Have to wrap this in a File first to address an issue where Gradle, when running in daemon mode, will |
| 175 | + * resolve values passed into the Paths class from the directory where the daemon mode was launched, which |
| 176 | + * may not be the current directory. |
| 177 | + */ |
| 178 | + baseDir = new File(baseDir).toURI().toString(); |
| 179 | + if (logger.isDebugEnabled()) { |
| 180 | + logger.debug("Finding modules in baseDir, which was modified to be: " + baseDir); |
| 181 | + } |
170 | 182 | } |
171 | | - |
172 | 183 | return findModulesWithResolvedBaseDir(baseDir); |
173 | 184 | } |
174 | 185 |
|
|
0 commit comments