-
Notifications
You must be signed in to change notification settings - Fork 59
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
Use setup-java/setup-graalvm instead of setup-scala #91
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2020-2021 Daniel Spiewak | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
package sbtghactions | ||
|
||
final case class JavaSpec(dist: JavaSpec.Distribution, version: String) { | ||
def render: String = dist match { | ||
case JavaSpec.Distribution.GraalVM(gversion) => s"graal:$gversion@$version" | ||
case dist => s"${dist.rendering}@$version" | ||
} | ||
} | ||
|
||
object JavaSpec { | ||
|
||
def temurin(version: String): JavaSpec = JavaSpec(Distribution.Temurin, version) | ||
def graalvm(graal: String, version: String): JavaSpec = JavaSpec(Distribution.GraalVM(graal), version) | ||
|
||
sealed abstract class Distribution(val rendering: String) extends Product with Serializable | ||
|
||
object Distribution { | ||
case object Temurin extends Distribution("temurin") | ||
case object Zulu extends Distribution("zulu") | ||
case object Adopt extends Distribution("adopt-hotspot") | ||
case object OpenJ9 extends Distribution("adopt-openj9") | ||
case object Liberica extends Distribution("liberica") | ||
final case class GraalVM(version: String) extends Distribution(version) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't that a bit dangerous - publishing by default for Java 11?
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.
There's basically two possible dangers. One is that the classfiles have the wrong version header and are thus incompatible with <11, and the other is standard library stuff. In the former case, that only happens if you have Java sources mixed into your project and you aren't using the
-target
option. You're likely to be aware of the pitfalls if you're in that situation.The standard library stuff is more complicated, but also much rarer. These are things like
ByteBuffer#swap
. They're hard to figure out in advance, but most people who are around these types of issues have some idea of what's going on.At the very least, it's an easy fix downstream: you can just opt-in to Java 8. This change just makes Java 8 runtime an opt-in rather than an opt-out. I think it's important to apply some gentle pressure to the larger ecosystem to move forward. Java 8 is ancient at this point.
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.
But does this plugin set the
-target
option? 🤔I agree it's time to move on but the reality is that production systems are slow in that regard.
I'm not sure what would be the trigger for the entire ecosystem to move forward, but we need something.
I'm just afraid that this isn't gonna provide sufficient motivation.
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 feel like the motivation has to be slow and subtle. Nothing else really makes sense or will work. What this change does is effectively lean into the idea that bending over backwards to support a deprecated JVM is the "unusual" thing to do, still possible but unusual in a small way.
For what it's worth, most production systems I see these days are on 11 or higher. It's very rare that I see something other than a library on 8.
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.
There is nothing subtle about publishing a library though - it's either on Java 8 or 11 and if it's on 11 you can't use 8 and that's it. If it's on 8 nobody that is using it would notice. I.e. it's more or less a binary choice for the ecosystem and at some point we will have to say it's time to bootstrap on Java 11. But it would be good to reach a widely supported decision to do so.
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.
Only if they have Java sources though. How wide of a cohort is that?
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.
Why? Doesn't the same apply to Scala sources as well? They also need to produce bytecode.
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 Scala compiler always targets Java 8 for bytecode output. If you do a quick publishLocal on anything that is pure Scala from Java 11 (or higher) and then grab it in ammonite on Java 8, it'll work perfectly.
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.
Ok nice 👍 Somehow I missed that, I guess I'm still confused about this stuff.
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'm not so sure about that.
Once something has already gone wrong (once a call to an 11+ or 17+ Java stdlib method has been used, and CI isn't set up to catch it) and the problem is noticed and reported, "most people" who do Scala OSS will know right away what happened. But by that point it's already too late; a library version has already accidentally been published that doesn't work on 8.
Perhaps it's reasonable — though bold — to make publish-on-11 the default as a way of encouraging people to drop 8, but I don't think "problems will be rare" is a good supporting argument.