-
Notifications
You must be signed in to change notification settings - Fork 6
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
654d085
commit c6f00b1
Showing
8 changed files
with
147 additions
and
18 deletions.
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
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
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
45 changes: 45 additions & 0 deletions
45
cli/src/main/scala/scala/scalanative/cli/options/SemanticsConfigOptions.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,45 @@ | ||
package scala.scalanative.cli.options | ||
|
||
import scopt.OptionParser | ||
import scala.scalanative.build | ||
|
||
case class SemanticsConfigOptions( | ||
finalFields: Option[JVMMemoryModelCompliance] = None | ||
) | ||
|
||
sealed abstract class JVMMemoryModelCompliance { | ||
import JVMMemoryModelCompliance._ | ||
def convert: build.JVMMemoryModelCompliance = this match { | ||
case None => build.JVMMemoryModelCompliance.None | ||
case Relaxed => build.JVMMemoryModelCompliance.Relaxed | ||
case Strict => build.JVMMemoryModelCompliance.Strict | ||
} | ||
} | ||
object JVMMemoryModelCompliance { | ||
case object None extends JVMMemoryModelCompliance | ||
case object Relaxed extends JVMMemoryModelCompliance | ||
case object Strict extends JVMMemoryModelCompliance | ||
|
||
implicit val read: scopt.Read[JVMMemoryModelCompliance] = | ||
scopt.Read.reads { | ||
case "none" => JVMMemoryModelCompliance.None | ||
case "relaxed" => JVMMemoryModelCompliance.Relaxed | ||
case "strict" => JVMMemoryModelCompliance.Strict | ||
} | ||
} | ||
|
||
object SemanticsConfigOptions { | ||
def set(parser: OptionParser[LinkerOptions]) = { | ||
def update(c: LinkerOptions)( | ||
fn: SemanticsConfigOptions => SemanticsConfigOptions | ||
) = | ||
c.copy(semanticsConfig = fn(c.semanticsConfig)) | ||
parser.note("Semantics options:") | ||
parser | ||
.opt[JVMMemoryModelCompliance]("final-fields-semantics") | ||
.valueName("<final-fields-semantics> (none, relaxed, or stricts)") | ||
.optional() | ||
.action((x, c) => update(c)(_.copy(finalFields = Some(x)))) | ||
.text("Maximal number of allowed nested inlines.") | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
cli/src/main/scala/scala/scalanative/cli/options/SourceLevelDebuggingConfigOptions.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,64 @@ | ||
package scala.scalanative.cli.options | ||
|
||
import java.nio.file.{Path, Paths} | ||
import scopt.OptionParser | ||
|
||
case class SourceLevelDebuggingConfigOptions( | ||
enabled: Option[Boolean] = None, | ||
genFunctionSourcePositions: Option[Boolean] = None, | ||
genLocalVariables: Option[Boolean] = None, | ||
customSourceRoots: Seq[Path] = Nil | ||
) | ||
|
||
object SourceLevelDebuggingConfigOptions { | ||
def set(parser: OptionParser[LinkerOptions]) = { | ||
def update(c: LinkerOptions)( | ||
fn: SourceLevelDebuggingConfigOptions => SourceLevelDebuggingConfigOptions | ||
) = | ||
c.copy(sourceLevelDebuggingConfig = fn(c.sourceLevelDebuggingConfig)) | ||
parser.note("Source Level Debugging options:") | ||
parser | ||
.opt[Boolean]("-debug-info") | ||
.optional() | ||
.action((x, c) => update(c)(_.copy(enabled = Some(x)))) | ||
.text("Should enable generation of source level debug metadata") | ||
parser | ||
.opt[Unit]("debug-all") | ||
.abbr("g") | ||
.optional() | ||
.action((x, c) => | ||
update(c)( | ||
_.copy( | ||
enabled = Some(true), | ||
genFunctionSourcePositions = Some(true), | ||
genLocalVariables = Some(true) | ||
) | ||
) | ||
) | ||
.text( | ||
"Should enable all debug metadata generation" | ||
) | ||
parser | ||
.opt[Boolean]("debug-function-source-positions") | ||
.optional() | ||
.action((x, c) => update(c)(_.copy(genFunctionSourcePositions = Some(x)))) | ||
.text( | ||
"Should enable generation of function source position for stack traces" | ||
) | ||
parser | ||
.opt[Boolean]("debug-local-variables") | ||
.optional() | ||
.action((x, c) => update(c)(_.copy(genLocalVariables = Some(x)))) | ||
.text("Should enable generation of localv variables metadata") | ||
parser | ||
.opt[String]("debug-source-root") | ||
.optional() | ||
.unbounded() | ||
.action((x, c) => | ||
update(c)(cc => | ||
cc.copy(customSourceRoots = Paths.get(x) +: cc.customSourceRoots) | ||
) | ||
) | ||
.text("Add custom sources root directory") | ||
} | ||
} |
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