Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/sbtPublic
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

[2.x] compile straight-to-jar#7592

Draft
adpi2 wants to merge15 commits intosbt:develop
base:develop
Choose a base branch
Loading
fromadpi2:2.x-compile-straight-to-jar

Conversation

adpi2
Copy link
Member

@adpi2adpi2 commentedJun 26, 2024
edited
Loading

This PR enables compilation to JAR by default in sbt 2.x, so that we can directly cache the compiled JAR without the annoying zip/unzip loop.

Several versions of the Scala 3 compiler do not support straight-to-JAR compilation:

I think it is a manageable situation because, by the time we release sbt 2.x, everyone should be using 3.3.5+ or 3.5+.

@adpi2adpi2force-pushed the2.x-compile-straight-to-jar branch from45add08 to9d55dc2CompareJune 27, 2024 14:20
@adpi2
Copy link
MemberAuthor

adpi2 commentedJun 27, 2024
edited
Loading

Some of the tests are broken because the Scala 3 compiler does not declare any products when compiling to jar, which I fixed inscala/scala3#20592. Those products are needed for loading auto-plugins, and also for incremental compilation of downstream modules. We will have to wait for a backport and release of 3.3.5 to fix those tests.

EDIT: I updated to the latest compiler nightly to continue working

@adpi2adpi2force-pushed the2.x-compile-straight-to-jar branch 4 times, most recently fromd89091c tocddba85CompareJuly 3, 2024 08:05
@adpi2adpi2force-pushed the2.x-compile-straight-to-jar branch 2 times, most recently from1e24a38 to2584e0bCompareJuly 3, 2024 09:08
Comment on lines +2566 to +2569
// TODO remove: create output jar if missing
if !Files.exists(outputJar) then
val zip = new ZipOutputStream(new FileOutputStream(outputJar.toFile))
zip.close()
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This should be removed once we releasesbt/zinc#1368

Comment on lines +12 to +28
// TODO remove and use IO.unzip as soon as Zinc can create regular Jar files
object IO2 {
def unzip(from: File, toDirectory: File): Set[File] =
val dirPath = toDirectory.toPath
val set = mutable.Set.empty[File]
jarFileSystem(from) { root =>
Files
.walk(root)
.iterator
.asScala
.foreach { entry =>
val target = dirPath.resolve(root.relativize(entry).toString)
if !Files.isDirectory(target) then Files.copy(entry, target)
if Files.isRegularFile(target) then set += target.toFile
}
}
set.toSet
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We cannot use theIO.unzip method because the JAR file produced by Zinc contains all old and new entries since the creation of the JAR.

Work is being done in Zinc to fix this.

@@ -6,7 +6,7 @@ object Dependencies {
// WARNING: Please Scala update versions in PluginCross.scala too
val scala212 = "2.12.19"
val scala213 = "2.13.12"
val scala3 = "3.3.1"
val scala3 = "3.5.1-RC1-bin-20240628-1efbb92-NIGHTLY"
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Using a nightly version because ofscala/scala3#20592, and we need the Zinc products to find the auto plugins.

Eventually we should use3.3.5 or3.5.1.

Comment on lines +1 to 5
# Marked pending until sbt/zinc#1376 is released

$ copy-file changes/S1.scala S.scala
> compile
$ copy-file changes/S2.scala S.scala
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This scripted test is failing because ofsbt/zinc#1376

@adpi2
Copy link
MemberAuthor

@eed3si9n this is definitelty not ready for merging but it is ready for a review if you have time.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@adpi2

[8]ページ先頭

©2009-2025 Movatter.jp