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
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@
"allDeclaredClasses": true,
"allPublicClasses": true
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
{
"name": "collectionClassName",
"parameterTypes": [

]
}
]
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
{
"name": "getPlatformClassLoader",
"parameterTypes": [

]
}
]
Expand Down Expand Up @@ -68,4 +67,4 @@
}
]
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"scala.build.bloop.ScalaDebugServerForwardStubs",
"org.eclipse.lsp4j.jsonrpc.Endpoint"
]
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,6 @@
{
"name": "<init>",
"parameterTypes": [

]
}
]
Expand All @@ -755,7 +754,6 @@
{
"name": "<init>",
"parameterTypes": [

]
}
]
Expand Down Expand Up @@ -847,7 +845,6 @@
{
"name": "<init>",
"parameterTypes": [

]
}
]
Expand All @@ -869,7 +866,6 @@
{
"name": "<init>",
"parameterTypes": [

]
}
]
Expand All @@ -881,7 +877,6 @@
{
"name": "<init>",
"parameterTypes": [

]
}
]
Expand Down Expand Up @@ -1072,4 +1067,4 @@
"allDeclaredMethods": true,
"allDeclaredFields": true
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@
]
},
"bundles": [

]
}
}
3 changes: 1 addition & 2 deletions modules/cli/src/main/scala/scala/cli/ScalaCli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object ScalaCli {
.takeWhile(_.isDigit)
.toInt

def main(args: Array[String]): Unit = {
def main(args: Array[String]): Unit =
try main0(args)
catch {
case e: Throwable if !isCI =>
Expand Down Expand Up @@ -106,7 +106,6 @@ object ScalaCli {
if (CurrentParams.verbosity >= 2) throw e
else sys.exit(1)
}
}

private def warnRequiresJava17(): Unit =
System.err.println(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import java.io.{ByteArrayOutputStream, File}
import java.nio.charset.Charset

import scala.cli.integration.util.DockerServer
import scala.io.Codec
import scala.util.Properties

abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
Expand Down Expand Up @@ -1608,4 +1609,35 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
test("Js DOM") {
jsDomTest()
}

test("UTF-8") {
val message = "Hello from TestÅÄÖåäö"
val fileName = "TestÅÄÖåäö.scala"
val inputs = TestInputs(
Seq(
os.rel / fileName ->
s"""object TestÅÄÖåäö {
| def main(args: Array[String]): Unit = {
| println("$message")
| }
|}
|""".stripMargin
)
)
inputs.fromRoot { root =>
val res = os.proc(
TestUtil.cli,
"-Dtest.scala-cli.debug-charset-issue=true",
"run",
extraOptions,
fileName
)
.call(cwd = root)
if (res.out.text(Codec.default).trim != message) {
pprint.err.log(res.out.text(Codec.default).trim)
pprint.err.log(message)
}
expect(res.out.text(Codec.default).trim == message)
}
}
}
45 changes: 35 additions & 10 deletions project/settings.sc
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,42 @@ trait CliLaunchers extends SbtModule { self =>
def nativeImageDockerParams = Some(
NativeImage.DockerParams(
imageName = "ubuntu:18.04",
prepareCommand = "apt-get update -q -y && apt-get install -q -y build-essential libz-dev",
prepareCommand =
"""apt-get update -q -y &&\
|apt-get install -q -y build-essential libz-dev locales
|locale-gen en_US.UTF-8
|export LANG=en_US.UTF-8
|export LANGUAGE=en_US:en
|export LC_ALL=en_US.UTF-8""",
csUrl =
s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz",
extraNativeImageArgs = Nil
)
)
}

private def setupLocale(params: NativeImage.DockerParams): NativeImage.DockerParams =
params.copy(
prepareCommand = params.prepareCommand +
"""
|set -v
|apt-get update
|apt-get install -q -y locales
|locale-gen en_US.UTF-8
|export LANG=en_US.UTF-8
|export LANGUAGE=en_US:en
|export LC_ALL=en_US.UTF-8""".stripMargin
)

object `static-image` extends CliNativeImage {
def nativeImageDockerParams = T {
buildHelperImage()
Some(
NativeImage.linuxStaticParams(
Docker.muslBuilder,
s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz"
)
val baseDockerParams = NativeImage.linuxStaticParams(
Docker.muslBuilder,
s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz"
)
val dockerParams = setupLocale(baseDockerParams)
buildHelperImage()
Some(dockerParams)
}
def buildHelperImage = T {
os.proc("docker", "build", "-t", Docker.customMuslBuilderImageName, ".")
Expand All @@ -221,12 +240,14 @@ trait CliLaunchers extends SbtModule { self =>
}

object `mostly-static-image` extends CliNativeImage {
def nativeImageDockerParams = Some(
NativeImage.linuxMostlyStaticParams(
def nativeImageDockerParams = T {
val baseDockerParams = NativeImage.linuxMostlyStaticParams(
"ubuntu:18.04", // TODO Pin that
s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz"
)
)
val dockerParams = setupLocale(baseDockerParams)
Some(dockerParams)
}
}

def localRepoJar: T[PathRef]
Expand Down Expand Up @@ -590,6 +611,10 @@ private def doFormatNativeImageConf(dir: os.Path, format: Boolean): List[os.Path
else
json
val updatedContent = updatedJson.render(indent = 2)
.linesIterator
.filter(_.trim.nonEmpty)
.map(_ + "\n")
.mkString
if (updatedContent != content) {
needsFormatting = file :: needsFormatting
if (format)
Expand Down