-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c01b670
commit 68541d5
Showing
4 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
modules/directives/src/main/scala/scala/build/preprocessing/directives/ObjectWrapper.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package scala.build.preprocessing.directives | ||
|
||
import scala.build.directives.* | ||
import scala.build.errors.BuildException | ||
import scala.build.options.{BuildOptions, ScriptOptions} | ||
import scala.cli.commands.SpecificationLevel | ||
|
||
@DirectiveExamples("//> using objectWrapper") | ||
@DirectiveUsage("//> using objectWrapper", "`//> using objectWrapper") | ||
@DirectiveDescription("Set the default code wrapper for scripts to object wrapper") | ||
@DirectiveLevel(SpecificationLevel.RESTRICTED) | ||
final case class ObjectWrapper( | ||
@DirectiveName("object.wrapper") | ||
objectWrapper: Boolean = false | ||
) extends HasBuildOptions { | ||
def buildOptions: Either[BuildException, BuildOptions] = | ||
val options = BuildOptions(scriptOptions = | ||
ScriptOptions(forceObjectWrapper = Some(true)) | ||
) | ||
Right(options) | ||
} | ||
|
||
object ObjectWrapper { | ||
val handler: DirectiveHandler[ObjectWrapper] = DirectiveHandler.derive | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters