-
Notifications
You must be signed in to change notification settings - Fork 138
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 issue using Scala-CLI 1.6.1 (Apache Pekko build) #3464
Comments
I'm going to start by trying to get https://github.com/VirtusLab/scala-cli-setup approved by ASF so that we can use that and hopefully try to use an older version of Scala-CLI that doesn't have this issue. |
As for your CI, the best way would be to use https://github.com/VirtusLab/scala-cli-setup and then set the If that is not an option, any Scala CLI launcher can switch to an earlier version with the scala-cli version
# Scala CLI version: 1.6.1
# Scala version (default): 3.6.3
scala-cli --cli-version 1.5.4 version
# Scala CLI version: 1.5.4
# Scala version (default): 3.5.2 |
@pjfanning So your build seems to fail on this script: Now, I don't know the content of those You can try to pin the Scala version for those scripts and see if that fixes it for now. if scala-cli -S 3.5.2 "$file" ; then I suspect that will fix your CI (do get back and let us know if that is the case). Now, as for the actual change of behaviour, I need a reproduction of the bug to be able to say more. |
@Gedochao thanks for the quick response. The script that fails is generated is derived using The scala version should be 3.3.4 and the pekko version is the version of a local build stored to MavenLocal. A released version of pekko like 1.1.3 may reproduce this issue too. The only thing that has change recently was the upgrade of Scala CLI as opposed to the VerifyJDK9Classes job changing. |
//> using scala 3.3.4
//> using dep "org.apache.pekko::pekko-stream:1.1.3"
object VerifyJDK9Classes {
def main(args: Array[String]): Unit = {
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.scaladsl.{ JavaFlowSupport, Source }
import java.lang.System.exit
import scala.concurrent.Await
import scala.concurrent.duration.DurationInt
implicit val system: ActorSystem = ActorSystem.create("test")
val future = Source(1 to 3).runWith(
JavaFlowSupport.Sink.asPublisher[Int](fanout = false).mapMaterializedValue { p =>
JavaFlowSupport.Source.fromPublisher(p).runFold(0)(_ + _)
})
val result = Await.result(future, 3.seconds)
println(s"Result:" + result)
system.terminate()
exit(if (result == 6) 0 else 1)
}
} @pjfanning so this seems to work fine on my local machine (MacOS M1), and not just for Scala 3.3.4, but for 3.5.2 and 3.6.3, as well... not sure if it's because of the 1.1.3 version. |
BTW, looking at the logs from apache/pekko#1751:
@pjfanning So this is becoming increasingly suspicious. |
The script is
Note the license. The script is also generated with |
@pjfanning Ah, right. As per the using directive specification, using directives need to be on top of a file to be accepted. If they occur after Scala code, they are interpreted as standard comments.
This means the license code has to be moved to after the directives section, like this: //> using scala 3
//> using dep "org.apache.pekko::pekko-stream:1.2.0-M0+71-6a42f4e8-SNAPSHOT"
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
object VerifyJDK9Classes {
def main(args: Array[String]): Unit = {
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.scaladsl.{ JavaFlowSupport, Source }
import java.lang.System.exit
import scala.concurrent.Await
import scala.concurrent.duration.DurationInt
implicit val system: ActorSystem = ActorSystem.create("test")
val future = Source(1 to 3).runWith(
JavaFlowSupport.Sink.asPublisher[Int](fanout = false).mapMaterializedValue { p =>
JavaFlowSupport.Source.fromPublisher(p).runFold(0)(_ + _)
})
val result = Await.result(future, 3.seconds)
println(s"Result:" + result)
system.terminate()
exit(if (result == 6) 0 else 1)
}
} This is technically not a bug, but we could potentially consider accepting //> using /* comment1 */ key /* comment2 */ value And that we do not want.
Please note that
So TL;DR, the code would be compiled with Scala 3.6.3, regardless if Scala CLI v1.5.4 (since it's the currently newest Scala 3 Next version) or v1.6.1 (since that's the default there) was used. Hope this helps. |
In my local testing, using |
@pjfanning Yep. That's because of the |
I'll close this since @Gedochao has explained what the issue is and how to fix it on my side. |
Version(s)
Describe the bug
Pekko build worked until CI started picking up Scala-CLI 1.6.1 (1.5.x was working for us).
Issue is at apache/pekko#1751
To Reproduce
Expected behaviour
Any help would be appreciated. Is there even a way to pin to the CI job to use an older version of Scala CLI?
The text was updated successfully, but these errors were encountered: