with one click
scala-cli-adding-directives
// Add or change using directives in Scala CLI. Use when adding a new //> using directive, registering a directive handler, or editing directive preprocessing.
// Add or change using directives in Scala CLI. Use when adding a new //> using directive, registering a directive handler, or editing directive preprocessing.
Deprecate CLI options, option aliases, using directives, sub-commands, or config keys in Scala CLI. Use when marking a feature as deprecated with a warning.
Add or run Scala CLI integration tests. Use when adding integration tests, debugging RunTests/CompileTests/etc., or working in modules/integration.
| name | scala-cli-adding-directives |
| description | Add or change using directives in Scala CLI. Use when adding a new //> using directive, registering a directive handler, or editing directive preprocessing. |
Create a case class in modules/directives/src/main/scala/scala/build/preprocessing/directives/ extending one of:
HasBuildOptions — produces BuildOptions directlyHasBuildOptionsWithRequirements — produces BuildOptions with scoped requirements (e.g. test.dep)HasBuildRequirements — produces BuildRequirements (for //> require)Annotate: @DirectiveLevel(SpecificationLevel.EXPERIMENTAL), @DirectiveDescription("…"), @DirectiveUsage("…"), @DirectiveExamples("…"), @DirectiveName("key") on fields.
Companion: val handler: DirectiveHandler[YourDirective] = DirectiveHandler.derive
Register in modules/build/.../DirectivesPreprocessingUtils.scala in the right list: usingDirectiveHandlers, usingDirectiveWithReqsHandlers, or requireDirectiveHandlers.
Regenerate reference docs: ./mill -i 'generate-reference-doc[]'.run
CLI options always override directive values when both set the same thing.