Skip to content

Commit

Permalink
Add feature flags to config schema
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Nov 19, 2024
1 parent 61e1f4c commit 267d330
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/nextflow/config/dsl/ConfigSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import nextflow.config.scopes.*;
import nextflow.script.dsl.Description;
import nextflow.script.dsl.FeatureFlag;
import nextflow.script.dsl.FeatureFlagDsl;
import nextflow.script.dsl.ProcessDsl;

public class ConfigSchema {
Expand Down Expand Up @@ -108,13 +110,19 @@ private static Map<String, String> getConfigOptions() {
result.put(name, annot.value());
}
}
// derive process config from process directives
// derive nextflow config scope from feature flags
for( var field : FeatureFlagDsl.class.getDeclaredFields() ) {
var name = field.getAnnotation(FeatureFlag.class);
var description = field.getAnnotation(Description.class);
result.put(name.value(), description.value());
}
// derive process config scope from process directives
for( var method : ProcessDsl.DirectiveDsl.class.getDeclaredMethods() ) {
var annot = method.getAnnotation(Description.class);
if( annot == null )
var description = method.getAnnotation(Description.class);
if( description == null )
continue;
var name = "process." + method.getName();
result.put(name, annot.value());
result.put(name, description.value());
}
return result;
}
Expand Down

0 comments on commit 267d330

Please sign in to comment.