Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
// apply CompileStatic AST annotation on .sgroovy files
withConfig(configuration){
    source(extension: 'sgroovy') {
        ast(CompileStatic)
    }
}

// apply CompileStatic AST annotation on .sgroovy or .sg files
withConfig(configuration){
    source(extensions: ['sgroovy','sg']) {
        ast(CompileStatic)
    }
}

// apply CompileStatic AST annotation on .sgroovy or .sg files
withConfig(configuration) {
    source(extensionValidator: { it.name in ['sgroovy','sg']}) {
        ast(CompileStatic)
    }
}

// apply CompileStatic AST annotation on files whose name is 'foo'
withConfig(configuration) {
    source(basename: 'foo') {
        ast(CompileStatic)
    }
}

// apply CompileStatic AST annotation on files whose name is 'foo' or 'bar'
withConfig(configuration) {
    source(basenames: ['foo', 'bar']) {
        ast(CompileStatic)
    }
}

// apply CompileStatic AST annotation on files whose name is 'foo' or 'bar'
withConfig(configuration)(basenames {
    source(basenameValidator: { it in ['foo', 'bar'] }) {
        ast(CompileStatic)
    }
}

// apply CompileStatic AST annotation on files that do not contain a class named 'Baz'
withConfig(configuration) {
    source(unitValidator: { unit -> !unit.AST.classes.any { it.name == 'Baz' } }) {
        ast(CompileStatic)
    }
}

Inlining a customizer

Inlined customizer allows you to write a compilation customizer directly, without having to create a dedicated class for it.

...