Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nativeMultithreading in ScalaNativeModule #3896

Merged
merged 1 commit into from
Nov 2, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ trait ScalaNativeModule extends ScalaModule { outer =>
/** Build target for current compilation */
def nativeBuildTarget: T[BuildTarget] = Task { BuildTarget.Application }

/**
* Shall be compiled with multithreading support. If equal to `None` the
* toolchain would detect if program uses system threads - when not thrads
* are not used, the program would be linked without multihreading support.
*/
def nativeMultithreading: T[Option[Boolean]] = Task { None }

private def nativeConfig: Task[NativeConfig] = Task.Anon {
val classpath = runClasspath().map(_.path).filter(_.toIO.exists).toList

Expand All @@ -240,6 +247,7 @@ trait ScalaNativeModule extends ScalaModule { outer =>
nativeEmbedResources(),
nativeIncrementalCompilation(),
nativeDump(),
nativeMultithreading(),
toWorkerApi(logLevel()),
toWorkerApi(nativeBuildTarget())
) match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package mill.scalanativelib

import java.util.jar.JarFile
import mill._
import mill.api.Result
import mill.define.Discover
import mill.eval.EvaluatorPaths
import mill.scalalib.api.ZincWorkerUtil
Expand Down
11 changes: 1 addition & 10 deletions scalanativelib/test/src/mill/scalanativelib/TestingTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,11 @@ package mill.scalanativelib

import mill._
import mill.api.Result
import mill.define.Discover
import mill.eval.EvaluatorPaths
import mill.scalalib.api.ZincWorkerUtil
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
import mill.scalalib.{DepSyntax, PublishModule, ScalaModule, TestModule}
import mill.scalanativelib.api._
import mill.testkit.{TestBaseModule, UnitTester}
import mill.testkit.UnitTester
import mill.testrunner.TestResult
import mill.util.TestUtil
import utest._

import java.util.jar.JarFile
import scala.jdk.CollectionConverters._

object TestingTests extends TestSuite {
import CompileRunTests._
def tests: Tests = Tests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private[scalanativelib] trait ScalaNativeWorkerApi {
nativeEmbedResources: Boolean,
nativeIncrementalCompilation: Boolean,
nativeDump: Boolean,
nativeMultithreading: Option[Boolean],
logLevel: NativeLogLevel,
buildTarget: BuildTarget
): Either[String, Object]
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ScalaNativeWorkerImpl extends mill.scalanativelib.worker.api.ScalaNativeWo
nativeEmbedResources: Boolean,
nativeIncrementalCompilation: Boolean,
nativeDump: Boolean,
nativeMultithreading: Option[Boolean],
logLevel: NativeLogLevel,
buildTarget: BuildTarget
): Either[String, Config] = {
Expand All @@ -81,6 +82,7 @@ class ScalaNativeWorkerImpl extends mill.scalanativelib.worker.api.ScalaNativeWo
})
.withEmbedResources(nativeEmbedResources)
.withIncrementalCompilation(nativeIncrementalCompilation)
.withMultithreading(nativeMultithreading)
.withBaseName("out")

val config = Config.empty
Expand Down
Loading