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

Cross build to sbt 2.0.0-M3 #1647

Merged
merged 1 commit into from
Jan 5, 2025
Merged

Cross build to sbt 2.0.0-M3 #1647

merged 1 commit into from
Jan 5, 2025

Conversation

eed3si9n
Copy link
Member

@eed3si9n eed3si9n commented Nov 10, 2024

Fixes #1638

Problem/Solution

This cross builds sbt-native-packager for sbt 1.x and 2.0.0-M3.

This PR was co-authored by @eed3si9n and @jtjeferreira.

@jtjeferreira
Copy link
Contributor

I am fixing scripted tests in eed3si9n#1

@eed3si9n eed3si9n force-pushed the wip/cross branch 3 times, most recently from b6e5599 to 1b7a7b2 Compare December 27, 2024 02:09
@eed3si9n eed3si9n force-pushed the wip/cross branch 6 times, most recently from c9d85e1 to 32ed998 Compare December 27, 2024 05:07
@eed3si9n eed3si9n changed the title wip: Cross build to sbt 2.x Cross build to sbt 2.0.0-M3 Dec 27, 2024
@eed3si9n eed3si9n marked this pull request as ready for review December 27, 2024 06:12
@jtjeferreira
Copy link
Contributor

I will try to have a look in the coming days

Comment on lines +1 to +3
# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
> set target := baseDirectory.value / "target"

Copy link
Contributor

Choose a reason for hiding this comment

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

There are still a few places with this workaround. Lets remove it and use exists with glob?

Copy link
Member Author

Choose a reason for hiding this comment

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

I kept this one because

> checkSoftlink target/debian-test-0.1.0/usr/share/debian-test/logs points to /non-standard/log/debian-test

contains a relative path

Copy link
Contributor

Choose a reason for hiding this comment

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

ok. Also in src/sbt-test/docker/entrypoint/test I see

exec grep -q -F 'ENTRYPOINT ["/bin/sh", "-c", "env"]' target/docker/stage/Dockerfile

which we can't change to use the glob.

However there are still 28 references to this workaround, and I think we some one them can be changed to use the glob like src/sbt-test/debian/upstart-deb-facilities/test or src/sbt-test/docker/staging/test for example....

Comment on lines +38 to +43
implicit val converter: FileConverter = fileConverter.value
val assetsDir = baseDirectory.value / "src" / "main" / "assets"
assetsDir.**(AllPassFilter).filter(_.isFile).classpath.map(
_
.put(PluginCompat.artifactStr, PluginCompat.artifactToStr((Assets / artifact).value))
.put(PluginCompat.moduleIDStr, PluginCompat.moduleIDToStr(projectID.value))
Copy link
Contributor

Choose a reason for hiding this comment

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

If I recall correctly, this was migrated from using a directory ( src/main/assets ) to all the files in the directory, because the new HashedVirtualFileRef cannot be used with directories...

import sbt.*
import xsbti.FileConverter

object PluginCompat {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is no longer private. should we consider it part of this plugin public API? Or somehow move it to an internal package (like com.typesafe.sbt.packager.internal) to signal it should not be used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe the type aliases needs to be public since they are part of keys, but individual functions should be scoped to private[packager]?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added private[packager] in 2a20c60

src/main/scala/com/typesafe/sbt/PackagerPlugin.scala Outdated Show resolved Hide resolved
muuki88
muuki88 previously approved these changes Jan 4, 2025
Copy link
Contributor

@muuki88 muuki88 left a comment

Choose a reason for hiding this comment

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

This is already looking good. Thanks a tone @eed3si9n ❤️ ❤️

Would you consider this ready to merge?

@eed3si9n
Copy link
Member Author

eed3si9n commented Jan 4, 2025

Would you consider this ready to merge?

Sort of yes/no. Overall this PR shows that we're close, but @jtjeferreira has provided a few feedbacks that I would like to address this weekend.

@eed3si9n eed3si9n force-pushed the wip/cross branch 6 times, most recently from 3e0aefe to f1de9e7 Compare January 5, 2025 07:53
**Problem/Solution**
This cross builds sbt-native-packager for sbt 1.x and 2.0.0-M3.

Co-authored-by: Eugene Yokota <[email protected]>
Co-authored-by: João Ferreira <[email protected]>
@eed3si9n
Copy link
Member Author

eed3si9n commented Jan 5, 2025

ok. I think this is ready to land.

@muuki88 muuki88 merged commit 6b69d6c into sbt:main Jan 5, 2025
15 checks passed
@muuki88
Copy link
Contributor

muuki88 commented Jan 5, 2025

v1.11.0 is on its way: https://github.com/sbt/sbt-native-packager/actions/runs/12620792105

@eed3si9n eed3si9n deleted the wip/cross branch January 5, 2025 19:58
@eed3si9n
Copy link
Member Author

eed3si9n commented Jan 5, 2025

Nice. I'm going to hand-edit the release note. Here's the generated one as back up - https://gist.github.com/eed3si9n/6c26c9ca0d711277e76f32e7c97ab795

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.

Add sbt 2.0 crossbuilds
3 participants