-
Notifications
You must be signed in to change notification settings - Fork 81
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
build(core): support scala native + enabled JS tests #909
build(core): support scala native + enabled JS tests #909
Conversation
|
||
object SimpleApp extends ZIOAppDefault { | ||
|
||
override val bootstrap: ZLayer[ZIOAppArgs, Any, Any] = | ||
Runtime.removeDefaultLoggers >>> consoleLogger(ConsoleLoggerConfig.default) | ||
if (Platform.isJS) ZLayer.empty | ||
else Runtime.removeDefaultLoggers >>> consoleLogger(ConsoleLoggerConfig.default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on JS this seems to remove all logging... ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personally i do not have experience with scala JS, but if there are differences i think is better to do example specific for jvm and JS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anyway, with that condition, it look like that for platform JS it will not use consoleLogger(ConsoleLoggerConfig.default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it, all platforms use the same setup again. And discovered it wasn't working before because the scala-java-time-tzdb dependency was missing. Added them to 'core' because it is always required when using zio-logging.
@@ -152,7 +152,7 @@ private[logging] object LogAppender { | |||
} | |||
|
|||
def json(textAppender: String => Any): LogAppender = new LogAppender { self => | |||
val AnsiColorRegex = "\\u001b\\[\\d+m".r | |||
val AnsiColorRegex = """\033\[\d+m""".r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unicode is not compatible with Native. This ANSI is.
3218617
to
94fb3cc
Compare
hi @ThijsBroersen , thank you very much for contribution |
@@ -16,6 +16,7 @@ inThisBuild( | |||
List( | |||
name := "zio-logging", | |||
ciEnabledBranches := Seq("master"), | |||
// ciJvmOptions ++= Seq("-Xmx6g", "-Xss2m", "-XX:+UseG1GC"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this some leftover ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is was rendered in the ci.yaml but not properly picked up in the job. If you check the jobs here then you will see it was picked up but later in the job it still seemed to have only the default 1GB of memory: https://github.com/zio/zio-logging/actions/runs/11993647760/job/33434815940
So for now I added a .jvmopts
file to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left the commented out part there so it can be fixed. I am not sure where it goes wrong. It prints NOTE: Picked up JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags -Xmx6G -Xss2M -XX:+UseG1GC -XX:G1ConcRefinementThreads=4 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=1073741824 -XX:MaxHeapSize=1073741824 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=134217728 -XX:ThreadStackSize=4096 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC
which shows different InitialHeapSize and MaxHeapSize than the passed Xmx.
Locally I have the same issue. I am a bit puzzeled here. With the .jvmopts it is fine.
@@ -49,13 +49,13 @@ object ReconfigurableLoggerSpec extends ZIOSpecDefault { | |||
_ <- ZIO.logDebug("debug") | |||
elements1 <- queue.takeAll | |||
_ <- TestSystem.putProperty("logger/format", "%level %message") | |||
_ <- ZIO.sleep(500.millis) | |||
_ <- ZIO.sleep(1000.millis) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like on the JS platform it sometimes takes a bit longer to reconfigure
@ThijsBroersen nice, actually did you look into https://github.com/zio/zio-logging/tree/master/docs section if something do not need to be updated? seems to not, but just in case ... in relation to package changes, we should probably to do minor release (which i think will be 2.5.0) |
@justcoon update one line which was only mentioning JVM and JS support. |
hello @ThijsBroersen , thanks for contribution, can we follow with merge of this PR, or do you want to add something? |
All is fine. Not near a computer for the next few hours, can rebase later today. |
fbd77c9
to
10ddb39
Compare
Rebased |
This PR provides support for Scala Native for module
core
.While implementing I discovered all tests were only defined for the JVM. For JS nothing was tested. I moved all tests to shared.
Then I discovered all File related code is incompatible with the JS platform. I moved this to jvm-native.
Only the mimaChecks seem fail because I had to move some shared zio.logging package code and add the platform specific package code in the platform directories.
I could fix it by duplicating the package objects..
Is there any way it can be fixed without duplicating the code? I tried the scala3-library transparentTrait but that did not fix it and is not available for Native.