Skip to content

Commit a80cba8

Browse files
committed
Scala Native port
1 parent b166a05 commit a80cba8

File tree

20 files changed

+53
-70
lines changed

20 files changed

+53
-70
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,18 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
scalaversion: ["2.11.12", "2.12.10", "2.13.1"]
16-
scalajsversion: ["1.x", "0.6.x"]
17-
include:
18-
- scalaversion: "2.10.7"
19-
scalajsversion: "0.6.x"
20-
env:
21-
SCALAJS_VERSION: "${{ matrix.scalajsversion == '0.6.x' && '0.6.31' || '' }}"
15+
scalaversion: ["2.12.19", "2.13.14"]
2216
steps:
2317
- uses: actions/checkout@v2
2418
- uses: olafurpg/setup-scala@v10
2519
with:
2620
java-version: "[email protected]"
2721
- uses: coursier/cache-action@v5
2822
- name: Scalastyle
29-
run: sbt "++${{ matrix.scalaversion }}" root/scalastyle testSuiteJVM/scalastyle testSuiteJVM/test:scalastyle testSuiteJS/scalastyle testSuiteJS/test:scalastyle
23+
run: sbt "++${{ matrix.scalaversion }}" root/scalastyle testSuiteJVM/scalastyle testSuiteJVM/test:scalastyle testSuiteNative/scalastyle testSuiteNative/test:scalastyle
3024
- name: Test JVM
3125
run: sbt "++${{ matrix.scalaversion }}" testSuiteJVM/test
32-
- name: Test JS
33-
run: sbt "++${{ matrix.scalaversion }}" testSuiteJS/test
34-
- name: Test JS fullOpt
35-
run: sbt "++${{ matrix.scalaversion }}" 'set scalaJSStage in Global := FullOptStage' testSuiteJS/test
26+
- name: Test Native
27+
run: sbt "++${{ matrix.scalaversion }}" testSuiteNative/test
3628
- name: Test publish
3729
run: sbt "++${{ matrix.scalaversion }}" publishLocal

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Contributing guidelines
22

3-
See the [contributing guidelines of Scala.js core](https://github.com/scala-js/scala-js/blob/main/CONTRIBUTING.md).
3+
See the [contributing guidelines of Scala Native core](https://github.com/scala-native/scala-native/blob/main/CONTRIBUTING.md).
44
The same guidelines apply to this repository.
55

66
## Very important notice
77

8-
`scalajs-java-logging` contains a reimplementation of part of the JDK in Scala.js itself.
8+
`scala-native-java-logging` contains a reimplementation of part of the JDK in Scala Native itself.
99

1010
***To contribute to this code, it is strictly forbidden to even look at the
1111
source code of the Oracle JDK or OpenJDK!***

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
# scalajs-java-logging
1+
# scala-native-java-logging
22

3-
[![CI](https://github.com/scala-js/scala-js-java-logging/actions/workflows/ci.yml/badge.svg)](https://github.com/scala-js/scala-js-java-logging/actions/workflows/ci.yml)
4-
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-0.6.29.svg)](https://www.scala-js.org/)
5-
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-1.0.0.svg)](https://www.scala-js.org)
3+
[![CI](https://github.com/scala-native/scala-native-java-logging/actions/workflows/ci.yml/badge.svg)](https://github.com/scala-native/scala-native-java-logging/actions/workflows/ci.yml)
64

7-
`scalajs-java-logging` is a BSD-licensed reimplementation of the `java.logging` API for Scala.js.
8-
It enables this API in Scala.js projects.
5+
`scala-native-java-logging` is a BSD-licensed reimplementation of the `java.logging` API for Scala Native.
6+
It enables this API in Scala Native projects.
7+
8+
Ported from https://github.com/scala-js/scala-js-java-logging.
99

1010
## Usage
1111

1212
Simply add the following line to your sbt settings:
1313

1414
```scala
15-
libraryDependencies += "org.scala-js" %%% "scalajs-java-logging" % "1.0.0"
15+
libraryDependencies += "org.scala-native" %%% "scala-native-java-logging" % "1.0.0"
1616
```
1717

1818
If you have a `crossProject`, the setting must be used only in the JS part:
1919

2020
```scala
2121
lazy val myCross = crossProject.
2222
...
23-
jsSettings.(
24-
libraryDependencies += "org.scala-js" %%% "scalajs-java-logging" % "1.0.0"
23+
nativeSettings.(
24+
libraryDependencies += "org.scala-native" %%% "scala-native-java-logging" % "1.0.0"
2525
)
2626
```
2727

@@ -36,7 +36,7 @@ classes and methods!
3636

3737
## License
3838

39-
`scalajs-java-logging` is distributed under the
39+
`scala-native-java-logging` is distributed under the
4040
[BSD 3-Clause license](./LICENSE.txt).
4141

4242
## Contributing

build.sbt

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
import sbtcrossproject.crossProject
22

3-
crossScalaVersions in ThisBuild := {
4-
val allVersions = Seq("2.12.10", "2.11.12", "2.10.7", "2.13.1")
5-
if (scalaJSVersion.startsWith("0.6."))
6-
allVersions
7-
else
8-
allVersions.filter(!_.startsWith("2.10."))
9-
}
3+
crossScalaVersions in ThisBuild := Seq("2.12.19", "2.13.14")
104
scalaVersion in ThisBuild := (crossScalaVersions in ThisBuild).value.head
115

126
val commonSettings: Seq[Setting[_]] = Seq(
137
version := "1.0.1-SNAPSHOT",
14-
organization := "org.scala-js",
8+
organization := "org.scala-native",
159
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),
1610

17-
homepage := Some(url("http://scala-js.org/")),
11+
homepage := Some(url("http://scala-native.org/")),
1812
licenses += ("BSD New",
19-
url("https://github.com/scala-js/scala-js-java-logging/blob/main/LICENSE")),
13+
url("https://github.com/scala-native/scala-native-java-logging/blob/main/LICENSE")),
2014
scmInfo := Some(ScmInfo(
21-
url("https://github.com/scala-js/scala-js-java-logging"),
22-
"scm:git:[email protected]:scala-js/scala-js-java-logging.git",
23-
Some("scm:git:[email protected]:scala-js/scala-js-java-logging.git")))
15+
url("https://github.com/scala-native/scala-native-java-logging"),
16+
"scm:git:[email protected]:scala-native/scala-native-java-logging.git",
17+
Some("scm:git:[email protected]:scala-native/scala-native-java-logging.git")))
2418
)
2519

