Skip to content

Commit

Permalink
Add nativeMultithreading in ScalaNativeModule (#3896)
Browse files Browse the repository at this point in the history
- Remove dead code for Scala Native 0.4
- Cleanup unused imports

Pull Request: #3896
  • Loading branch information
lolgab authored Nov 2, 2024
1 parent 94d28d2 commit d5d56b5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 190 deletions.
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

0 comments on commit d5d56b5

Please sign in to comment.