Skip to content

Commit

Permalink
Fix resolution of module resources
Browse files Browse the repository at this point in the history
This commit allows the correct resolution of resource bundles
for module for which the script name is different from 'main.nf'.

For example:

```
.
├── README.md
├── main.nf
├── modules
│   └── bar
│       ├── main.nf
│       ├── resources
│       │   └── usr
│       │       └── bin
│       │           └── increase.py
│       └── utils.nf
└── nextflow.config
```

Having the `bar` module, the resource path `resources/usr/bin` is
correctly resolved both for `bar/main.nf` and `bar/utils.nf`.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Apr 1, 2023
1 parent a2c71ac commit 2c5a687
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1695,8 +1695,9 @@ class TaskProcessor {
protected List<Path> getBinDirs() {
final result = new ArrayList(10)
// module bundle bin dir have priority, add before
if( moduleBundle!=null && session.enableModuleBinaries() )
result.addAll(moduleBundle.getBinDirs())
final bundle = session.enableModuleBinaries() ? getModuleBundle() : null
if( bundle!=null )
result.addAll(bundle.getBinDirs())
// then add project bin dir
if( executor.binDir )
result.add(executor.binDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,6 @@ class ScriptMeta {
ResourcesBundle getModuleBundle() {
if( !scriptPath )
throw new IllegalStateException("Module scriptPath has not been defined yet")
if( scriptPath.getName()!='main.nf' )
return null
final bundlePath = scriptPath.resolveSibling('resources')
return ResourcesBundle.scan(bundlePath)
}
Expand Down

0 comments on commit 2c5a687

Please sign in to comment.