2620
lazy val root: Project = project.in(file(".")).
27-
enablePlugins(ScalaJSPlugin).
21+
enablePlugins(ScalaNativePlugin).
2822
settings(commonSettings).
2923
settings(
30-
name := "scalajs-java-logging",
24+
name := "scala-native-java-logging",
3125

3226
mappings in (Compile, packageBin) ~= {
3327
_.filter(!_._2.endsWith(".class"))
@@ -64,17 +58,17 @@ lazy val root: Project = project.in(file(".")).
6458
pomIncludeRepository := { _ => false }
6559
)
6660

67-
lazy val testSuite = crossProject(JSPlatform, JVMPlatform).
68-
jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)).
61+
lazy val testSuite = crossProject(NativePlatform, JVMPlatform).
62+
nativeConfigure(_.enablePlugins(ScalaNativeJUnitPlugin)).
6963
settings(commonSettings: _*).
7064
settings(
7165
testOptions +=
7266
Tests.Argument(TestFramework("com.novocode.junit.JUnitFramework"), "-v", "-a")
7367
).
74-
jsSettings(
75-
name := "java.logging testSuite on JS"
68+
nativeSettings(
69+
name := "java.logging testSuite on Native"
7670
).
77-
jsConfigure(_.dependsOn(root)).
71+
nativeConfigure(_.dependsOn(root)).
7872
jvmSettings(
7973
name := "java.logging testSuite on JVM",
8074
libraryDependencies +=

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.3.3
1+
sbt.version=1.10.0

project/build.sbt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
val scalaJSVersion =
2-
Option(System.getenv("SCALAJS_VERSION")).filter(_ != "").getOrElse("1.0.0")
3-
4-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
5-
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")
1+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1")
2+
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.1")
63

74
addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "1.0.0")

scalastyle-config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<scalastyle>
2-
<name>Scalastyle configuration for Scala.js</name>
2+
<name>Scalastyle configuration for Scala Native</name>
33

44
<check level="error" enabled="true" class="org.scalastyle.file.FileTabChecker"/>
55
<check level="error" enabled="true" class="org.scalastyle.file.WhitespaceEndOfLineChecker"/>

src/main/scala/java/util/logging/Formatter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ abstract class Formatter protected () {
1515
val params = record.getParameters
1616

1717
if (params != null && params.length > 0) {
18-
// The Java spec uses java.text formatting not available in Scala.js
18+
// The Java spec uses java.text formatting not available in Scala Native
1919
// Instead we'll do simple text replacement, very imperative
2020
var msgAccumulator = new StringBuilder()
2121
var inParam = false

src/main/scala/java/util/logging/Level.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Level protected (private[this] val name: String,
3535

3636
def getName(): String = name
3737

38-
// Not implemented, no locale in Scala.js
38+
// Not implemented, no locale in Scala Native
3939
//def getLocalizedName():String
4040

4141
override def toString(): String = name

src/main/scala/java/util/logging/LogRecord.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ class LogRecord(private[this] var level: Level, private[this] var msg: String) {
2424
def setLoggerName(loggerName: String): Unit =
2525
this.loggerName = loggerName
2626

27-
// Not implemented, no locale in Scala.js
27+
// Not implemented, no locale in Scala Native
2828
//def getResourceBundle():ResourceBundle = ???
2929

30-
// Not implemented, no locale in Scala.js
30+
// Not implemented, no locale in Scala Native
3131
//def setResourceBundle(bundle: ResourceBundle):Unit = ???
3232

3333
// Message is not localizable, return null

0 commit comments

Comments
 (0)