Skip to content
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

Add Scala3 support #27

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

adkian-sifive
Copy link

No description provided.

Copy link
Collaborator

@jackkoenig jackkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments but I am pretty certain there is no reason to make any substantial changes to the Scala source of firtool-resolver (other than minor changes needed for cross-compilation).

object `firtool-resolver` extends Cross[FirtoolResolver]("2.13", "2.12")
trait FirtoolResolver extends CrossScalaModule with ChipsAlliancePublishModule { root =>
object `firtool-resolver` extends Cross[FirtoolResolver]("2.13", "2.12", "3.4", "3.3")
trait FirtoolResolver extends CrossSbtModule with ChipsAlliancePublishModule { root =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than switching this to SBT style, I would rather stick with vanilla Mill style. We only use SBT style in Chisel for historical reasons, we could just override millSourcePath here. Fortunately, we don't even need to do that as I will explain below.

@@ -233,12 +233,14 @@ object `llvm-firtool` extends JavaModule with ChipsAlliancePublishModule {
// ******************** WARNING ********************
// This is extremely manual and changing dependencies IN ANY WAY (including bumping version)
// requires carefully checking the packages to shade and dynamic ivy deps in the outer project
object `firtool-resolver` extends Cross[FirtoolResolver]("2.13", "2.12")
trait FirtoolResolver extends CrossScalaModule with ChipsAlliancePublishModule { root =>
object `firtool-resolver` extends Cross[FirtoolResolver]("2.13", "2.12", "3.4", "3.3")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
object `firtool-resolver` extends Cross[FirtoolResolver]("2.13", "2.12", "3.4", "3.3")
object `firtool-resolver` extends Cross[FirtoolResolver]("2.13", "2.12", "3")

Comment on lines +242 to +243
"3.4" -> "3.4.2",
"3.3" -> "3.3.3"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"3.4" -> "3.4.2",
"3.3" -> "3.3.3"
"3" -> "3.3.3"

Scala 3 maintains binary compatibility across all minor versions so there is no reason to cross compile for any version but 1 in Scala 3 (unlike Scala 2 where it you do have to compile differently for 2.12 and 2.13.

@@ -281,8 +283,7 @@ trait FirtoolResolver extends CrossScalaModule with ChipsAlliancePublishModule {
ivy"org.scala-lang.modules::scala-collection-compat:2.11.0"
)

object core extends ScalaModule {

object core extends CrossSbtModule with CrossValue {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
object core extends CrossSbtModule with CrossValue {
object core extends ScalaModule with CrossValue {


object FetchArtifact {
def apply(logger: Logger, defaultVersion: String): Either[String, FirtoolBinary] = {
Left("Firtool not found on system: building firtool is not supported in Scala 3")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not right. llvm-firtool (the Maven project published by this repo that is just a repackaging of pre-build firtool binaries as Java published artifacts) is a Java project--it has no dependency on the Scala version.

Only firtool-resolver needs to be cross-compiled and I am fairly certainly all of this source code can cross compile (or can easily be made to cross-compile).

Copy link
Author

@adkian-sifive adkian-sifive Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to get it without coursier? my cursory search indicated that coursier does not provide a scala3 artifact

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nice, trying..

@jackkoenig
Copy link
Collaborator

Also please add Scala 3 to CI

@adkian-sifive
Copy link
Author

The problem here is caused by the dependency on ivy coursier artifacts which afaict does not provide a Scala 3 version. If there's a way around it without having to use the 3-part structure here, let's do it, but i couldn't think of any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants