Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions scalanativelib/src/mill/scalanativelib/ScalaNativeModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ trait ScalaNativeModule extends ScalaModule { outer =>
*/
def nativeMultithreading: T[Option[Boolean]] = Task { None }

/**
* List of service providers which shall be allowed in the final binary.
* Example:
* Map("java.nio.file.spi.FileSystemProvider" -> Seq("my.lib.MyCustomFileSystem"))
* Makes the implementation for the FileSystemProvider trait in `my.lib.MyCustomFileSystem`
* included in the binary for reflective instantiation.
*/
def nativeServiceProviders: T[Map[String, Seq[String]]] = Task { Map.empty[String, Seq[String]] }

private def nativeConfig: Task[NativeConfig] = Task.Anon {
val classpath = runClasspath().map(_.path).filter(_.toIO.exists).toList
withScalaNativeBridge.apply().apply(_.config(
Expand All @@ -245,6 +254,7 @@ trait ScalaNativeModule extends ScalaModule { outer =>
nativeIncrementalCompilation(),
nativeDump(),
nativeMultithreading(),
nativeServiceProviders(),
toWorkerApi(logLevel()),
toWorkerApi(nativeBuildTarget())
)) match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private[scalanativelib] trait ScalaNativeWorkerApi {
nativeIncrementalCompilation: Boolean,
nativeDump: Boolean,
nativeMultithreading: Option[Boolean],
nativeServiceProviders: Map[String, Seq[String]],
logLevel: NativeLogLevel,
buildTarget: BuildTarget
): Either[String, Object]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class ScalaNativeWorkerImpl extends mill.scalanativelib.worker.api.ScalaNativeWo
nativeIncrementalCompilation: Boolean,
nativeDump: Boolean,
nativeMultithreading: Option[Boolean],
nativeServiceProviders: Map[String, Seq[String]],
logLevel: NativeLogLevel,
buildTarget: BuildTarget
): Either[String, Config] = {
Expand All @@ -83,6 +84,7 @@ class ScalaNativeWorkerImpl extends mill.scalanativelib.worker.api.ScalaNativeWo
.withEmbedResources(nativeEmbedResources)
.withIncrementalCompilation(nativeIncrementalCompilation)
.withMultithreading(nativeMultithreading)
.withServiceProviders(nativeServiceProviders)
.withBaseName("out")

val config = Config.empty
Expand Down
Loading